Ejemplo n.º 1
0
def build_reform(tax_benefit_system):

    reference_legislation_json = tax_benefit_system.legislation_json
    reform_legislation_json = copy.deepcopy(reference_legislation_json)
    reform_year = 2014
    reform_period = periods.period('year', reform_year)

    reform_legislation_json = reforms.update_legislation(
        legislation_json = reform_legislation_json,
        path = ('children', 'ir', 'children', 'bareme', 'slices', 1, 'rate'),
        period = reform_period,
        value = 0,
        )
    reform_legislation_json = reforms.update_legislation(
        legislation_json = reform_legislation_json,
        path = ('children', 'ir', 'children', 'bareme', 'slices', 2, 'threshold'),
        period = reform_period,
        value = 9641,
        )
    reform_legislation_json['children'].update(build_new_legislation_nodes())

    to_entity_class_by_key_plural = lambda entity_class_by_symbol: {
        entity_class.key_plural: entity_class
        for symbol, entity_class in entity_class_by_symbol.iteritems()
        }

    reform = reforms.Reform(
        entity_class_by_key_plural = to_entity_class_by_key_plural(build_reform_entity_class_by_symbol()),
        legislation_json = reform_legislation_json,
        name = u'PLF2015',
        reference = tax_benefit_system,
        )

    return reform
Ejemplo n.º 2
0
def build_reform(tax_benefit_system):
    # Update legislation
    reference_legislation_json = tax_benefit_system.legislation_json
    reform_legislation_json = copy.deepcopy(reference_legislation_json)
    reform_year = 2014
    reform_period = periods.period('year', reform_year)

    reform_legislation_json = reforms.update_legislation(
        legislation_json=reform_legislation_json,
        path=('children', 'ir', 'children', 'bareme', 'brackets', 1, 'rate'),
        period=reform_period,
        value=0,
    )
    reform_legislation_json = reforms.update_legislation(
        legislation_json=reform_legislation_json,
        path=('children', 'ir', 'children', 'bareme', 'brackets', 2,
              'threshold'),
        period=reform_period,
        value=9690,
    )
    reform_legislation_json['children'].update(reform_legislation_subtree)

    # Update formulas
    reform_entity_class_by_key_plural = reforms.clone_entity_classes(
        entities.entity_class_by_key_plural)
    ReformFoyersFiscaux = reform_entity_class_by_key_plural['foyers_fiscaux']
    ReformFoyersFiscaux.column_by_name['decote'] = decote

    return reforms.Reform(
        entity_class_by_key_plural=reform_entity_class_by_key_plural,
        legislation_json=reform_legislation_json,
        name=u'PLF2015',
        reference=tax_benefit_system,
    )
Ejemplo n.º 3
0
def build_reform(tax_benefit_system):
    # Update legislation
    reference_legislation_json = tax_benefit_system.legislation_json
    reform_legislation_json = copy.deepcopy(reference_legislation_json)
    reform_year = 2014
    reform_period = periods.period('year', reform_year)

    reform_legislation_json = reforms.update_legislation(
        legislation_json = reform_legislation_json,
        path = ('children', 'ir', 'children', 'bareme', 'brackets', 1, 'rate'),
        period = reform_period,
        value = 0,
        )
    reform_legislation_json = reforms.update_legislation(
        legislation_json = reform_legislation_json,
        path = ('children', 'ir', 'children', 'bareme', 'brackets', 2, 'threshold'),
        period = reform_period,
        value = 9690,
        )
    reform_legislation_json['children'].update(reform_legislation_subtree)

    # Update formulas
    reform_entity_class_by_key_plural = reforms.clone_entity_classes(entities.entity_class_by_key_plural)
    ReformFoyersFiscaux = reform_entity_class_by_key_plural['foyers_fiscaux']
    ReformFoyersFiscaux.column_by_name['decote'] = decote

    return reforms.Reform(
        entity_class_by_key_plural = reform_entity_class_by_key_plural,
        legislation_json = reform_legislation_json,
        name = u'PLF2015',
        reference = tax_benefit_system,
        )
Ejemplo n.º 4
0
def build_reform(tax_benefit_system):
    reference_legislation_json = tax_benefit_system.legislation_json
    reform_legislation_json = copy.deepcopy(reference_legislation_json)
    reform_year = 2014
    reform_period = periods.period('year', reform_year)

    reform_legislation_json = reforms.update_legislation(
        legislation_json = reform_legislation_json,
        path = ('children', 'ir', 'children', 'bareme', 'brackets', 1, 'rate'),
        period = reform_period,
        value = 0,
        )
    reform_legislation_json = reforms.update_legislation(
        legislation_json = reform_legislation_json,
        path = ('children', 'ir', 'children', 'bareme', 'brackets', 2, 'threshold'),
        period = reform_period,
        value = 9690,
        )
    reform_legislation_json['children'].update(reform_legislation_subtree)

    Reform = reforms.make_reform(
        legislation_json = reform_legislation_json,
        name = u'PLF2015',
        new_formulas = (decote, ),
        reference = tax_benefit_system,
        )
    return Reform()
Ejemplo n.º 5
0
def modify_legislation_json(reference_legislation_json_copy):
    reform_legislation_subtree = {
        "@type": "Node",
        "description": "PLF 2015 sur revenus 2013 (Décote)",
        "children": {
            "seuil_celib": {
                "@type":
                "Parameter",
                "description":
                "Seuil de la décote pour un célibataire",
                "format":
                "integer",
                "unit":
                "currency",
                "values": [{
                    'start': u'2013-01-01',
                    'stop': u'2013-12-31',
                    'value': 1135
                }],
            },
            "seuil_couple": {
                "@type":
                "Parameter",
                "description":
                "Seuil de la décote pour un couple",
                "format":
                "integer",
                "unit":
                "currency",
                "values": [{
                    'start': u'2013-01-01',
                    'stop': u'2013-12-31',
                    'value': 1870
                }],
            },
        },
    }
    reform_year = 2013
    reform_period = periods.period('year', reform_year)
    # FIXME update_legislation is deprecated.
    reference_legislation_json_copy = reforms.update_legislation(
        legislation_json=reference_legislation_json_copy,
        path=('children', 'ir', 'children', 'bareme', 'brackets', 1, 'rate'),
        period=reform_period,
        value=0,
    )
    # FIXME update_legislation is deprecated.
    reference_legislation_json_copy = reforms.update_legislation(
        legislation_json=reference_legislation_json_copy,
        path=('children', 'ir', 'children', 'bareme', 'brackets', 2,
              'threshold'),
        period=reform_period,
        value=9690,
    )
    reference_legislation_json_copy['children'][
        'plf2015'] = reform_legislation_subtree
    return reference_legislation_json_copy
Ejemplo n.º 6
0
 def update_threshold_bracket(bracket, amount):
     return reforms.update_legislation(
         legislation_json = reform_legislation_json,
         path = ('children', 'ir', 'children', 'bareme', 'brackets', bracket, 'threshold'),
         period = reform_period,
         value = amount,
         )
Ejemplo n.º 7
0
 def update_rate_bracket(bracket, rate):
     return reforms.update_legislation(
         legislation_json = reform_legislation_json,
         path = ('children', 'ir', 'children', 'bareme', 'brackets', bracket, 'rate'),
         period = reform_period,
         value = rate,
         )
def modify_legislation_json(reference_legislation_json_copy):
    reform_legislation_json = reforms.update_legislation(
    legislation_json = reference_legislation_json_copy,
    path = ('children', 'ir', 'children', 'bareme', 'brackets', 0, 'rate'),
    period = simulation_period,
    value = 1,
    )
    return reform_legislation_json
def modify_legislation_json(reference_legislation_json_copy):
    reform_legislation_json = update_legislation(
        legislation_json = reference_legislation_json_copy,
        path = ('children', 'cotsoc', 'children', 'gen', 'children', 'smic_h_b', 'values'),
        period = periods.period("year", "2013"),
        value = 9,
        )
    return reform_legislation_json
Ejemplo n.º 10
0
 def update_rate_bracket(bracket, rate):
     return reforms.update_legislation(
         legislation_json=reform_legislation_json,
         path=('children', 'ir', 'children', 'bareme', 'brackets', bracket,
               'rate'),
         period=reform_period,
         value=rate,
     )
Ejemplo n.º 11
0
 def update_threshold_bracket(bracket, amount):
     return reforms.update_legislation(
         legislation_json=reform_legislation_json,
         path=('children', 'ir', 'children', 'bareme', 'brackets', bracket,
               'threshold'),
         period=reform_period,
         value=amount,
     )
 def modify_legislation_json(reference_legislation_json_copy):
     # FIXME update_legislation is deprecated.
     reform_legislation_json = reforms.update_legislation(
         legislation_json = reference_legislation_json_copy,
         path = ('children', 'ir', 'children', 'bareme', 'brackets', 0, 'rate'),
         period = simulation_period,
         value = 1,
         )
     return reform_legislation_json
Ejemplo n.º 13
0
def modify_legislation_json(reference_legislation_json_copy):
    # FIXME update_legislation is deprecated.
    reform_legislation_json = reforms.update_legislation(
        legislation_json=reference_legislation_json_copy,
        path=('children', 'cotsoc', 'children', 'gen', 'children', 'smic_h_b',
              'values'),
        period=periods.period("year", "2013"),
        value=9,
    )
    return reform_legislation_json
Ejemplo n.º 14
0
def modify_legislation_json(reference_legislation_json_copy):
    reform_legislation_json = update_legislation(
        legislation_json=reference_legislation_json_copy,
        path=[
            'children', 'cotsoc', 'children', 'gen', 'children', 'smic_h_b',
            'values'
        ],
        period=periods.period(2013),
        value=9,
    )
    return reform_legislation_json
def modify_legislation_json(reference_legislation_json_copy):
    reform_legislation_json = reforms.update_legislation(
        legislation_json=reference_legislation_json_copy,
        path=[
            'children', 'impot_revenu', 'children', 'bareme', 'brackets', 0,
            'rate'
        ],
        period=simulation_period,
        value=1,
    )
    return reform_legislation_json
Ejemplo n.º 16
0
def modify_legislation_json(reference_legislation_json_copy):
    reform_year = 2016
    reform_period = periods.period(reform_year)

    reference_legislation_json_copy = update_legislation(
        legislation_json=reference_legislation_json_copy,
        path=('children', 'ir', 'children', 'bareme', 'brackets', 3, 'rate'),
        period=reform_period,
        value=.27,
    )
    return reference_legislation_json_copy
Ejemplo n.º 17
0
def build_reform(tax_benefit_system):
    reference_legislation_json = tax_benefit_system.legislation_json
    reform_legislation_json = copy.deepcopy(reference_legislation_json)
    reform_year = 2007
    reform_period = periods.period('year', reform_year)

    def update_threshold_bracket(bracket, amount):
        return reforms.update_legislation(
            legislation_json = reform_legislation_json,
            path = ('children', 'ir', 'children', 'bareme', 'brackets', bracket, 'threshold'),
            period = reform_period,
            value = amount,
            )

    def update_rate_bracket(bracket, rate):
        return reforms.update_legislation(
            legislation_json = reform_legislation_json,
            path = ('children', 'ir', 'children', 'bareme', 'brackets', bracket, 'rate'),
            period = reform_period,
            value = rate,
            )

    reform_legislation_json = update_rate_bracket(bracket = 0, rate = 0)
    reform_legislation_json = update_rate_bracket(bracket = 1, rate = .0683)
    reform_legislation_json = update_rate_bracket(bracket = 2, rate = .1914)
    reform_legislation_json = update_rate_bracket(bracket = 3, rate = .2826)
    reform_legislation_json = update_rate_bracket(bracket = 4, rate = .3738)
    reform_legislation_json = update_rate_bracket(bracket = 5, rate = .4262)
    reform_legislation_json = update_rate_bracket(bracket = 6, rate = .4809)

    inflation = 1
    reform_legislation_json = update_threshold_bracket(bracket = 0, amount = 0)
    reform_legislation_json = update_threshold_bracket(bracket = 1, amount = 4412 * inflation)
    reform_legislation_json = update_threshold_bracket(bracket = 2, amount = 8677 * inflation)
    reform_legislation_json = update_threshold_bracket(bracket = 3, amount = 15274 * inflation)
    reform_legislation_json = update_threshold_bracket(bracket = 4, amount = 24731 * inflation)
    reform_legislation_json = update_threshold_bracket(bracket = 5, amount = 40241 * inflation)
    reform_legislation_json = update_threshold_bracket(bracket = 6, amount = 49624 * inflation)

    reform_legislation_json = reforms.update_legislation(
        legislation_json = reform_legislation_json,
        path = ('children', 'ir', 'children', 'tspr', 'children', 'sabatsalpen'),
        period = reform_period,
        value = 0,
        )

    Reform = reforms.make_reform(
        legislation_json = reform_legislation_json,
        name = u'ir_2006',
        new_formulas = (),
        reference = tax_benefit_system,
        )
    return Reform()
Ejemplo n.º 18
0
def modify_legislation_json(reference_legislation_json_copy):
    reform_legislation_subtree = {
        "@type": "Node",
        "description": "PLF 2015 sur revenus 2013 (Décote)",
        "children": {
            "seuil_celib": {
                "@type": "Parameter",
                "description": "Seuil de la décote pour un célibataire",
                "format": "integer",
                "unit": "currency",
                "values": [{'start': u'2013-01-01', 'stop': u'2013-12-31', 'value': 1135}],
                },
            "seuil_couple": {
                "@type": "Parameter",
                "description": "Seuil de la décote pour un couple",
                "format": "integer",
                "unit": "currency",
                "values": [{'start': u'2013-01-01', 'stop': u'2013-12-31', 'value': 1870}],
                },
            },
        }
    reform_year = 2013
    reform_period = periods.period('year', reform_year)
    # FIXME update_legislation is deprecated.
    reference_legislation_json_copy = reforms.update_legislation(
        legislation_json = reference_legislation_json_copy,
        path = ('children', 'ir', 'children', 'bareme', 'brackets', 1, 'rate'),
        period = reform_period,
        value = 0,
        )
    # FIXME update_legislation is deprecated.
    reference_legislation_json_copy = reforms.update_legislation(
        legislation_json = reference_legislation_json_copy,
        path = ('children', 'ir', 'children', 'bareme', 'brackets', 2, 'threshold'),
        period = reform_period,
        value = 9690,
        )
    reference_legislation_json_copy['children']['plf2015'] = reform_legislation_subtree
    return reference_legislation_json_copy
def create_simulation(year = 2014, bareme = False):

    simulation_period = periods.period('year', year)
    reference_legislation_json = tax_benefit_system.legislation_json
    reform_legislation_json = reforms.update_legislation(
        legislation_json = reference_legislation_json,
        path = ('children', 'ir', 'children', 'bareme', 'slices', 0, 'rate'),
        period = simulation_period,
        value = 1,
        )

    Reform = reforms.make_reform(
        name =  u"Imposition à 100% dès le premier euro et jusqu'à la fin de la 1ère tranche",
        legislation_json = reform_legislation_json,
        reference = tax_benefit_system
        )
    reform = Reform()
    parent1 = dict(
        birth = datetime.date(year - 40, 1, 1),
        salaire_de_base = 10000 if bareme is False else None,
        type_sal = 0,
        )
#    parent2 = dict(
#        birth = datetime.date(year - 40, 1, 1),
#        salaire_de_base = 0,
#        )
    # Adding a husband/wife on the same tax sheet (foyer)
    menage = dict(
        loyer = 1000,
        statut_occupation = 4,
        )
    axes = [
        dict(
            count = 200,
            name = 'salaire_de_base',
            max = 300000,
            min = 0,
            ),
        ]
    scenario = reform.new_scenario().init_single_entity(
        axes = axes if bareme else None,
        menage = menage,
        parent1 = parent1,
        # parent2 = parent2,
        period = periods.period('year', year),
        )
    reference_simulation = scenario.new_simulation(debug = True, reference = True)
    reform_simulation = scenario.new_simulation(debug = True)

    return reform_simulation, reference_simulation
Ejemplo n.º 20
0
def test_plf15_reform():
    simulation_year = 2014
    simulation_period = periods.period('year', simulation_year)
    reference_legislation_json = tax_benefit_system.legislation_json
#    import json
#    import os
#    with open(os.path.join(os.path.dirname(__file__), 'reference_legislation.json'), 'w') as json_file:
#        json.dump(reference_legislation_json, json_file, indent = 4)
    reform_legislation_json = reforms.update_legislation(
        legislation_json = reference_legislation_json,
        path = ('children', 'ir', 'children', 'bareme', 'slices', 1, 'rate'),
        period = simulation_period,
        value = 0,
        path = ('children', 'ir', 'children', 'bareme', 'slices', 1, 'threshold'),
        period = simulation_period,
        value = 9690,        
        path = ('children', 'ir', 'children', 'bareme', 'slices', 2, 'threshold'),
        period = simulation_period,
        value = 12051,
        path = ('children', 'ir', 'children', 'bareme', 'slices', 3, 'threshold'),
        period = simulation_period,
        value = 26764,
        path = ('children', 'ir', 'children', 'bareme', 'slices', 4, 'threshold'),
        period = simulation_period,
        value = 71754,
        path = ('children', 'ir', 'children', 'bareme', 'slices', 5, 'threshold'),
        period = simulation_period,
        value = 151956,              
        )

    reform = reforms.Reform(
        name = u'IR_suppression_tranche_1',
        label = u"PLF 2015 suppression première tranche",
        legislation_json = reform_legislation_json,
        reference_legislation_json = reference_legislation_json
        )


     scenario = tax_benefit_system.new_scenario().init_single_entity(
        axes = [
            dict(
                count = 3,
                name = 'sali',
                max = 100000,
                min = 0,
                ),
            ],
        period = simulation_period,
        parent1 = dict(birth = datetime.date(simulation_year - 40, 1, 1)),
        )
def test_check():
    for employee_type, test_parameters in test_case_by_employee_type.iteritems(
    ):

        reference_legislation_json = tax_benefit_system.legislation_json

        reform_legislation_json = reforms.update_legislation(
            legislation_json=reference_legislation_json,
            path=('children', 'cotsoc', 'children', 'gen', 'children',
                  'smic_h_b', 'values'),
            period=periods.period("year", "2011"),
            value=9,
        )
        reform = reforms.Reform(
            name=u'smic_h_b_9_euros',
            label=
            u"Réforme pour simulation ACOSS SMIC horaire brut fixe à 9 euros",
            legislation_json=reform_legislation_json,
            reference=tax_benefit_system,
        )

        simulation_period = 2011
        parent1 = dict(birth=datetime.date(
            periods.period(simulation_period).start.year - 40, 1, 1), )
        parent1.update(test_parameters['input_variables'])

        simulation = reform.new_scenario().init_single_entity(
            period=simulation_period,
            parent1=parent1,
        ).new_simulation(debug=True)

        for variable, amounts in test_parameters['output_variables'].iteritems(
        ):
            if isinstance(amounts, dict):
                for period_str, amount in sorted(amounts.iteritems()):
                    output = simulation.calculate(
                        variable, period=periods.period(period_str))
                    variable_message = "{} at {}".format(variable, period_str)
                    yield assert_variable, variable_message, employee_type, amount, output
            else:
                output = simulation.calculate(variable)
                variable_message = variable
                amount = amounts
                yield assert_variable, variable_message, employee_type, amount, output
def test_check():
    for employee_type, test_parameters in test_case_by_employee_type.iteritems():

        reference_legislation_json = tax_benefit_system.legislation_json

        reform_legislation_json = reforms.update_legislation(
            legislation_json = reference_legislation_json,
            path = ('children', 'cotsoc', 'children', 'gen', 'children', 'smic_h_b', 'values'),
            period = periods.period("year", "2011"),
            value = 9,
            )

        Reform = reforms.make_reform(
            legislation_json = reform_legislation_json,
            # name = u'smic_h_b_9_euros',
            name = u"Réforme pour simulation ACOSS SMIC horaire brut fixe à 9 euros",
            reference = tax_benefit_system,
            )
        reform = Reform()

        simulation_period = 2011
        parent1 = dict(
            birth = datetime.date(periods.period(simulation_period).start.year - 40, 1, 1),
            )
        parent1.update(test_parameters['input_variables'])

        simulation = reform.new_scenario().init_single_entity(
            period = simulation_period,
            parent1 = parent1,
            ).new_simulation(debug = True)

        for variable, amounts in test_parameters['output_variables'].iteritems():
            if isinstance(amounts, dict):
                for period_str, amount in sorted(amounts.iteritems()):
                    output = simulation.calculate_add_divide(variable, period = periods.period(period_str))
                    variable_message = "{} at {}".format(variable, period_str)
                    yield assert_variable, variable_message, employee_type, amount, output
            else:
                output = simulation.calculate(variable)
                variable_message = variable
                amount = amounts
                yield assert_variable, variable_message, employee_type, amount, output
def test_parametric_reform():
    simulation_year = 2013
    simulation_period = periods.period('year', simulation_year)
    reference_legislation_json = tax_benefit_system.legislation_json

    reform_legislation_json = reforms.update_legislation(
        legislation_json = reference_legislation_json,
        path = ('children', 'ir', 'children', 'bareme', 'brackets', 0, 'rate'),
        period = simulation_period,
        value = 1,
        )

    Reform = reforms.make_reform(
        legislation_json = reform_legislation_json,
        # name = u'IR_100_tranche_1',
        name = u"Imposition à 100% dès le premier euro et jusqu'à la fin de la 1ère tranche",
        reference = tax_benefit_system,
        )
    reform = Reform()

    scenario = reform.new_scenario().init_single_entity(
        axes = [
            dict(
                count = 3,
                name = 'sal',
                max = 100000,
                min = 0,
                ),
            ],
        period = simulation_period,
        parent1 = dict(birth = datetime.date(simulation_year - 40, 1, 1)),
        )

    reference_simulation = scenario.new_simulation(debug = True, reference = True)
    assert_near(reference_simulation.calculate('impo'), [0, -7889.20019531, -23435.52929688], error_margin = .01)

    reform_simulation = scenario.new_simulation(debug = True)
    assert_near(reform_simulation.calculate('impo'), [0, -13900.20019531, -29446.52929688], error_margin = .0001)
Ejemplo n.º 24
0
def build_reform(tax_benefit_system):
    reference_legislation_json = tax_benefit_system.legislation_json
    reform_legislation_json = copy.deepcopy(reference_legislation_json)
    reform_year = 2007
    reform_period = periods.period('year', reform_year)

    def update_threshold_bracket(bracket, amount):
        return reforms.update_legislation(
            legislation_json=reform_legislation_json,
            path=('children', 'ir', 'children', 'bareme', 'brackets', bracket,
                  'threshold'),
            period=reform_period,
            value=amount,
        )

    def update_rate_bracket(bracket, rate):
        return reforms.update_legislation(
            legislation_json=reform_legislation_json,
            path=('children', 'ir', 'children', 'bareme', 'brackets', bracket,
                  'rate'),
            period=reform_period,
            value=rate,
        )

    reform_legislation_json = update_rate_bracket(bracket=0, rate=0)
    reform_legislation_json = update_rate_bracket(bracket=1, rate=.0683)
    reform_legislation_json = update_rate_bracket(bracket=2, rate=.1914)
    reform_legislation_json = update_rate_bracket(bracket=3, rate=.2826)
    reform_legislation_json = update_rate_bracket(bracket=4, rate=.3738)
    reform_legislation_json = update_rate_bracket(bracket=5, rate=.4262)
    reform_legislation_json = update_rate_bracket(bracket=6, rate=.4809)

    inflation = 1
    reform_legislation_json = update_threshold_bracket(bracket=0, amount=0)
    reform_legislation_json = update_threshold_bracket(bracket=1,
                                                       amount=4412 * inflation)
    reform_legislation_json = update_threshold_bracket(bracket=2,
                                                       amount=8677 * inflation)
    reform_legislation_json = update_threshold_bracket(bracket=3,
                                                       amount=15274 *
                                                       inflation)
    reform_legislation_json = update_threshold_bracket(bracket=4,
                                                       amount=24731 *
                                                       inflation)
    reform_legislation_json = update_threshold_bracket(bracket=5,
                                                       amount=40241 *
                                                       inflation)
    reform_legislation_json = update_threshold_bracket(bracket=6,
                                                       amount=49624 *
                                                       inflation)

    reform_legislation_json = reforms.update_legislation(
        legislation_json=reform_legislation_json,
        path=('children', 'ir', 'children', 'tspr', 'children', 'sabatsalpen'),
        period=reform_period,
        value=0,
    )

    Reform = reforms.make_reform(
        legislation_json=reform_legislation_json,
        name=u'ir_2006',
        new_formulas=(),
        reference=tax_benefit_system,
    )
    return Reform()
Ejemplo n.º 25
0
def counterfactual_2014_modify_legislation_json(reference_legislation_json_copy):
    # TODO: inflater les paramètres de la décote le barème de l'IR
    inflator = 1 + .001 + .005
    reform_year = 2015
    reform_period = periods.period('year', reform_year)
#    reference_legislation_json_copy = reforms.update_legislation(
#        legislation_json = reference_legislation_json_copy,
#        path = ('children', 'ir', 'children', 'reductions_impots', 'children', 'reduction_impot_exceptionnelle',
#                'children', 'montant_plafond'),
#        period = reform_period,
#        value = 350 * inflator,
#        )
#    reference_legislation_json_copy = reforms.update_legislation(
#        legislation_json = reference_legislation_json_copy,
#        path = ('children', 'ir', 'children', 'reductions_impots', 'children', 'reduction_impot_exceptionnelle',
#                'children', 'seuil'),
#        period = reform_period,
#        value = 13795 * inflator,
#        )
#    reference_legislation_json_copy = reforms.update_legislation(
#        legislation_json = reference_legislation_json_copy,
#        path = ('children', 'ir', 'children', 'reductions_impots', 'children', 'reduction_impot_exceptionnelle',
#                'children', 'majoration_seuil'),
#        period = reform_period,
#        value = 3536 * inflator,
#        )

    # FIXME update_legislation is deprecated.
    reference_legislation_json_copy = reforms.update_legislation(
        legislation_json = reference_legislation_json_copy,
        path = ('children', 'ir', 'children', 'bareme', 'brackets', 1, 'threshold'),
        period = reform_period,
        value = 6011 * inflator,
        )
    reference_legislation_json_copy = reforms.update_legislation(
        legislation_json = reference_legislation_json_copy,
        path = ('children', 'ir', 'children', 'bareme', 'brackets', 1, 'rate'),
        period = reform_period,
        value = .055,
        )
    reference_legislation_json_copy = reforms.update_legislation(
        legislation_json = reference_legislation_json_copy,
        path = ('children', 'ir', 'children', 'bareme', 'brackets', 2, 'threshold'),
        period = reform_period,
        value = 11991 * inflator,
        )
    reference_legislation_json_copy = reforms.update_legislation(
        legislation_json = reference_legislation_json_copy,
        path = ('children', 'ir', 'children', 'bareme', 'brackets', 2, 'rate'),
        period = reform_period,
        value = .14,
        )
    reference_legislation_json_copy = reforms.update_legislation(
        legislation_json = reference_legislation_json_copy,
        path = ('children', 'ir', 'children', 'bareme', 'brackets', 3, 'threshold'),
        period = reform_period,
        value = 26631 * inflator,
        )
    reference_legislation_json_copy = reforms.update_legislation(
        legislation_json = reference_legislation_json_copy,
        path = ('children', 'ir', 'children', 'bareme', 'brackets', 3, 'rate'),
        period = reform_period,
        value = .30,
        )
    reference_legislation_json_copy = reforms.update_legislation(
        legislation_json = reference_legislation_json_copy,
        path = ('children', 'ir', 'children', 'bareme', 'brackets', 4, 'threshold'),
        period = reform_period,
        value = 71397 * inflator,
        )
    reference_legislation_json_copy = reforms.update_legislation(
        legislation_json = reference_legislation_json_copy,
        path = ('children', 'ir', 'children', 'bareme', 'brackets', 4, 'rate'),
        period = reform_period,
        value = .40,
        )

    return reference_legislation_json_copy
Ejemplo n.º 26
0
def counterfactual_2014_modify_legislation_json(
        reference_legislation_json_copy):
    # TODO: inflater les paramètres de la décote le barème de l'IR
    inflator = 1 + .001 + .005
    reform_year = 2015
    reform_period = periods.period(reform_year)
    # reference_legislation_json_copy = reforms.update_legislation(
    #     legislation_json = reference_legislation_json_copy,
    #     path = ('children', 'ir', 'children', 'reductions_impots', 'children', 'reduction_impot_exceptionnelle',
    #             'children', 'montant_plafond'),
    #     period = reform_period,
    #     value = 350 * inflator,
    #     )
    # reference_legislation_json_copy = reforms.update_legislation(
    #     legislation_json = reference_legislation_json_copy,
    #     path = ('children', 'ir', 'children', 'reductions_impots', 'children', 'reduction_impot_exceptionnelle',
    #             'children', 'seuil'),
    #     period = reform_period,
    #     value = 13795 * inflator,
    #     )
    # reference_legislation_json_copy = reforms.update_legislation(
    #     legislation_json = reference_legislation_json_copy,
    #     path = ('children', 'ir', 'children', 'reductions_impots', 'children', 'reduction_impot_exceptionnelle',
    #             'children', 'majoration_seuil'),
    #     period = reform_period,
    #     value = 3536 * inflator,
    #     )

    reference_legislation_json_copy = update_legislation(
        legislation_json=reference_legislation_json_copy,
        path=('children', 'impot_revenu', 'children', 'bareme', 'brackets', 1,
              'threshold'),
        period=reform_period,
        value=6011 * inflator,
    )
    reference_legislation_json_copy = update_legislation(
        legislation_json=reference_legislation_json_copy,
        path=('children', 'impot_revenu', 'children', 'bareme', 'brackets', 1,
              'rate'),
        period=reform_period,
        value=.055,
    )
    reference_legislation_json_copy = update_legislation(
        legislation_json=reference_legislation_json_copy,
        path=('children', 'impot_revenu', 'children', 'bareme', 'brackets', 2,
              'threshold'),
        period=reform_period,
        value=11991 * inflator,
    )
    reference_legislation_json_copy = update_legislation(
        legislation_json=reference_legislation_json_copy,
        path=('children', 'impot_revenu', 'children', 'bareme', 'brackets', 2,
              'rate'),
        period=reform_period,
        value=.14,
    )
    reference_legislation_json_copy = update_legislation(
        legislation_json=reference_legislation_json_copy,
        path=('children', 'impot_revenu', 'children', 'bareme', 'brackets', 3,
              'threshold'),
        period=reform_period,
        value=26631 * inflator,
    )
    reference_legislation_json_copy = update_legislation(
        legislation_json=reference_legislation_json_copy,
        path=('children', 'impot_revenu', 'children', 'bareme', 'brackets', 3,
              'rate'),
        period=reform_period,
        value=.30,
    )
    reference_legislation_json_copy = update_legislation(
        legislation_json=reference_legislation_json_copy,
        path=('children', 'impot_revenu', 'children', 'bareme', 'brackets', 4,
              'threshold'),
        period=reform_period,
        value=71397 * inflator,
    )
    reference_legislation_json_copy = update_legislation(
        legislation_json=reference_legislation_json_copy,
        path=('children', 'impot_revenu', 'children', 'bareme', 'brackets', 4,
              'rate'),
        period=reform_period,
        value=.40,
    )

    return reference_legislation_json_copy