From b63a32dd0d0a72d6868884b584e975984c70fed2 Mon Sep 17 00:00:00 2001 From: Nikhil Woodruff <35577657+nikhilwoodruff@users.noreply.github.com> Date: Mon, 25 Apr 2022 11:44:00 +0100 Subject: [PATCH 1/3] Fix mapping bug --- CHANGELOG.md | 6 ++++++ openfisca_tools/hypothetical.py | 12 +++++------- setup.py | 2 +- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3a8308a..00a3118 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.10.2] - 2022-04-25 + +### Fixed + +* Adding a `target` entity to `IndividualSim.calc` now functions correctly when `target` has a different entity type than `variable`. + ## [0.10.1] - 2022-04-24 ### Fixed diff --git a/openfisca_tools/hypothetical.py b/openfisca_tools/hypothetical.py index d0e32c7..9c2a0d0 100644 --- a/openfisca_tools/hypothetical.py +++ b/openfisca_tools/hypothetical.py @@ -275,15 +275,8 @@ def calc( self.apply_reform(reform) self.build() - if map_to is None and target is not None: - map_to = self.get_entity(target).key - period = period or self.year entity = self.system.variables[var].entity - if target is not None: - target_entity = self.get_entity(target) - if target_entity.key != entity.key: - target = self.get_group(entity, target) try: result = self.simulation.calculate(var, period) except: @@ -291,6 +284,11 @@ def calc( result = self.sim.calculate_add(var, period) except: result = self.simulation.calculate_divide(var, period) + if ( + target is not None + and target not in self.situation_data[entity.plural] + ): + map_to = self.get_entity(target).key if map_to is not None: result = self.map_to(result, entity.key, map_to) entity = self.entities[map_to] diff --git a/setup.py b/setup.py index c009b65..b88e2e1 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ setup( name="OpenFisca-Tools", - version="0.10.1", + version="0.10.2", author="PolicyEngine", license="http://www.fsf.org/licensing/licenses/agpl-3.0.html", url="https://github.com/policyengine/openfisca-tools", From bedcec2478afe193e82ee26a0e759687b2933705 Mon Sep 17 00:00:00 2001 From: Nikhil Woodruff <35577657+nikhilwoodruff@users.noreply.github.com> Date: Mon, 25 Apr 2022 13:16:28 +0100 Subject: [PATCH 2/3] Add manifest --- CHANGELOG.md | 1 + MANIFEST.in | 1 + 2 files changed, 2 insertions(+) create mode 100644 MANIFEST.in diff --git a/CHANGELOG.md b/CHANGELOG.md index 00a3118..37abac6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed * Adding a `target` entity to `IndividualSim.calc` now functions correctly when `target` has a different entity type than `variable`. +* Adds `MANIFEST.in` to the repo. ## [0.10.1] - 2022-04-24 diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..61caa9a --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1 @@ +recursive-include openfisca_us * From b0df2587ccb43e66dfa11ff7cd4ae515a09ccb16 Mon Sep 17 00:00:00 2001 From: Nikhil Woodruff <35577657+nikhilwoodruff@users.noreply.github.com> Date: Mon, 25 Apr 2022 13:16:40 +0100 Subject: [PATCH 3/3] Fix manifest --- MANIFEST.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MANIFEST.in b/MANIFEST.in index 61caa9a..91eeb3f 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1 +1 @@ -recursive-include openfisca_us * +recursive-include openfisca_tools *