From 31c8d22238fc16d97ccd3c30a53e2eb7df482e20 Mon Sep 17 00:00:00 2001 From: "martin.holmer@gmail.com" Date: Thu, 2 Jan 2025 11:45:08 -0500 Subject: [PATCH 1/4] Fix warnings except for line-too-long --- docs/guide/make/make_io_vars.py | 6 +-- docs/guide/make/make_params.py | 59 +++++++++++++++++------------ docs/guide/make/make_uguide.py | 8 ++-- extend_tcja.py | 5 ++- taxcalc/calcfunctions.py | 35 +++++++++-------- taxcalc/calculator.py | 2 +- taxcalc/tests/test_calcfunctions.py | 36 ++++++++++-------- taxcalc/tests/test_cpscsv.py | 2 +- taxcalc/tests/test_policy.py | 4 +- taxcalc/tests/test_utils.py | 2 +- 10 files changed, 90 insertions(+), 69 deletions(-) diff --git a/docs/guide/make/make_io_vars.py b/docs/guide/make/make_io_vars.py index cbd47258d..4802cf66f 100644 --- a/docs/guide/make/make_io_vars.py +++ b/docs/guide/make/make_io_vars.py @@ -4,7 +4,8 @@ def make_io_vars(path, iotype): - """ Create string of information for input or output variables. + """ + Create string of information for input or output variables. Args: path: Path to records_variables.json. @@ -18,8 +19,7 @@ def title(df): return '## `' + df.index + '` \n' def required(df): - return np.where(df.required == True, '**_Required Input Variable_** \n', - '') + return np.where(df.required, '**_Required Input Variable_** \n', '') def description(df): return '_Description_: ' + df.desc + ' \n' diff --git a/docs/guide/make/make_params.py b/docs/guide/make/make_params.py index 254234f26..2c71f4115 100644 --- a/docs/guide/make/make_params.py +++ b/docs/guide/make/make_params.py @@ -55,20 +55,27 @@ def make_params(path, ptype): df['content'] = paramtextdf(df, ptype) # Only policy parameters have sections. if ptype == 'policy': - df.section_1 = np.where(df.section_1 == '', - 'Other Parameters (not in Tax-Brain webapp)', df.section_1) + df.section_1 = np.where( + df.section_1 == '', + 'Other Parameters (not in Tax-Brain webapp)', + df.section_1 + ) section_1_order_index = dict(zip(SECTION_1_ORDER, - range(len(SECTION_1_ORDER)))) + range(len(SECTION_1_ORDER)))) df['section_1_order'] = df.section_1.map(section_1_order_index) df.sort_values(['section_1_order', 'section_2'], inplace=True) # Add section titles when they change. df['new_section_1'] = ~df.section_1.eq(df.section_1.shift()) - df['new_section_2'] = (~df.section_2.eq(df.section_2.shift()) & - (df.section_2 > '')) - df['section_1_content'] = np.where(df.new_section_1, - '## ' + df.section_1 + '\n\n', '') - df['section_2_content'] = np.where(df.new_section_2, - '### ' + df.section_2 + '\n\n', '') + df['new_section_2'] = ( + ~df.section_2.eq(df.section_2.shift()) & + (df.section_2 > '') + ) + df['section_1_content'] = np.where( + df.new_section_1, '## ' + df.section_1 + '\n\n', '' + ) + df['section_2_content'] = np.where( + df.new_section_2, '### ' + df.section_2 + '\n\n', '' + ) # Concatenate section titles with content for each parameter. df.content = df.section_1_content + df.section_2_content + df.content # Return a single string. @@ -95,41 +102,41 @@ def boolstr(b): def paramtextdf(df, ptype): """ Don't include sections - do that later. - + Args: df: DataFrame representing parameters. - ptype: + ptype: """ def title(df): return '#### `' + df.index + '` \n' - + def long_name(df): return '_Long Name:_ ' + df.title + ' \n' def description(df): return '_Description:_ ' + df.description + ' \n' - + def notes(df): return np.where(df.notes == '', '', '_Notes:_ ' + df.notes + ' \n') - + def effect_puf_cps_one(row): return ('_Has An Effect When Using:_' + ' _PUF data:_ ' + boolstr(row.compatible_data['puf']) + ' _CPS data:_ ' + boolstr(row.compatible_data['cps']) + ' \n') - + def effect_puf_cps(df): return df.apply(effect_puf_cps_one, axis=1) - + def inflation_indexed(df): return ('_Can Be Inflation Indexed:_ ' + boolstr(df.indexable) + ' _Is Inflation Indexed:_ ' + boolstr(df.indexed) + ' \n') - + def value_type(df): return '_Value Type:_ ' + df.type + ' \n' - + def known_values_one(row): # Requires non-vectorizable functions. - txt ='_Known Values:_ \n' + txt = '_Known Values:_ \n' nvalues = len(row['values'][0]) if nvalues == 5: txt += ' for: [single, mjoint, mseparate, headhh, widow] \n' @@ -142,10 +149,10 @@ def known_values_one(row): val = val[0] txt += str(cyr) + ': ' + str(val) + ' \n' return txt - + def known_values(df): return df.apply(known_values_one, axis=1) - + def default_value_one(row): return '_Default Value:_ ' + str(row.value[0]['value']) + ' \n' @@ -158,10 +165,10 @@ def valid_range_one(row): ' min = ' + str(r['min']) + ' and max = ' + str(r['max']) + ' \n' + '_Out-of-Range Action:_ ' + r.get('level', 'error') + ' \n') - + def valid_range(df): return df.apply(valid_range_one, axis=1) - + text = title(df) # Add "long name" for growdiff and consumption parameters. if ptype != 'policy': @@ -214,8 +221,10 @@ def reformat_params(): for idx in range(0, len(params[param])): if params[param][idx]['year'] == year: list_vals1.append(params[param][idx]['value']) - if (params[param][idx]['year'] != - params[param][idx - 1]['year']): + if ( + params[param][idx]['year'] != + params[param][idx - 1]['year'] + ): list_vals2.append(list_vals1) params_dict[param]['values'] = list_vals2 return params_dict diff --git a/docs/guide/make/make_uguide.py b/docs/guide/make/make_uguide.py index 248862ed2..7d0bb088c 100644 --- a/docs/guide/make/make_uguide.py +++ b/docs/guide/make/make_uguide.py @@ -25,7 +25,7 @@ CONSUMPTION_PATH = os.path.join(TAXCALC_PATH, 'consumption.json') GROWDIFF_PATH = os.path.join(TAXCALC_PATH, 'growdiff.json') TEMPLATE_PATH = os.path.join(CURDIR_PATH, '../templates') -OUTPUT_PATH = os.path.join(CURDIR_PATH, '..') +OUTPUT_PATH = os.path.join(CURDIR_PATH, '..') START_YEAR = 2013 END_YEAR_SHORT = 2020 @@ -39,9 +39,9 @@ def main(): # Assumption parameters, created separately for growdiff and consumption. growdiff_param_text = make_params.make_params(GROWDIFF_PATH, 'growdiff') consumption_param_text = make_params.make_params(CONSUMPTION_PATH, - 'consumption') + 'consumption') assumption_param_text = ('## Growdiff\n\n' + growdiff_param_text + - '\n\n## Consumption\n\n' + consumption_param_text) + '\n\n## Consumption\n\n' + consumption_param_text) write_file(assumption_param_text, 'assumption_params') # Input and output variables. input_var_text = make_io_vars.make_io_vars(IOVARS_PATH, 'read') @@ -65,7 +65,7 @@ def write_file(text, file): """ template = os.path.join(TEMPLATE_PATH, file + '_template.md') outfile = os.path.join(OUTPUT_PATH, file + '.md') - with open(template,'r') as f: + with open(template, 'r') as f: template_text = f.read() with open(outfile, 'w') as f: f.write(template_text + '\n\n' + text) diff --git a/extend_tcja.py b/extend_tcja.py index 7246e379a..9bbf6a60d 100644 --- a/extend_tcja.py +++ b/extend_tcja.py @@ -97,10 +97,11 @@ def main(): ifactor28 = 1.0 + pirates[2028-taxcalc.Policy.JSON_START_YEAR] # specify extend-TCJA-beyond-2025 reform # ... get 2025 parameter values - pol.set_year(2025) + year = 2025 + pol.set_year(year) pdata = dict(pol.items()) # ... write reform header comments - print( '// REFORM TO EXTEND TEMPORARY TCJA PROVISIONS BEYOND 2025') + print(f'// REFORM TO EXTEND TEMPORARY TCJA PROVISIONS BEYOND {year}') print(f'// USING TAX-CALCULATOR {taxcalc.__version__}') print(f'// WITH 2025-to-2026 INDEXING FACTOR = {ifactor25:.6f}') print(f'// AND 2028-to-2029 INDEXING FACTOR = {ifactor28:.6f}') diff --git a/taxcalc/calcfunctions.py b/taxcalc/calcfunctions.py index 12441c610..6ae276cec 100644 --- a/taxcalc/calcfunctions.py +++ b/taxcalc/calcfunctions.py @@ -100,8 +100,8 @@ def BenefitPrograms(calc): @iterate_jit(nopython=True) def EI_PayrollTax(SS_Earnings_c, e00200p, e00200s, pencon_p, pencon_s, - FICA_ss_trt_employer, FICA_ss_trt_employee, - FICA_mc_trt_employer, FICA_mc_trt_employee, + FICA_ss_trt_employer, FICA_ss_trt_employee, + FICA_mc_trt_employer, FICA_mc_trt_employee, ALD_SelfEmploymentTax_hc, SS_Earnings_thd, SECA_Earnings_thd, e00900p, e00900s, e02100p, e02100s, k1bx14p, k1bx14s, payrolltax, ptax_was, setax, c03260, ptax_oasdi, @@ -127,7 +127,7 @@ def EI_PayrollTax(SS_Earnings_c, e00200p, e00200s, pencon_p, pencon_s, FICA_ss_trt_employer: float Employer side social security payroll tax rate FICA_ss_trt_employee: float - Employee side social security payroll tax rate + Employee side social security payroll tax rate FICA_mc_trt_employer: float Employer side medicare payroll tax rate FICA_mc_trt_employee: float @@ -251,13 +251,15 @@ def EI_PayrollTax(SS_Earnings_c, e00200p, e00200s, pencon_p, pencon_s, # compute extra OASDI payroll taxes on the portion of the sum # of wage-and-salary income and taxable self employment income # that exceeds SS_Earnings_thd - sey_frac = 1.0 - 0.5 * (FICA_ss_trt_employer + FICA_ss_trt_employee) + sey_frac = 1.0 - 0.5 * (FICA_ss_trt_employer + FICA_ss_trt_employee) was_plus_sey_p = gross_was_p + max(0., sey_p * sey_frac) was_plus_sey_s = gross_was_s + max(0., sey_s * sey_frac) extra_ss_income_p = max(0., was_plus_sey_p - SS_Earnings_thd) extra_ss_income_s = max(0., was_plus_sey_s - SS_Earnings_thd) - extra_payrolltax = (extra_ss_income_p * (FICA_ss_trt_employer + FICA_ss_trt_employee) + - extra_ss_income_s * (FICA_ss_trt_employer + FICA_ss_trt_employee)) + extra_payrolltax = ( + extra_ss_income_p * (FICA_ss_trt_employer + FICA_ss_trt_employee) + + extra_ss_income_s * (FICA_ss_trt_employer + FICA_ss_trt_employee) + ) # compute part of total payroll taxes for filing unit payrolltax = ptax_was + extra_payrolltax @@ -1105,7 +1107,7 @@ def AdditionalMedicareTax(e00200, MARS, FICA_mc_trt_employer: float Employer side FICA Medicare tax rate FICA_mc_trt_employee: float - Employee side FICA Medicare tax rate + Employee side FICA Medicare tax rate e00200: float Wages and salaries sey: float @@ -2432,7 +2434,7 @@ def RefundablePayrollTaxCredit(was_plus_sey_p, was_plus_sey_s, @iterate_jit(nopython=True) def ChildDepTaxCredit(age_head, age_spouse, nu18, n24, MARS, c00100, XTOT, num, - c05800, e07260, CR_ResidentialEnergy_hc, + c05800, e07260, CR_ResidentialEnergy_hc, e07300, CR_ForeignTax_hc, c07180, c07230, @@ -2635,13 +2637,16 @@ def PersonalTaxCredit(MARS, c00100, XTOT, nu18, recovery_rebate_credit = RRC_c * XTOT recovery_rebate_credit += RRC_c_unit[MARS-1] + RRC_c_kids * nu18 elif c00100 < RRC_pe[MARS - 1] and c00100 > 0: - prt = ((c00100 - RRC_ps[MARS - 1])/ - (RRC_pe[MARS - 1] - RRC_ps[MARS - 1])) + prt = ( + (c00100 - RRC_ps[MARS - 1]) / + (RRC_pe[MARS - 1] - RRC_ps[MARS - 1]) + ) recovery_rebate_credit = RRC_c * XTOT * (1 - prt) else: recovery_rebate_credit = max( - 0, RRC_c_unit[MARS-1] + RRC_c_kids * nu18 - RRC_prt * - (c00100 - RRC_ps[MARS -1])) + 0, RRC_c_unit[MARS - 1] + RRC_c_kids * nu18 - RRC_prt * + (c00100 - RRC_ps[MARS - 1]) + ) return (personal_refundable_credit, personal_nonrefundable_credit, recovery_rebate_credit) @@ -3279,9 +3284,9 @@ def CTC_new(CTC_new_c, CTC_new_rt, CTC_new_c_under6_bonus, New refundable child tax credit """ if CTC_include17: - tu18 = int(age_head < 18) # taxpayer is under age 18 - su18 = int(MARS == 2 and age_spouse < 18) # spouse is under age 18 - childnum = n24 + max(0, nu18 - tu18 - su18 - n24) + tu18 = int(age_head < 18) # taxpayer is under age 18 + su18 = int(MARS == 2 and age_spouse < 18) # spouse is under age 18 + childnum = n24 + max(0, nu18 - tu18 - su18 - n24) else: childnum = n24 if childnum > 0: diff --git a/taxcalc/calculator.py b/taxcalc/calculator.py index 3c1cac849..0fa290a36 100644 --- a/taxcalc/calculator.py +++ b/taxcalc/calculator.py @@ -1196,7 +1196,7 @@ def lines(text, num_indent_spaces, max_line_length=77): 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) + or (is_array is False and upda_value != base_value) ): params_with_diff.append(pname) if params_with_diff: diff --git a/taxcalc/tests/test_calcfunctions.py b/taxcalc/tests/test_calcfunctions.py index 192a37d89..eb8da986f 100644 --- a/taxcalc/tests/test_calcfunctions.py +++ b/taxcalc/tests/test_calcfunctions.py @@ -199,7 +199,7 @@ def test_DependentCare(skip_jit): tuple8 = (1, 200, STD_in, 44, 0, STD_Aged_in, 1000, 3, 0, 0, 0, 2, True, 0, 100000, 1, Charity_max_in) tuple9 = (1, 1000, STD_in, 44, 0, STD_Aged_in, 1000, 3, 0, 0, 0, 2, - True, 0,100000, 1, Charity_max_in) + True, 0, 100000, 1, Charity_max_in) expected = [12000, 15800, 13800, 14400, 6000, 6000, 0, 1000, 1350] @@ -224,8 +224,8 @@ def test_StdDed(test_tuple, expected_value, skip_jit): assert np.allclose(avalue, expected_value), f"{avalue} != {expected_value}" -tuple1 = (120000, 10000, 15000, 100, 2000, 0.06, 0.06, 0.015, 0.015, 0, 99999999999, - 400, 0, 0, 0, 0, 0, 0, None, None, None, None, None, None, +tuple1 = (120000, 10000, 15000, 100, 2000, 0.06, 0.06, 0.015, 0.015, 0, 99999999999, + 400, 0, 0, 0, 0, 0, 0, None, None, None, None, None, None, None, None, None, None, None) tuple2 = (120000, 10000, 15000, 100, 2000, 0.06, 0.06, 0.015, 0.015, 0, 99999999999, 400, 2000, 0, 10000, 0, 0, 3000, None, None, None, None, None, @@ -254,6 +254,7 @@ def test_StdDed(test_tuple, expected_value, skip_jit): 10382, 17000) expected6 = (-40000, 4065, 4065, 0, 0, 3252, 0, 0, 15000, 10100, 17000) + @pytest.mark.parametrize( 'test_input, expected_output', [ (tuple1, expected1), @@ -274,6 +275,7 @@ def test_EI_PayrollTax(test_input, expected_output, skip_jit): print('EXPECT:', expected_output) assert 1 == 2, 'ACTUAL != EXPECT' + def test_AfterTaxIncome(skip_jit): ''' Tests the AfterTaxIncome function @@ -655,7 +657,7 @@ def test_TaxInc(test_tuple, expected_value, skip_jit): CTC_include17 = True c07220 = 0 # actual value will be returned from function odc = 0 # actual value will be returned from function -codtc_limited = 0 # actual value will be returned from function +codtc_limited = 0 # actual value will be returned from function tuple0 = ( age_head, age_spouse, nu18, n24, MARS, c00100, XTOT, num, c05800, e07260, CR_ResidentialEnergy_hc, @@ -673,8 +675,8 @@ def test_TaxInc(test_tuple, expected_value, skip_jit): @pytest.mark.parametrize( - 'test_tuple,expected_value', [ - (tuple0, expected0)]) + 'test_tuple,expected_value', [(tuple0, expected0)] +) def test_ChildDepTaxCredit_2021(test_tuple, expected_value, skip_jit): """ Tests the ChildDepTaxCredit function @@ -682,6 +684,7 @@ def test_ChildDepTaxCredit_2021(test_tuple, expected_value, skip_jit): test_value = calcfunctions.ChildDepTaxCredit(*test_tuple) assert np.allclose(test_value, expected_value) + # parameterization represents 2022 law age_head = 45 age_spouse = 0 @@ -712,7 +715,7 @@ def test_ChildDepTaxCredit_2021(test_tuple, expected_value, skip_jit): CTC_include17 = False c07220 = 0 # actual value will be returned from function odc = 0 # actual value will be returned from function -codtc_limited = 0 # actual value will be returned from function +codtc_limited = 0 # actual value will be returned from function tuple0 = ( age_head, age_spouse, nu18, n24, MARS, c00100, XTOT, num, c05800, e07260, CR_ResidentialEnergy_hc, @@ -739,6 +742,7 @@ def test_ChildDepTaxCredit_2022(test_tuple, expected_value, skip_jit): test_value = calcfunctions.ChildDepTaxCredit(*test_tuple) assert np.allclose(test_value, expected_value) + # parameterization represents 2021 law CTC_new_c = 1000 CTC_new_rt = 0 @@ -762,7 +766,7 @@ def test_ChildDepTaxCredit_2022(test_tuple, expected_value, skip_jit): MARS = 4 ptax_oasdi = 0 c09200 = 0 -ctc_new = 0 # actual value will be returned from function +ctc_new = 0 # actual value will be returned from function tuple0 = ( CTC_new_c, CTC_new_rt, CTC_new_c_under6_bonus, CTC_new_ps, CTC_new_prt, CTC_new_for_all, CTC_include17, @@ -773,6 +777,7 @@ def test_ChildDepTaxCredit_2022(test_tuple, expected_value, skip_jit): # output tuple is : (ctc_new) expected0 = (0) + @pytest.mark.parametrize( 'test_tuple,expected_value', [ (tuple0, expected0)]) @@ -783,6 +788,7 @@ def test_CTCnew_2021(test_tuple, expected_value, skip_jit): test_value = calcfunctions.CTC_new(*test_tuple) assert np.allclose(test_value, expected_value) + # parameterization represents 2022 law CTC_new_c = 0 CTC_new_rt = 0 @@ -806,7 +812,7 @@ def test_CTCnew_2021(test_tuple, expected_value, skip_jit): MARS = 4 ptax_oasdi = 0 c09200 = 0 -ctc_new = 0 # actual value will be returned from function +ctc_new = 0 # actual value will be returned from function tuple0 = ( CTC_new_c, CTC_new_rt, CTC_new_c_under6_bonus, CTC_new_ps, CTC_new_prt, CTC_new_for_all, CTC_include17, @@ -817,9 +823,10 @@ def test_CTCnew_2021(test_tuple, expected_value, skip_jit): # output tuple is : (ctc_new) expected0 = (0) + @pytest.mark.parametrize( - 'test_tuple,expected_value', [ - (tuple0, expected0)]) + 'test_tuple,expected_value', [(tuple0, expected0)] +) def test_CTCnew_2022(test_tuple, expected_value, skip_jit): """ Tests the CTCnew function @@ -828,7 +835,7 @@ def test_CTCnew_2022(test_tuple, expected_value, skip_jit): assert np.allclose(test_value, expected_value) - +# parameters for next test ymod1 = 19330 + 10200 c02500 = 0 c02900 = 0 @@ -859,8 +866,8 @@ def test_CTCnew_2022(test_tuple, expected_value, skip_jit): @pytest.mark.parametrize( - 'test_tuple,expected_value', [ - (tuple0, expected0)]) + 'test_tuple,expected_value', [(tuple0, expected0)] +) def test_AGI(test_tuple, expected_value, skip_jit): """ Tests the TaxInc function @@ -868,4 +875,3 @@ def test_AGI(test_tuple, expected_value, skip_jit): test_value = calcfunctions.AGI(*test_tuple) print('Returned from agi function: ', test_value) assert np.allclose(test_value, expected_value) - diff --git a/taxcalc/tests/test_cpscsv.py b/taxcalc/tests/test_cpscsv.py index 691be717b..3a4bfc77e 100644 --- a/taxcalc/tests/test_cpscsv.py +++ b/taxcalc/tests/test_cpscsv.py @@ -65,7 +65,7 @@ def test_agg(tests_path, cps_fullsample): raise ValueError(msg) # create aggregate diagnostic table using unweighted sub-sample of records rn_seed = 180 # to ensure sub-sample is always the same - subfrac = 0.07# 0.03 # sub-sample fraction + subfrac = 0.07 # sub-sample fraction subsample = cps_fullsample.sample(frac=subfrac, random_state=rn_seed) recs_subsample = Records.cps_constructor(data=subsample) calc_subsample = Calculator(policy=baseline_policy, records=recs_subsample) diff --git a/taxcalc/tests/test_policy.py b/taxcalc/tests/test_policy.py index 68d396b69..f75950822 100644 --- a/taxcalc/tests/test_policy.py +++ b/taxcalc/tests/test_policy.py @@ -765,7 +765,7 @@ def generate_section_dictionary(md_text): md_text = md_file.read() md_dict = generate_section_dictionary(md_text) # ... make sure every md_dict section title is in valid_dict - for sec1title,secdict in md_dict.items(): + for sec1title, secdict in md_dict.items(): assert isinstance(secdict, dict) assert sec1title in valid_dict for sec2title in secdict: @@ -1332,7 +1332,7 @@ def test_multiple_cpi_swaps2(): {"year": 2018, "value": 500000}, ], "SS_Earnings_c-indexed": [ - {"year": 2017, "value": False}, + {"year": 2017, "value": False}, {"year": 2019, "value": True}, ], "AMT_em-indexed": [ diff --git a/taxcalc/tests/test_utils.py b/taxcalc/tests/test_utils.py index 6c72266f9..fa4b9634b 100644 --- a/taxcalc/tests/test_utils.py +++ b/taxcalc/tests/test_utils.py @@ -154,7 +154,7 @@ def test_create_tables(cps_subsample): 100.0, 13.2, 8.3, - 1.4,] + 1.4] if not np.allclose(diff[tabcol].values.astype('float'), expected, atol=0.1, rtol=0.0): test_failure = True From 4f09b80861226917dc1fc763db601d664aa2d96b Mon Sep 17 00:00:00 2001 From: "martin.holmer@gmail.com" Date: Thu, 2 Jan 2025 12:00:33 -0500 Subject: [PATCH 2/4] Fix line-too-long in tests modules --- taxcalc/tests/test_4package.py | 5 +++-- taxcalc/tests/test_calcfunctions.py | 18 ++++++++++++------ 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/taxcalc/tests/test_4package.py b/taxcalc/tests/test_4package.py index 0c5d24e76..0ab3980c6 100644 --- a/taxcalc/tests/test_4package.py +++ b/taxcalc/tests/test_4package.py @@ -24,8 +24,9 @@ def extract_install_requires(setup_py_content): list: A list of package requirements """ # Use regex to find the install_requires list - match = re.search(r'"install_requires"\s*:\s*\[([^\]]+)\]', setup_py_content, re.DOTALL) - + match = re.search( + r'"install_requires"\s*:\s*\[([^\]]+)\]', setup_py_content, re.DOTALL + ) if match: # Extract the contents of the list and split into packages packages_str = match.group(1) diff --git a/taxcalc/tests/test_calcfunctions.py b/taxcalc/tests/test_calcfunctions.py index eb8da986f..83e631002 100644 --- a/taxcalc/tests/test_calcfunctions.py +++ b/taxcalc/tests/test_calcfunctions.py @@ -224,22 +224,28 @@ def test_StdDed(test_tuple, expected_value, skip_jit): assert np.allclose(avalue, expected_value), f"{avalue} != {expected_value}" -tuple1 = (120000, 10000, 15000, 100, 2000, 0.06, 0.06, 0.015, 0.015, 0, 99999999999, +tuple1 = (120000, 10000, 15000, 100, 2000, + 0.06, 0.06, 0.015, 0.015, 0, 99999999999, 400, 0, 0, 0, 0, 0, 0, None, None, None, None, None, None, None, None, None, None, None) -tuple2 = (120000, 10000, 15000, 100, 2000, 0.06, 0.06, 0.015, 0.015, 0, 99999999999, +tuple2 = (120000, 10000, 15000, 100, 2000, + 0.06, 0.06, 0.015, 0.015, 0, 99999999999, 400, 2000, 0, 10000, 0, 0, 3000, None, None, None, None, None, None, None, None, None, None, None) -tuple3 = (120000, 150000, 15000, 100, 2000, 0.06, 0.06, 0.015, 0.015, 0, 99999999999, +tuple3 = (120000, 150000, 15000, 100, 2000, + 0.06, 0.06, 0.015, 0.015, 0, 99999999999, 400, 2000, 0, 10000, 0, 0, 3000, None, None, None, None, None, None, None, None, None, None, None) -tuple4 = (120000, 500000, 15000, 100, 2000, 0.06, 0.06, 0.015, 0.015, 0, 400000, +tuple4 = (120000, 500000, 15000, 100, 2000, + 0.06, 0.06, 0.015, 0.015, 0, 400000, 400, 2000, 0, 10000, 0, 0, 3000, None, None, None, None, None, None, None, None, None, None, None) -tuple5 = (120000, 10000, 15000, 100, 2000, 0.06, 0.06, 0.015, 0.015, 0, 99999999999, +tuple5 = (120000, 10000, 15000, 100, 2000, + 0.06, 0.06, 0.015, 0.015, 0, 99999999999, 400, 300, 0, 0, 0, 0, 0, None, None, None, None, None, None, None, None, None, None, None) -tuple6 = (120000, 10000, 15000, 100, 2000, 0.06, 0.06, 0.015, 0.015, 0, 99999999999, +tuple6 = (120000, 10000, 15000, 100, 2000, + 0.06, 0.06, 0.015, 0.015, 0, 99999999999, 400, 0, 0, 0, 0, -40000, 0, None, None, None, None, None, None, None, None, None, None, None) expected1 = (0, 4065, 4065, 0, 0, 3252, 25000, 10000, 15000, 10100, From 9dbe164bd995c7427f3e6b6c35d500d5eb7d367b Mon Sep 17 00:00:00 2001 From: "martin.holmer@gmail.com" Date: Thu, 2 Jan 2025 12:27:54 -0500 Subject: [PATCH 3/4] Revise Makefile cstest target logic --- Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 778d70226..ba0a632b9 100644 --- a/Makefile +++ b/Makefile @@ -85,14 +85,14 @@ TOPLEVEL_JSON_FILES := $(shell ls -l ./*json | awk '{print $$9}') TAXCALC_JSON_FILES := $(shell ls -l ./taxcalc/*json | awk '{print $$9}') TESTS_JSON_FILES := $(shell ls -l ./taxcalc/tests/*json | awk '{print $$9}') PYLINT_FILES := $(shell grep -rl --include="*py" disable=locally-disabled .) -PYLINT_OPTIONS = --disable=locally-disabled --score=no --jobs=4 +PYLINT_OPTIONS = --disable=locally-disabled --score=no --jobs=4 --disable=R0801 RECIPE_FILES := $(shell ls -l ./docs/recipes/recipe*.ipynb | awk '{print $$9}') -PYLINT_IGNORE = C0103,C0111,E0401,E1120,R0913,R0914,W0401,W0614 -RECIPE_OPTIONS = --disable=$(PYLINT_IGNORE) --score=no --jobs=4 +RECIPE_IGNORE = C0103,C0111,E0401,E1120,R0913,R0914,W0401,W0614,R0801 +RECIPE_OPTIONS = --disable=$(RECIPE_IGNORE) --score=no --jobs=4 .PHONY=cstest cstest: - -pycodestyle . + -pycodestyle . | grep -v validation @-pycodestyle --ignore=E501,E121 $(TOPLEVEL_JSON_FILES) @-pycodestyle --ignore=E501,E121 $(TAXCALC_JSON_FILES) @-pycodestyle --ignore=E501,E121 $(TESTS_JSON_FILES) From d0aa3bca2b99cf50341b161fa1dd57b1237a09b9 Mon Sep 17 00:00:00 2001 From: "martin.holmer@gmail.com" Date: Thu, 2 Jan 2025 13:31:11 -0500 Subject: [PATCH 4/4] Eliminate line-too-long warnings in calcfunctions.py --- Makefile | 2 +- taxcalc/calcfunctions.py | 440 ++++++++++++++++++++++++++------------- 2 files changed, 293 insertions(+), 149 deletions(-) diff --git a/Makefile b/Makefile index ba0a632b9..bf7a2e32e 100644 --- a/Makefile +++ b/Makefile @@ -92,7 +92,7 @@ RECIPE_OPTIONS = --disable=$(RECIPE_IGNORE) --score=no --jobs=4 .PHONY=cstest cstest: - -pycodestyle . | grep -v validation + -pycodestyle . | grep -v taxcalc/validation @-pycodestyle --ignore=E501,E121 $(TOPLEVEL_JSON_FILES) @-pycodestyle --ignore=E501,E121 $(TAXCALC_JSON_FILES) @-pycodestyle --ignore=E501,E121 $(TESTS_JSON_FILES) diff --git a/taxcalc/calcfunctions.py b/taxcalc/calcfunctions.py index 6ae276cec..739b24196 100644 --- a/taxcalc/calcfunctions.py +++ b/taxcalc/calcfunctions.py @@ -114,8 +114,10 @@ def EI_PayrollTax(SS_Earnings_c, e00200p, e00200s, pencon_p, pencon_s, ---------- SS_Earnings_c: float Maximum taxable earnings for Social Security. - Individual earnings below this amount are subjected to OASDI payroll tax. - This parameter is indexed by rate of growth in average wages not by the price inflation rate. + Individual earnings below this amount are subjected to + OASDI payroll tax. + This parameter is indexed by rate of growth in average wages not by + the price inflation rate. e00200p: float Wages, salaries, and tips for taxpayer net of pension contributions e00200s: float @@ -134,12 +136,14 @@ def EI_PayrollTax(SS_Earnings_c, e00200p, e00200s, pencon_p, pencon_s, Employee side medicare payroll tax rate ALD_SelfEmploymentTax_hc: float Adjustment for self-employment tax haircut - If greater than zero, reduces the employer equivalent portion of self-employment adjustment + If greater than zero, reduces the employer equivalent portion + of self-employment adjustment Final adjustment amount = (1-Haircut)*SelfEmploymentTaxAdjustment SS_Earnings_thd: float Additional taxable earnings threshold for Social Security - Individual earnings above this threshold are subjected to OASDI payroll tax, in addtion to - earnings below the maximum taxable earnings threshold. + Individual earnings above this threshold are subjected to + OASDI payroll tax, in addtion to earnings below the + maximum taxable earnings threshold. SECA_Earnings_thd: float Threshold value for self-employment income below which there is no SECA tax liability @@ -152,9 +156,11 @@ def EI_PayrollTax(SS_Earnings_c, e00200p, e00200s, pencon_p, pencon_s, e02100s: float Farm net income/loss for spouse k1bx14p: float - Partner self-employment earnings/loss for taxpayer (included in e26270 total) + Partner self-employment earnings/loss for taxpayer + (included in e26270 total) k1bx14s: float - Partner self-employment earnings/loss for spouse (included in e26270 total) + Partner self-employment earnings/loss for spouse + (included in e26270 total) payrolltax: float Total (employee and employer) payroll tax liability payrolltax = ptax_was @@ -215,34 +221,44 @@ def EI_PayrollTax(SS_Earnings_c, e00200p, e00200s, pencon_p, pencon_s, sey = sey_p + sey_s # total self-employment income for filing unit # compute gross wage and salary income ('was' denotes 'wage and salary') - gross_was_p = e00200p + pencon_p - gross_was_s = e00200s + pencon_s + gross_ws_p = e00200p + pencon_p + gross_ws_s = e00200s + pencon_s # compute taxable gross earnings for OASDI FICA - txearn_was_p = min(SS_Earnings_c, gross_was_p) - txearn_was_s = min(SS_Earnings_c, gross_was_s) + txearn_was_p = min(SS_Earnings_c, gross_ws_p) + txearn_was_s = min(SS_Earnings_c, gross_ws_s) # compute OASDI and HI payroll taxes on wage-and-salary income, FICA - ptax_ss_was_p = (FICA_ss_trt_employer + FICA_ss_trt_employee) * txearn_was_p - ptax_ss_was_s = (FICA_ss_trt_employer + FICA_ss_trt_employee) * txearn_was_s - ptax_mc_was_p = (FICA_mc_trt_employer + FICA_mc_trt_employee) * gross_was_p - ptax_mc_was_s = (FICA_mc_trt_employer + FICA_mc_trt_employee) * gross_was_s - ptax_was = ptax_ss_was_p + ptax_ss_was_s + ptax_mc_was_p + ptax_mc_was_s + ptax_ss_ws_p = (FICA_ss_trt_employer + FICA_ss_trt_employee) * txearn_was_p + ptax_ss_ws_s = (FICA_ss_trt_employer + FICA_ss_trt_employee) * txearn_was_s + ptax_mc_ws_p = (FICA_mc_trt_employer + FICA_mc_trt_employee) * gross_ws_p + ptax_mc_ws_s = (FICA_mc_trt_employer + FICA_mc_trt_employee) * gross_ws_s + ptax_was = ptax_ss_ws_p + ptax_ss_ws_s + ptax_mc_ws_p + ptax_mc_ws_s # compute taxable self-employment income for OASDI SECA - sey_frac = 1.0 - 0.5 * (FICA_ss_trt_employer + FICA_ss_trt_employee + FICA_mc_trt_employer + FICA_mc_trt_employee) + sey_frac = ( + 1.0 - 0.5 * + (FICA_ss_trt_employer + FICA_ss_trt_employee + + FICA_mc_trt_employer + FICA_mc_trt_employee) + ) txearn_sey_p = min(max(0., sey_p * sey_frac), SS_Earnings_c - txearn_was_p) txearn_sey_s = min(max(0., sey_s * sey_frac), SS_Earnings_c - txearn_was_s) # compute self-employment tax on taxable self-employment income, SECA setax_ss_p = (FICA_ss_trt_employer + FICA_ss_trt_employee) * txearn_sey_p setax_ss_s = (FICA_ss_trt_employer + FICA_ss_trt_employee) * txearn_sey_s - setax_mc_p = (FICA_mc_trt_employer + FICA_mc_trt_employee) * max(0., sey_p * sey_frac) - setax_mc_s = (FICA_mc_trt_employer + FICA_mc_trt_employee) * max(0., sey_s * sey_frac) + setax_mc_p = ( + (FICA_mc_trt_employer + FICA_mc_trt_employee) * + max(0., sey_p * sey_frac) + ) + setax_mc_s = ( + (FICA_mc_trt_employer + FICA_mc_trt_employee) * + max(0., sey_s * sey_frac) + ) setax_p = setax_ss_p + setax_mc_p setax_s = setax_ss_s + setax_mc_s setax = setax_p + setax_s - # # no tax if low amount of self-employment income + # no setax if self-employment income is low if sey * sey_frac > SECA_Earnings_thd: setax = setax_p + setax_s else: @@ -252,8 +268,8 @@ def EI_PayrollTax(SS_Earnings_c, e00200p, e00200s, pencon_p, pencon_s, # of wage-and-salary income and taxable self employment income # that exceeds SS_Earnings_thd sey_frac = 1.0 - 0.5 * (FICA_ss_trt_employer + FICA_ss_trt_employee) - was_plus_sey_p = gross_was_p + max(0., sey_p * sey_frac) - was_plus_sey_s = gross_was_s + max(0., sey_s * sey_frac) + was_plus_sey_p = gross_ws_p + max(0., sey_p * sey_frac) + was_plus_sey_s = gross_ws_s + max(0., sey_s * sey_frac) extra_ss_income_p = max(0., was_plus_sey_p - SS_Earnings_thd) extra_ss_income_s = max(0., was_plus_sey_s - SS_Earnings_thd) extra_payrolltax = ( @@ -265,7 +281,7 @@ def EI_PayrollTax(SS_Earnings_c, e00200p, e00200s, pencon_p, pencon_s, payrolltax = ptax_was + extra_payrolltax # compute OASDI part of payroll taxes - ptax_oasdi = (ptax_ss_was_p + ptax_ss_was_s + + ptax_oasdi = (ptax_ss_ws_p + ptax_ss_ws_s + setax_ss_p + setax_ss_s + extra_payrolltax) @@ -295,17 +311,20 @@ def DependentCare(nu13, elderly_dependents, earned, nu13: int Number of dependents under 13 years old elderly_dependents: int - Number of elderly dependents age 65+ in filing unit excluding taxpayer and spouse + Number of elderly dependents age 65+ in filing unit other than + taxpayer and spouse earned: float Earned income for filing unit MARS: int - Filing marital status (1=single, 2=joint, 3=separate, 4=household-head, 5=widow(er)) + Filing marital status (1=single, 2=joint, 3=separate, + 4=household-head, 5=widow(er)) ALD_Dependents_thd: list Maximum income to qualify for dependent care deduction ALD_Dependents_hc: float Deduction for childcare costs haircut ALD_Dependents_Child_c: float - National weighted average cost of childcare, ceiling for available childcare deduction + National weighted average cost of childcare, ceiling for + available childcare deduction ALD_Dependents_Elder_c: float Eldercare deduction ceiling @@ -435,7 +454,8 @@ def ALD_InvInc_ec_base(p22250, p23250, sep, e01200: float Other net gain/loss from Form 4797 MARS: int - Filing marital status (1=single, 2=joint, 3=separate, 4=household-head, 5=widow(er)) + Filing marital status (1=single, 2=joint, 3=separate, + 4=household-head, 5=widow(er)) invinc_ec_base: float Exclusion of investment income from AGI Capital_loss_limitation: float @@ -447,7 +467,9 @@ def ALD_InvInc_ec_base(p22250, p23250, sep, Exclusion of investment income from AGI """ # limitation on net short-term and long-term capital losses - cgain = max((-1 * Capital_loss_limitation[MARS - 1] / sep), p22250 + p23250) + cgain = max( + (-1 * Capital_loss_limitation[MARS - 1] / sep), p22250 + p23250 + ) # compute exclusion of investment income from AGI invinc_ec_base = e00300 + e00600 + cgain + e01100 + e01200 return invinc_ec_base @@ -492,17 +514,21 @@ def CapGains(p23250, p22250, sep, ALD_StudentLoan_hc, e00800: float Alimony received CG_nodiff: bool - Long term capital gains and qualified dividends taxed no differently than regular taxable income + Long term capital gains and qualified dividends taxed no + differently than regular taxable income CG_ec: float - Dollar amount of all capital gains and qualified dividends that are excluded from AGI + Dollar amount of all capital gains and qualified dividends that are + excluded from AGI CG_reinvest_ec_rt: float - Fraction of all capital gains and qualified dividends in excess of the dollar exclusion that are excluded from AGI + Fraction of all capital gains and qualified dividends in excess + of the dollar exclusion that are excluded from AGI Capital_loss_limitation: float Limitation on capital losses that are deductible ALD_BusinessLosses_c: list Maximm amount of business losses deductible MARS: int - Filing marital status (1=single, 2=joint, 3=separate, 4=household-head, 5=widow(er)) + Filing marital status (1=single, 2=joint, 3=separate, + 4=household-head, 5=widow(er)) e00900: float Schedule C business net profit/loss for filing unit e01100: float @@ -514,7 +540,8 @@ def CapGains(p23250, p22250, sep, ALD_StudentLoan_hc, e01700: float Taxable pensions and annunities e02000: float - Schedule E total rental, royalty, partnership, S-corporation, etc, income/loss (includes e26270 and e27200) + Schedule E total rental, royalty, partnership, S-corporation, + etc, income/loss (includes e26270 and e27200) e02100: float Farm net income/loss for filing unit from Schedule F e02300: float @@ -590,7 +617,8 @@ def SSBenefits(MARS, ymod, e02400, SS_all_in_agi, SS_thd50, SS_thd85, Parameters ---------- MARS: int - Filing marital status (1=single, 2=joint, 3=separate, 4=household-head, 5=widow(er)) + Filing marital status (1=single, 2=joint, 3=separate, + 4=household-head, 5=widow(er)) ymod: float Variable that is used in OASDI benefit taxation logic e02400: float @@ -690,7 +718,8 @@ def AGI(ymod1, c02500, c02900, XTOT, MARS, sep, DSI, exact, nu18, taxable_ubi, XTOT: int Total number of exemptions for filing unit MARS: int - Filing marital status (1=single, 2=joint, 3=separate, 4=household-head, 5=widow(er)) + Filing marital status (1=single, 2=joint, 3=separate, + 4=household-head, 5=widow(er)) sep: int 2 when MARS is 3 (married filing separately); otherwise 1 DSI: int @@ -789,44 +818,61 @@ def ItemDedCap(e17500, e18400, e18500, e19200, e19800, e20100, e20400, g20500, c00100: float Adjusted gross income (AGI) ID_AmountCap_rt: float - Ceiling on the gross amount of itemized deductions allowed; decimal fraction of AGI + Ceiling on the gross amount of itemized deductions allowed; + expressed as decimal fraction of AGI ID_AmountCap_Switch: list Deductions subject to the cap on itemized deduction benefits e17500_capped: float - Schedule A: medical expenses, capped by ItemDedCap as a decimal fraction of AGI + Schedule A: medical expenses, capped by + ItemDedCap as a decimal fraction of AGI e18400_capped: float - Schedule A: state and local income taxes deductlbe, capped by ItemDedCap as a decimal fraction of AGI + Schedule A: state and local income taxes deductlbe, capped by + ItemDedCap as a decimal fraction of AGI e18500_capped: float - Schedule A: state and local real estate taxes deductible, capped by ItemDedCap as a decimal fraction of AGI + Schedule A: state and local real estate taxes deductible, capped by + ItemDedCap as a decimal fraction of AGI e19200_capped: float - Schedule A: interest deduction deductible, capped by ItemDedCap as decimal fraction of AGI + Schedule A: interest deduction deductible, capped by + ItemDedCap as decimal fraction of AGI e19800_capped: float - Schedule A: charity cash contributions deductible, capped by ItemDedCap as a decimal fraction of AGI + Schedule A: charity cash contributions deductible, capped by + ItemDedCap as a decimal fraction of AGI e20100_capped: float - Schedule A: charity noncash contributions deductible, capped aby ItemDedCap s a decimal fraction of AGI + Schedule A: charity noncash contributions deductible, capped by + ItemDedCap s a decimal fraction of AGI e20400_capped: float - Schedule A: gross miscellaneous deductions deductible, capped by ItemDedCap as a decimal fraction of AGI + Schedule A: gross miscellaneous deductions deductible, capped by + ItemDedCap as a decimal fraction of AGI g20500_capped: float - Schedule A: gross casualty or theft loss deductible, capped aby ItemDedCap s a decimal fraction of AGI + Schedule A: gross casualty or theft loss deductible, capped by + ItemDedCap s a decimal fraction of AGI Returns ------- e17500_capped: float - Schedule A: medical expenses, capped by ItemDedCap as a decimal fraction of AGI + Schedule A: medical expenses, capped by + ItemDedCap as a decimal fraction of AGI e18400_capped: float - Schedule A: state and local income taxes deductlbe, capped by ItemDedCap as a decimal fraction of AGI + Schedule A: state and local income taxes deductlbe, capped by + ItemDedCap as a decimal fraction of AGI e18500_capped: float - Schedule A: state and local real estate taxes deductible, capped by ItemDedCap as a decimal fraction of AGI + Schedule A: state and local real estate taxes deductible, capped by + ItemDedCap as a decimal fraction of AGI e19200_capped: float - Schedule A: interest deduction deductible, capped by ItemDedCap as decimal fraction of AGI + Schedule A: interest deduction deductible, capped by + ItemDedCap as decimal fraction of AGI e19800_capped: float - Schedule A: charity cash contributions deductible, capped by ItemDedCap as a decimal fraction of AGI + Schedule A: charity cash contributions deductible, capped by + ItemDedCap as a decimal fraction of AGI e20100_capped: float - Schedule A: charity noncash contributions deductible, capped by ItemDedCap as a decimal fraction of AGI + Schedule A: charity noncash contributions deductible, capped by + ItemDedCap as a decimal fraction of AGI e20400_capped: float - Schedule A: gross miscellaneous deductions deductible, capped by ItemDedCap as a decimal fraction of AGI + Schedule A: gross miscellaneous deductions deductible, capped by + ItemDedCap as a decimal fraction of AGI g20500_capped: float - Schedule A: gross casualty or theft loss deductible, capped by ItemDedCap as a decimal fraction of AGI + Schedule A: gross casualty or theft loss deductible, capped by + ItemDedCap as a decimal fraction of AGI """ # pylint: disable=too-many-branches @@ -900,23 +946,32 @@ def ItemDed(e17500_capped, e18400_capped, e18500_capped, e19200_capped, Parameters ---------- e17500_capped: float - Schedule A: medical expenses, capped by ItemDedCap as a decimal fraction of AGI + Schedule A: medical expenses, capped by + ItemDedCap as a decimal fraction of AGI e18400_capped: float - Schedule A: state and local income taxes deductlbe, capped by ItemDedCap as a decimal fraction of AGI + Schedule A: state and local income taxes deductlbe, capped by + ItemDedCap as a decimal fraction of AGI e18500_capped: float - Schedule A: state and local real estate taxes deductible, capped by ItemDedCap as a decimal fraction of AGI + Schedule A: state and local real estate taxes deductible, capped by + ItemDedCap as a decimal fraction of AGI e19200_capped: float - Schedule A: interest deduction deductible, capped by ItemDedCap as decimal fraction of AGI + Schedule A: interest deduction deductible, capped by + ItemDedCap as decimal fraction of AGI e19800_capped: float - Schedule A: charity cash contributions deductible, capped by ItemDedCap as a decimal fraction of AGI + Schedule A: charity cash contributions deductible, capped by + ItemDedCap as a decimal fraction of AGI e20100_capped: float - Schedule A: charity noncash contributions deductible, capped by ItemDedCap as a decimal fraction of AGI + Schedule A: charity noncash contributions deductible, capped by + ItemDedCap as a decimal fraction of AGI e20400_capped: float - Schedule A: gross miscellaneous deductions deductible, capped by ItemDedCap as a decimal fraction of AGI + Schedule A: gross miscellaneous deductions deductible, capped by + ItemDedCap as a decimal fraction of AGI g20500_capped: float - Schedule A: gross casualty or theft loss deductible, capped by ItemDedCap as a decimal fraction of AGI + Schedule A: gross casualty or theft loss deductible, capped by + ItemDedCap as a decimal fraction of AGI MARS: int - Filing marital status (1=single, 2=joint, 3=separate, 4=household-head, 5=widow(er)) + Filing marital status (1=single, 2=joint, 3=separate, + 4=household-head, 5=widow(er)) age_head: int Age in years of taxpayer age_spouse: int @@ -946,7 +1001,8 @@ def ItemDed(e17500_capped, e18400_capped, e18500_capped, e19200_capped, ID_Medical_frt: float Floor (as decimal fraction of AGI) for deductible medical expenses ID_Medical_frt_add4aged: float - Add on floor (as decimal fraction of AGI) for deductible medical expenses for elderly filing units + Add on floor (as decimal fraction of AGI) for deductible + medical expenses for elderly filing units ID_Medical_hc: float Medical expense deduction haircut ID_Casualty_frt: float @@ -954,23 +1010,28 @@ def ItemDed(e17500_capped, e18400_capped, e18500_capped, e19200_capped, ID_Casualty_hc: float Casualty expense deduction haircut ID_Miscellaneous_frt: float - Floor (as decimal fraction of AGI) for deductible miscellaneous expenses + Floor (as decimal fraction of AGI) for deductible + miscellaneous expenses ID_Miscellaneous_hc: float Miscellaneous expense deduction haircut ID_Charity_crt_cash: float - Ceiling (as decimal fraction of AGI) for cash charitable contribution deductions + Ceiling (as decimal fraction of AGI) for cash charitable + contribution deductions ID_Charity_crt_noncash: float - Ceiling (as decimal fraction of AGI) for noncash charitable contribution deductions + Ceiling (as decimal fraction of AGI) for noncash charitable + contribution deductions ID_prt: float Itemized deduction phaseout rate (Pease) ID_crt: float - Itemized deduction maximum phaseout as a decimal fraction of total itemized deductions (Pease) + Itemized deduction maximum phaseout as a decimal fraction of total + itemized deductions (Pease) ID_c: list Ceiling on the amount of itemized deductions allowed (dollars) ID_StateLocalTax_hc: float State and local income and sales taxes deduction haircut ID_Charity_frt: float - Floor (as decimal fraction of AGI) for deductible charitable contributions + Floor (as decimal fraction of AGI) for deductible charitable + contributions ID_Charity_hc: float Charity expense deduction haircut ID_InterestPaid_hc: float @@ -980,9 +1041,11 @@ def ItemDed(e17500_capped, e18400_capped, e18500_capped, e19200_capped, ID_Medical_c: list Ceiling on the amount of medical expense deduction allowed (dollars) ID_StateLocalTax_c: list - Ceiling on the amount of state and local income and sales taxes deduction allowed (dollars) + Ceiling on the amount of state and local income and sales taxes + deduction allowed (dollars) ID_RealEstate_c: list - Ceiling on the amount of state, local, and foreign real estate taxes deduction allowed (dollars) + Ceiling on the amount of state, local, and foreign real estate taxes + deduction allowed (dollars) ID_InterestPaid_c: list Ceiling on the amount of interest paid deduction allowed (dollars) ID_Charity_c: list @@ -990,15 +1053,19 @@ def ItemDed(e17500_capped, e18400_capped, e18500_capped, e19200_capped, ID_Casualty_c: list Ceiling on the amount of casualty expense deduction allowed (dollars) ID_Miscellaneous_c: list - Ceiling on the amount of miscellaneous expense deduction allowed (dollars) + Ceiling on the amount of miscellaneous expense deduction + allowed (dollars) ID_AllTaxes_c: list - Ceiling on the amount of state and local income, stales, and real estate deductions allowed (dollars) + Ceiling on the amount of state and local income, stales, and + real estate deductions allowed (dollars) ID_AllTaxes_hc: float State and local income, sales, and real estate tax deduciton haircut ID_StateLocalTax_crt: float - Ceiling (as decimal fraction of AGI) for the combination of all state and local income and sales tax deductions + Ceiling (as decimal fraction of AGI) for the combination of all + state and local income and sales tax deductions ID_RealEstate_crt: float - Ceiling (as decimal fraction of AGI) for the combination of all state, local, and foreign real estate tax deductions + Ceiling (as decimal fraction of AGI) for the combination of all + state, local, and foreign real estate tax deductions ID_Charity_f: list Floor on the amount of charity expense deduction allowed (dollars) @@ -1095,7 +1162,8 @@ def AdditionalMedicareTax(e00200, MARS, Parameters ----- MARS: int - Filing marital status (1=single, 2=joint, 3=separate, 4=household-head, 5=widow(er)) + Filing marital status (1=single, 2=joint, 3=separate, + 4=household-head, 5=widow(er)) AMEDT_ec: list Additional Medicare Tax earnings exclusion AMEDT_rt: float @@ -1120,7 +1188,10 @@ def AdditionalMedicareTax(e00200, MARS, ptax_amc: float Additional Medicare Tax (included in othertaxes and iitax) """ - line8 = max(0., sey) * (1. - 0.5 * (FICA_mc_trt_employer + FICA_mc_trt_employee + FICA_ss_trt_employer + FICA_ss_trt_employee)) + line8 = max(0., sey) * ( + 1. - 0.5 * (FICA_mc_trt_employer + FICA_mc_trt_employee + + FICA_ss_trt_employer + FICA_ss_trt_employee) + ) line11 = max(0., AMEDT_ec[MARS - 1] - e00200) ptax_amc = AMEDT_rt * (max(0., e00200 - AMEDT_ec[MARS - 1]) + max(0., line8 - line11)) @@ -1153,7 +1224,8 @@ def StdDed(DSI, earned, STD, age_head, age_spouse, STD_Aged, STD_Dep, STD_Dep: float Standard deduction for dependents MARS: int - Filing (marital) status. (1=single, 2=joint, 3=separate, 4=household-head, 5=widow(er)) + Filing (marital) status. (1=single, 2=joint, 3=separate, + 4=household-head, 5=widow(er)) MIDR: int 1 if separately filing spouse itemizes, 0 otherwise blind_head: int @@ -1163,7 +1235,8 @@ def StdDed(DSI, earned, STD, age_head, age_spouse, STD_Aged, STD_Dep, standard: float Standard deduction (zero for itemizers) STD_allow_charity_ded_nonitemizers: bool - Allow standard deduction filers to take the charitable contributions deduction + Allow standard deduction filers to take the charitable contributions + deduction e19800: float Schedule A: cash charitable contributions ID_Charity_crt_cash: float @@ -1228,7 +1301,8 @@ def TaxInc(c00100, standard, c04470, c04600, MARS, e00900, c03260, e26270, c04600: float Personal exemptions after phase-out MARS: int - Filing (marital) status. (1=single, 2=joint, 3=separate, 4=household-head, 5=widow(er)) + Filing (marital) status. (1=single, 2=joint, 3=separate, + 4=household-head, 5=widow(er)) e00900: float Schedule C business net profit/loss for filing unit c03260: float @@ -1244,12 +1318,16 @@ def TaxInc(c00100, standard, c04470, c04600, MARS, e00900, c03260, e26270, c01000: float Limitation on capital losses PT_SSTB_income: int - Value of one implies business income is from a specified service trade or business (SSTB) - Value of zero implies business income is from a qualified trade or business + Value of one implies business income is from a specified service + trade or business (SSTB) + Value of zero implies business income is from a qualified trade or + business PT_binc_w2_wages: float - Filing unit's share of total W-2 wages paid by the pass-through business + Filing unit's share of total W-2 wages paid by the + pass-through business PT_ubia_property: float - Filing unit's share of total business property owned by the pass-through business + Filing unit's share of total business property owned by the + pass-through business PT_qbid_rt: float Pass-through qualified business income deduction rate PT_qbid_taxinc_thd: list @@ -1350,13 +1428,15 @@ def SchXYZ(taxable_income, MARS, e00900, e26270, e02000, e00200, taxable_income: float Taxable income MARS: int - Filing (marital) status. (1=single, 2=joint, 3=separate, 4=household-head, 5=widow(er)) + Filing (marital) status. (1=single, 2=joint, 3=separate, + 4=household-head, 5=widow(er)) e00900: float Schedule C business net profit/loss for filing unit e26270: float Schedule E: combined partnership and S-corporation net income/loss e02000: float - Schedule E total rental, royalty, parternship, S-corporation, etc, income/loss + Schedule E total rental, royalty, parternship, S-corporation, + etc, income/loss e00200: float Wages, salaries, and tips for filing unit net of pension contributions PT_rt1: float @@ -1406,19 +1486,26 @@ def SchXYZ(taxable_income, MARS, e00900, e26270, e02000, e00200, II_rt8: float Personal income (regular/non-AMT/non-pass-through) tax rate 8 II_brk1: list - Personal income (regular/non-AMT/non-pass/through) tax bracket (upper threshold) 1 + Personal income (regular/non-AMT/non-pass/through) + tax bracket (upper threshold) 1 II_brk2: list - Personal income (regular/non-AMT/non-pass/through) tax bracket (upper threshold) 2 + Personal income (regular/non-AMT/non-pass/through) + tax bracket (upper threshold) 2 II_brk3: list - Personal income (regular/non-AMT/non-pass/through) tax bracket (upper threshold) 3 + Personal income (regular/non-AMT/non-pass/through) + tax bracket (upper threshold) 3 II_brk4: list - Personal income (regular/non-AMT/non-pass/through) tax bracket (upper threshold) 4 + Personal income (regular/non-AMT/non-pass/through) + tax bracket (upper threshold) 4 II_brk5: list - Personal income (regular/non-AMT/non-pass/through) tax bracket (upper threshold) 5 + Personal income (regular/non-AMT/non-pass/through) + tax bracket (upper threshold) 5 II_brk6: list - Personal income (regular/non-AMT/non-pass/through) tax bracket (upper threshold) 6 + Personal income (regular/non-AMT/non-pass/through) + tax bracket (upper threshold) 6 II_brk7: list - Personal income (regular/non-AMT/non-pass/through) tax bracket (upper threshold) 7 + Personal income (regular/non-AMT/non-pass/through) + tax bracket (upper threshold) 7 PT_EligibleRate_active: float Share of active business income eligible for PT rate schedule PT_EligibleRate_passive: float @@ -1496,7 +1583,8 @@ def SchXYZTax(c04800, MARS, e00900, e26270, e02000, e00200, c04800: float Regular taxable income MARS: int - Filing (marital) status. (1=single, 2=joint, 3=separate, 4=household-head, 5=widow(er)) + Filing (marital) status. (1=single, 2=joint, 3=separate, + 4=household-head, 5=widow(er)) e00900: float Schedule C business net profit/loss for filing unit e26270: float @@ -1552,19 +1640,26 @@ def SchXYZTax(c04800, MARS, e00900, e26270, e02000, e00200, II_rt8: float Personal income (regular/non-AMT/non-pass-through) tax rate 8 II_brk1: list - Personal income (regular/non-AMT/non-pass/through) tax bracket (upper threshold) 1 + Personal income (regular/non-AMT/non-pass/through) + tax bracket (upper threshold) 1 II_brk2: list - Personal income (regular/non-AMT/non-pass/through) tax bracket (upper threshold) 2 + Personal income (regular/non-AMT/non-pass/through) + tax bracket (upper threshold) 2 II_brk3: list - Personal income (regular/non-AMT/non-pass/through) tax bracket (upper threshold) 3 + Personal income (regular/non-AMT/non-pass/through) + tax bracket (upper threshold) 3 II_brk4: list - Personal income (regular/non-AMT/non-pass/through) tax bracket (upper threshold) 4 + Personal income (regular/non-AMT/non-pass/through) + tax bracket (upper threshold) 4 II_brk5: list - Personal income (regular/non-AMT/non-pass/through) tax bracket (upper threshold) 5 + Personal income (regular/non-AMT/non-pass/through) + tax bracket (upper threshold) 5 II_brk6: list - Personal income (regular/non-AMT/non-pass/through) tax bracket (upper threshold) 6 + Personal income (regular/non-AMT/non-pass/through) + tax bracket (upper threshold) 6 II_brk7: list - Personal income (regular/non-AMT/non-pass/through) tax bracket (upper threshold) 7 + Personal income (regular/non-AMT/non-pass/through) + tax bracket (upper threshold) 7 PT_EligibleRate_active: float Share of active business income eligible for PT rate schedule PT_EligibleRate_passive: float @@ -1632,7 +1727,8 @@ def GainsTax(e00650, c01000, c23650, p23250, e01100, e58990, e00200, e24518: float Schedule D: 28% rate gain or loss MARS: int - Filing (marital) status. (1=single, 2=joint, 3=separate, 4=household-head, 5=widow(er)) + Filing (marital) status. (1=single, 2=joint, 3=separate, + 4=household-head, 5=widow(er)) c04800: float Regular taxable income c05200: float @@ -1642,7 +1738,8 @@ def GainsTax(e00650, c01000, c23650, p23250, e01100, e58990, e00200, e26270: float Schedule E: combined partnership and S-corporation net income/loss e02000: float - Schedule E total rental, royalty, partnership, S-corporation, etc, income/loss + Schedule E total rental, royalty, partnership, S-corporation, + etc, income/loss II_rt1: float Personal income (regular/non-AMT/non-pass-through) tax rate 1 II_rt2: float @@ -1660,19 +1757,26 @@ def GainsTax(e00650, c01000, c23650, p23250, e01100, e58990, e00200, II_rt8: float Personal income (regular/non-AMT/non-pass-through) tax rate 8 II_brk1: list - Personal income (regular/non-AMT/non-pass/through) tax bracket (upper threshold) 1 + Personal income (regular/non-AMT/non-pass/through) + tax bracket (upper threshold) 1 II_brk2: list - Personal income (regular/non-AMT/non-pass/through) tax bracket (upper threshold) 2 + Personal income (regular/non-AMT/non-pass/through) + tax bracket (upper threshold) 2 II_brk3: list - Personal income (regular/non-AMT/non-pass/through) tax bracket (upper threshold) 3 + Personal income (regular/non-AMT/non-pass/through) + tax bracket (upper threshold) 3 II_brk4: list - Personal income (regular/non-AMT/non-pass/through) tax bracket (upper threshold) 4 + Personal income (regular/non-AMT/non-pass/through) + tax bracket (upper threshold) 4 II_brk5: list - Personal income (regular/non-AMT/non-pass/through) tax bracket (upper threshold) 5 + Personal income (regular/non-AMT/non-pass/through) + tax bracket (upper threshold) 5 II_brk6: list - Personal income (regular/non-AMT/non-pass/through) tax bracket (upper threshold) 6 + Personal income (regular/non-AMT/non-pass/through) + tax bracket (upper threshold) 6 II_brk7: list - Personal income (regular/non-AMT/non-pass/through) tax bracket (upper threshold) 7 + Personal income (regular/non-AMT/non-pass/through) + tax bracket (upper threshold) 7 PT_rt1: float Pass through income tax rate 1 PT_rt2: float @@ -1704,7 +1808,8 @@ def GainsTax(e00650, c01000, c23650, p23250, e01100, e58990, e00200, PT_brk7: list Pass through income tax bracket (upper threshold) 7 CG_nodiff: bool - Long term capital gains and qualified dividends taxed no differently than regular taxable income + Long term capital gains and qualified dividends taxed no differently + than regular taxable income PT_EligibleRate_active: float Share of active business income eligible for PT rate schedule PT_EligibleRate_passive: float @@ -1722,11 +1827,14 @@ def GainsTax(e00650, c01000, c23650, p23250, e01100, e58990, e00200, CG_rt4: float Long term capital gain and qualified dividends (regular/non-AMT) rate 4 CG_brk1: list - Top of long-term capital gains and qualified dividends (regular/non-AMT) tax bracket 1 + Top of long-term capital gains and qualified dividends + (regular/non-AMT) tax bracket 1 CG_brk2: list - Top of long-term capital gains and qualified dividends (regular/non-AMT) tax bracket 2 + Top of long-term capital gains and qualified dividends + (regular/non-AMT) tax bracket 2 CG_brk3: list - Top of long-term capital gains and qualified dividends (regular/non-AMT) tax bracket 3 + Top of long-term capital gains and qualified dividends + (regular/non-AMT) tax bracket 3 dwks10: float Sum of dwks6 + dwks9 dwks13: float @@ -1867,7 +1975,8 @@ def AGIsurtax(c00100, MARS, AGI_surtax_trt, AGI_surtax_thd, taxbc, surtax): c00100: float Adjusted Gross Income (AGI) MARS: int - Filing (marital) status. (1=single, 2=joint, 3=separate, 4=household-head, 5=widow(er)) + Filing (marital) status. (1=single, 2=joint, 3=separate, + 4=household-head, 5=widow(er)) AGI_surtax_trt: float New AGI surtax rate AGI_surtax_thd: list @@ -1936,7 +2045,8 @@ def AMT(e07300, dwks13, standard, f6251, c00100, c18300, taxbc, e24515: float Schedule D: Un-Recaptured Section 1250 Gain MARS: int - Filing (marital) status. (1=single, 2=joint, 3=separate, 4=household-head, 5=widow(er)) + Filing (marital) status. (1=single, 2=joint, 3=separate, + 4=household-head, 5=widow(er)) sep: int 2 when MARS is 3 (married filing separately), otherwise 1 dwks19: float @@ -1978,13 +2088,17 @@ def AMT(e07300, dwks13, standard, f6251, c00100, c18300, taxbc, AMT_em_ps: list AMT exemption phaseout start AMT_em_pe: float - AMT exemption phaseout ending AMT taxable income for Married Filing Separately + AMT exemption phaseout ending AMT taxable income for + married filing separately AMT_CG_brk1: list - Top of long-term capital gains and qualified dividends (AMT) tax bracket 1 + Top of long-term capital gains and qualified dividends (AMT) tax + bracket 1 AMT_CG_brk2: list - Top of long-term capital gains and qualified dividends (AMT) tax bracket 2 + Top of long-term capital gains and qualified dividends (AMT) tax + bracket 2 AMT_CG_brk3: list - Top of long-term capital gains and qualified dividends (AMT) tax bracket 3 + Top of long-term capital gains and qualified dividends (AMT) tax + bracket 3 AMT_CG_rt1: float Long term capital gain and qualified dividends (AMT) rate 1 AMT_CG_rt2: float @@ -2099,7 +2213,8 @@ def NetInvIncTax(e00300, e00600, e02000, e26270, c01000, e00600: float Ordinary dividends included in AGI e02000: float - Schedule E total rental, royalty, parternship, S-corporation, etc, income/loss + Schedule E total rental, royalty, parternship, S-corporation, + etc, income/loss e26270: float Schedule E: combined partnership and S-corporation net income/loss c01000: float @@ -2109,7 +2224,8 @@ def NetInvIncTax(e00300, e00600, e02000, e26270, c01000, NIIT_thd: list Net Investment Income Tax modified AGI threshold MARS: int - Filing (marital) status. (1=single, 2=joint, 3=separate, 4=household-head, 5=widow(er)) + Filing (marital) status. (1=single, 2=joint, 3=separate, + 4=household-head, 5=widow(er)) NIIT_PT_taxed: bool Whether or not partnership and S-corp income is NIIT based NIIT_rt: float @@ -2142,7 +2258,8 @@ def F2441(MARS, earned_p, earned_s, f2441, CDCC_c, e32800, Parameters ---------- MARS: int - Filing (marital) status. (1=single, 2=joint, 3=separate, 4=household-head, 5=widow(er)) + Filing (marital) status. (1=single, 2=joint, 3=separate, + 4=household-head, 5=widow(er)) earned_p: float Earned income for taxpayer earned_s: float @@ -2274,7 +2391,8 @@ def EITC(MARS, DSI, EIC, c00100, e00300, e00400, e00600, c01000, Parameters ---------- MARS: int - Filing (marital) status. (1=single, 2=joint, 3=separate, 4=household-head, 5=widow(er)) + Filing (marital) status. (1=single, 2=joint, 3=separate, + 4=household-head, 5=widow(er)) DSI: int 1 if claimed as dependent on another return, otherwise 0 EIC: int @@ -2290,7 +2408,8 @@ def EITC(MARS, DSI, EIC, c00100, e00300, e00400, e00600, c01000, c01000: float Limitation on capital losses e02000: float - Schedule E total rental, royalty, partnership, S-corporation, etc, income/loss + Schedule E total rental, royalty, partnership, S-corporation, + etc, income/loss e26270: float Schedule E combined partnership and S-corporation net income/loss age_head: int @@ -2310,7 +2429,8 @@ def EITC(MARS, DSI, EIC, c00100, e00300, e00400, e00600, c01000, EITC_MaxEligAge: int Maximum age for childless EITC eligibility EITC_ps_MarriedJ: list - Extra earned income credit phaseout start AGI for married filling jointly + Extra earned income credit phaseout start AGI for + married filling jointly EITC_rt: list Earned income credit phasein rate EITC_c: list @@ -2452,9 +2572,11 @@ def ChildDepTaxCredit(age_head, age_spouse, nu18, n24, MARS, c00100, XTOT, num, Parameters ---------- n24: int - Number of children who are Child-Tax-Credit eligible, one condition for which is being under age 17 + Number of children who are Child-Tax-Credit eligible, one condition + for which is being under age 17 MARS: int - Filing (marital) status. (1=single, 2=joint, 3=separate, 4=household-head, 5=widow(er)) + Filing (marital) status. (1=single, 2=joint, 3=separate, + 4=household-head, 5=widow(er)) c00100: float Adjusted Gross Income (AGI) XTOT: int @@ -2575,7 +2697,8 @@ def PersonalTaxCredit(MARS, c00100, XTOT, nu18, Parameters ---------- MARS: int - Filing (marital) status. (1=single, 2=joint, 3=separate, 4=household-head, 5=widow(er)) + Filing (marital) status. (1=single, 2=joint, 3=separate, + 4=household-head, 5=widow(er)) c00100: float Adjusted Gross Income (AGI) XTOT: int @@ -2664,7 +2787,8 @@ def AmOppCreditParts(exact, e87521, num, c00100, CR_AmOppRefundable_hc, exact: int Whether or not to do rounding of phaseout fraction e87521: float - Total tentative AmOppCredit amount for all students. From Form 8863, line 1. + Total tentative AmOppCredit amount for all students. + From Form 8863, line 1. num: int 2 when MARS is 2 (married filing jointly), otherwise 1 c00100: float @@ -2731,7 +2855,8 @@ def SchR(age_head, age_spouse, MARS, c00100, age_spouse: int Age in years of spouse (secondary adult, if present) MARS: int - Filing (marital) status. (1=single, 2=joint, 3=separate, 4=household-head, 5=widow(er)) + Filing (marital) status. (1=single, 2=joint, 3=separate, + 4=household-head, 5=widow(er)) c00100: float Adjusted Gross Income (AGI) c05800: float @@ -2815,7 +2940,8 @@ def EducationTaxCredit(exact, e87530, MARS, c00100, c05800, e87530: float Adjusted qualified lifetime learning expenses for all students MARS: int - Filing (marital) status. (1=single, 2=joint, 3=separate, 4=household-head, 5=widow(er)) + Filing (marital) status. (1=single, 2=joint, 3=separate, + 4=household-head, 5=widow(er)) c00100: float Adjusted Gross Income (AGI) c05800: float @@ -2897,7 +3023,8 @@ def CharityCredit(e19800, e20100, c00100, CR_Charity_rt, CR_Charity_f, CR_Charity_frt: float Charity credit floor rate MARS: int - Filing (marital) status. (1=single, 2=joint, 3=separate, 4=household-head, 5=widow(er)) + Filing (marital) status. (1=single, 2=joint, 3=separate, + 4=household-head, 5=widow(er)) charity_credit: float Credit for charitable giving @@ -3075,7 +3202,8 @@ def AdditionalCTC(codtc_limited, ACTC_c, n24, earned, ACTC_Income_thd, ACTC_c: float Maximum refundable additional child tax credit n24: int - Number of children who are Child-Tax-Credit eligible, one condition for which is being under age 17 + Number of children who are Child-Tax-Credit eligible, one condition + for which is being under age 17 earned: float Earned income for filing unit ACTC_Income_thd: float @@ -3085,9 +3213,11 @@ def AdditionalCTC(codtc_limited, ACTC_c, n24, earned, ACTC_Income_thd, nu06: int Number of dependents under 6 years old ACTC_rt_bonus_under6family: float - Bonus additional child tax credit rate for families with qualifying children under 6 + Bonus additional child tax credit rate for families with qualifying + children under 6 ACTC_ChildNum: float - Additional Child Tax Credit minimum number of qualified children for different formula + Additional Child Tax Credit minimum number of qualified children for + different formula ptax_was: float Employee and employer OASDI plus HI FICA tax c03260: float @@ -3197,7 +3327,8 @@ def C1040(c05800, c07180, c07200, c07220, c07230, c07240, c07260, c07300, c07100: float Total non-refundable credits used to reduce positive tax liability c09200: float - Income tax liabilities (including othertaxes) after non-refundable credits are used, but before refundable credits are applied + Income tax liabilities (including othertaxes) after non-refundable + credits are used, but before refundable credits are applied odc: float Other Dependent Credit charity_credit: float @@ -3212,7 +3343,8 @@ def C1040(c05800, c07180, c07200, c07220, c07230, c07240, c07260, c07300, othertaxes: float Sum of niit, e09700, e09800, and e09900 c09200: float - Income tax liabilities (including othertaxes) after non-refundable credits are used, but before refundable credits are applied + Income tax liabilities (including othertaxes) after non-refundable + credits are used, but before refundable credits are applied """ # total used nonrefundable credits (as computed in NonrefundableCredits) c07100 = (c07180 + c07200 + c07600 + c07300 + c07400 + @@ -3245,36 +3377,44 @@ def CTC_new(CTC_new_c, CTC_new_rt, CTC_new_c_under6_bonus, CTC_new_rt: float New refundalbe child tax credit amount phasein rate CTC_new_c_under6_bonus: float - Bonus new refundable child tax credit maximum for qualifying children under six + Bonus new refundable child tax credit maximum for qualifying + children under six CTC_new_ps: list New refundable child tax credit phaseout starting AGI CTC_new_prt: float New refundable child tax credit amount phaseout rate CTC_new_for_all: bool - Whether or not maximum amount of the new refundable child tax credit is available to all + Whether or not maximum amount of the new refundable child tax credit + is available to all CTC_new_refund_limited: bool - New child tax credit refund limited to a decimal fraction of payroll taxes + New child tax credit refund limited to a decimal fraction of + payroll taxes CTC_new_refund_limit_payroll_rt: float - New child tax credit refund limit rate (decimal fraction of payroll taxes) + New child tax credit refund limit rate (decimal fraction of + payroll taxes) CTC_new_refund_limited_all_payroll: bool - New child tax credit refund limit applies to all FICA taxes, not just OASDI + New child tax credit refund limit applies to all FICA taxes, not + just OASDI payrolltax: float Total (employee + employer) payroll tax liability exact: int Whether or not exact phase-out calculation is being done n24: int - Number of children who are Child-Tax-Credit eligible, one condition for which is being under age 17 + Number of children who are Child-Tax-Credit eligible, one + condition for which is being under age 17 nu06: int Number of dependents under 6 years old c00100: float Adjusted Gross Income (AGI) MARS: int - Filing (marital) status. (1=single, 2=joint, 3=separate, 4=household-head, 5=widow(er)) + Filing (marital) status. (1=single, 2=joint, 3=separate, + 4=household-head, 5=widow(er)) ptax_oasdi: float Employee and employer OASDI FICA tax plus self employment tax Excludes HI FICA so positive ptax_oasdi is less than ptax_was + setax c09200: float - Income tax liabilities (including othertaxes) after non-refundable credits are used, but before refundable credits are applied + Income tax liabilities (including othertaxes) after non-refundable + credits are used, but before refundable credits are applied ctc_new: float New refundable child tax credit @@ -3408,7 +3548,8 @@ def Taxes(income, MARS, tbrk_base, income: float Taxable income MARS: int - Filing (marital) status. (1=single, 2=joint, 3=separate, 4=household-head, 5=widow(er)) + Filing (marital) status. (1=single, 2=joint, 3=separate, + 4=household-head, 5=widow(er)) tbrk_base: float Amount of income used to determine the braket the filer is in rate1: list @@ -3601,7 +3742,8 @@ def FairShareTax(c00100, MARS, ptax_was, setax, ptax_amc, c00100: float Adjusted Gross Income (AGI) MARS: int - Filing (marital) status. (1=single, 2=joint, 3=separate, 4=household-head, 5=widow(er)) + Filing (marital) status. (1=single, 2=joint, 3=separate, + 4=household-head, 5=widow(er)) ptax_was: float Employee and employer OASDI plus HI FICA tax setax: float @@ -3722,7 +3864,8 @@ def ExpandIncome(e00200, pencon_p, pencon_s, e00300, e00400, e00600, e01500: float Total pensions and annuities e02000: float - Schedule E total rental, royalty, partnership, S-corporation, etc, income/loss + Schedule E total rental, royalty, partnership, S-corporation, + etc, income/loss e02100: float Farm net income/loss for filing unit from Schedule F p22250: float @@ -3734,7 +3877,8 @@ def ExpandIncome(e00200, pencon_p, pencon_s, e00300, e00400, e00600, ptax_was: float Employee and employer OASDI and HI FICA tax benefit_value_total: float - Consumption value of all benefits received by tax unit, which is included in expanded income + Consumption value of all benefits received by tax unit, which + is included in expanded income expanded_income: float Broad income measure that includes benefit_value_total