Skip to content

Commit 75148b9

Browse files
committed
docs: fix docs
1 parent fbb0e54 commit 75148b9

File tree

4 files changed

+21
-15
lines changed

4 files changed

+21
-15
lines changed

openfisca_core/populations/_core_population.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class CorePopulation:
2828
"""Base class to build populations from.
2929
3030
Args:
31-
entity: The :class:`.CoreEntity` of the population.
31+
entity: The :class:`~entities.CoreEntity` of the population.
3232
*__args: Variable length argument list.
3333
**__kwds: Arbitrary keyword arguments.
3434
@@ -43,7 +43,7 @@ class CorePopulation:
4343
#: A pseudo index for the members of the population.
4444
ids: Sequence[str] = []
4545

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

4949
#: The holders of the variables.
@@ -67,7 +67,7 @@ def __call__(
6767
options: The options to use for the calculation.
6868
6969
Returns:
70-
None: If there is no :class:`.Simulation`.
70+
None: If there is no :class:`~simulations.Simulation`.
7171
ndarray[generic]: The result of the calculation.
7272
7373
Raises:

openfisca_core/populations/_errors.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
from openfisca_core import types as t
22

3+
from ._enums import Option
4+
35

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

79
def __init__(self, variable_name: t.VariableName) -> None:
8-
add, divide = t.Option
10+
add, divide = Option
911
msg = (
1012
f"Options {add} and {divide} are incompatible (trying to compute "
1113
f"variable {variable_name})."

openfisca_core/reforms/reform.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ def modify_parameters(self, modifier_function):
7171
Call this function in `apply()` if the reform asks for legislation parameter modifications.
7272
7373
Args:
74-
modifier_function: A function that takes a :obj:`.ParameterNode` and should return an object of the same type.
74+
modifier_function: A function that takes a :obj:`~parameters.ParameterNode` and should return an object of
75+
the same type.
7576
7677
"""
7778
baseline_parameters = self.baseline.parameters

openfisca_core/types.py

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -321,9 +321,6 @@ def __getitem__(self, __index: str | VarArray, /) -> ParameterNodeChild: ...
321321
#: For example 2020.
322322
PeriodInt = NewType("PeriodInt", int)
323323

324-
#: Type alias for a period-like object.
325-
PeriodLike: TypeAlias = Union["Period", "PeriodStr", PeriodInt]
326-
327324

328325
class _InstantStrMeta(type):
329326
def __instancecheck__(self, arg: object) -> bool:
@@ -406,15 +403,15 @@ def offset(
406403
) -> Period: ...
407404

408405

406+
#: Type alias for a period-like object.
407+
PeriodLike: TypeAlias = Union[Period, PeriodStr, PeriodInt]
408+
409+
409410
# Populations
410411

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

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

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

450447

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

453455

@@ -507,9 +509,6 @@ def instantiate_entities(self, /) -> dict[str, CorePopulation]: ...
507509
#: A type representing a mapping of serialized traces.
508510
SerializedNodeMap: TypeAlias = dict["NodeKey", "SerializedTraceMap"]
509511

510-
#: A stack of simple traces.
511-
SimpleStack: TypeAlias = list["SimpleTraceMap"]
512-
513512
#: Key of a trace.
514513
NodeKey = NewType("NodeKey", str)
515514

@@ -587,6 +586,10 @@ def formula_time(self, /) -> Time: ...
587586
def append_child(self, __node: TraceNode, /) -> None: ...
588587

589588

589+
#: A stack of simple traces.
590+
SimpleStack: TypeAlias = list[SimpleTraceMap]
591+
592+
590593
# Variables
591594

592595
#: For example "salary".

0 commit comments

Comments
 (0)