Skip to content

Commit

Permalink
Add Holder() annotation
Browse files Browse the repository at this point in the history
  • Loading branch information
Mauko Quiroga committed Sep 9, 2021
1 parent 19ed765 commit 17e53f4
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 3 deletions.
5 changes: 3 additions & 2 deletions openfisca_core/holders/holder.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,16 @@
from openfisca_core.data_storage import InMemoryStorage, OnDiskStorage
from openfisca_core.indexed_enums import Enum
from openfisca_core.periods import Period
from openfisca_core.types import ArrayLike, ArrayType
from openfisca_core.variables import Variable
from openfisca_core.types import ArrayLike, ArrayType, Aggregatable


class Holder:
"""
A holder keeps tracks of a variable values after they have been calculated, or set as an input.
"""

def __init__(self, variable, population):
def __init__(self, variable: Variable, population: Aggregatable) -> None:
self.population = population
self.variable = variable
self.simulation = population.simulation
Expand Down
1 change: 1 addition & 0 deletions openfisca_core/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
)

from .protocols import ( # noqa: F401
Aggregatable,
Buildable,
Descriptable,
Personifiable,
Expand Down
2 changes: 1 addition & 1 deletion openfisca_core/types/callables/formulas.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from typing import Callable

from ..protocols._aggregatable import Aggregatable
from ..protocols._instantizable import Instantizable
from ..protocols._timeable import Timeable
from ..protocols.aggregatable import Aggregatable
from ..data_types import ArrayType

ParamsType = Callable[[Timeable], Instantizable]
Expand Down
1 change: 1 addition & 0 deletions openfisca_core/types/protocols/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#
# See: https://www.python.org/dev/peps/pep-0008/#imports

from .aggregatable import Aggregatable # noqa: F401
from .buildable import Buildable # noqa: F401
from .descriptable import Descriptable # noqa: F401
from .personifiable import Personifiable # noqa: F401
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from typing import Any

from typing_extensions import Protocol


Expand All @@ -12,4 +14,7 @@ class Aggregatable(Protocol):
"""

count: int
simulation: Any

...

0 comments on commit 17e53f4

Please sign in to comment.