Skip to content

Commit

Permalink
fix(simulations): build uses group populations
Browse files Browse the repository at this point in the history
  • Loading branch information
bonjourmauko committed Sep 16, 2024
1 parent 7892ea8 commit fbce81f
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions openfisca_core/simulations/_build_default_simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
import numpy

from .simulation import Simulation
from .types import CoreEntity, CorePopulation, TaxBenefitSystem
from .types import CoreEntity, GroupPopulation, TaxBenefitSystem

Populations: TypeAlias = dict[str, CorePopulation[CoreEntity]]
Populations: TypeAlias = dict[str, GroupPopulation[CoreEntity]]


class _BuildDefaultSimulation:
Expand Down
4 changes: 2 additions & 2 deletions openfisca_core/simulations/_build_from_variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
from ._build_default_simulation import _BuildDefaultSimulation
from ._guards import is_variable_dated
from .simulation import Simulation
from .types import CoreEntity, CorePopulation, TaxBenefitSystem, Variables
from .types import CoreEntity, GroupPopulation, TaxBenefitSystem, Variables

Populations: TypeAlias = dict[str, CorePopulation[CoreEntity]]
Populations: TypeAlias = dict[str, GroupPopulation[CoreEntity]]


class _BuildFromVariables:
Expand Down
4 changes: 1 addition & 3 deletions openfisca_core/simulations/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,7 @@ class Period(t.Period, Protocol):


class CorePopulation(t.CorePopulation, Protocol[D]):
count: int
entity: D
ids: t.Array[String]

def get_holder(self, __variable_name: str) -> Holder[V]:
...
Expand Down Expand Up @@ -213,7 +211,7 @@ def get_variable(

def instantiate_entities(
self,
) -> dict[str, SinglePopulation[E]]:
) -> dict[str, GroupPopulation[E]]:
...


Expand Down
2 changes: 2 additions & 0 deletions openfisca_core/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,9 @@ def unit(self) -> Any:


class CorePopulation(Protocol):
count: int
entity: Any
ids: Array[numpy.str_]

@abc.abstractmethod
def get_holder(self, variable_name: Any) -> Any:
Expand Down

0 comments on commit fbce81f

Please sign in to comment.