Types

Data types and protocols used by OpenFisca Core.

The type definitions included in this sub-package are intended for contributors, to help them better understand and document contracts and expected behaviours.

Official Public API:
  • Array

  • ArrayLike

  • Cache

  • Entity

  • Formula

  • Holder

  • Instant

  • ParameterNodeAtInstant

  • Params

  • Period

  • Population

  • Role,

  • Simulation,

  • TaxBenefitSystem

  • Variable

Note

How imports are being used today:

from openfisca_core.types import *  # Bad
from openfisca_core.types.data_types.arrays import ArrayLike  # Bad

The previous examples provoke cyclic dependency problems, that prevents us from modularizing the different components of the library, so as to make them easier to test and to maintain.

How could them be used after the next major release:

from openfisca_core.types import ArrayLike

ArrayLike # Good: import types as publicly exposed
openfisca_core.types.Array

alias of nptyping.types._ndarray.NDArray

class openfisca_core.types.Entity(*args, **kwargs)[source]

Entity protocol.

abstract check_role_validity(role)[source]

Abstract method.

Return type

None

abstract check_variable_defined_for_entity(variable_name)[source]

Abstract method.

Return type

None

abstract get_variable(variable_name, check_existence=Ellipsis)[source]

Abstract method.

Return type

Optional[Any]

class openfisca_core.types.Formula(*args, **kwargs)[source]

Formula protocol.

abstract __call__(population, instant, params)[source]

Abstract method.

Return type

ndarray

class openfisca_core.types.Holder(*args, **kwargs)[source]

Holder protocol.

abstract clone(population)[source]

Abstract method.

Return type

Holder

abstract get_memory_usage()[source]

Abstract method.

Return type

Any

class openfisca_core.types.Instant(*args, **kwargs)[source]

Instant protocol.

class openfisca_core.types.ParameterNodeAtInstant(*args, **kwargs)[source]

ParameterNodeAtInstant protocol.

class openfisca_core.types.Params(*args, **kwargs)[source]

Params protocol.

abstract __call__(instant)[source]

Abstract method.

Return type

ParameterNodeAtInstant

class openfisca_core.types.Period(*args, **kwargs)[source]

Period protocol.

abstract property start: Any

Abstract method.

Return type

Any

abstract property unit: Any

Abstract method.

Return type

Any

class openfisca_core.types.Population(*args, **kwargs)[source]

Population protocol.

abstract get_holder(variable_name)[source]

Abstract method.

Return type

Any

class openfisca_core.types.Role(*args, **kwargs)[source]

Role protocol.

class openfisca_core.types.Simulation(*args, **kwargs)[source]

Simulation protocol.

abstract calculate(variable_name, period)[source]

Abstract method.

Return type

Any

abstract calculate_add(variable_name, period)[source]

Abstract method.

Return type

Any

abstract calculate_divide(variable_name, period)[source]

Abstract method.

Return type

Any

abstract get_population(plural)[source]

Abstract method.

Return type

Any

class openfisca_core.types.TaxBenefitSystem(*args, **kwargs)[source]

TaxBenefitSystem protocol.

abstract get_variable(variable_name, check_existence=Ellipsis)[source]

Abstract method.

Return type

Optional[Any]

class openfisca_core.types.Variable(*args, **kwargs)[source]

Variable protocol.