Skip to content

Commit

Permalink
Bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
bonjourmauko committed Oct 5, 2023
1 parent b1e31cc commit cf26c76
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 33 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions openfisca_core/entities/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from .entity import Entity
from .group_entity import GroupEntity
from .role import Role
from .typing import Role


def build_entity(
Expand All @@ -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.
Expand Down
5 changes: 3 additions & 2 deletions openfisca_core/projectors/helpers.py
Original file line number Diff line number Diff line change
@@ -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):
Expand Down Expand Up @@ -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)
Expand Down
29 changes: 1 addition & 28 deletions openfisca_core/projectors/typing.py
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@

setup(
name="OpenFisca-Core",
version="41.1.2",
version="41.2.0",
author="OpenFisca Team",
author_email="[email protected]",
classifiers=[
Expand Down

0 comments on commit cf26c76

Please sign in to comment.