Skip to content

Commit f527940

Browse files
committed
test(simulations): improve simulation builder doc
1 parent fdb6a82 commit f527940

File tree

9 files changed

+483
-175
lines changed

9 files changed

+483
-175
lines changed

openfisca_core/entities/types.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
from typing import NewType, Protocol
55
from typing_extensions import Required, TypedDict
66

7-
from openfisca_core import types
87
from openfisca_core import types as t
98

109
# Entities
@@ -31,12 +30,11 @@ class SingleEntity(t.SingleEntity, Protocol):
3130
...
3231

3332

34-
class GroupEntity(types.CoreEntity, Protocol):
33+
class GroupEntity(t.GroupEntity, Protocol):
3534
...
3635

3736

38-
class Role(types.Role, Protocol):
39-
max: int | None
37+
class Role(t.Role, Protocol):
4038
subroles: Iterable[Role] | None
4139

4240

openfisca_core/projectors/typing.py

Lines changed: 0 additions & 32 deletions
This file was deleted.

openfisca_core/simulations/_build_from_variables.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from openfisca_core import errors
99

1010
from ._build_default_simulation import _BuildDefaultSimulation
11-
from ._guards import is_variable_dated
11+
from ._guards import is_a_dated_value, is_a_pure_value
1212
from .simulation import Simulation
1313
from .types import Populations, TaxBenefitSystem, Variables
1414

@@ -142,7 +142,7 @@ def add_dated_values(self) -> Self:
142142
"""
143143

144144
for variable, value in self.variables.items():
145-
if is_variable_dated(dated_variable := value):
145+
if is_a_dated_value(dated_variable := value):
146146
for period, dated_value in dated_variable.items():
147147
self.simulation.set_input(variable, period, dated_value)
148148

@@ -200,7 +200,7 @@ def add_undated_values(self) -> Self:
200200
"""
201201

202202
for variable, value in self.variables.items():
203-
if not is_variable_dated(undated_value := value):
203+
if is_a_pure_value(undated_value := value):
204204
if (period := self.default_period) is None:
205205
message = (
206206
"Can't deal with type: expected object. Input "

0 commit comments

Comments
 (0)