From 9f5bc41a4f52ce142afb892ec53fe151c6055410 Mon Sep 17 00:00:00 2001 From: "martin.holmer@gmail.com" Date: Thu, 7 Nov 2024 09:48:38 -0500 Subject: [PATCH 1/4] Fix handling of tmd_growfactors.csv file --- taxcalc.egg-info/PKG-INFO | 2 +- taxcalc/growfactors.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/taxcalc.egg-info/PKG-INFO b/taxcalc.egg-info/PKG-INFO index b93fe2de9..59007e8e1 100644 --- a/taxcalc.egg-info/PKG-INFO +++ b/taxcalc.egg-info/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: taxcalc -Version: 4.3.0 +Version: 4.3.1 Summary: taxcalc Home-page: https://github.com/PSLmodels/Tax-Calculator Download-URL: https://github.com/PSLmodels/Tax-Calculator diff --git a/taxcalc/growfactors.py b/taxcalc/growfactors.py index 336d8ae74..8be68f1fb 100644 --- a/taxcalc/growfactors.py +++ b/taxcalc/growfactors.py @@ -38,7 +38,7 @@ class instance: GrowFactors which is for use with puf and cps data from the taxdata repository. """ - PACKAGE_FILE_NAMES = ['growfactors.csv', 'tmd_growfactors.csv'] + PACKAGE_FILE_NAMES = ['growfactors.csv'] FILE_PATH = os.path.abspath(os.path.dirname(__file__)) VALID_NAMES = set(['ABOOK', 'ACGNS', 'ACPIM', 'ACPIU', From 73b0aee5ee3adadda5b9ae47eace4d8e6ef92659 Mon Sep 17 00:00:00 2001 From: "martin.holmer@gmail.com" Date: Thu, 7 Nov 2024 14:48:28 -0500 Subject: [PATCH 2/4] Fix bug introduced in PR #2401: Use ParamTools --- taxcalc/calculator.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/taxcalc/calculator.py b/taxcalc/calculator.py index af2abbd84..014ae2369 100644 --- a/taxcalc/calculator.py +++ b/taxcalc/calculator.py @@ -1189,12 +1189,14 @@ def lines(text, num_indent_spaces, max_line_length=77): for pname in baseline.keys(): upda_value = getattr(updated, pname) base_value = getattr(baseline, pname) - if ( - (isinstance(upda_value, np.ndarray) and - np.allclose(upda_value, base_value)) or - (not isinstance(upda_value, np.ndarray) and - upda_value != base_value) - ): + is_diff = False + if isinstance(upda_value, np.ndarray): + if not np.allclose(upda_value, base_value): + is_diff = True + else: + if upda_value != base_value: + is_diff = True + if is_diff: params_with_diff.append(pname) if params_with_diff: mdata_base = baseline.specification(meta_data=True) From 52460b360d1e63d34d7764a73ec4bff94c17b104 Mon Sep 17 00:00:00 2001 From: "martin.holmer@gmail.com" Date: Thu, 7 Nov 2024 15:39:42 -0500 Subject: [PATCH 3/4] Consolidate logical statements --- taxcalc/calculator.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/taxcalc/calculator.py b/taxcalc/calculator.py index 014ae2369..fe5e9a21c 100644 --- a/taxcalc/calculator.py +++ b/taxcalc/calculator.py @@ -1189,14 +1189,9 @@ def lines(text, num_indent_spaces, max_line_length=77): for pname in baseline.keys(): upda_value = getattr(updated, pname) base_value = getattr(baseline, pname) - is_diff = False - if isinstance(upda_value, np.ndarray): - if not np.allclose(upda_value, base_value): - is_diff = True - else: - if upda_value != base_value: - is_diff = True - if is_diff: + isarray = isinstance(upda_value, np.ndarray) + if ((isarray and not np.allclose(upda_value, base_value)) + or (not is_array and upda_value != base_value)): params_with_diff.append(pname) if params_with_diff: mdata_base = baseline.specification(meta_data=True) From 4bdaef3dc4ae1ba91fbe7876a91849dc24cf1516 Mon Sep 17 00:00:00 2001 From: "martin.holmer@gmail.com" Date: Thu, 7 Nov 2024 16:00:28 -0500 Subject: [PATCH 4/4] Additional logic revision; fix too long a line --- taxcalc/calculator.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/taxcalc/calculator.py b/taxcalc/calculator.py index fe5e9a21c..353d09959 100644 --- a/taxcalc/calculator.py +++ b/taxcalc/calculator.py @@ -698,7 +698,8 @@ def mtr(self, variable_str='e00200p', self.policy_param('FICA_ss_trt_employee') + self.policy_param('FICA_mc_trt_employer') + self.policy_param('FICA_mc_trt_employee')), - 0.5 * (self.policy_param('FICA_mc_trt_employer') + self.policy_param('FICA_mc_trt_employee'))) + 0.5 * (self.policy_param('FICA_mc_trt_employer') + + self.policy_param('FICA_mc_trt_employee'))) else: adj = 0.0 # compute marginal tax rates @@ -1189,9 +1190,11 @@ def lines(text, num_indent_spaces, max_line_length=77): for pname in baseline.keys(): upda_value = getattr(updated, pname) base_value = getattr(baseline, pname) - isarray = isinstance(upda_value, np.ndarray) - if ((isarray and not np.allclose(upda_value, base_value)) - or (not is_array and upda_value != base_value)): + is_array = isinstance(upda_value, np.ndarray) + if ( + (is_array and not np.allclose(upda_value, base_value)) + or (is_array == False and upda_value != base_value) + ): params_with_diff.append(pname) if params_with_diff: mdata_base = baseline.specification(meta_data=True)