From cf26c765bb2b342bfe131f531f7b5a8397c34b37 Mon Sep 17 00:00:00 2001 From: Mauko Quiroga Date: Thu, 5 Oct 2023 18:32:14 +0200 Subject: [PATCH] Bump version --- CHANGELOG.md | 10 ++++++++++ openfisca_core/entities/helpers.py | 4 ++-- openfisca_core/projectors/helpers.py | 5 +++-- openfisca_core/projectors/typing.py | 29 +--------------------------- setup.py | 2 +- 5 files changed, 17 insertions(+), 33 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9f3d7d278..9d0bd1675 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,15 @@ # Changelog +## 41.2.0 [#1197](https://github.com/openfisca/openfisca-core/pull/1197) + +#### New features + +- Add `entities.find_role()` to find roles by key and `max`. + +#### Technical changes + +- Document `projectors.get_projector_from_shortcut()`. + ### 41.1.2 [#1192](https://github.com/openfisca/openfisca-core/pull/1192) #### Technical changes diff --git a/openfisca_core/entities/helpers.py b/openfisca_core/entities/helpers.py index 91131c390..f3d988536 100644 --- a/openfisca_core/entities/helpers.py +++ b/openfisca_core/entities/helpers.py @@ -4,7 +4,7 @@ from .entity import Entity from .group_entity import GroupEntity -from .role import Role +from .typing import Role def build_entity( @@ -28,7 +28,7 @@ def build_entity( def find_role( roles: Iterable[Role], key: str, *, total: int | None = None ) -> Role | None: - """Find a role in an entity. + """Find a Role in a GrupEntity. Args: group_entity (GroupEntity): The entity to search in. diff --git a/openfisca_core/projectors/helpers.py b/openfisca_core/projectors/helpers.py index 4269ad638..196801b71 100644 --- a/openfisca_core/projectors/helpers.py +++ b/openfisca_core/projectors/helpers.py @@ -1,10 +1,11 @@ from __future__ import annotations from collections.abc import Mapping +from openfisca_core.entities.typing import Entity, GroupEntity, Role from openfisca_core import entities, projectors -from .typing import Entity, GroupEntity, GroupPopulation, Population +from .typing import GroupPopulation, Population def projectable(function): @@ -124,7 +125,7 @@ def get_projector_from_shortcut( return projectors.FirstPersonToEntityProjector(population, parent) if isinstance(entity, entities.GroupEntity): - role: entities.Role | None = entities.find_role(entity.roles, shortcut, total=1) + role: Role | None = entities.find_role(entity.roles, shortcut, total=1) if role is not None: return projectors.UniqueRoleToEntityProjector(population, role, parent) diff --git a/openfisca_core/projectors/typing.py b/openfisca_core/projectors/typing.py index 5093f28e9..7b9170ad7 100644 --- a/openfisca_core/projectors/typing.py +++ b/openfisca_core/projectors/typing.py @@ -1,37 +1,10 @@ from __future__ import annotations from collections.abc import Mapping +from openfisca_core.entities.typing import Entity, GroupEntity, Role from typing import Iterable, Protocol -class Entity(Protocol): - @property - def is_person(self) -> bool: - ... - - -class GroupEntity(Protocol): - @property - def containing_entities(self) -> Iterable[str]: - ... - - @property - def is_person(self) -> bool: - ... - - @property - def flattened_roles(self) -> Iterable[Role]: - ... - - @property - def roles(self) -> Iterable[Role]: - ... - - -class Role(Protocol): - ... - - class Population(Protocol): @property def entity(self) -> Entity: diff --git a/setup.py b/setup.py index 07fd5c2c9..09dc8938b 100644 --- a/setup.py +++ b/setup.py @@ -67,7 +67,7 @@ setup( name="OpenFisca-Core", - version="41.1.2", + version="41.2.0", author="OpenFisca Team", author_email="contact@openfisca.org", classifiers=[