Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add dunder contains and dunder iter to TracingParameterNodeAtInstant #1200

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Changelog

## 41.3.0 [#1200](https://github.com/openfisca/openfisca-core/pull/1200)

> As `TracingParameterNodeAtInstant` is a wrapper for `ParameterNodeAtInstant`
> which allows iteration and the use of `contains`, it was not possible
> to use those on a `TracingParameterNodeAtInstant`

#### New features

- Allows iterations on `TracingParameterNodeAtInstant`
- Allows keyword `contains` on `TracingParameterNodeAtInstant`

## 41.2.0 [#1199](https://github.com/openfisca/openfisca-core/pull/1199)

#### Technical changes
Expand Down
6 changes: 6 additions & 0 deletions openfisca_core/tracers/tracing_parameter_node_at_instant.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ def __getattr__(
child = getattr(self.parameter_node_at_instant, key)
return self.get_traced_child(child, key)

def __contains__(self, key) -> bool:
return key in self.parameter_node_at_instant

def __iter__(self):
return iter(self.parameter_node_at_instant)

def __getitem__(
self,
key: Union[str, ArrayLike],
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.2.0",
version="41.3.0",
author="OpenFisca Team",
author_email="[email protected]",
classifiers=[
Expand Down
Loading