Skip to content

Commit

Permalink
docs: fix docs
Browse files Browse the repository at this point in the history
  • Loading branch information
bonjourmauko committed Nov 21, 2024
1 parent 858d2e3 commit d9c37e1
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
6 changes: 3 additions & 3 deletions openfisca_core/populations/_core_population.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class CorePopulation:
"""Base class to build populations from.
Args:
entity: The :class:`.CoreEntity` of the population.
entity: The :class:`~entities.CoreEntity` of the population.
*__args: Variable length argument list.
**__kwds: Arbitrary keyword arguments.
Expand All @@ -43,7 +43,7 @@ class CorePopulation:
#: A pseudo index for the members of the population.
ids: Sequence[str] = []

#: The :class:`.Simulation` for which the population is calculated.
#: The :class:`~simulations.Simulation` for which the population is calculated.
simulation: None | t.Simulation = None

#: The holders of the variables.
Expand All @@ -67,7 +67,7 @@ def __call__(
options: The options to use for the calculation.
Returns:
None: If there is no :class:`.Simulation`.
None: If there is no :class:`~simulations.Simulation`.
ndarray[generic]: The result of the calculation.
Raises:
Expand Down
4 changes: 3 additions & 1 deletion openfisca_core/populations/_errors.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
from openfisca_core import types as t

from ._enums import Option


class IncompatibleOptionsError(ValueError):
"""Raised when two options are incompatible."""

def __init__(self, variable_name: t.VariableName) -> None:
add, divide = t.Option
add, divide = Option
msg = (
f"Options {add} and {divide} are incompatible (trying to compute "
f"variable {variable_name})."
Expand Down
3 changes: 2 additions & 1 deletion openfisca_core/reforms/reform.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ def modify_parameters(self, modifier_function):
Call this function in `apply()` if the reform asks for legislation parameter modifications.
Args:
modifier_function: A function that takes a :obj:`.ParameterNode` and should return an object of the same type.
modifier_function: A function that takes a :obj:`~parameters.ParameterNode` and should return an object of
the same type.
"""
baseline_parameters = self.baseline.parameters
Expand Down
10 changes: 6 additions & 4 deletions openfisca_core/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,15 +406,12 @@ def offset(
#: Type alias for a period-like object.
PeriodLike: TypeAlias = Union[Period, PeriodStr, PeriodInt]


# Populations

#: Type alias for a population's holders.
HolderByVariable: TypeAlias = MutableMapping["VariableName", Holder[_N]]

# TODO(Mauko Quiroga-Alvarado): I'm not sure if this type alias is correct.
# https://openfisca.org/doc/coding-the-legislation/50_entities.html
Members: TypeAlias = Iterable["SinglePopulation"]


class MemoryUsageByVariable(TypedDict, total=False):
by_variable: dict[VariableName, MemoryUsage]
Expand Down Expand Up @@ -448,6 +445,11 @@ def members_entity_id(self, /) -> StrArray: ...
def nb_persons(self, /, __role: None | Role = ...) -> int: ...


# TODO(Mauko Quiroga-Alvarado): I'm not sure if this type alias is correct.
# https://openfisca.org/doc/coding-the-legislation/50_entities.html
Members: TypeAlias = Iterable[SinglePopulation]


# Simulations


Expand Down

0 comments on commit d9c37e1

Please sign in to comment.