Skip to content

Commit 0277902

Browse files
committed
test(simulations): improve simulation builder doc
1 parent 9f26f9b commit 0277902

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 Protocol
55
from typing_extensions import TypedDict
66

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

109
# Entities
@@ -19,12 +18,11 @@ class SingleEntity(t.SingleEntity, Protocol):
1918
...
2019

2120

22-
class GroupEntity(types.CoreEntity, Protocol):
21+
class GroupEntity(t.GroupEntity, Protocol):
2322
...
2423

2524

26-
class Role(types.Role, Protocol):
27-
max: int | None
25+
class Role(t.Role, Protocol):
2826
subroles: Iterable[Role] | None
2927

3028

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)