Skip to content

Commit

Permalink
test(simulations): improve simulation builder doc
Browse files Browse the repository at this point in the history
  • Loading branch information
bonjourmauko committed Sep 17, 2024
1 parent db25b40 commit c92b1c1
Show file tree
Hide file tree
Showing 9 changed files with 483 additions and 175 deletions.
6 changes: 2 additions & 4 deletions openfisca_core/entities/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from typing import NewType, Protocol
from typing_extensions import Required, TypedDict

from openfisca_core import types
from openfisca_core import types as t

# Entities
Expand All @@ -31,12 +30,11 @@ class SingleEntity(t.SingleEntity, Protocol):
...


class GroupEntity(types.CoreEntity, Protocol):
class GroupEntity(t.GroupEntity, Protocol):
...


class Role(types.Role, Protocol):
max: int | None
class Role(t.Role, Protocol):
subroles: Iterable[Role] | None


Expand Down
32 changes: 0 additions & 32 deletions openfisca_core/projectors/typing.py

This file was deleted.

6 changes: 3 additions & 3 deletions openfisca_core/simulations/_build_from_variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from openfisca_core import errors

from ._build_default_simulation import _BuildDefaultSimulation
from ._guards import is_variable_dated
from ._guards import is_a_dated_value, is_a_pure_value
from .simulation import Simulation
from .types import Populations, TaxBenefitSystem, Variables

Expand Down Expand Up @@ -142,7 +142,7 @@ def add_dated_values(self) -> Self:
"""

for variable, value in self.variables.items():
if is_variable_dated(dated_variable := value):
if is_a_dated_value(dated_variable := value):
for period, dated_value in dated_variable.items():
self.simulation.set_input(variable, period, dated_value)

Expand Down Expand Up @@ -200,7 +200,7 @@ def add_undated_values(self) -> Self:
"""

for variable, value in self.variables.items():
if not is_variable_dated(undated_value := value):
if is_a_pure_value(undated_value := value):
if (period := self.default_period) is None:
message = (
"Can't deal with type: expected object. Input "
Expand Down
Loading

0 comments on commit c92b1c1

Please sign in to comment.