Skip to content

Commit

Permalink
Reform_dynamic : Permet de charger le chemin des aides via une variab…
Browse files Browse the repository at this point in the history
…le d'environement (#177)
  • Loading branch information
Allan-CodeWorks authored Aug 17, 2023
1 parent 3dfb727 commit 7df5ccc
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## [6.0.3] - 2023-08-17

_Pour les changements détaillés et les discussions associées, consultez la pull request [#177](https://github.com/openfisca/openfisca-france-local/pull/177)_

### Added

- Ajoute la possibilité de spécifier le chemin des aides à charger via la reform_dynamic par une variable d'environnement DYNAMIC_BENEFIT_FOLDER

## [6.0.2] - 2023-08-16

_Pour les changements détaillés et les discussions associées, consultez la pull request [#171](https://github.com/openfisca/openfisca-france-local/pull/171)_
Expand Down
12 changes: 6 additions & 6 deletions openfisca_france_local/aides_jeunes_reform.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-

import os
from os import path, getenv

import collections
from typing import Union
Expand Down Expand Up @@ -379,21 +379,21 @@ def formula(individu: Population, period: Period, parameters):


root = '.'
path = 'test_data/benefits'
current_path = os.path.join(root, path)
benefit_path = 'test_data/benefits'
current_path = path.join(root, benefit_path)


class aides_jeunes_reform_dynamic(reforms.Reform):
def __init__(self, baseline, benefits_folder_path=current_path):
self.benefits_folder_path = benefits_folder_path
self.benefits_folder_path = getenv('DYNAMIC_BENEFIT_FOLDER', benefits_folder_path)
super().__init__(baseline)

def apply(self):
try:
benefit_files_paths: 'list[str]' = self._extract_benefits_paths(self.benefits_folder_path)

for path in benefit_files_paths:
benefit: dict = self._extract_benefit_file_content(path)
for benefit_path in benefit_files_paths:
benefit: dict = self._extract_benefit_file_content(benefit_path)
benefit_parameters: ParameterNode = convert_benefit_conditions_to_parameters(benefit)
self._add_parameters_into_current_tax_and_benefits_system(benefit_parameters)

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

setup(
name='OpenFisca-France-Local',
version='6.0.2',
version='6.0.3',
author='OpenFisca Team',
author_email='[email protected]',
classifiers=[
Expand Down

0 comments on commit 7df5ccc

Please sign in to comment.