policyengine 3.1.0__py3-none-any.whl → 3.1.1__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.
- policyengine/__pycache__/__init__.cpython-313.pyc +0 -0
- policyengine/core/dynamic.py +26 -0
- policyengine/core/policy.py +26 -0
- {policyengine-3.1.0.dist-info → policyengine-3.1.1.dist-info}/METADATA +1 -1
- {policyengine-3.1.0.dist-info → policyengine-3.1.1.dist-info}/RECORD +8 -8
- {policyengine-3.1.0.dist-info → policyengine-3.1.1.dist-info}/WHEEL +0 -0
- {policyengine-3.1.0.dist-info → policyengine-3.1.1.dist-info}/licenses/LICENSE +0 -0
- {policyengine-3.1.0.dist-info → policyengine-3.1.1.dist-info}/top_level.txt +0 -0
|
Binary file
|
policyengine/core/dynamic.py
CHANGED
|
@@ -15,3 +15,29 @@ class Dynamic(BaseModel):
|
|
|
15
15
|
simulation_modifier: Callable | None = None
|
|
16
16
|
created_at: datetime = Field(default_factory=datetime.now)
|
|
17
17
|
updated_at: datetime = Field(default_factory=datetime.now)
|
|
18
|
+
|
|
19
|
+
def __add__(self, other: "Dynamic") -> "Dynamic":
|
|
20
|
+
"""Combine two dynamics by appending parameter values and chaining simulation modifiers."""
|
|
21
|
+
if not isinstance(other, Dynamic):
|
|
22
|
+
return NotImplemented
|
|
23
|
+
|
|
24
|
+
# Combine simulation modifiers
|
|
25
|
+
combined_modifier = None
|
|
26
|
+
if self.simulation_modifier is not None and other.simulation_modifier is not None:
|
|
27
|
+
|
|
28
|
+
def combined_modifier(sim):
|
|
29
|
+
sim = self.simulation_modifier(sim)
|
|
30
|
+
sim = other.simulation_modifier(sim)
|
|
31
|
+
return sim
|
|
32
|
+
|
|
33
|
+
elif self.simulation_modifier is not None:
|
|
34
|
+
combined_modifier = self.simulation_modifier
|
|
35
|
+
elif other.simulation_modifier is not None:
|
|
36
|
+
combined_modifier = other.simulation_modifier
|
|
37
|
+
|
|
38
|
+
return Dynamic(
|
|
39
|
+
name=f"{self.name} + {other.name}",
|
|
40
|
+
description=f"Combined dynamic: {self.name} and {other.name}",
|
|
41
|
+
parameter_values=self.parameter_values + other.parameter_values,
|
|
42
|
+
simulation_modifier=combined_modifier,
|
|
43
|
+
)
|
policyengine/core/policy.py
CHANGED
|
@@ -15,3 +15,29 @@ class Policy(BaseModel):
|
|
|
15
15
|
simulation_modifier: Callable | None = None
|
|
16
16
|
created_at: datetime = Field(default_factory=datetime.now)
|
|
17
17
|
updated_at: datetime = Field(default_factory=datetime.now)
|
|
18
|
+
|
|
19
|
+
def __add__(self, other: "Policy") -> "Policy":
|
|
20
|
+
"""Combine two policies by appending parameter values and chaining simulation modifiers."""
|
|
21
|
+
if not isinstance(other, Policy):
|
|
22
|
+
return NotImplemented
|
|
23
|
+
|
|
24
|
+
# Combine simulation modifiers
|
|
25
|
+
combined_modifier = None
|
|
26
|
+
if self.simulation_modifier is not None and other.simulation_modifier is not None:
|
|
27
|
+
|
|
28
|
+
def combined_modifier(sim):
|
|
29
|
+
sim = self.simulation_modifier(sim)
|
|
30
|
+
sim = other.simulation_modifier(sim)
|
|
31
|
+
return sim
|
|
32
|
+
|
|
33
|
+
elif self.simulation_modifier is not None:
|
|
34
|
+
combined_modifier = self.simulation_modifier
|
|
35
|
+
elif other.simulation_modifier is not None:
|
|
36
|
+
combined_modifier = other.simulation_modifier
|
|
37
|
+
|
|
38
|
+
return Policy(
|
|
39
|
+
name=f"{self.name} + {other.name}",
|
|
40
|
+
description=f"Combined policy: {self.name} and {other.name}",
|
|
41
|
+
parameter_values=self.parameter_values + other.parameter_values,
|
|
42
|
+
simulation_modifier=combined_modifier,
|
|
43
|
+
)
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
policyengine/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
policyengine/__pycache__/__init__.cpython-313.pyc,sha256=
|
|
2
|
+
policyengine/__pycache__/__init__.cpython-313.pyc,sha256=dmkhqYKcUjDPvirOFgf1L-P-aV3l7JIWK6zZZ6J45LU,175
|
|
3
3
|
policyengine/core/__init__.py,sha256=3vabkWXYNNmQmN4Vy1yx2kKk6RKVSsdjtToQ8s8gzUg,870
|
|
4
4
|
policyengine/core/dataset.py,sha256=jGjnoyEQ6VcTiCs8Hr6PT22l59CRhK1oUT5RPaz7mC0,9256
|
|
5
5
|
policyengine/core/dataset_version.py,sha256=6KeFCRGQto_Yyl4QY4Vo2JFythjaXrNAOHQiwRGESyM,378
|
|
6
|
-
policyengine/core/dynamic.py,sha256=
|
|
6
|
+
policyengine/core/dynamic.py,sha256=40RO3N6hmUT6-3tpJy0wSOC-9ITdFSS5LRiqPmi79f0,1605
|
|
7
7
|
policyengine/core/output.py,sha256=cCW4vbzkLdQaT_nJTyDJBl7Hubm7nZeRuR7aVG1dKvg,643
|
|
8
8
|
policyengine/core/parameter.py,sha256=PLDaepytqB7FVSfYQ541vnkVuMDLamFBeHtz2TmQrOE,378
|
|
9
9
|
policyengine/core/parameter_value.py,sha256=b0ts1kbWcwjPSYnZm2rlCylmTLPJRLxDL8z3RmxM5OI,377
|
|
10
|
-
policyengine/core/policy.py,sha256=
|
|
10
|
+
policyengine/core/policy.py,sha256=xorVf03bcjB-3mBEmwj2YMqF1-6Xzps74SquzqtS0lo,1599
|
|
11
11
|
policyengine/core/simulation.py,sha256=x9dU_nKEIgCZa11cxB-VdRNt9DZjjSML7n7M8_3STv8,941
|
|
12
12
|
policyengine/core/tax_benefit_model.py,sha256=2Yc1RlQrUG7djDMZbJOQH4Ns86_lOnLeISCGR4-9zMo,176
|
|
13
13
|
policyengine/core/tax_benefit_model_version.py,sha256=AJHFRaSEzR2_0FVkBBb40ID3FAaFFrFLnhSXRYYbtWs,1291
|
|
@@ -32,8 +32,8 @@ policyengine/utils/__init__.py,sha256=1X-VYAWLyB9A0YRHwsGWrqQHns1WfeZ7ISC6DMU5my
|
|
|
32
32
|
policyengine/utils/dates.py,sha256=HnAqyl8S8EOYp8ibsnMTmECYoDWCSqwL-7A2_qKgxSc,1510
|
|
33
33
|
policyengine/utils/parametric_reforms.py,sha256=4P3U39-4pYTU4BN6JjgmVLUkCkBhRfZJ6UIWTlsjyQE,1155
|
|
34
34
|
policyengine/utils/plotting.py,sha256=JbMPwD7SCQqp_qbjYrXixT5zS0eG734n0Sg4JkD9nDc,5336
|
|
35
|
-
policyengine-3.1.
|
|
36
|
-
policyengine-3.1.
|
|
37
|
-
policyengine-3.1.
|
|
38
|
-
policyengine-3.1.
|
|
39
|
-
policyengine-3.1.
|
|
35
|
+
policyengine-3.1.1.dist-info/licenses/LICENSE,sha256=hIahDEOTzuHCU5J2nd07LWwkLW7Hko4UFO__ffsvB-8,34523
|
|
36
|
+
policyengine-3.1.1.dist-info/METADATA,sha256=JuCAmXnSyBcTeeqyBm54GYmsYrrOPg8zGhWHdYoleT4,45889
|
|
37
|
+
policyengine-3.1.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
38
|
+
policyengine-3.1.1.dist-info/top_level.txt,sha256=_23UPobfkneHQkpJ0e0OmDJfhCUfoXj_F2sTckCGOH4,13
|
|
39
|
+
policyengine-3.1.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|