policyengine-uk 2.55.1__py3-none-any.whl → 2.55.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of policyengine-uk might be problematic. Click here for more details.

@@ -43,6 +43,7 @@ class Simulation(CoreSimulation):
43
43
 
44
44
  calculated_periods: List[str] = []
45
45
  _variable_dependencies: Dict[str, List[str]] = None
46
+ dataset = None
46
47
 
47
48
  def __init__(
48
49
  self,
@@ -84,12 +85,12 @@ class Simulation(CoreSimulation):
84
85
 
85
86
  self.branches: Dict[str, Simulation] = {}
86
87
 
87
- if scenario is not None:
88
- if scenario.parameter_changes is not None:
89
- self.apply_parameter_changes(scenario.parameter_changes)
88
+ if scenario is not None and scenario.applied_before_data_load:
90
89
  if scenario.simulation_modifier is not None:
91
90
  scenario.simulation_modifier(self)
92
91
 
92
+ if scenario.parameter_changes is not None:
93
+ self.apply_parameter_changes(scenario.parameter_changes)
93
94
  # Build simulation from appropriate source
94
95
  if situation is not None:
95
96
  self.build_from_situation(situation)
@@ -137,6 +138,12 @@ class Simulation(CoreSimulation):
137
138
 
138
139
  self.calculated_periods = []
139
140
 
141
+ if scenario is not None and not scenario.applied_before_data_load:
142
+ if scenario.simulation_modifier is not None:
143
+ scenario.simulation_modifier(self)
144
+ if scenario.parameter_changes is not None:
145
+ self.apply_parameter_changes(scenario.parameter_changes)
146
+
140
147
  def reset_calculations(self):
141
148
  for variable in self.tax_benefit_system.variables:
142
149
  if variable not in self.input_variables:
@@ -69,7 +69,7 @@ def calculate_dependency_contributions(
69
69
  if "weight" in variable:
70
70
  continue
71
71
  sim.get_holder(variable_name).delete_arrays(year)
72
- value_type = system.get_variable(variable).value_type
72
+ value_type = sim.tax_benefit_system.get_variable(variable).value_type
73
73
  current_values = sim.calculate(variable, year)
74
74
  if value_type == float:
75
75
  sim.set_input(variable, year, (current_values * 0).astype(float))
@@ -13,6 +13,8 @@ class Scenario(BaseModel):
13
13
  using the + operator.
14
14
  """
15
15
 
16
+ applied_before_data_load: bool = False
17
+
16
18
  parameter_changes: Optional[
17
19
  Dict[
18
20
  str,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: policyengine-uk
3
- Version: 2.55.1
3
+ Version: 2.55.3
4
4
  Summary: PolicyEngine tax and benefit system for the UK.
5
5
  Project-URL: Homepage, https://github.com/PolicyEngine/policyengine-uk
6
6
  Project-URL: Repository, https://github.com/PolicyEngine/policyengine-uk
@@ -3,7 +3,7 @@ policyengine_uk/entities.py,sha256=9yUbkUWQr3WydNE-gHhUudG97HGyXIZY3dkgQ6Z3t9A,1
3
3
  policyengine_uk/microsimulation.py,sha256=WskrrDrLGfDYwS1CzFk5rJkQSQlTknLkxFufStKRpxc,3379
4
4
  policyengine_uk/model_api.py,sha256=KdwJCL2HkXVxDpL6fCsCnQ9Sub6Kqp7Hyxlis3MNIx4,241
5
5
  policyengine_uk/modelled_policies.yaml,sha256=TLhvmkuI9ip-Fjq63n66RzDErCkN8K4BzY6XLxLMtFg,463
6
- policyengine_uk/simulation.py,sha256=0FRttWoO05aTG7qvsJ5-mALEgxDHFCVRh28kwKP0XUY,21381
6
+ policyengine_uk/simulation.py,sha256=7kNg5uwucAKyJDA-3L51736r0-KqV-H5W23isT-gJwE,21750
7
7
  policyengine_uk/system.py,sha256=Z-ax_ImUq5k4tycuThczTxQNW5iTE6ikBJIBQdKfIzU,91
8
8
  policyengine_uk/tax_benefit_system.py,sha256=CjX1lERyOm_vlgHQcQO92HZtJiwItLH-MxJveJqk6iM,5165
9
9
  policyengine_uk/data/__init__.py,sha256=fF3Qhm01PCx26pbG_WRKddacNzbgbuEoayV_xMETDgc,144
@@ -704,9 +704,9 @@ policyengine_uk/utils/__init__.py,sha256=3c4PdgyrexqRqqkACZxyNNbhKduhuYZmzUWm6t1
704
704
  policyengine_uk/utils/compare.py,sha256=mhHOiwYoj_lteA0uActRtO9y_Zd7cqUPVgVmBfx4u5o,697
705
705
  policyengine_uk/utils/create_ahc_deflator.py,sha256=7GvhywFiUMSsh0syBd-A2MVBr-HU6t4RIuqSgMTyZEw,5463
706
706
  policyengine_uk/utils/create_triple_lock.py,sha256=-LpKwztjcDaNYd3RpnMiwxAm48RWsvw0NY9wG6gXIYw,952
707
- policyengine_uk/utils/dependencies.py,sha256=8epKWmZBeHnxqh3j0sb-Wl3Of_OdKNX-p1syLowUcWs,8197
707
+ policyengine_uk/utils/dependencies.py,sha256=8Ssi99wD0MFAM6Sw6yEDZyDsny0uSf2qc5K-NKhCD6M,8213
708
708
  policyengine_uk/utils/parameters.py,sha256=OQTzTkHMdwbphCo0mV7_n_FJT0rdwIKNFTsk_lsdETE,1301
709
- policyengine_uk/utils/scenario.py,sha256=07PNZhrAi9eb4EgvtGX1wHrj6GPbwd__8AXwY2WeeW4,8297
709
+ policyengine_uk/utils/scenario.py,sha256=FdFHG10Kl3PBEccTvbh1gIOAwfVYKqRKEwkrVbZBgAs,8341
710
710
  policyengine_uk/utils/solve_private_school_attendance_factor.py,sha256=RIpxsT6OKhLlNCX5ielTRr2ZkPQOfPpg9AbP062iWh4,1555
711
711
  policyengine_uk/utils/water/README.md,sha256=sdBI-JZ-jcRoSUfwNx5wjv5Ig_nM8OPvvjSsSMs_Wh8,443
712
712
  policyengine_uk/utils/water/forecast_water_bills.py,sha256=B4vtfJuR8XfBP-KHGyhRp2Oo7X7buN-lDH6tBIXqE2U,2788
@@ -1392,7 +1392,7 @@ policyengine_uk/variables/misc/spi_imputed.py,sha256=iPVlBF_TisM0rtKvO-3-PQ2UYCe
1392
1392
  policyengine_uk/variables/misc/uc_migrated.py,sha256=zFNcUJaO8gwmbL1iY9GKgUt3G6J9yrCraqBV_5dCvlM,306
1393
1393
  policyengine_uk/variables/misc/categories/lower_middle_or_higher.py,sha256=C54tHYz2DmOyvQYCC1bF8RJwRZinhAq_e3aYC-9F5fM,157
1394
1394
  policyengine_uk/variables/misc/categories/lower_or_higher.py,sha256=81NIbLLabRr9NwjpUZDuV8IV8_mqmp5NM-CZvt55TwE,129
1395
- policyengine_uk-2.55.1.dist-info/METADATA,sha256=cSUuwlgZGi1K9G30p8u9IjNNOZQbt3cZ-Ty9ObKtWD8,3995
1396
- policyengine_uk-2.55.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
1397
- policyengine_uk-2.55.1.dist-info/licenses/LICENSE,sha256=dql8h4yceoMhuzlcK0TT_i-NgTFNIZsgE47Q4t3dUYI,34520
1398
- policyengine_uk-2.55.1.dist-info/RECORD,,
1395
+ policyengine_uk-2.55.3.dist-info/METADATA,sha256=QLN3eI9ByQbMHTvAr3I52JT57dq8gUr9ZePXdl82Lr8,3995
1396
+ policyengine_uk-2.55.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
1397
+ policyengine_uk-2.55.3.dist-info/licenses/LICENSE,sha256=dql8h4yceoMhuzlcK0TT_i-NgTFNIZsgE47Q4t3dUYI,34520
1398
+ policyengine_uk-2.55.3.dist-info/RECORD,,