From a96ea94355381958f826086ce4ec5d4d59e6ebb8 Mon Sep 17 00:00:00 2001 From: Richard Evans Date: Thu, 10 Oct 2024 14:22:52 -0600 Subject: [PATCH 1/2] Black formatted files --- .../is_older_child_for_medicaid.py | 25 +++++++++++++------ .../premium_tax_credit/is_ptc_eligible.py | 7 +++--- .../gov/states/co/ssa/oap/co_oap_eligible.py | 18 ++++++------- .../co_state_supplement_eligible.py | 3 ++- 4 files changed, 32 insertions(+), 21 deletions(-) diff --git a/fiscalsim_us/variables/gov/hhs/medicaid/eligibility/categories/older_child/is_older_child_for_medicaid.py b/fiscalsim_us/variables/gov/hhs/medicaid/eligibility/categories/older_child/is_older_child_for_medicaid.py index 8990d3742..b2d9ac318 100644 --- a/fiscalsim_us/variables/gov/hhs/medicaid/eligibility/categories/older_child/is_older_child_for_medicaid.py +++ b/fiscalsim_us/variables/gov/hhs/medicaid/eligibility/categories/older_child/is_older_child_for_medicaid.py @@ -1,6 +1,7 @@ import numpy as np from fiscalsim_us.model_api import * + class is_older_child_for_medicaid(Variable): value_type = bool entity = Person @@ -23,16 +24,26 @@ def formula(person, period, parameters): return result except Exception as e: print(f"Calculation failed: {str(e)}") - print(f"is_older_child: type={type(is_older_child)}, value={is_older_child}") + print( + f"is_older_child: type={type(is_older_child)}, value={is_older_child}" + ) print(f"income: type={type(income)}, value={income}") - print(f"income_limit: type={type(income_limit)}, value={income_limit}") - + print( + f"income_limit: type={type(income_limit)}, value={income_limit}" + ) + # Convert to numpy arrays and ensure correct types - is_older_child = np.asarray(is_older_child if is_older_child is not None else False).astype(bool) - income = np.asarray(income if income is not None else 0).astype(float) - income_limit = np.asarray(income_limit if income_limit is not None else 0).astype(float) + is_older_child = np.asarray( + is_older_child if is_older_child is not None else False + ).astype(bool) + income = np.asarray(income if income is not None else 0).astype( + float + ) + income_limit = np.asarray( + income_limit if income_limit is not None else 0 + ).astype(float) # Attempt calculation again result = is_older_child & (income < income_limit) print("Calculation succeeded after type conversion") - return result \ No newline at end of file + return result diff --git a/fiscalsim_us/variables/gov/irs/credits/premium_tax_credit/is_ptc_eligible.py b/fiscalsim_us/variables/gov/irs/credits/premium_tax_credit/is_ptc_eligible.py index 5e96d15ad..f344afae7 100644 --- a/fiscalsim_us/variables/gov/irs/credits/premium_tax_credit/is_ptc_eligible.py +++ b/fiscalsim_us/variables/gov/irs/credits/premium_tax_credit/is_ptc_eligible.py @@ -1,6 +1,7 @@ import numpy as np from fiscalsim_us.model_api import * + class is_ptc_eligible(Variable): value_type = bool entity = TaxUnit @@ -16,8 +17,8 @@ def formula(tax_unit, period, parameters): add(tax_unit, period, ["has_marketplace_health_coverage"]) > 0 ) income_eligible = eligibility.calc(income_level) - + on_marketplace = np.array(on_marketplace, dtype=bool) income_eligible = np.array(income_eligible, dtype=bool) - - return on_marketplace & income_eligible \ No newline at end of file + + return on_marketplace & income_eligible diff --git a/fiscalsim_us/variables/gov/states/co/ssa/oap/co_oap_eligible.py b/fiscalsim_us/variables/gov/states/co/ssa/oap/co_oap_eligible.py index 6bda084f3..5018fadaf 100644 --- a/fiscalsim_us/variables/gov/states/co/ssa/oap/co_oap_eligible.py +++ b/fiscalsim_us/variables/gov/states/co/ssa/oap/co_oap_eligible.py @@ -13,23 +13,21 @@ def formula(person, period, parameters): assets = person("ssi_countable_resources", period) joint_claim = person("ssi_claim_is_joint", period) p = parameters(period).gov.states.co.ssa.oap - + assets = np.array(assets) joint_claim = np.array(joint_claim, dtype=bool) - + asset_limit = np.where( - joint_claim, - p.resources.couple, - p.resources.single + joint_claim, p.resources.couple, p.resources.single ) - + below_asset_limit = assets <= asset_limit - + age = person("age", period) in_age_range = p.age_range.calc(age) - + in_age_range = np.array(in_age_range, dtype=bool) - + below_asset_limit = below_asset_limit.astype(bool) - + return below_asset_limit & in_age_range diff --git a/fiscalsim_us/variables/gov/states/co/ssa/state_suplement/co_state_supplement_eligible.py b/fiscalsim_us/variables/gov/states/co/ssa/state_suplement/co_state_supplement_eligible.py index 68dc49218..e56f0adb3 100644 --- a/fiscalsim_us/variables/gov/states/co/ssa/state_suplement/co_state_supplement_eligible.py +++ b/fiscalsim_us/variables/gov/states/co/ssa/state_suplement/co_state_supplement_eligible.py @@ -1,6 +1,7 @@ from fiscalsim_us.model_api import * import numpy as np + class co_state_supplement_eligible(Variable): value_type = bool entity = Person @@ -27,4 +28,4 @@ def formula(person, period, parameters): in_age_range = np.array(in_age_range).astype(bool) # Use bitwise & for the final operation - return disabled_or_blind & ssi_eligible & in_age_range \ No newline at end of file + return disabled_or_blind & ssi_eligible & in_age_range From 2c5ca7aadb669834eb8ea258ea6504937a01a21f Mon Sep 17 00:00:00 2001 From: Richard Evans Date: Thu, 10 Oct 2024 14:39:53 -0600 Subject: [PATCH 2/2] Updated version --- CHANGELOG.md | 7 +++++++ changelog.yaml | 7 ++++++- setup.py | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c8d088494..cca534fd9 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.3.2] - 2024-10-10 3:00:00 + +### Added + +- Updated 4 files to remove type errors. + ## [0.3.1] - 2024-10-04 12:00:00 ### Added @@ -225,6 +231,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - First prototype version based off of openfisca-us and tax-calculator. +[0.3.2]: https://github.com/TheCGO/fiscalsim-us/compare/v0.3.1...v0.3.2 [0.3.1]: https://github.com/TheCGO/fiscalsim-us/compare/v0.3.0...v0.3.1 [0.3.0]: https://github.com/TheCGO/fiscalsim-us/compare/v0.2.9...v0.3.0 [0.2.9]: https://github.com/TheCGO/fiscalsim-us/compare/v0.2.8...v0.2.9 diff --git a/changelog.yaml b/changelog.yaml index 29c619ae9..4b64a1f1c 100644 --- a/changelog.yaml +++ b/changelog.yaml @@ -197,9 +197,14 @@ - Updates South Carolina tax logic and tests. - Replaces Mambaforge Python installer with Miniforge in GH Actions date: 2024-10-03 02:00:00 -- bump: minor +- bump: patch changes: added: - Updates IRS rate threshholds and standard deduction amounts in `parameters.gov.irs.income.bracket.yaml` and in `parameters.gov.irs.deductions.standard.amount.yaml` - Renames `WIDOW` filer type to `SURVIVING_SPOUSE` date: 2024-10-04 12:00:00 +- bump: patch + changes: + added: + - Updated 4 files to remove type errors. + date: 2024-10-10 3:00:00 diff --git a/setup.py b/setup.py index 5ece74139..ae2422f08 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ setup( name="fiscalsim-us", - version="0.3.1", + version="0.3.2", author="Richard W. Evans", author_email="rick@abundance.institute", long_description=readme,