Skip to content

Commit

Permalink
Lint
Browse files Browse the repository at this point in the history
  • Loading branch information
sylvainipp committed Dec 4, 2024
1 parent e15e885 commit c6fff04
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions openfisca_survey_manager/calibration.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,9 @@ def _build_calmar_data(self) -> dict:
period = self.period
for variable in self.margins_by_variable:
assert variable in self.simulation.tax_benefit_system.variables or variable.split(" ")[0] in self.simulation.tax_benefit_system.variables
value = self.simulation.adaptative_calculate_variable(variable.split(" ")[0], period = period)
if len(variable.split(" ")) > 1:
var_to_eval = simulation.adaptative_calculate_variable(variable.split(" ")[0], period = period)
value = eval('var_to_eval' + ''.join(variable.split(" ")[1: ])).astype(float)
else:
value = self.simulation.adaptative_calculate_variable(variable, period = period)
value = eval('value' + ''.join(variable.split(" ")[1:])).astype(float)
data[self.simulation.tax_benefit_system.variables[variable].entity.key][variable] = value

if len(self.entities) == 2:
Expand Down Expand Up @@ -280,11 +278,9 @@ def _update_margins(self):
filter_by = self.filter_by
initial_weight = self.initial_weight

value = simulation.adaptative_calculate_variable(variable.split(" ")[0], period = period)
if len(variable.split(" ")) > 1:
var_to_eval = simulation.adaptative_calculate_variable(variable.split(" ")[0], period = period)
value = eval( 'var_to_eval' + ''.join(variable.split(" ")[1: ])).astype(float)
else:
value = simulation.adaptative_calculate_variable(variable, period = period)
value = eval('value' + ''.join(variable.split(" ")[1:])).astype(float)
weight_variable = simulation.weight_variable_by_entity[target_entity]

if len(self.entities) == 2 and simulation.tax_benefit_system.variables[variable.split(" ")[0]].entity.key != self.target_entity:
Expand Down

0 comments on commit c6fff04

Please sign in to comment.