From 1f86d7d6ed2398df2253f7e72d0446324c554cbb Mon Sep 17 00:00:00 2001 From: benoit-cty <6603048+benoit-cty@users.noreply.github.com> Date: Fri, 8 Sep 2023 10:02:56 +0200 Subject: [PATCH 1/7] Bump OpenFisca-France to v153 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index e270467f..9543aa55 100644 --- a/setup.py +++ b/setup.py @@ -39,7 +39,7 @@ python_requires = ">=3.9", install_requires = [ "multipledispatch >=0.6.0, <1.0.0", - "openFisca-france >=150.0.0, <151.0.0", + "OpenFisca-France >=150.0.0, <154.0.0", "openFisca-survey-manager >=1, <2.0.0", "wquantiles >=0.3.0, <1.0.0", # To compute weighted quantiles ], From 48ab4e9b504f268f3f092fc71df1d6d1bb491cd8 Mon Sep 17 00:00:00 2001 From: cgl Date: Fri, 8 Sep 2023 11:32:46 +0200 Subject: [PATCH 2/7] =?UTF-8?q?rapratrie=20des=20anciennes=20r=C3=A9formes?= =?UTF-8?q?=20d'openfisca=20france?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- openfisca_france_data/base_survey.py | 4 +- .../old_openfisca_france_reforms/__init__.py | 0 .../allocations_familiales_imposables.py | 96 +++++++++ .../cesthra_invalidee.py | 66 ++++++ .../de_net_a_brut.py | 60 ++++++ .../allocations_familiales_imposables.yaml | 8 + .../parameters/cesthra_invalidite.yaml | 15 ++ .../parameters/landais_piketty_saez.yaml | 107 ++++++++++ .../parameters/plf2015.yaml | 17 ++ .../parameters/plf2016.yaml | 17 ++ .../parameters/plfr2014.yaml | 27 +++ .../parameters/plfrss2014.yaml | 188 ++++++++++++++++++ .../parameters/trannoy_wasmer.yaml | 23 +++ .../old_openfisca_france_reforms/plf2015.py | 42 ++++ .../plf2016_ayrault_muet.py | 132 ++++++++++++ .../old_openfisca_france_reforms/plfr2014.py | 84 ++++++++ .../trannoy_wasmer.py | 55 +++++ tests/erfs_fpr/integration/test_aggregates.py | 2 +- .../erfs_fpr/unit/test_get_survey_scenario.py | 2 +- tests/test_fake_survey_simulation.py | 2 +- 20 files changed, 942 insertions(+), 5 deletions(-) create mode 100644 openfisca_france_data/reforms/old_openfisca_france_reforms/__init__.py create mode 100644 openfisca_france_data/reforms/old_openfisca_france_reforms/allocations_familiales_imposables.py create mode 100644 openfisca_france_data/reforms/old_openfisca_france_reforms/cesthra_invalidee.py create mode 100644 openfisca_france_data/reforms/old_openfisca_france_reforms/de_net_a_brut.py create mode 100644 openfisca_france_data/reforms/old_openfisca_france_reforms/parameters/allocations_familiales_imposables.yaml create mode 100644 openfisca_france_data/reforms/old_openfisca_france_reforms/parameters/cesthra_invalidite.yaml create mode 100644 openfisca_france_data/reforms/old_openfisca_france_reforms/parameters/landais_piketty_saez.yaml create mode 100644 openfisca_france_data/reforms/old_openfisca_france_reforms/parameters/plf2015.yaml create mode 100644 openfisca_france_data/reforms/old_openfisca_france_reforms/parameters/plf2016.yaml create mode 100644 openfisca_france_data/reforms/old_openfisca_france_reforms/parameters/plfr2014.yaml create mode 100644 openfisca_france_data/reforms/old_openfisca_france_reforms/parameters/plfrss2014.yaml create mode 100644 openfisca_france_data/reforms/old_openfisca_france_reforms/parameters/trannoy_wasmer.yaml create mode 100644 openfisca_france_data/reforms/old_openfisca_france_reforms/plf2015.py create mode 100644 openfisca_france_data/reforms/old_openfisca_france_reforms/plf2016_ayrault_muet.py create mode 100644 openfisca_france_data/reforms/old_openfisca_france_reforms/plfr2014.py create mode 100644 openfisca_france_data/reforms/old_openfisca_france_reforms/trannoy_wasmer.py diff --git a/openfisca_france_data/base_survey.py b/openfisca_france_data/base_survey.py index cfa1ccb1..1c10f8ff 100644 --- a/openfisca_france_data/base_survey.py +++ b/openfisca_france_data/base_survey.py @@ -5,7 +5,7 @@ from openfisca_france.entities import Famille from openfisca_france_data import france_data_tax_benefit_system -from openfisca_france.reforms import ( +from openfisca_france_data.reforms.old_openfisca_france_reforms import ( allocations_familiales_imposables, cesthra_invalidee, # inversion_directe_salaires, # We use a custom inversion_directe_salaires, not merged in the openfisca-france yet @@ -37,7 +37,7 @@ scipy = None if scipy is not None: - from openfisca_france.reforms import de_net_a_brut + from openfisca_france_data.reforms.old_openfisca_france_reforms import de_net_a_brut reform_list['de_net_a_brut'] = de_net_a_brut.de_net_a_brut reform_by_full_key = {} diff --git a/openfisca_france_data/reforms/old_openfisca_france_reforms/__init__.py b/openfisca_france_data/reforms/old_openfisca_france_reforms/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/openfisca_france_data/reforms/old_openfisca_france_reforms/allocations_familiales_imposables.py b/openfisca_france_data/reforms/old_openfisca_france_reforms/allocations_familiales_imposables.py new file mode 100644 index 00000000..cce1f5fb --- /dev/null +++ b/openfisca_france_data/reforms/old_openfisca_france_reforms/allocations_familiales_imposables.py @@ -0,0 +1,96 @@ +import os + +from ..model.base import * + + +dir_path = os.path.join(os.path.dirname(__file__), 'parameters') + + +def modify_parameters(parameters): + file_path = os.path.join(dir_path, 'allocations_familiales_imposables.yaml') + reform_parameters_subtree = load_parameter_file(name='allocations_familiales_imposables', file_path=file_path) + parameters.add_child('allocations_familiales_imposables', reform_parameters_subtree) + return parameters + + +class allocations_familiales_imposables(Reform): + name = 'Allocations familiales imposables' + + class rbg(Variable): + label = 'Nouveau revenu brut global intégrant les allocations familiales' + definition_period = YEAR + + def formula(foyer_fiscal, period, parameters): + allocations_familiales_imposables = foyer_fiscal('allocations_familiales_imposables', period, options = [ADD]) + deficit_ante = foyer_fiscal('deficit_ante', period) + f6gh = foyer_fiscal('f6gh', period) + + nacc_pvce_i = foyer_fiscal.members('nacc_pvce', period) + nbic_impm_i = foyer_fiscal.members('nbic_impm', period) + + revenu_categoriel = foyer_fiscal('revenu_categoriel', period) + cga = parameters(period).impot_revenu.calcul_revenus_imposables.rpns.cga_taux2 + + nacc_pvce = foyer_fiscal.sum(nacc_pvce_i) + return max_( + 0, + allocations_familiales_imposables + + revenu_categoriel + + f6gh + + (foyer_fiscal.sum(nbic_impm_i) + nacc_pvce) + * (1 + cga) + - deficit_ante + ) + + class rfr(Variable): + label = 'Nouveau revenu fiscal de référence intégrant les allocations familiales' + definition_period = YEAR + + def formula(foyer_fiscal, period, parameters): + allocations_familiales_imposables = foyer_fiscal('allocations_familiales_imposables') + abattements_plus_values = foyer_fiscal('abattements_plus_values') + f3vi_holder = foyer_fiscal.members('f3vi') + f3vz = foyer_fiscal('f3vz') + rfr_cd = foyer_fiscal('rfr_cd') + rni = foyer_fiscal('rni') + rpns_exon_holder = foyer_fiscal.members('rpns_exon') + rfr_rvcm_abattements_a_reintegrer = foyer_fiscal('rfr_rvcm_abattements_a_reintegrer') # Supprimée en 2018 + revenus_capitaux_prelevement_liberatoire = foyer_fiscal('revenus_capitaux_prelevement_liberatoire', period, options = [ADD]) # Supprimée en 2018 + revenus_capitaux_prelevement_forfaitaire_unique_ir = foyer_fiscal('revenus_capitaux_prelevement_forfaitaire_unique_ir', period, options = [ADD]) # Existe à partir de 2018 + microentreprise = foyer_fiscal('microentreprise') + + f3vi = foyer_fiscal.sum(f3vi_holder) + rpns_exon = foyer_fiscal.sum(rpns_exon_holder) + + return ( + max_(0, rni - allocations_familiales_imposables) + + rfr_cd + + rfr_rvcm_abattements_a_reintegrer + + revenus_capitaux_prelevement_liberatoire + + revenus_capitaux_prelevement_forfaitaire_unique_ir + + f3vi + + rpns_exon + + abattements_plus_values + + f3vz + + microentreprise + ) + + # TO CHECK : f3vb after 2015 (abattements sur moins-values = interdits) + + class allocations_familiales_imposables(Variable): + value_type = float + entity = FoyerFiscal + label = 'Allocations familiales imposables' + definition_period = YEAR + + def formula(foyer_fiscal, period, parameters): + imposition = parameters(period).allocations_familiales_imposables.imposition + af = foyer_fiscal.declarant_principal.famille('af', period, options = [ADD]) + + return af * imposition + + def apply(self): + self.update_variable(self.rbg) + self.update_variable(self.rfr) + self.add_variable(self.allocations_familiales_imposables) + self.modify_parameters(modifier_function = modify_parameters) diff --git a/openfisca_france_data/reforms/old_openfisca_france_reforms/cesthra_invalidee.py b/openfisca_france_data/reforms/old_openfisca_france_reforms/cesthra_invalidee.py new file mode 100644 index 00000000..9b4472f9 --- /dev/null +++ b/openfisca_france_data/reforms/old_openfisca_france_reforms/cesthra_invalidee.py @@ -0,0 +1,66 @@ +import os + +from openfisca_france.model.base import * + +from .. import entities + + +dir_path = os.path.join(os.path.dirname(__file__), 'parameters') + + +def modify_parameters(parameters): + file_path = os.path.join(dir_path, 'cesthra_invalidite.yaml') + reform_parameters_subtree = load_parameter_file(name='cesthra', file_path=file_path) + parameters.add_child('cesthra', reform_parameters_subtree) + return parameters + + +class cesthra(Variable): + value_type = float + entity = entities.FoyerFiscal + label = "Contribution exceptionnelle de solidarité sur les très hauts revenus d'activité" + definition_period = YEAR + # PLF 2013 (rejeté) : 'taxe à 75%' + + def formula(foyer_fiscal, period, parameters): + salaire_imposable_i = foyer_fiscal.members('salaire_imposable', period, options = [ADD]) + _cesthra = parameters(period).cesthra + + cesthra_i = max_(salaire_imposable_i - _cesthra.seuil, 0) * _cesthra.taux + + return foyer_fiscal.sum(cesthra_i) + + +class irpp(Variable): + label = 'Impôt sur le revenu des personnes physiques (réformée pour intégrer la cesthra)' + definition_period = YEAR + + def formula(foyer_fiscal, period, parameters): + ''' + Montant après seuil de recouvrement (hors ppe) + ''' + iai = foyer_fiscal('iai', period) + credits_impot = foyer_fiscal('credits_impot', period) + acomptes_ir = foyer_fiscal('acomptes_ir', period) + contribution_exceptionnelle_hauts_revenus = foyer_fiscal('contribution_exceptionnelle_hauts_revenus', period) + cesthra = foyer_fiscal('cesthra', period = period) + recouvrement = parameters(period).impot_revenu.calcul_impot_revenu.recouvrement + + pre_result = iai - credits_impot - acomptes_ir + contribution_exceptionnelle_hauts_revenus + cesthra + + return ( + (iai > recouvrement.seuil) + * ((pre_result < recouvrement.min) * (pre_result > 0) * iai * 0 + + ((pre_result <= 0) + (pre_result >= recouvrement.min)) * (- pre_result)) + + (iai <= recouvrement.seuil) * ((pre_result < 0) * (-pre_result) + + (pre_result >= 0) * 0 * iai) + ) + + +class cesthra_invalidee(Reform): + name = "Contribution execptionnelle sur les très hauts revenus d'activité (invalidée par le CC)" + + def apply(self): + self.add_variable(cesthra) + self.update_variable(irpp) + self.modify_parameters(modifier_function = modify_parameters) diff --git a/openfisca_france_data/reforms/old_openfisca_france_reforms/de_net_a_brut.py b/openfisca_france_data/reforms/old_openfisca_france_reforms/de_net_a_brut.py new file mode 100644 index 00000000..b6d7cb61 --- /dev/null +++ b/openfisca_france_data/reforms/old_openfisca_france_reforms/de_net_a_brut.py @@ -0,0 +1,60 @@ +from openfisca_core.reforms import Reform + +try: + from scipy.optimize import fsolve +except ImportError: + fsolve = None + +from .. import entities +from ..model.base import * + + +def calculate_net_from(salaire_de_base, individu, period): + + # We're not wanting to calculate salaire_de_base again, but instead manually set it as an input variable + individu.get_holder('salaire_de_base').put_in_cache(salaire_de_base, period) + + # Work in isolation + temp_simulation = individu.simulation.clone() + temp_individu = temp_simulation.individu + + # Force recomputing of salaire_net + temp_individu.get_holder('salaire_net_a_payer').delete_arrays() + + net = temp_individu('salaire_net_a_payer', period)[0] + + return net + + +class salaire_de_base(Variable): + value_type = float + entity = entities.Individu + label = 'Salaire brut' + definition_period = MONTH + + def formula(individu, period, parameters): + # Calcule le salaire brut à partir du salaire net par inversion numérique. + + net = individu.get_holder('salaire_net_a_payer').get_array(period) + + if net is None: + return individu.empty_array() + + def solve_func(net): + def innerfunc(essai): + return calculate_net_from(essai, individu, period) - net + return innerfunc + brut_calcule = fsolve( + solve_func(net), + net * 1.5, # on entend souvent parler cette méthode... + xtol = 1 / 10 # précision + ) + + return brut_calcule + + +class de_net_a_brut(Reform): + name = 'Inversion du calcul brut -> net' + + def apply(self): + self.update_variable(salaire_de_base) diff --git a/openfisca_france_data/reforms/old_openfisca_france_reforms/parameters/allocations_familiales_imposables.yaml b/openfisca_france_data/reforms/old_openfisca_france_reforms/parameters/allocations_familiales_imposables.yaml new file mode 100644 index 00000000..3a78d6f4 --- /dev/null +++ b/openfisca_france_data/reforms/old_openfisca_france_reforms/parameters/allocations_familiales_imposables.yaml @@ -0,0 +1,8 @@ +description: Intégration au revenu imposable des allocations familiales +imposition: + description: "Indicatrice d'imposition" + values: + '2015-01-01': + value: null + '2000-01-01': + value: true diff --git a/openfisca_france_data/reforms/old_openfisca_france_reforms/parameters/cesthra_invalidite.yaml b/openfisca_france_data/reforms/old_openfisca_france_reforms/parameters/cesthra_invalidite.yaml new file mode 100644 index 00000000..9e455203 --- /dev/null +++ b/openfisca_france_data/reforms/old_openfisca_france_reforms/parameters/cesthra_invalidite.yaml @@ -0,0 +1,15 @@ +description: Contribution execptionnelle sur les très hauts revenus d'activité +seuil: + description: Seuil + values: + '2014-01-01': + value: null + '2012-01-01': + value: 1000000 +taux: + description: Taux + values: + '2014-01-01': + value: null + '2012-01-01': + value: 0.75 diff --git a/openfisca_france_data/reforms/old_openfisca_france_reforms/parameters/landais_piketty_saez.yaml b/openfisca_france_data/reforms/old_openfisca_france_reforms/parameters/landais_piketty_saez.yaml new file mode 100644 index 00000000..e79b3cdf --- /dev/null +++ b/openfisca_france_data/reforms/old_openfisca_france_reforms/parameters/landais_piketty_saez.yaml @@ -0,0 +1,107 @@ +description: Impôt à base large proposé par Landais Piketty et Saez +bareme: + unit: currency + description: Barème de l'impôt + brackets: + - average_rate: + '2015-01-01': + value: null + '2000-01-01': + value: 0.02 + threshold: + '2015-01-01': + value: null + '2000-01-01': + value: 1100 + - average_rate: + '2015-01-01': + value: null + '2000-01-01': + value: 0.1 + threshold: + '2015-01-01': + value: null + '2000-01-01': + value: 2200 + - average_rate: + '2015-01-01': + value: null + '2000-01-01': + value: 0.13 + threshold: + '2015-01-01': + value: null + '2000-01-01': + value: 5000 + - average_rate: + '2015-01-01': + value: null + '2000-01-01': + value: 0.25 + threshold: + '2015-01-01': + value: null + '2000-01-01': + value: 10000 + - average_rate: + '2015-01-01': + value: null + '2000-01-01': + value: 0.5 + threshold: + '2015-01-01': + value: null + '2000-01-01': + value: 40000 + - average_rate: + '2015-01-01': + value: null + '2000-01-01': + value: 0.6 + threshold: + '2015-01-01': + value: null + '2000-01-01': + value: 100000 +imposition: + description: "Indicatrice d'imposition" + values: + '2015-01-01': + value: null + '2000-01-01': + value: true +credit_enfant: + description: "Crédit d'impôt forfaitaire par enfant" + values: + '2015-01-01': + value: null + '2000-01-01': + value: 0 +reduc_enfant: + description: "Réduction d'impôt forfaitaire par enfant" + values: + '2015-01-01': + value: null + '2000-01-01': + value: 0 +abatt_enfant: + description: Abattement forfaitaire sur le revenu par enfant + values: + '2015-01-01': + value: null + '2000-01-01': + value: 0 +reduc_conj: + description: "Réduction d'impôt forfaitaire si conjoint" + values: + '2015-01-01': + value: null + '2000-01-01': + value: 0 +abatt_conj: + description: Abattement forfaitaire sur le revenu si conjoint + values: + '2015-01-01': + value: null + '2000-01-01': + value: 0 diff --git a/openfisca_france_data/reforms/old_openfisca_france_reforms/parameters/plf2015.yaml b/openfisca_france_data/reforms/old_openfisca_france_reforms/parameters/plf2015.yaml new file mode 100644 index 00000000..fbfecdcc --- /dev/null +++ b/openfisca_france_data/reforms/old_openfisca_france_reforms/parameters/plf2015.yaml @@ -0,0 +1,17 @@ +description: PLF 2015 sur revenus 2013 (Décote) +seuil_celib: + description: Seuil de la décote pour un célibataire + unit: currency + values: + '2014-01-01': + value: null + '2013-01-01': + value: 1135 +seuil_couple: + description: Seuil de la décote pour un couple + unit: currency + values: + '2014-01-01': + value: null + '2013-01-01': + value: 1870 diff --git a/openfisca_france_data/reforms/old_openfisca_france_reforms/parameters/plf2016.yaml b/openfisca_france_data/reforms/old_openfisca_france_reforms/parameters/plf2016.yaml new file mode 100644 index 00000000..a3b59162 --- /dev/null +++ b/openfisca_france_data/reforms/old_openfisca_france_reforms/parameters/plf2016.yaml @@ -0,0 +1,17 @@ +description: PLF 2016 sur revenus 2014 +decote_seuil_celib: + description: Seuil de la décôte pour un célibataire + unit: currency + values: + '2015-01-01': + value: null + '2014-01-01': + value: 1165 +decote_seuil_couple: + description: Seuil de la décôte pour un couple + unit: currency + values: + '2015-01-01': + value: null + '2014-01-01': + value: 1920 diff --git a/openfisca_france_data/reforms/old_openfisca_france_reforms/parameters/plfr2014.yaml b/openfisca_france_data/reforms/old_openfisca_france_reforms/parameters/plfr2014.yaml new file mode 100644 index 00000000..afeec5a6 --- /dev/null +++ b/openfisca_france_data/reforms/old_openfisca_france_reforms/parameters/plfr2014.yaml @@ -0,0 +1,27 @@ +description: Projet de loi de finance rectificative 2014 +reduction_impot_exceptionnelle: + description: Réduction d'impôt exceptionnelle + montant_plafond: + description: Montant plafond par part pour les deux premières parts + unit: currency + values: + '2015-01-01': + value: null + '2013-01-01': + value: 350 + seuil: + description: Seuil (à partir duquel la réduction décroît) par part pour les deux premières parts + unit: currency + values: + '2015-01-01': + value: null + '2013-01-01': + value: 13795 + majoration_seuil: + description: Majoration du seuil par demi-part supplémentaire + unit: currency + values: + '2015-01-01': + value: null + '2013-01-01': + value: 3536 diff --git a/openfisca_france_data/reforms/old_openfisca_france_reforms/parameters/plfrss2014.yaml b/openfisca_france_data/reforms/old_openfisca_france_reforms/parameters/plfrss2014.yaml new file mode 100644 index 00000000..79717e75 --- /dev/null +++ b/openfisca_france_data/reforms/old_openfisca_france_reforms/parameters/plfrss2014.yaml @@ -0,0 +1,188 @@ +description: Projet de loi de financement de la sécurité sociale rectificative 2014 +exonerations_bas_salaires: + description: Exonérations de cotisations salariées sur les bas salaires + prive: + description: Salariés du secteur privé + taux: + description: Taux + unit: /1 + values: + '2015-01-01': + value: null + '2014-01-01': + value: 0.03 + seuil: + description: Seuil (en SMIC) + unit: /1 + values: + '2015-01-01': + value: null + '2014-01-01': + value: 1.3 + public: + description: Salariés du secteur public + taux_1: + description: Taux + unit: /1 + values: + '2015-01-01': + value: null + '2014-01-01': + value: 0.02 + seuil_1: + description: Indice majoré plafond + values: + '2015-01-01': + value: null + '2014-01-01': + value: 312 + taux_2: + description: Taux + unit: /1 + values: + '2015-01-01': + value: null + '2014-01-01': + value: 0.018 + seuil_2: + description: Indice majoré plafond + values: + '2015-01-01': + value: null + '2014-01-01': + value: 328 + taux_3: + description: Taux + unit: /1 + values: + '2015-01-01': + value: null + '2014-01-01': + value: 0.016 + seuil_3: + description: Indice majoré plafond + values: + '2015-01-01': + value: null + '2014-01-01': + value: 343 + taux_4: + description: Taux + unit: /1 + values: + '2015-01-01': + value: null + '2014-01-01': + value: 0.014 + seuil_4: + description: Indice majoré plafond + values: + '2015-01-01': + value: null + '2014-01-01': + value: 359 + taux_5: + description: Taux + unit: /1 + values: + '2015-01-01': + value: null + '2014-01-01': + value: 0.012 + seuil_5: + description: Indice majoré plafond + values: + '2015-01-01': + value: null + '2014-01-01': + value: 375 + taux_6: + description: Taux + unit: /1 + values: + '2015-01-01': + value: null + '2014-01-01': + value: 0.01 + seuil_6: + description: Indice majoré plafond + values: + '2015-01-01': + value: null + '2014-01-01': + value: 390 + taux_7: + description: Taux + unit: /1 + values: + '2015-01-01': + value: null + '2014-01-01': + value: 0.008 + seuil_7: + description: Indice majoré plafond + values: + '2015-01-01': + value: null + '2014-01-01': + value: 406 + taux_8: + description: Taux + unit: /1 + values: + '2015-01-01': + value: null + '2014-01-01': + value: 0.007 + seuil_8: + description: Indice majoré plafond + values: + '2015-01-01': + value: null + '2014-01-01': + value: 421 + taux_9: + description: Taux + unit: /1 + values: + '2015-01-01': + value: null + '2014-01-01': + value: 0.006 + seuil_9: + description: Indice majoré plafond + values: + '2015-01-01': + value: null + '2014-01-01': + value: 437 + taux_10: + description: Taux + unit: /1 + values: + '2015-01-01': + value: null + '2014-01-01': + value: 0.005 + seuil_10: + description: Indice majoré plafond + values: + '2015-01-01': + value: null + '2014-01-01': + value: 453 + taux_11: + description: Taux + unit: /1 + values: + '2015-01-01': + value: null + '2014-01-01': + value: 0.002 + seuil_11: + description: Indice majoré plafond + values: + '2015-01-01': + value: null + '2014-01-01': + value: 468 diff --git a/openfisca_france_data/reforms/old_openfisca_france_reforms/parameters/trannoy_wasmer.yaml b/openfisca_france_data/reforms/old_openfisca_france_reforms/parameters/trannoy_wasmer.yaml new file mode 100644 index 00000000..62150540 --- /dev/null +++ b/openfisca_france_data/reforms/old_openfisca_france_reforms/parameters/trannoy_wasmer.yaml @@ -0,0 +1,23 @@ +description: Charge de loyer +active: + description: Activation de la charge + values: + '2014-01-01': + value: null + '2002-01-01': + value: true +plaf: + description: Plafond mensuel + unit: currency + values: + '2014-01-01': + value: null + '2002-01-01': + value: 1000 +plaf_nbp: + description: Ajuster le plafond au nombre de part + values: + '2014-01-01': + value: null + '2002-01-01': + value: false diff --git a/openfisca_france_data/reforms/old_openfisca_france_reforms/plf2015.py b/openfisca_france_data/reforms/old_openfisca_france_reforms/plf2015.py new file mode 100644 index 00000000..72d9ce4f --- /dev/null +++ b/openfisca_france_data/reforms/old_openfisca_france_reforms/plf2015.py @@ -0,0 +1,42 @@ +import os + +from ..model.base import * + + +dir_path = os.path.join(os.path.dirname(__file__), 'parameters') + + +def modify_parameters(parameters): + reform_year = 2013 + reform_period = period(reform_year) + + file_path = os.path.join(dir_path, 'plf2015.yaml') + reform_parameters_subtree = load_parameter_file(name='plf2015', file_path=file_path) + parameters.add_child('plf2015', reform_parameters_subtree) + + parameters.impot_revenu.bareme_ir_depuis_1945.bareme[1].rate.update(period=reform_period, value=0) + parameters.impot_revenu.bareme_ir_depuis_1945.bareme[2].threshold.update(period=reform_period, value=9690) + + return parameters + + +class decote(Variable): + label = 'Décote IR 2015 appliquée sur IR 2014 (revenus 2013)' + definition_period = YEAR + + def formula_2013_01_01(foyer_fiscal, period, parameters): + ir_plaf_qf = foyer_fiscal('ir_plaf_qf', period) + nb_adult = foyer_fiscal('nb_adult', period) + plf = parameters(period).plf2015 + + decote_celib = (ir_plaf_qf < plf.seuil_celib) * (plf.seuil_celib - ir_plaf_qf) + decote_couple = (ir_plaf_qf < plf.seuil_couple) * (plf.seuil_couple - ir_plaf_qf) + return (nb_adult == 1) * decote_celib + (nb_adult == 2) * decote_couple + + +class plf2015(Reform): + name = 'Projet de Loi de Finances 2015 appliquée aux revenus 2013' + + def apply(self): + self.update_variable(decote) + self.modify_parameters(modifier_function = modify_parameters) diff --git a/openfisca_france_data/reforms/old_openfisca_france_reforms/plf2016_ayrault_muet.py b/openfisca_france_data/reforms/old_openfisca_france_reforms/plf2016_ayrault_muet.py new file mode 100644 index 00000000..3cc73c4c --- /dev/null +++ b/openfisca_france_data/reforms/old_openfisca_france_reforms/plf2016_ayrault_muet.py @@ -0,0 +1,132 @@ +import os + +from ..model.base import * + + +dir_path = os.path.dirname(__file__) + + +# Réforme de l'amendement Ayrault-Muet + +def ayrault_muet_modify_parameters(parameters): + # TODO: inflater les paramètres de la décote le barème de l'IR + inflator = 1 + for inflation in [2.8, 0.1, 1.5, 2.1, 2, 0.9, 0.5, 0.1]: + inflator = inflator * (1 + inflation / 100) + del inflation + + elig1 = Parameter('elig1', {'values': {'2015-01-01': {'value': round(16251 * inflator)}, '2016-01-01': {'value': None}}}) + elig2 = Parameter('elig2', {'values': {'2015-01-01': {'value': round(32498 * inflator)}, '2016-01-01': {'value': None}}}) + elig3 = Parameter('elig3', {'values': {'2015-01-01': {'value': round(4490 * inflator)}, '2016-01-01': {'value': None}}}) + parameters.impot_revenu.credits_impots.ppe.add_child('elig1', elig1) + parameters.impot_revenu.credits_impots.ppe.add_child('elig2', elig2) + parameters.impot_revenu.credits_impots.ppe.add_child('elig3', elig3) + return parameters + + +class variator(Variable): + value_type = float + default_value = 1 + entity = FoyerFiscal + label = 'Multiplicateur du seuil de régularisation' + definition_period = YEAR + + +class reduction_csg(Variable): + value_type = float + entity = Individu + label = 'Réduction dégressive de CSG' + definition_period = YEAR + + def formula_2015_01_01(individu, period, parameters): + smic_proratise = individu('smic_proratise', period, options = [ADD]) + assiette_csg_abattue = individu('assiette_csg_abattue', period, options = [ADD]) + + seuil = 1.34 + coefficient_correctif = .9 + taux_csg = ( + parameters(period).csg.activite.imposable.taux + + parameters(period).csg.activite.deductible.taux + ) + tx_max = coefficient_correctif * taux_csg + ratio_smic_salaire = smic_proratise / (assiette_csg_abattue + 1e-16) + # règle d'arrondi: 4 décimales au dix-millième le plus proche + taux_allegement_csg = tx_max * min_(1, max_(seuil - 1 / ratio_smic_salaire, 0) / (seuil - 1)) + # Montant de l'allegment + return taux_allegement_csg * assiette_csg_abattue + + +class reduction_csg_foyer_fiscal(Variable): + entity = FoyerFiscal + label = 'Réduction dégressive de CSG des memebres du foyer fiscal' + value_type = float + definition_period = YEAR + + def formula(foyer_fiscal, period, parameters): + reduction_csg = foyer_fiscal('reduction_csg', period) + return foyer_fiscal.sum(reduction_csg) + + +class reduction_csg_nette(Variable): + value_type = float + entity = Individu + label = 'Réduction dégressive de CSG' + definition_period = YEAR + + def formula_2015_01_01(individu, period): + reduction_csg = individu('reduction_csg', period) + ppe_elig_bis = individu.foyer_fiscal('ppe_elig_bis', period) + return reduction_csg * ppe_elig_bis + + +class ppe_elig_bis(Variable): + value_type = bool + entity = FoyerFiscal + label = 'ppe_elig_bis' + definition_period = YEAR + + def formula(foyer_fiscal, period, parameters): + ''' + PPE: eligibilité à la ppe, condition sur le revenu fiscal de référence + 'foy' + ''' + rfr = foyer_fiscal('rfr', period) + ppe_coef = foyer_fiscal('ppe_coef', period) + maries_ou_pacses = foyer_fiscal('maries_ou_pacses', period) + veuf = foyer_fiscal('veuf', period) + celibataire_ou_divorce = foyer_fiscal('celibataire_ou_divorce', period) + nbptr = foyer_fiscal('nbptr', period) + variator = foyer_fiscal('variator', period) + ppe = parameters(period).impot_revenu.credits_impots.ppe + seuil = (veuf | celibataire_ou_divorce) * (ppe.seuils_rfr_eligibilite.personne_seule + 2 * max_(nbptr - 1, 0) * ppe.seuils_rfr_eligibilite.increment_par_demi_part)\ + + maries_ou_pacses * (ppe.seuils_rfr_eligibilite.couple_marie_pacse + 2 * max_(nbptr - 2, 0) * ppe.seuils_rfr_eligibilite.increment_par_demi_part) + return (rfr * ppe_coef) <= (seuil * variator) + + +class regularisation_reduction_csg(Variable): + value_type = float + entity = FoyerFiscal + label = 'Régularisation complète réduction dégressive de CSG' + definition_period = YEAR + + def formula_2015_01_01(foyer_fiscal, period, parameters): + reduction_csg = foyer_fiscal('reduction_csg_foyer_fiscal', period) + ppe_elig_bis = foyer_fiscal('ppe_elig_bis', period) + return not_(ppe_elig_bis) * (reduction_csg > 1) + + +class ayrault_muet(Reform): + name = 'Amendement Ayrault-Muet au PLF2016' + key = 'ayrault_muet' + + def apply(self): + for variable in [ + reduction_csg, + regularisation_reduction_csg, + reduction_csg_foyer_fiscal, + reduction_csg_nette, + ppe_elig_bis, + variator, + ]: + self.update_variable(variable) + self.modify_parameters(modifier_function = ayrault_muet_modify_parameters) diff --git a/openfisca_france_data/reforms/old_openfisca_france_reforms/plfr2014.py b/openfisca_france_data/reforms/old_openfisca_france_reforms/plfr2014.py new file mode 100644 index 00000000..2396c18f --- /dev/null +++ b/openfisca_france_data/reforms/old_openfisca_france_reforms/plfr2014.py @@ -0,0 +1,84 @@ +import os + +from ..model.base import * + + +dir_path = os.path.join(os.path.dirname(__file__), 'parameters') + + +# TODO: les baisses de charges n'ont pas été codées car annulées (toute ou en partie ?) +# par le Conseil constitutionnel + +class plfr2014(Reform): + name = 'Projet de Loi de Finances Rectificative 2014' + + class reduction_impot_exceptionnelle(Variable): + definition_period = YEAR + + def formula_2013_01_01(foyer_fiscal, period, parameters): + janvier = period.first_month + + nb_adult = foyer_fiscal('nb_adult', period) + nb_parents = foyer_fiscal.declarant_principal.famille('nb_parents', period = janvier) + rfr = foyer_fiscal('rfr', period) + params = parameters(period).plfr2014.reduction_impot_exceptionnelle + plafond = params.seuil * nb_adult + (nb_parents - nb_adult) * 2 * params.majoration_seuil + montant = params.montant_plafond * nb_adult + return min_(max_(plafond + montant - rfr, 0), montant) + + class reductions(Variable): + label = "Somme des réductions d'impôt à intégrer pour l'année 2013" + definition_period = YEAR + + def formula_2013_01_01(foyer_fiscal, period, parameters): + accult = foyer_fiscal('accult', period) + frais_de_comptabilite = foyer_fiscal('frais_de_comptabilite', period) + cappme = foyer_fiscal('cappme', period) + creaen = foyer_fiscal('creaen', period) + accueil_dans_etablissement_personnes_agees = foyer_fiscal('accueil_dans_etablissement_personnes_agees', period) + defense_forets_contre_incendies = foyer_fiscal('defense_forets_contre_incendies', period) + dfppce = foyer_fiscal('dfppce', period) + doment = foyer_fiscal('doment', period) + domlog = foyer_fiscal('domlog', period) + duflot = foyer_fiscal('duflot_pinel_denormandie_metropole', period) + duflot_om = foyer_fiscal('duflot_pinel_denormandie_om', period) + reduction_enfants_scolarises = foyer_fiscal('reduction_enfants_scolarises', period) + gardenf = foyer_fiscal('gardenf', period) + interets_paiements_differes_agriculteurs = foyer_fiscal('interets_paiements_differes_agriculteurs', period) + investissement_forestier = foyer_fiscal('ri_investissement_forestier', period) + invlst = foyer_fiscal('invlst', period) + ip_net = foyer_fiscal('ip_net', period) + location_meublee = foyer_fiscal('location_meublee', period) + mecena = foyer_fiscal('mecena', period) + mohist = foyer_fiscal('mohist', period) + protection_patrimoine_naturel = foyer_fiscal('protection_patrimoine_naturel', period) + prestations_compensatoires = foyer_fiscal('prestations_compensatoires', period) + reduction_impot_exceptionnelle = foyer_fiscal('reduction_impot_exceptionnelle', period) + interets_emprunt_reprise_societe = foyer_fiscal('interets_emprunt_reprise_societe', period) + restauration_patrimoine_bati = foyer_fiscal('restauration_patrimoine_bati', period) + rente_survie = foyer_fiscal('rente_survie', period) + saldom = foyer_fiscal('ri_saldom', period) + scelli = foyer_fiscal('scelli', period) + sofica = foyer_fiscal('sofica', period) + souscriptions_parts_fcpi_fip = foyer_fiscal('souscriptions_parts_fcpi_fip', period) + total_reductions = accult + frais_de_comptabilite + cappme + creaen + accueil_dans_etablissement_personnes_agees + defense_forets_contre_incendies + dfppce + doment + domlog +\ + duflot + duflot_om + reduction_enfants_scolarises + gardenf + interets_paiements_differes_agriculteurs + investissement_forestier + invlst + location_meublee + mecena + mohist + protection_patrimoine_naturel +\ + prestations_compensatoires + interets_emprunt_reprise_societe + restauration_patrimoine_bati + rente_survie + saldom + scelli + sofica + souscriptions_parts_fcpi_fip + reduction_impot_exceptionnelle + return min_(ip_net, total_reductions) + + def apply(self): + for variable in [self.reduction_impot_exceptionnelle, self.reductions]: + self.update_variable(variable) + self.modify_parameters(modifier_function = modify_parameters) + + +def modify_parameters(parameters): + file_path = os.path.join(dir_path, 'plfr2014.yaml') + plfr2014_parameters_subtree = load_parameter_file(name='plfr2014', file_path=file_path) + + file_path = os.path.join(dir_path, 'plfrss2014.yaml') + plfrss2014_parameters_subtree = load_parameter_file(name='plfrss2014', file_path=file_path) + + parameters.add_child('plfr2014', plfr2014_parameters_subtree) + parameters.add_child('plfrss2014', plfrss2014_parameters_subtree) + return parameters diff --git a/openfisca_france_data/reforms/old_openfisca_france_reforms/trannoy_wasmer.py b/openfisca_france_data/reforms/old_openfisca_france_reforms/trannoy_wasmer.py new file mode 100644 index 00000000..5b5c6392 --- /dev/null +++ b/openfisca_france_data/reforms/old_openfisca_france_reforms/trannoy_wasmer.py @@ -0,0 +1,55 @@ +import os + +from ..model.base import * + + +dir_path = os.path.join(os.path.dirname(__file__), 'parameters') + + +def modify_parameters(parameters): + file_path = os.path.join(dir_path, 'trannoy_wasmer.yaml') + reform_parameters_subtree = load_parameter_file(name = 'trannoy_wasmer', file_path = file_path) + + parameters.add_child('charge_loyer', reform_parameters_subtree) + return parameters + + +class charges_deduc(Variable): + label = 'Charge déductibles intégrant la charge pour loyer (Trannoy-Wasmer)' + definition_period = YEAR + + def formula(foyer_fiscal, period, parameters): + cd1 = foyer_fiscal('cd1', period) + cd2 = foyer_fiscal('cd2', period) + charge_loyer = foyer_fiscal('charge_loyer', period) + + return cd1 + cd2 + charge_loyer + + +class charge_loyer(Variable): + value_type = float + entity = FoyerFiscal + label = "Charge déductible pour paiement d'un loyer" + definition_period = YEAR + + def formula(foyer_fiscal, period, parameters): + nbptr = foyer_fiscal('nbptr', period) + + loyer = foyer_fiscal.declarant_principal.menage('loyer', period, options = [ADD]) + + charge_loyer = parameters(period).charge_loyer + + plaf = charge_loyer.plaf + plaf_nbp = charge_loyer.plaf_nbp + plafond = plaf * (not_(plaf_nbp) + plaf * nbptr * plaf_nbp) + + return 12 * min_(loyer / 12, plafond) + + +class trannoy_wasmer(Reform): + name = 'Loyer comme charge déductible (Trannoy-Wasmer)' + + def apply(self): + self.update_variable(charges_deduc) + self.add_variable(charge_loyer) + self.modify_parameters(modifier_function = modify_parameters) diff --git a/tests/erfs_fpr/integration/test_aggregates.py b/tests/erfs_fpr/integration/test_aggregates.py index aad235f9..c583c440 100644 --- a/tests/erfs_fpr/integration/test_aggregates.py +++ b/tests/erfs_fpr/integration/test_aggregates.py @@ -61,7 +61,7 @@ def test_erfs_fpr_aggregates_reform(): """Tests aggregates value with data. :param year: year of data and simulation to test agregates - :param reform: optional argument, put an openfisca_france.refoms object, default None + :param reform: optional argument, put an openfisca_france_data.refoms.old_openfisca_france_reforms object, default None """ tax_benefit_system = france_data_tax_benefit_system year = 2014 diff --git a/tests/erfs_fpr/unit/test_get_survey_scenario.py b/tests/erfs_fpr/unit/test_get_survey_scenario.py index 262cc33c..f1576f39 100644 --- a/tests/erfs_fpr/unit/test_get_survey_scenario.py +++ b/tests/erfs_fpr/unit/test_get_survey_scenario.py @@ -3,7 +3,7 @@ from openfisca_core.reforms import Reform # type: ignore from openfisca_france import FranceTaxBenefitSystem as TaxBenefitSystem # type: ignore -from openfisca_france.reforms.plf2015 import plf2015 # type: ignore +from openfisca_france_data.reforms.old_openfisca_france_reforms.plf2015 import plf2015 # type: ignore from openfisca_france_data import france_data_tax_benefit_system from openfisca_france_data.erfs_fpr.get_survey_scenario import ( diff --git a/tests/test_fake_survey_simulation.py b/tests/test_fake_survey_simulation.py index 9e15db3d..47694fcf 100644 --- a/tests/test_fake_survey_simulation.py +++ b/tests/test_fake_survey_simulation.py @@ -7,7 +7,7 @@ from openfisca_core.tools import assert_near # type: ignore from openfisca_france_data.erfs.scenario import ErfsSurveyScenario # type: ignore from openfisca_survey_manager.calibration import Calibration # type: ignore -from openfisca_france.reforms.plf2015 import plf2015 # type: ignore +from openfisca_france_data.reforms.old_openfisca_france_reforms.plf2015 import plf2015 # type: ignore @pytest.fixture From a40a8dbcd017ae78625ef65ba18cfaa469b57a9c Mon Sep 17 00:00:00 2001 From: cgl Date: Fri, 8 Sep 2023 11:38:40 +0200 Subject: [PATCH 3/7] fix imports --- .../allocations_familiales_imposables.py | 2 +- .../reforms/old_openfisca_france_reforms/cesthra_invalidee.py | 2 +- .../reforms/old_openfisca_france_reforms/de_net_a_brut.py | 4 ++-- .../reforms/old_openfisca_france_reforms/plf2015.py | 2 +- .../old_openfisca_france_reforms/plf2016_ayrault_muet.py | 2 +- .../reforms/old_openfisca_france_reforms/plfr2014.py | 2 +- .../reforms/old_openfisca_france_reforms/trannoy_wasmer.py | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/openfisca_france_data/reforms/old_openfisca_france_reforms/allocations_familiales_imposables.py b/openfisca_france_data/reforms/old_openfisca_france_reforms/allocations_familiales_imposables.py index cce1f5fb..f7ee0764 100644 --- a/openfisca_france_data/reforms/old_openfisca_france_reforms/allocations_familiales_imposables.py +++ b/openfisca_france_data/reforms/old_openfisca_france_reforms/allocations_familiales_imposables.py @@ -1,6 +1,6 @@ import os -from ..model.base import * +from openfisca_france.model.base import * dir_path = os.path.join(os.path.dirname(__file__), 'parameters') diff --git a/openfisca_france_data/reforms/old_openfisca_france_reforms/cesthra_invalidee.py b/openfisca_france_data/reforms/old_openfisca_france_reforms/cesthra_invalidee.py index 9b4472f9..66a5ecea 100644 --- a/openfisca_france_data/reforms/old_openfisca_france_reforms/cesthra_invalidee.py +++ b/openfisca_france_data/reforms/old_openfisca_france_reforms/cesthra_invalidee.py @@ -2,7 +2,7 @@ from openfisca_france.model.base import * -from .. import entities +from openfisca_france import entities dir_path = os.path.join(os.path.dirname(__file__), 'parameters') diff --git a/openfisca_france_data/reforms/old_openfisca_france_reforms/de_net_a_brut.py b/openfisca_france_data/reforms/old_openfisca_france_reforms/de_net_a_brut.py index b6d7cb61..b5fb1773 100644 --- a/openfisca_france_data/reforms/old_openfisca_france_reforms/de_net_a_brut.py +++ b/openfisca_france_data/reforms/old_openfisca_france_reforms/de_net_a_brut.py @@ -5,8 +5,8 @@ except ImportError: fsolve = None -from .. import entities -from ..model.base import * +from openfisca_france import entities +from openfisca_france.model.base import * def calculate_net_from(salaire_de_base, individu, period): diff --git a/openfisca_france_data/reforms/old_openfisca_france_reforms/plf2015.py b/openfisca_france_data/reforms/old_openfisca_france_reforms/plf2015.py index 72d9ce4f..08b76f86 100644 --- a/openfisca_france_data/reforms/old_openfisca_france_reforms/plf2015.py +++ b/openfisca_france_data/reforms/old_openfisca_france_reforms/plf2015.py @@ -1,6 +1,6 @@ import os -from ..model.base import * +from openfisca_france.model.base import * dir_path = os.path.join(os.path.dirname(__file__), 'parameters') diff --git a/openfisca_france_data/reforms/old_openfisca_france_reforms/plf2016_ayrault_muet.py b/openfisca_france_data/reforms/old_openfisca_france_reforms/plf2016_ayrault_muet.py index 3cc73c4c..a12f46bb 100644 --- a/openfisca_france_data/reforms/old_openfisca_france_reforms/plf2016_ayrault_muet.py +++ b/openfisca_france_data/reforms/old_openfisca_france_reforms/plf2016_ayrault_muet.py @@ -1,6 +1,6 @@ import os -from ..model.base import * +from openfisca_france.model.base import * dir_path = os.path.dirname(__file__) diff --git a/openfisca_france_data/reforms/old_openfisca_france_reforms/plfr2014.py b/openfisca_france_data/reforms/old_openfisca_france_reforms/plfr2014.py index 2396c18f..7d0996cd 100644 --- a/openfisca_france_data/reforms/old_openfisca_france_reforms/plfr2014.py +++ b/openfisca_france_data/reforms/old_openfisca_france_reforms/plfr2014.py @@ -1,6 +1,6 @@ import os -from ..model.base import * +from openfisca_france.model.base import * dir_path = os.path.join(os.path.dirname(__file__), 'parameters') diff --git a/openfisca_france_data/reforms/old_openfisca_france_reforms/trannoy_wasmer.py b/openfisca_france_data/reforms/old_openfisca_france_reforms/trannoy_wasmer.py index 5b5c6392..27150aa7 100644 --- a/openfisca_france_data/reforms/old_openfisca_france_reforms/trannoy_wasmer.py +++ b/openfisca_france_data/reforms/old_openfisca_france_reforms/trannoy_wasmer.py @@ -1,6 +1,6 @@ import os -from ..model.base import * +from openfisca_france.model.base import * dir_path = os.path.join(os.path.dirname(__file__), 'parameters') From f8a0bd7c495b1391c4f13cae7b41f1906afecf53 Mon Sep 17 00:00:00 2001 From: cgl Date: Fri, 8 Sep 2023 11:46:54 +0200 Subject: [PATCH 4/7] bump --- CHANGELOG.md | 6 +++++- setup.py | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e0a51c5f..124f350d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ # Changelog -### 2.0.5 [#238(https://github.com/openfisca/openfisca-france-data/pull/238) +### 2.0.6 [#240](https://github.com/openfisca/openfisca-france-data/pull/240) +* Technical changes +- Rapatrie certaines réformes qui ont été supprimés dans openfisca france par la (PR 2177)[https://github.com/Supprime vieilles réformes non utilisées openfisca-france#2177] mais qui sont encore utilisées dans ce dépôt + +### 2.0.5 [#238](https://github.com/openfisca/openfisca-france-data/pull/238) * Technical changes - Corrige le calcul du smic annuel en fonction du smic horaire dans openfisca_france_data/erfs_fpr/input_data_builder/step_04_famille.py diff --git a/setup.py b/setup.py index 9543aa55..6ab34d3a 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ setup( name = "OpenFisca-France-Data", - version = "2.0.5", + version = "2.0.6", description = "OpenFisca-France-Data module to work with French survey data", long_description = long_description, long_description_content_type="text/markdown", From 3a09a2a31ae8f7c76ed8db902f6ee9c5a781d0e3 Mon Sep 17 00:00:00 2001 From: cgl Date: Fri, 8 Sep 2023 12:13:03 +0200 Subject: [PATCH 5/7] wip --- .../reforms/old_openfisca_france_reforms/plf2015.py | 1 + 1 file changed, 1 insertion(+) diff --git a/openfisca_france_data/reforms/old_openfisca_france_reforms/plf2015.py b/openfisca_france_data/reforms/old_openfisca_france_reforms/plf2015.py index 08b76f86..b0253db1 100644 --- a/openfisca_france_data/reforms/old_openfisca_france_reforms/plf2015.py +++ b/openfisca_france_data/reforms/old_openfisca_france_reforms/plf2015.py @@ -10,6 +10,7 @@ def modify_parameters(parameters): reform_year = 2013 reform_period = period(reform_year) + print(dir_path) file_path = os.path.join(dir_path, 'plf2015.yaml') reform_parameters_subtree = load_parameter_file(name='plf2015', file_path=file_path) parameters.add_child('plf2015', reform_parameters_subtree) From cf8bfcc723cdf6712e4f982a4c4085a63c7c345b Mon Sep 17 00:00:00 2001 From: cgl Date: Fri, 8 Sep 2023 14:00:27 +0200 Subject: [PATCH 6/7] add init --- .../reforms/old_openfisca_france_reforms/parameters/__init__.py | 0 .../reforms/old_openfisca_france_reforms/plf2015.py | 1 - 2 files changed, 1 deletion(-) create mode 100644 openfisca_france_data/reforms/old_openfisca_france_reforms/parameters/__init__.py diff --git a/openfisca_france_data/reforms/old_openfisca_france_reforms/parameters/__init__.py b/openfisca_france_data/reforms/old_openfisca_france_reforms/parameters/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/openfisca_france_data/reforms/old_openfisca_france_reforms/plf2015.py b/openfisca_france_data/reforms/old_openfisca_france_reforms/plf2015.py index b0253db1..08b76f86 100644 --- a/openfisca_france_data/reforms/old_openfisca_france_reforms/plf2015.py +++ b/openfisca_france_data/reforms/old_openfisca_france_reforms/plf2015.py @@ -10,7 +10,6 @@ def modify_parameters(parameters): reform_year = 2013 reform_period = period(reform_year) - print(dir_path) file_path = os.path.join(dir_path, 'plf2015.yaml') reform_parameters_subtree = load_parameter_file(name='plf2015', file_path=file_path) parameters.add_child('plf2015', reform_parameters_subtree) From 6efd91afec072229b9adc1d3f68717f37b4c6475 Mon Sep 17 00:00:00 2001 From: cgl Date: Fri, 8 Sep 2023 14:07:27 +0200 Subject: [PATCH 7/7] Add yaml files in setup --- .../old_openfisca_france_reforms/parameters/__init__.py | 0 setup.py | 3 ++- 2 files changed, 2 insertions(+), 1 deletion(-) delete mode 100644 openfisca_france_data/reforms/old_openfisca_france_reforms/parameters/__init__.py diff --git a/openfisca_france_data/reforms/old_openfisca_france_reforms/parameters/__init__.py b/openfisca_france_data/reforms/old_openfisca_france_reforms/parameters/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/setup.py b/setup.py index 6ab34d3a..cc7fee5a 100644 --- a/setup.py +++ b/setup.py @@ -27,7 +27,8 @@ ], package_data = { 'openfisca_france_data': ['assets/aggregats/taxipp/agregats_tests_taxipp_2_0.xlsx', - 'assets/aggregats/ines/ines_2019.json'], + 'assets/aggregats/ines/ines_2019.json', + 'reforms/old_openfisca_france_reforms/parameters/*.yaml'], }, entry_points = { 'console_scripts': [