diff --git a/Makefile b/Makefile index 12b1226f9..2957944b4 100644 --- a/Makefile +++ b/Makefile @@ -90,7 +90,7 @@ EXCLUDED_PATHS = taxcalc/validation,docs/guide .PHONY=cstest cstest: - @-pycodestyle --exclude=$(EXCLUDED_PATHS) . + @-pycodestyle --ignore=W503,W504,E712 --exclude=$(EXCLUDED_PATHS) . @-pycodestyle --ignore=E501,E121 $(TOPLEVEL_JSON_FILES) @-pycodestyle --ignore=E501,E121 $(TAXCALC_JSON_FILES) @-pycodestyle --ignore=E501,E121 $(TESTS_JSON_FILES) diff --git a/extend_tcja.py b/extend_tcja.py index 87a61fc53..ee782aef8 100644 --- a/extend_tcja.py +++ b/extend_tcja.py @@ -95,8 +95,8 @@ def main(): # calculate 2025-to-2026 parameters indexing factor pol = taxcalc.Policy() pirates = pol.inflation_rates() - ifactor25 = 1.0 + pirates[2025-taxcalc.Policy.JSON_START_YEAR] - ifactor28 = 1.0 + pirates[2028-taxcalc.Policy.JSON_START_YEAR] + ifactor25 = 1.0 + pirates[2025 - taxcalc.Policy.JSON_START_YEAR] + ifactor28 = 1.0 + pirates[2028 - taxcalc.Policy.JSON_START_YEAR] # specify extend-TCJA-beyond-2025 reform # ... get 2025 parameter values year = 2025 diff --git a/taxcalc/calcfunctions.py b/taxcalc/calcfunctions.py index 3c674caea..7da32eca2 100644 --- a/taxcalc/calcfunctions.py +++ b/taxcalc/calcfunctions.py @@ -2759,7 +2759,7 @@ def PersonalTaxCredit(MARS, c00100, XTOT, nu18, # calculate Recovery Rebate Credit from CARES Act 2020 and/or ARPA 2021 if c00100 < RRC_ps[MARS - 1]: recovery_rebate_credit = RRC_c * XTOT - recovery_rebate_credit += RRC_c_unit[MARS-1] + RRC_c_kids * nu18 + recovery_rebate_credit += RRC_c_unit[MARS - 1] + RRC_c_kids * nu18 elif 0 < c00100 < RRC_pe[MARS - 1]: prt = ( (c00100 - RRC_ps[MARS - 1]) / diff --git a/taxcalc/parameters.py b/taxcalc/parameters.py index dfd2c0291..57031300d 100644 --- a/taxcalc/parameters.py +++ b/taxcalc/parameters.py @@ -370,7 +370,15 @@ def adjust_with_indexing(self, params_or_path, **kwargs): ): continue if self._data[param].get("indexed", False): + # pylint: disable=singleton-comparison to_delete[param] = self.sel[param]["_auto"] == True + # pylint warning message: + # Comparison 'self.sel[param]['_auto'] == True' should + # be 'self.sel[param]['_auto'] is True' if checking for + # the singleton value True, or + # 'bool(self.sel[param]['_auto'])' if testing for + # truthiness + # pylint: enable=singleton-comparison needs_reset.append(param) self.delete(to_delete, **kwargs) diff --git a/taxcalc/policy.py b/taxcalc/policy.py index e804f30fc..c0e27f316 100644 --- a/taxcalc/policy.py +++ b/taxcalc/policy.py @@ -158,7 +158,7 @@ def parameter_list(): Policy.DEFAULTS_FILE_PATH, Policy.DEFAULTS_FILE_NAME ) - with open(path, 'r', encoding='utf-8') as f: + with open(path, 'r', encoding='utf-8') as f: defaults = json.loads(f.read()) # pylint: disable=protected-access return [k for k in defaults if k != "schema"] diff --git a/taxcalc/tests/test_policy.py b/taxcalc/tests/test_policy.py index b1dedf02d..4f40468e5 100644 --- a/taxcalc/tests/test_policy.py +++ b/taxcalc/tests/test_policy.py @@ -1542,8 +1542,8 @@ def test_two_sets_of_tax_brackets(): Test that II_brk? and PT_brk? values are the same under current law. """ pol = Policy() - brackets = range(1, 7+1) - years = range(Policy.JSON_START_YEAR, Policy.LAST_KNOWN_YEAR+1) + brackets = range(1, 7 + 1) + years = range(Policy.JSON_START_YEAR, Policy.LAST_KNOWN_YEAR + 1) emsg = '' for year in years: pol.set_year(year) diff --git a/taxcalc/tests/test_puf_var_stats.py b/taxcalc/tests/test_puf_var_stats.py index b6e156d0c..1f436f9ab 100644 --- a/taxcalc/tests/test_puf_var_stats.py +++ b/taxcalc/tests/test_puf_var_stats.py @@ -61,7 +61,7 @@ def create_base_table(test_path): read_vars = list(records_varinfo.USABLE_READ_VARS - unused_var_set) # get read variable information from JSON file rec_vars_path = os.path.join(test_path, '..', 'records_variables.json') - with open(rec_vars_path, 'r', encoding='utf-8') as rvfile: + with open(rec_vars_path, 'r', encoding='utf-8') as rvfile: read_var_dict = json.load(rvfile) # create table_dict with sorted read vars followed by sorted calc vars table_dict = {} diff --git a/taxcalc/tests/test_reforms.py b/taxcalc/tests/test_reforms.py index 3cb585bfb..a2eba0e76 100644 --- a/taxcalc/tests/test_reforms.py +++ b/taxcalc/tests/test_reforms.py @@ -58,7 +58,7 @@ def test_2017_law_reform(tests_path): } assert isinstance(pre_expect, dict) assert set(pre_expect.keys()).issubset(set(pre_mdata.keys())) - for name in pre_expect: + for name in pre_expect: # pylint: disable=consider-using-dict-items aval = pre_mdata[name] if aval.ndim == 2: act = aval[0][0] # comparing only first item in a vector parameter @@ -153,7 +153,7 @@ def test_round_trip_reforms(fyear, tests_path): ) fail_params = [] msg = '\nRound-trip-reform and current-law-policy param values differ for:' - for pname in clp_mdata.keys(): + for pname in clp_mdata.keys(): # pylint: disable=consider-using-dict-items rtr_val = rtr_mdata[pname] clp_val = clp_mdata[pname] if not np.allclose(rtr_val, clp_val):