taxcalc 4.4.0__py3-none-any.whl → 4.5.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. taxcalc/__init__.py +1 -1
  2. taxcalc/calcfunctions.py +326 -171
  3. taxcalc/calculator.py +35 -34
  4. taxcalc/cli/tc.py +6 -7
  5. taxcalc/consumption.json +1 -1
  6. taxcalc/consumption.py +9 -4
  7. taxcalc/cps_weights.csv.gz +0 -0
  8. taxcalc/data.py +8 -8
  9. taxcalc/decorators.py +3 -3
  10. taxcalc/growdiff.json +1 -1
  11. taxcalc/growdiff.py +5 -0
  12. taxcalc/growfactors.csv +26 -25
  13. taxcalc/growfactors.py +1 -1
  14. taxcalc/parameters.py +85 -42
  15. taxcalc/policy.py +2 -2
  16. taxcalc/policy_current_law.json +87 -87
  17. taxcalc/puf_ratios.csv +15 -14
  18. taxcalc/puf_weights.csv.gz +0 -0
  19. taxcalc/records.py +1 -0
  20. taxcalc/records_variables.json +6 -0
  21. taxcalc/reforms/ext.json +21 -21
  22. taxcalc/taxcalcio.py +49 -44
  23. taxcalc/tests/cmpi_cps_expect.txt +6 -6
  24. taxcalc/tests/cmpi_puf_expect.txt +6 -6
  25. taxcalc/tests/conftest.py +43 -42
  26. taxcalc/tests/cpscsv_agg_expect.csv +22 -22
  27. taxcalc/tests/puf_var_wght_means_by_year.csv +70 -70
  28. taxcalc/tests/pufcsv_agg_expect.csv +22 -22
  29. taxcalc/tests/test_4package.py +9 -7
  30. taxcalc/tests/test_benefits.py +9 -8
  31. taxcalc/tests/test_calcfunctions.py +55 -38
  32. taxcalc/tests/test_calculator.py +11 -6
  33. taxcalc/tests/test_compare.py +45 -51
  34. taxcalc/tests/test_compatible_data.py +9 -7
  35. taxcalc/tests/test_consumption.py +38 -18
  36. taxcalc/tests/test_cpscsv.py +33 -31
  37. taxcalc/tests/test_data.py +31 -24
  38. taxcalc/tests/test_decorators.py +84 -32
  39. taxcalc/tests/test_growdiff.py +16 -13
  40. taxcalc/tests/test_growfactors.py +8 -8
  41. taxcalc/tests/test_parameters.py +55 -59
  42. taxcalc/tests/test_policy.py +14 -12
  43. taxcalc/tests/test_puf_var_stats.py +14 -14
  44. taxcalc/tests/test_pufcsv.py +40 -40
  45. taxcalc/tests/test_records.py +73 -60
  46. taxcalc/tests/test_reforms.py +35 -32
  47. taxcalc/tests/test_responses.py +4 -4
  48. taxcalc/tests/test_taxcalcio.py +76 -62
  49. taxcalc/tests/test_utils.py +78 -46
  50. taxcalc/utils.py +49 -42
  51. taxcalc/validation/taxsim35/taxsim_emulation.json +1 -5
  52. {taxcalc-4.4.0.dist-info → taxcalc-4.5.0.dist-info}/METADATA +19 -5
  53. {taxcalc-4.4.0.dist-info → taxcalc-4.5.0.dist-info}/RECORD +57 -57
  54. {taxcalc-4.4.0.dist-info → taxcalc-4.5.0.dist-info}/WHEEL +1 -1
  55. {taxcalc-4.4.0.dist-info → taxcalc-4.5.0.dist-info}/LICENSE +0 -0
  56. {taxcalc-4.4.0.dist-info → taxcalc-4.5.0.dist-info}/entry_points.txt +0 -0
  57. {taxcalc-4.4.0.dist-info → taxcalc-4.5.0.dist-info}/top_level.txt +0 -0
taxcalc/calcfunctions.py CHANGED
@@ -16,6 +16,7 @@ indexing).
16
16
  # pylint: disable=too-many-lines
17
17
  # pylint: disable=invalid-name
18
18
  # pylint: disable=too-many-arguments
19
+ # pylint: disable=too-many-positional-arguments
19
20
  # pylint: disable=too-many-locals
20
21
 
21
22
  import math
@@ -100,8 +101,8 @@ def BenefitPrograms(calc):
100
101
 
101
102
  @iterate_jit(nopython=True)
102
103
  def EI_PayrollTax(SS_Earnings_c, e00200p, e00200s, pencon_p, pencon_s,
103
- FICA_ss_trt_employer, FICA_ss_trt_employee,
104
- FICA_mc_trt_employer, FICA_mc_trt_employee,
104
+ FICA_ss_trt_employer, FICA_ss_trt_employee,
105
+ FICA_mc_trt_employer, FICA_mc_trt_employee,
105
106
  ALD_SelfEmploymentTax_hc, SS_Earnings_thd, SECA_Earnings_thd,
106
107
  e00900p, e00900s, e02100p, e02100s, k1bx14p,
107
108
  k1bx14s, payrolltax, ptax_was, setax, c03260, ptax_oasdi,
@@ -114,8 +115,10 @@ def EI_PayrollTax(SS_Earnings_c, e00200p, e00200s, pencon_p, pencon_s,
114
115
  ----------
115
116
  SS_Earnings_c: float
116
117
  Maximum taxable earnings for Social Security.
117
- Individual earnings below this amount are subjected to OASDI payroll tax.
118
- This parameter is indexed by rate of growth in average wages not by the price inflation rate.
118
+ Individual earnings below this amount are subjected to
119
+ OASDI payroll tax.
120
+ This parameter is indexed by rate of growth in average wages not by
121
+ the price inflation rate.
119
122
  e00200p: float
120
123
  Wages, salaries, and tips for taxpayer net of pension contributions
121
124
  e00200s: float
@@ -127,19 +130,21 @@ def EI_PayrollTax(SS_Earnings_c, e00200p, e00200s, pencon_p, pencon_s,
127
130
  FICA_ss_trt_employer: float
128
131
  Employer side social security payroll tax rate
129
132
  FICA_ss_trt_employee: float
130
- Employee side social security payroll tax rate
133
+ Employee side social security payroll tax rate
131
134
  FICA_mc_trt_employer: float
132
135
  Employer side medicare payroll tax rate
133
136
  FICA_mc_trt_employee: float
134
137
  Employee side medicare payroll tax rate
135
138
  ALD_SelfEmploymentTax_hc: float
136
139
  Adjustment for self-employment tax haircut
137
- If greater than zero, reduces the employer equivalent portion of self-employment adjustment
140
+ If greater than zero, reduces the employer equivalent portion
141
+ of self-employment adjustment
138
142
  Final adjustment amount = (1-Haircut)*SelfEmploymentTaxAdjustment
139
143
  SS_Earnings_thd: float
140
144
  Additional taxable earnings threshold for Social Security
141
- Individual earnings above this threshold are subjected to OASDI payroll tax, in addtion to
142
- earnings below the maximum taxable earnings threshold.
145
+ Individual earnings above this threshold are subjected to
146
+ OASDI payroll tax, in addtion to earnings below the
147
+ maximum taxable earnings threshold.
143
148
  SECA_Earnings_thd: float
144
149
  Threshold value for self-employment income below which there is
145
150
  no SECA tax liability
@@ -152,9 +157,11 @@ def EI_PayrollTax(SS_Earnings_c, e00200p, e00200s, pencon_p, pencon_s,
152
157
  e02100s: float
153
158
  Farm net income/loss for spouse
154
159
  k1bx14p: float
155
- Partner self-employment earnings/loss for taxpayer (included in e26270 total)
160
+ Partner self-employment earnings/loss for taxpayer
161
+ (included in e26270 total)
156
162
  k1bx14s: float
157
- Partner self-employment earnings/loss for spouse (included in e26270 total)
163
+ Partner self-employment earnings/loss for spouse
164
+ (included in e26270 total)
158
165
  payrolltax: float
159
166
  Total (employee and employer) payroll tax liability
160
167
  payrolltax = ptax_was
@@ -215,34 +222,44 @@ def EI_PayrollTax(SS_Earnings_c, e00200p, e00200s, pencon_p, pencon_s,
215
222
  sey = sey_p + sey_s # total self-employment income for filing unit
216
223
 
217
224
  # compute gross wage and salary income ('was' denotes 'wage and salary')
218
- gross_was_p = e00200p + pencon_p
219
- gross_was_s = e00200s + pencon_s
225
+ gross_ws_p = e00200p + pencon_p
226
+ gross_ws_s = e00200s + pencon_s
220
227
 
221
228
  # compute taxable gross earnings for OASDI FICA
222
- txearn_was_p = min(SS_Earnings_c, gross_was_p)
223
- txearn_was_s = min(SS_Earnings_c, gross_was_s)
229
+ txearn_was_p = min(SS_Earnings_c, gross_ws_p)
230
+ txearn_was_s = min(SS_Earnings_c, gross_ws_s)
224
231
 
225
232
  # compute OASDI and HI payroll taxes on wage-and-salary income, FICA
226
- ptax_ss_was_p = (FICA_ss_trt_employer + FICA_ss_trt_employee) * txearn_was_p
227
- ptax_ss_was_s = (FICA_ss_trt_employer + FICA_ss_trt_employee) * txearn_was_s
228
- ptax_mc_was_p = (FICA_mc_trt_employer + FICA_mc_trt_employee) * gross_was_p
229
- ptax_mc_was_s = (FICA_mc_trt_employer + FICA_mc_trt_employee) * gross_was_s
230
- ptax_was = ptax_ss_was_p + ptax_ss_was_s + ptax_mc_was_p + ptax_mc_was_s
233
+ ptax_ss_ws_p = (FICA_ss_trt_employer + FICA_ss_trt_employee) * txearn_was_p
234
+ ptax_ss_ws_s = (FICA_ss_trt_employer + FICA_ss_trt_employee) * txearn_was_s
235
+ ptax_mc_ws_p = (FICA_mc_trt_employer + FICA_mc_trt_employee) * gross_ws_p
236
+ ptax_mc_ws_s = (FICA_mc_trt_employer + FICA_mc_trt_employee) * gross_ws_s
237
+ ptax_was = ptax_ss_ws_p + ptax_ss_ws_s + ptax_mc_ws_p + ptax_mc_ws_s
231
238
 
232
239
  # compute taxable self-employment income for OASDI SECA
233
- sey_frac = 1.0 - 0.5 * (FICA_ss_trt_employer + FICA_ss_trt_employee + FICA_mc_trt_employer + FICA_mc_trt_employee)
240
+ sey_frac = (
241
+ 1.0 - 0.5 *
242
+ (FICA_ss_trt_employer + FICA_ss_trt_employee +
243
+ FICA_mc_trt_employer + FICA_mc_trt_employee)
244
+ )
234
245
  txearn_sey_p = min(max(0., sey_p * sey_frac), SS_Earnings_c - txearn_was_p)
235
246
  txearn_sey_s = min(max(0., sey_s * sey_frac), SS_Earnings_c - txearn_was_s)
236
247
 
237
248
  # compute self-employment tax on taxable self-employment income, SECA
238
249
  setax_ss_p = (FICA_ss_trt_employer + FICA_ss_trt_employee) * txearn_sey_p
239
250
  setax_ss_s = (FICA_ss_trt_employer + FICA_ss_trt_employee) * txearn_sey_s
240
- setax_mc_p = (FICA_mc_trt_employer + FICA_mc_trt_employee) * max(0., sey_p * sey_frac)
241
- setax_mc_s = (FICA_mc_trt_employer + FICA_mc_trt_employee) * max(0., sey_s * sey_frac)
251
+ setax_mc_p = (
252
+ (FICA_mc_trt_employer + FICA_mc_trt_employee) *
253
+ max(0., sey_p * sey_frac)
254
+ )
255
+ setax_mc_s = (
256
+ (FICA_mc_trt_employer + FICA_mc_trt_employee) *
257
+ max(0., sey_s * sey_frac)
258
+ )
242
259
  setax_p = setax_ss_p + setax_mc_p
243
260
  setax_s = setax_ss_s + setax_mc_s
244
261
  setax = setax_p + setax_s
245
- # # no tax if low amount of self-employment income
262
+ # no setax if self-employment income is low
246
263
  if sey * sey_frac > SECA_Earnings_thd:
247
264
  setax = setax_p + setax_s
248
265
  else:
@@ -251,19 +268,21 @@ def EI_PayrollTax(SS_Earnings_c, e00200p, e00200s, pencon_p, pencon_s,
251
268
  # compute extra OASDI payroll taxes on the portion of the sum
252
269
  # of wage-and-salary income and taxable self employment income
253
270
  # that exceeds SS_Earnings_thd
254
- sey_frac = 1.0 - 0.5 * (FICA_ss_trt_employer + FICA_ss_trt_employee)
255
- was_plus_sey_p = gross_was_p + max(0., sey_p * sey_frac)
256
- was_plus_sey_s = gross_was_s + max(0., sey_s * sey_frac)
271
+ sey_frac = 1.0 - 0.5 * (FICA_ss_trt_employer + FICA_ss_trt_employee)
272
+ was_plus_sey_p = gross_ws_p + max(0., sey_p * sey_frac)
273
+ was_plus_sey_s = gross_ws_s + max(0., sey_s * sey_frac)
257
274
  extra_ss_income_p = max(0., was_plus_sey_p - SS_Earnings_thd)
258
275
  extra_ss_income_s = max(0., was_plus_sey_s - SS_Earnings_thd)
259
- extra_payrolltax = (extra_ss_income_p * (FICA_ss_trt_employer + FICA_ss_trt_employee) +
260
- extra_ss_income_s * (FICA_ss_trt_employer + FICA_ss_trt_employee))
276
+ extra_payrolltax = (
277
+ extra_ss_income_p * (FICA_ss_trt_employer + FICA_ss_trt_employee) +
278
+ extra_ss_income_s * (FICA_ss_trt_employer + FICA_ss_trt_employee)
279
+ )
261
280
 
262
281
  # compute part of total payroll taxes for filing unit
263
282
  payrolltax = ptax_was + extra_payrolltax
264
283
 
265
284
  # compute OASDI part of payroll taxes
266
- ptax_oasdi = (ptax_ss_was_p + ptax_ss_was_s +
285
+ ptax_oasdi = (ptax_ss_ws_p + ptax_ss_ws_s +
267
286
  setax_ss_p + setax_ss_s +
268
287
  extra_payrolltax)
269
288
 
@@ -293,17 +312,20 @@ def DependentCare(nu13, elderly_dependents, earned,
293
312
  nu13: int
294
313
  Number of dependents under 13 years old
295
314
  elderly_dependents: int
296
- Number of elderly dependents age 65+ in filing unit excluding taxpayer and spouse
315
+ Number of elderly dependents age 65+ in filing unit other than
316
+ taxpayer and spouse
297
317
  earned: float
298
318
  Earned income for filing unit
299
319
  MARS: int
300
- Filing marital status (1=single, 2=joint, 3=separate, 4=household-head, 5=widow(er))
320
+ Filing marital status (1=single, 2=joint, 3=separate,
321
+ 4=household-head, 5=widow(er))
301
322
  ALD_Dependents_thd: list
302
323
  Maximum income to qualify for dependent care deduction
303
324
  ALD_Dependents_hc: float
304
325
  Deduction for childcare costs haircut
305
326
  ALD_Dependents_Child_c: float
306
- National weighted average cost of childcare, ceiling for available childcare deduction
327
+ National weighted average cost of childcare, ceiling for
328
+ available childcare deduction
307
329
  ALD_Dependents_Elder_c: float
308
330
  Eldercare deduction ceiling
309
331
 
@@ -433,7 +455,8 @@ def ALD_InvInc_ec_base(p22250, p23250, sep,
433
455
  e01200: float
434
456
  Other net gain/loss from Form 4797
435
457
  MARS: int
436
- Filing marital status (1=single, 2=joint, 3=separate, 4=household-head, 5=widow(er))
458
+ Filing marital status (1=single, 2=joint, 3=separate,
459
+ 4=household-head, 5=widow(er))
437
460
  invinc_ec_base: float
438
461
  Exclusion of investment income from AGI
439
462
  Capital_loss_limitation: float
@@ -445,7 +468,9 @@ def ALD_InvInc_ec_base(p22250, p23250, sep,
445
468
  Exclusion of investment income from AGI
446
469
  """
447
470
  # limitation on net short-term and long-term capital losses
448
- cgain = max((-1 * Capital_loss_limitation[MARS - 1] / sep), p22250 + p23250)
471
+ cgain = max(
472
+ (-1 * Capital_loss_limitation[MARS - 1] / sep), p22250 + p23250
473
+ )
449
474
  # compute exclusion of investment income from AGI
450
475
  invinc_ec_base = e00300 + e00600 + cgain + e01100 + e01200
451
476
  return invinc_ec_base
@@ -490,17 +515,21 @@ def CapGains(p23250, p22250, sep, ALD_StudentLoan_hc,
490
515
  e00800: float
491
516
  Alimony received
492
517
  CG_nodiff: bool
493
- Long term capital gains and qualified dividends taxed no differently than regular taxable income
518
+ Long term capital gains and qualified dividends taxed no
519
+ differently than regular taxable income
494
520
  CG_ec: float
495
- Dollar amount of all capital gains and qualified dividends that are excluded from AGI
521
+ Dollar amount of all capital gains and qualified dividends that are
522
+ excluded from AGI
496
523
  CG_reinvest_ec_rt: float
497
- Fraction of all capital gains and qualified dividends in excess of the dollar exclusion that are excluded from AGI
524
+ Fraction of all capital gains and qualified dividends in excess
525
+ of the dollar exclusion that are excluded from AGI
498
526
  Capital_loss_limitation: float
499
527
  Limitation on capital losses that are deductible
500
528
  ALD_BusinessLosses_c: list
501
529
  Maximm amount of business losses deductible
502
530
  MARS: int
503
- Filing marital status (1=single, 2=joint, 3=separate, 4=household-head, 5=widow(er))
531
+ Filing marital status (1=single, 2=joint, 3=separate,
532
+ 4=household-head, 5=widow(er))
504
533
  e00900: float
505
534
  Schedule C business net profit/loss for filing unit
506
535
  e01100: float
@@ -512,7 +541,8 @@ def CapGains(p23250, p22250, sep, ALD_StudentLoan_hc,
512
541
  e01700: float
513
542
  Taxable pensions and annunities
514
543
  e02000: float
515
- Schedule E total rental, royalty, partnership, S-corporation, etc, income/loss (includes e26270 and e27200)
544
+ Schedule E total rental, royalty, partnership, S-corporation,
545
+ etc, income/loss (includes e26270 and e27200)
516
546
  e02100: float
517
547
  Farm net income/loss for filing unit from Schedule F
518
548
  e02300: float
@@ -588,7 +618,8 @@ def SSBenefits(MARS, ymod, e02400, SS_all_in_agi, SS_thd50, SS_thd85,
588
618
  Parameters
589
619
  ----------
590
620
  MARS: int
591
- Filing marital status (1=single, 2=joint, 3=separate, 4=household-head, 5=widow(er))
621
+ Filing marital status (1=single, 2=joint, 3=separate,
622
+ 4=household-head, 5=widow(er))
592
623
  ymod: float
593
624
  Variable that is used in OASDI benefit taxation logic
594
625
  e02400: float
@@ -688,7 +719,8 @@ def AGI(ymod1, c02500, c02900, XTOT, MARS, sep, DSI, exact, nu18, taxable_ubi,
688
719
  XTOT: int
689
720
  Total number of exemptions for filing unit
690
721
  MARS: int
691
- Filing marital status (1=single, 2=joint, 3=separate, 4=household-head, 5=widow(er))
722
+ Filing marital status (1=single, 2=joint, 3=separate,
723
+ 4=household-head, 5=widow(er))
692
724
  sep: int
693
725
  2 when MARS is 3 (married filing separately); otherwise 1
694
726
  DSI: int
@@ -787,44 +819,61 @@ def ItemDedCap(e17500, e18400, e18500, e19200, e19800, e20100, e20400, g20500,
787
819
  c00100: float
788
820
  Adjusted gross income (AGI)
789
821
  ID_AmountCap_rt: float
790
- Ceiling on the gross amount of itemized deductions allowed; decimal fraction of AGI
822
+ Ceiling on the gross amount of itemized deductions allowed;
823
+ expressed as decimal fraction of AGI
791
824
  ID_AmountCap_Switch: list
792
825
  Deductions subject to the cap on itemized deduction benefits
793
826
  e17500_capped: float
794
- Schedule A: medical expenses, capped by ItemDedCap as a decimal fraction of AGI
827
+ Schedule A: medical expenses, capped by
828
+ ItemDedCap as a decimal fraction of AGI
795
829
  e18400_capped: float
796
- Schedule A: state and local income taxes deductlbe, capped by ItemDedCap as a decimal fraction of AGI
830
+ Schedule A: state and local income taxes deductlbe, capped by
831
+ ItemDedCap as a decimal fraction of AGI
797
832
  e18500_capped: float
798
- Schedule A: state and local real estate taxes deductible, capped by ItemDedCap as a decimal fraction of AGI
833
+ Schedule A: state and local real estate taxes deductible, capped by
834
+ ItemDedCap as a decimal fraction of AGI
799
835
  e19200_capped: float
800
- Schedule A: interest deduction deductible, capped by ItemDedCap as decimal fraction of AGI
836
+ Schedule A: interest deduction deductible, capped by
837
+ ItemDedCap as decimal fraction of AGI
801
838
  e19800_capped: float
802
- Schedule A: charity cash contributions deductible, capped by ItemDedCap as a decimal fraction of AGI
839
+ Schedule A: charity cash contributions deductible, capped by
840
+ ItemDedCap as a decimal fraction of AGI
803
841
  e20100_capped: float
804
- Schedule A: charity noncash contributions deductible, capped aby ItemDedCap s a decimal fraction of AGI
842
+ Schedule A: charity noncash contributions deductible, capped by
843
+ ItemDedCap s a decimal fraction of AGI
805
844
  e20400_capped: float
806
- Schedule A: gross miscellaneous deductions deductible, capped by ItemDedCap as a decimal fraction of AGI
845
+ Schedule A: gross miscellaneous deductions deductible, capped by
846
+ ItemDedCap as a decimal fraction of AGI
807
847
  g20500_capped: float
808
- Schedule A: gross casualty or theft loss deductible, capped aby ItemDedCap s a decimal fraction of AGI
848
+ Schedule A: gross casualty or theft loss deductible, capped by
849
+ ItemDedCap s a decimal fraction of AGI
809
850
 
810
851
  Returns
811
852
  -------
812
853
  e17500_capped: float
813
- Schedule A: medical expenses, capped by ItemDedCap as a decimal fraction of AGI
854
+ Schedule A: medical expenses, capped by
855
+ ItemDedCap as a decimal fraction of AGI
814
856
  e18400_capped: float
815
- Schedule A: state and local income taxes deductlbe, capped by ItemDedCap as a decimal fraction of AGI
857
+ Schedule A: state and local income taxes deductlbe, capped by
858
+ ItemDedCap as a decimal fraction of AGI
816
859
  e18500_capped: float
817
- Schedule A: state and local real estate taxes deductible, capped by ItemDedCap as a decimal fraction of AGI
860
+ Schedule A: state and local real estate taxes deductible, capped by
861
+ ItemDedCap as a decimal fraction of AGI
818
862
  e19200_capped: float
819
- Schedule A: interest deduction deductible, capped by ItemDedCap as decimal fraction of AGI
863
+ Schedule A: interest deduction deductible, capped by
864
+ ItemDedCap as decimal fraction of AGI
820
865
  e19800_capped: float
821
- Schedule A: charity cash contributions deductible, capped by ItemDedCap as a decimal fraction of AGI
866
+ Schedule A: charity cash contributions deductible, capped by
867
+ ItemDedCap as a decimal fraction of AGI
822
868
  e20100_capped: float
823
- Schedule A: charity noncash contributions deductible, capped by ItemDedCap as a decimal fraction of AGI
869
+ Schedule A: charity noncash contributions deductible, capped by
870
+ ItemDedCap as a decimal fraction of AGI
824
871
  e20400_capped: float
825
- Schedule A: gross miscellaneous deductions deductible, capped by ItemDedCap as a decimal fraction of AGI
872
+ Schedule A: gross miscellaneous deductions deductible, capped by
873
+ ItemDedCap as a decimal fraction of AGI
826
874
  g20500_capped: float
827
- Schedule A: gross casualty or theft loss deductible, capped by ItemDedCap as a decimal fraction of AGI
875
+ Schedule A: gross casualty or theft loss deductible, capped by
876
+ ItemDedCap as a decimal fraction of AGI
828
877
  """
829
878
  # pylint: disable=too-many-branches
830
879
 
@@ -898,23 +947,32 @@ def ItemDed(e17500_capped, e18400_capped, e18500_capped, e19200_capped,
898
947
  Parameters
899
948
  ----------
900
949
  e17500_capped: float
901
- Schedule A: medical expenses, capped by ItemDedCap as a decimal fraction of AGI
950
+ Schedule A: medical expenses, capped by
951
+ ItemDedCap as a decimal fraction of AGI
902
952
  e18400_capped: float
903
- Schedule A: state and local income taxes deductlbe, capped by ItemDedCap as a decimal fraction of AGI
953
+ Schedule A: state and local income taxes deductlbe, capped by
954
+ ItemDedCap as a decimal fraction of AGI
904
955
  e18500_capped: float
905
- Schedule A: state and local real estate taxes deductible, capped by ItemDedCap as a decimal fraction of AGI
956
+ Schedule A: state and local real estate taxes deductible, capped by
957
+ ItemDedCap as a decimal fraction of AGI
906
958
  e19200_capped: float
907
- Schedule A: interest deduction deductible, capped by ItemDedCap as decimal fraction of AGI
959
+ Schedule A: interest deduction deductible, capped by
960
+ ItemDedCap as decimal fraction of AGI
908
961
  e19800_capped: float
909
- Schedule A: charity cash contributions deductible, capped by ItemDedCap as a decimal fraction of AGI
962
+ Schedule A: charity cash contributions deductible, capped by
963
+ ItemDedCap as a decimal fraction of AGI
910
964
  e20100_capped: float
911
- Schedule A: charity noncash contributions deductible, capped by ItemDedCap as a decimal fraction of AGI
965
+ Schedule A: charity noncash contributions deductible, capped by
966
+ ItemDedCap as a decimal fraction of AGI
912
967
  e20400_capped: float
913
- Schedule A: gross miscellaneous deductions deductible, capped by ItemDedCap as a decimal fraction of AGI
968
+ Schedule A: gross miscellaneous deductions deductible, capped by
969
+ ItemDedCap as a decimal fraction of AGI
914
970
  g20500_capped: float
915
- Schedule A: gross casualty or theft loss deductible, capped by ItemDedCap as a decimal fraction of AGI
971
+ Schedule A: gross casualty or theft loss deductible, capped by
972
+ ItemDedCap as a decimal fraction of AGI
916
973
  MARS: int
917
- Filing marital status (1=single, 2=joint, 3=separate, 4=household-head, 5=widow(er))
974
+ Filing marital status (1=single, 2=joint, 3=separate,
975
+ 4=household-head, 5=widow(er))
918
976
  age_head: int
919
977
  Age in years of taxpayer
920
978
  age_spouse: int
@@ -944,7 +1002,8 @@ def ItemDed(e17500_capped, e18400_capped, e18500_capped, e19200_capped,
944
1002
  ID_Medical_frt: float
945
1003
  Floor (as decimal fraction of AGI) for deductible medical expenses
946
1004
  ID_Medical_frt_add4aged: float
947
- Add on floor (as decimal fraction of AGI) for deductible medical expenses for elderly filing units
1005
+ Add on floor (as decimal fraction of AGI) for deductible
1006
+ medical expenses for elderly filing units
948
1007
  ID_Medical_hc: float
949
1008
  Medical expense deduction haircut
950
1009
  ID_Casualty_frt: float
@@ -952,23 +1011,28 @@ def ItemDed(e17500_capped, e18400_capped, e18500_capped, e19200_capped,
952
1011
  ID_Casualty_hc: float
953
1012
  Casualty expense deduction haircut
954
1013
  ID_Miscellaneous_frt: float
955
- Floor (as decimal fraction of AGI) for deductible miscellaneous expenses
1014
+ Floor (as decimal fraction of AGI) for deductible
1015
+ miscellaneous expenses
956
1016
  ID_Miscellaneous_hc: float
957
1017
  Miscellaneous expense deduction haircut
958
1018
  ID_Charity_crt_cash: float
959
- Ceiling (as decimal fraction of AGI) for cash charitable contribution deductions
1019
+ Ceiling (as decimal fraction of AGI) for cash charitable
1020
+ contribution deductions
960
1021
  ID_Charity_crt_noncash: float
961
- Ceiling (as decimal fraction of AGI) for noncash charitable contribution deductions
1022
+ Ceiling (as decimal fraction of AGI) for noncash charitable
1023
+ contribution deductions
962
1024
  ID_prt: float
963
1025
  Itemized deduction phaseout rate (Pease)
964
1026
  ID_crt: float
965
- Itemized deduction maximum phaseout as a decimal fraction of total itemized deductions (Pease)
1027
+ Itemized deduction maximum phaseout as a decimal fraction of total
1028
+ itemized deductions (Pease)
966
1029
  ID_c: list
967
1030
  Ceiling on the amount of itemized deductions allowed (dollars)
968
1031
  ID_StateLocalTax_hc: float
969
1032
  State and local income and sales taxes deduction haircut
970
1033
  ID_Charity_frt: float
971
- Floor (as decimal fraction of AGI) for deductible charitable contributions
1034
+ Floor (as decimal fraction of AGI) for deductible charitable
1035
+ contributions
972
1036
  ID_Charity_hc: float
973
1037
  Charity expense deduction haircut
974
1038
  ID_InterestPaid_hc: float
@@ -978,9 +1042,11 @@ def ItemDed(e17500_capped, e18400_capped, e18500_capped, e19200_capped,
978
1042
  ID_Medical_c: list
979
1043
  Ceiling on the amount of medical expense deduction allowed (dollars)
980
1044
  ID_StateLocalTax_c: list
981
- Ceiling on the amount of state and local income and sales taxes deduction allowed (dollars)
1045
+ Ceiling on the amount of state and local income and sales taxes
1046
+ deduction allowed (dollars)
982
1047
  ID_RealEstate_c: list
983
- Ceiling on the amount of state, local, and foreign real estate taxes deduction allowed (dollars)
1048
+ Ceiling on the amount of state, local, and foreign real estate taxes
1049
+ deduction allowed (dollars)
984
1050
  ID_InterestPaid_c: list
985
1051
  Ceiling on the amount of interest paid deduction allowed (dollars)
986
1052
  ID_Charity_c: list
@@ -988,15 +1054,19 @@ def ItemDed(e17500_capped, e18400_capped, e18500_capped, e19200_capped,
988
1054
  ID_Casualty_c: list
989
1055
  Ceiling on the amount of casualty expense deduction allowed (dollars)
990
1056
  ID_Miscellaneous_c: list
991
- Ceiling on the amount of miscellaneous expense deduction allowed (dollars)
1057
+ Ceiling on the amount of miscellaneous expense deduction
1058
+ allowed (dollars)
992
1059
  ID_AllTaxes_c: list
993
- Ceiling on the amount of state and local income, stales, and real estate deductions allowed (dollars)
1060
+ Ceiling on the amount of state and local income, stales, and
1061
+ real estate deductions allowed (dollars)
994
1062
  ID_AllTaxes_hc: float
995
1063
  State and local income, sales, and real estate tax deduciton haircut
996
1064
  ID_StateLocalTax_crt: float
997
- Ceiling (as decimal fraction of AGI) for the combination of all state and local income and sales tax deductions
1065
+ Ceiling (as decimal fraction of AGI) for the combination of all
1066
+ state and local income and sales tax deductions
998
1067
  ID_RealEstate_crt: float
999
- Ceiling (as decimal fraction of AGI) for the combination of all state, local, and foreign real estate tax deductions
1068
+ Ceiling (as decimal fraction of AGI) for the combination of all
1069
+ state, local, and foreign real estate tax deductions
1000
1070
  ID_Charity_f: list
1001
1071
  Floor on the amount of charity expense deduction allowed (dollars)
1002
1072
 
@@ -1093,7 +1163,8 @@ def AdditionalMedicareTax(e00200, MARS,
1093
1163
  Parameters
1094
1164
  -----
1095
1165
  MARS: int
1096
- Filing marital status (1=single, 2=joint, 3=separate, 4=household-head, 5=widow(er))
1166
+ Filing marital status (1=single, 2=joint, 3=separate,
1167
+ 4=household-head, 5=widow(er))
1097
1168
  AMEDT_ec: list
1098
1169
  Additional Medicare Tax earnings exclusion
1099
1170
  AMEDT_rt: float
@@ -1105,7 +1176,7 @@ def AdditionalMedicareTax(e00200, MARS,
1105
1176
  FICA_mc_trt_employer: float
1106
1177
  Employer side FICA Medicare tax rate
1107
1178
  FICA_mc_trt_employee: float
1108
- Employee side FICA Medicare tax rate
1179
+ Employee side FICA Medicare tax rate
1109
1180
  e00200: float
1110
1181
  Wages and salaries
1111
1182
  sey: float
@@ -1118,7 +1189,10 @@ def AdditionalMedicareTax(e00200, MARS,
1118
1189
  ptax_amc: float
1119
1190
  Additional Medicare Tax (included in othertaxes and iitax)
1120
1191
  """
1121
- line8 = max(0., sey) * (1. - 0.5 * (FICA_mc_trt_employer + FICA_mc_trt_employee + FICA_ss_trt_employer + FICA_ss_trt_employee))
1192
+ line8 = max(0., sey) * (
1193
+ 1. - 0.5 * (FICA_mc_trt_employer + FICA_mc_trt_employee +
1194
+ FICA_ss_trt_employer + FICA_ss_trt_employee)
1195
+ )
1122
1196
  line11 = max(0., AMEDT_ec[MARS - 1] - e00200)
1123
1197
  ptax_amc = AMEDT_rt * (max(0., e00200 - AMEDT_ec[MARS - 1]) +
1124
1198
  max(0., line8 - line11))
@@ -1151,7 +1225,8 @@ def StdDed(DSI, earned, STD, age_head, age_spouse, STD_Aged, STD_Dep,
1151
1225
  STD_Dep: float
1152
1226
  Standard deduction for dependents
1153
1227
  MARS: int
1154
- Filing (marital) status. (1=single, 2=joint, 3=separate, 4=household-head, 5=widow(er))
1228
+ Filing (marital) status. (1=single, 2=joint, 3=separate,
1229
+ 4=household-head, 5=widow(er))
1155
1230
  MIDR: int
1156
1231
  1 if separately filing spouse itemizes, 0 otherwise
1157
1232
  blind_head: int
@@ -1161,7 +1236,8 @@ def StdDed(DSI, earned, STD, age_head, age_spouse, STD_Aged, STD_Dep,
1161
1236
  standard: float
1162
1237
  Standard deduction (zero for itemizers)
1163
1238
  STD_allow_charity_ded_nonitemizers: bool
1164
- Allow standard deduction filers to take the charitable contributions deduction
1239
+ Allow standard deduction filers to take the charitable contributions
1240
+ deduction
1165
1241
  e19800: float
1166
1242
  Schedule A: cash charitable contributions
1167
1243
  ID_Charity_crt_cash: float
@@ -1226,7 +1302,8 @@ def TaxInc(c00100, standard, c04470, c04600, MARS, e00900, c03260, e26270,
1226
1302
  c04600: float
1227
1303
  Personal exemptions after phase-out
1228
1304
  MARS: int
1229
- Filing (marital) status. (1=single, 2=joint, 3=separate, 4=household-head, 5=widow(er))
1305
+ Filing (marital) status. (1=single, 2=joint, 3=separate,
1306
+ 4=household-head, 5=widow(er))
1230
1307
  e00900: float
1231
1308
  Schedule C business net profit/loss for filing unit
1232
1309
  c03260: float
@@ -1242,12 +1319,16 @@ def TaxInc(c00100, standard, c04470, c04600, MARS, e00900, c03260, e26270,
1242
1319
  c01000: float
1243
1320
  Limitation on capital losses
1244
1321
  PT_SSTB_income: int
1245
- Value of one implies business income is from a specified service trade or business (SSTB)
1246
- Value of zero implies business income is from a qualified trade or business
1322
+ Value of one implies business income is from a specified service
1323
+ trade or business (SSTB)
1324
+ Value of zero implies business income is from a qualified trade or
1325
+ business
1247
1326
  PT_binc_w2_wages: float
1248
- Filing unit's share of total W-2 wages paid by the pass-through business
1327
+ Filing unit's share of total W-2 wages paid by the
1328
+ pass-through business
1249
1329
  PT_ubia_property: float
1250
- Filing unit's share of total business property owned by the pass-through business
1330
+ Filing unit's share of total business property owned by the
1331
+ pass-through business
1251
1332
  PT_qbid_rt: float
1252
1333
  Pass-through qualified business income deduction rate
1253
1334
  PT_qbid_taxinc_thd: list
@@ -1348,13 +1429,15 @@ def SchXYZ(taxable_income, MARS, e00900, e26270, e02000, e00200,
1348
1429
  taxable_income: float
1349
1430
  Taxable income
1350
1431
  MARS: int
1351
- Filing (marital) status. (1=single, 2=joint, 3=separate, 4=household-head, 5=widow(er))
1432
+ Filing (marital) status. (1=single, 2=joint, 3=separate,
1433
+ 4=household-head, 5=widow(er))
1352
1434
  e00900: float
1353
1435
  Schedule C business net profit/loss for filing unit
1354
1436
  e26270: float
1355
1437
  Schedule E: combined partnership and S-corporation net income/loss
1356
1438
  e02000: float
1357
- Schedule E total rental, royalty, parternship, S-corporation, etc, income/loss
1439
+ Schedule E total rental, royalty, parternship, S-corporation,
1440
+ etc, income/loss
1358
1441
  e00200: float
1359
1442
  Wages, salaries, and tips for filing unit net of pension contributions
1360
1443
  PT_rt1: float
@@ -1404,19 +1487,26 @@ def SchXYZ(taxable_income, MARS, e00900, e26270, e02000, e00200,
1404
1487
  II_rt8: float
1405
1488
  Personal income (regular/non-AMT/non-pass-through) tax rate 8
1406
1489
  II_brk1: list
1407
- Personal income (regular/non-AMT/non-pass/through) tax bracket (upper threshold) 1
1490
+ Personal income (regular/non-AMT/non-pass/through)
1491
+ tax bracket (upper threshold) 1
1408
1492
  II_brk2: list
1409
- Personal income (regular/non-AMT/non-pass/through) tax bracket (upper threshold) 2
1493
+ Personal income (regular/non-AMT/non-pass/through)
1494
+ tax bracket (upper threshold) 2
1410
1495
  II_brk3: list
1411
- Personal income (regular/non-AMT/non-pass/through) tax bracket (upper threshold) 3
1496
+ Personal income (regular/non-AMT/non-pass/through)
1497
+ tax bracket (upper threshold) 3
1412
1498
  II_brk4: list
1413
- Personal income (regular/non-AMT/non-pass/through) tax bracket (upper threshold) 4
1499
+ Personal income (regular/non-AMT/non-pass/through)
1500
+ tax bracket (upper threshold) 4
1414
1501
  II_brk5: list
1415
- Personal income (regular/non-AMT/non-pass/through) tax bracket (upper threshold) 5
1502
+ Personal income (regular/non-AMT/non-pass/through)
1503
+ tax bracket (upper threshold) 5
1416
1504
  II_brk6: list
1417
- Personal income (regular/non-AMT/non-pass/through) tax bracket (upper threshold) 6
1505
+ Personal income (regular/non-AMT/non-pass/through)
1506
+ tax bracket (upper threshold) 6
1418
1507
  II_brk7: list
1419
- Personal income (regular/non-AMT/non-pass/through) tax bracket (upper threshold) 7
1508
+ Personal income (regular/non-AMT/non-pass/through)
1509
+ tax bracket (upper threshold) 7
1420
1510
  PT_EligibleRate_active: float
1421
1511
  Share of active business income eligible for PT rate schedule
1422
1512
  PT_EligibleRate_passive: float
@@ -1494,7 +1584,8 @@ def SchXYZTax(c04800, MARS, e00900, e26270, e02000, e00200,
1494
1584
  c04800: float
1495
1585
  Regular taxable income
1496
1586
  MARS: int
1497
- Filing (marital) status. (1=single, 2=joint, 3=separate, 4=household-head, 5=widow(er))
1587
+ Filing (marital) status. (1=single, 2=joint, 3=separate,
1588
+ 4=household-head, 5=widow(er))
1498
1589
  e00900: float
1499
1590
  Schedule C business net profit/loss for filing unit
1500
1591
  e26270: float
@@ -1550,19 +1641,26 @@ def SchXYZTax(c04800, MARS, e00900, e26270, e02000, e00200,
1550
1641
  II_rt8: float
1551
1642
  Personal income (regular/non-AMT/non-pass-through) tax rate 8
1552
1643
  II_brk1: list
1553
- Personal income (regular/non-AMT/non-pass/through) tax bracket (upper threshold) 1
1644
+ Personal income (regular/non-AMT/non-pass/through)
1645
+ tax bracket (upper threshold) 1
1554
1646
  II_brk2: list
1555
- Personal income (regular/non-AMT/non-pass/through) tax bracket (upper threshold) 2
1647
+ Personal income (regular/non-AMT/non-pass/through)
1648
+ tax bracket (upper threshold) 2
1556
1649
  II_brk3: list
1557
- Personal income (regular/non-AMT/non-pass/through) tax bracket (upper threshold) 3
1650
+ Personal income (regular/non-AMT/non-pass/through)
1651
+ tax bracket (upper threshold) 3
1558
1652
  II_brk4: list
1559
- Personal income (regular/non-AMT/non-pass/through) tax bracket (upper threshold) 4
1653
+ Personal income (regular/non-AMT/non-pass/through)
1654
+ tax bracket (upper threshold) 4
1560
1655
  II_brk5: list
1561
- Personal income (regular/non-AMT/non-pass/through) tax bracket (upper threshold) 5
1656
+ Personal income (regular/non-AMT/non-pass/through)
1657
+ tax bracket (upper threshold) 5
1562
1658
  II_brk6: list
1563
- Personal income (regular/non-AMT/non-pass/through) tax bracket (upper threshold) 6
1659
+ Personal income (regular/non-AMT/non-pass/through)
1660
+ tax bracket (upper threshold) 6
1564
1661
  II_brk7: list
1565
- Personal income (regular/non-AMT/non-pass/through) tax bracket (upper threshold) 7
1662
+ Personal income (regular/non-AMT/non-pass/through)
1663
+ tax bracket (upper threshold) 7
1566
1664
  PT_EligibleRate_active: float
1567
1665
  Share of active business income eligible for PT rate schedule
1568
1666
  PT_EligibleRate_passive: float
@@ -1630,7 +1728,8 @@ def GainsTax(e00650, c01000, c23650, p23250, e01100, e58990, e00200,
1630
1728
  e24518: float
1631
1729
  Schedule D: 28% rate gain or loss
1632
1730
  MARS: int
1633
- Filing (marital) status. (1=single, 2=joint, 3=separate, 4=household-head, 5=widow(er))
1731
+ Filing (marital) status. (1=single, 2=joint, 3=separate,
1732
+ 4=household-head, 5=widow(er))
1634
1733
  c04800: float
1635
1734
  Regular taxable income
1636
1735
  c05200: float
@@ -1640,7 +1739,8 @@ def GainsTax(e00650, c01000, c23650, p23250, e01100, e58990, e00200,
1640
1739
  e26270: float
1641
1740
  Schedule E: combined partnership and S-corporation net income/loss
1642
1741
  e02000: float
1643
- Schedule E total rental, royalty, partnership, S-corporation, etc, income/loss
1742
+ Schedule E total rental, royalty, partnership, S-corporation,
1743
+ etc, income/loss
1644
1744
  II_rt1: float
1645
1745
  Personal income (regular/non-AMT/non-pass-through) tax rate 1
1646
1746
  II_rt2: float
@@ -1658,19 +1758,26 @@ def GainsTax(e00650, c01000, c23650, p23250, e01100, e58990, e00200,
1658
1758
  II_rt8: float
1659
1759
  Personal income (regular/non-AMT/non-pass-through) tax rate 8
1660
1760
  II_brk1: list
1661
- Personal income (regular/non-AMT/non-pass/through) tax bracket (upper threshold) 1
1761
+ Personal income (regular/non-AMT/non-pass/through)
1762
+ tax bracket (upper threshold) 1
1662
1763
  II_brk2: list
1663
- Personal income (regular/non-AMT/non-pass/through) tax bracket (upper threshold) 2
1764
+ Personal income (regular/non-AMT/non-pass/through)
1765
+ tax bracket (upper threshold) 2
1664
1766
  II_brk3: list
1665
- Personal income (regular/non-AMT/non-pass/through) tax bracket (upper threshold) 3
1767
+ Personal income (regular/non-AMT/non-pass/through)
1768
+ tax bracket (upper threshold) 3
1666
1769
  II_brk4: list
1667
- Personal income (regular/non-AMT/non-pass/through) tax bracket (upper threshold) 4
1770
+ Personal income (regular/non-AMT/non-pass/through)
1771
+ tax bracket (upper threshold) 4
1668
1772
  II_brk5: list
1669
- Personal income (regular/non-AMT/non-pass/through) tax bracket (upper threshold) 5
1773
+ Personal income (regular/non-AMT/non-pass/through)
1774
+ tax bracket (upper threshold) 5
1670
1775
  II_brk6: list
1671
- Personal income (regular/non-AMT/non-pass/through) tax bracket (upper threshold) 6
1776
+ Personal income (regular/non-AMT/non-pass/through)
1777
+ tax bracket (upper threshold) 6
1672
1778
  II_brk7: list
1673
- Personal income (regular/non-AMT/non-pass/through) tax bracket (upper threshold) 7
1779
+ Personal income (regular/non-AMT/non-pass/through)
1780
+ tax bracket (upper threshold) 7
1674
1781
  PT_rt1: float
1675
1782
  Pass through income tax rate 1
1676
1783
  PT_rt2: float
@@ -1702,7 +1809,8 @@ def GainsTax(e00650, c01000, c23650, p23250, e01100, e58990, e00200,
1702
1809
  PT_brk7: list
1703
1810
  Pass through income tax bracket (upper threshold) 7
1704
1811
  CG_nodiff: bool
1705
- Long term capital gains and qualified dividends taxed no differently than regular taxable income
1812
+ Long term capital gains and qualified dividends taxed no differently
1813
+ than regular taxable income
1706
1814
  PT_EligibleRate_active: float
1707
1815
  Share of active business income eligible for PT rate schedule
1708
1816
  PT_EligibleRate_passive: float
@@ -1720,11 +1828,14 @@ def GainsTax(e00650, c01000, c23650, p23250, e01100, e58990, e00200,
1720
1828
  CG_rt4: float
1721
1829
  Long term capital gain and qualified dividends (regular/non-AMT) rate 4
1722
1830
  CG_brk1: list
1723
- Top of long-term capital gains and qualified dividends (regular/non-AMT) tax bracket 1
1831
+ Top of long-term capital gains and qualified dividends
1832
+ (regular/non-AMT) tax bracket 1
1724
1833
  CG_brk2: list
1725
- Top of long-term capital gains and qualified dividends (regular/non-AMT) tax bracket 2
1834
+ Top of long-term capital gains and qualified dividends
1835
+ (regular/non-AMT) tax bracket 2
1726
1836
  CG_brk3: list
1727
- Top of long-term capital gains and qualified dividends (regular/non-AMT) tax bracket 3
1837
+ Top of long-term capital gains and qualified dividends
1838
+ (regular/non-AMT) tax bracket 3
1728
1839
  dwks10: float
1729
1840
  Sum of dwks6 + dwks9
1730
1841
  dwks13: float
@@ -1865,7 +1976,8 @@ def AGIsurtax(c00100, MARS, AGI_surtax_trt, AGI_surtax_thd, taxbc, surtax):
1865
1976
  c00100: float
1866
1977
  Adjusted Gross Income (AGI)
1867
1978
  MARS: int
1868
- Filing (marital) status. (1=single, 2=joint, 3=separate, 4=household-head, 5=widow(er))
1979
+ Filing (marital) status. (1=single, 2=joint, 3=separate,
1980
+ 4=household-head, 5=widow(er))
1869
1981
  AGI_surtax_trt: float
1870
1982
  New AGI surtax rate
1871
1983
  AGI_surtax_thd: list
@@ -1934,7 +2046,8 @@ def AMT(e07300, dwks13, standard, f6251, c00100, c18300, taxbc,
1934
2046
  e24515: float
1935
2047
  Schedule D: Un-Recaptured Section 1250 Gain
1936
2048
  MARS: int
1937
- Filing (marital) status. (1=single, 2=joint, 3=separate, 4=household-head, 5=widow(er))
2049
+ Filing (marital) status. (1=single, 2=joint, 3=separate,
2050
+ 4=household-head, 5=widow(er))
1938
2051
  sep: int
1939
2052
  2 when MARS is 3 (married filing separately), otherwise 1
1940
2053
  dwks19: float
@@ -1976,13 +2089,17 @@ def AMT(e07300, dwks13, standard, f6251, c00100, c18300, taxbc,
1976
2089
  AMT_em_ps: list
1977
2090
  AMT exemption phaseout start
1978
2091
  AMT_em_pe: float
1979
- AMT exemption phaseout ending AMT taxable income for Married Filing Separately
2092
+ AMT exemption phaseout ending AMT taxable income for
2093
+ married filing separately
1980
2094
  AMT_CG_brk1: list
1981
- Top of long-term capital gains and qualified dividends (AMT) tax bracket 1
2095
+ Top of long-term capital gains and qualified dividends (AMT) tax
2096
+ bracket 1
1982
2097
  AMT_CG_brk2: list
1983
- Top of long-term capital gains and qualified dividends (AMT) tax bracket 2
2098
+ Top of long-term capital gains and qualified dividends (AMT) tax
2099
+ bracket 2
1984
2100
  AMT_CG_brk3: list
1985
- Top of long-term capital gains and qualified dividends (AMT) tax bracket 3
2101
+ Top of long-term capital gains and qualified dividends (AMT) tax
2102
+ bracket 3
1986
2103
  AMT_CG_rt1: float
1987
2104
  Long term capital gain and qualified dividends (AMT) rate 1
1988
2105
  AMT_CG_rt2: float
@@ -2097,7 +2214,8 @@ def NetInvIncTax(e00300, e00600, e02000, e26270, c01000,
2097
2214
  e00600: float
2098
2215
  Ordinary dividends included in AGI
2099
2216
  e02000: float
2100
- Schedule E total rental, royalty, parternship, S-corporation, etc, income/loss
2217
+ Schedule E total rental, royalty, parternship, S-corporation,
2218
+ etc, income/loss
2101
2219
  e26270: float
2102
2220
  Schedule E: combined partnership and S-corporation net income/loss
2103
2221
  c01000: float
@@ -2107,7 +2225,8 @@ def NetInvIncTax(e00300, e00600, e02000, e26270, c01000,
2107
2225
  NIIT_thd: list
2108
2226
  Net Investment Income Tax modified AGI threshold
2109
2227
  MARS: int
2110
- Filing (marital) status. (1=single, 2=joint, 3=separate, 4=household-head, 5=widow(er))
2228
+ Filing (marital) status. (1=single, 2=joint, 3=separate,
2229
+ 4=household-head, 5=widow(er))
2111
2230
  NIIT_PT_taxed: bool
2112
2231
  Whether or not partnership and S-corp income is NIIT based
2113
2232
  NIIT_rt: float
@@ -2133,14 +2252,15 @@ def NetInvIncTax(e00300, e00600, e02000, e26270, c01000,
2133
2252
  def F2441(MARS, earned_p, earned_s, f2441, CDCC_c, e32800,
2134
2253
  exact, c00100, CDCC_ps, CDCC_ps2, CDCC_crt, CDCC_frt,
2135
2254
  CDCC_po_step_size, CDCC_po_rate_per_step, CDCC_refundable,
2136
- c05800, e07300, c07180, CDCC_refund):
2255
+ c05800, e07300, c32800, c07180, CDCC_refund):
2137
2256
  """
2138
2257
  Calculates Form 2441 child and dependent care expense credit, c07180.
2139
2258
 
2140
2259
  Parameters
2141
2260
  ----------
2142
2261
  MARS: int
2143
- Filing (marital) status. (1=single, 2=joint, 3=separate, 4=household-head, 5=widow(er))
2262
+ Filing (marital) status. (1=single, 2=joint, 3=separate,
2263
+ 4=household-head, 5=widow(er))
2144
2264
  earned_p: float
2145
2265
  Earned income for taxpayer
2146
2266
  earned_s: float
@@ -2167,19 +2287,25 @@ def F2441(MARS, earned_p, earned_s, f2441, CDCC_c, e32800,
2167
2287
  Child/dependent care credit phaseout AGI step size
2168
2288
  CDCC_po_rate_per_step: float
2169
2289
  Child/dependent care credit phaseout rate per step size
2170
- CDCC_refund: bool
2290
+ CDCC_refundable: bool
2171
2291
  Indicator for whether CDCC is refundable
2172
2292
  c05800: float
2173
2293
  Total (regular + AMT) income tax liability before credits
2174
2294
  e07300: float
2175
2295
  Foreign tax credit from Form 1116
2296
+ c32800: float
2297
+ Child and dependent care expenses capped by policy (not by earnings)
2176
2298
  c07180: float
2177
2299
  Credit for child and dependent care expenses from Form 2441
2178
2300
 
2179
2301
  Returns
2180
2302
  -------
2303
+ c32800: float
2304
+ Child and dependent care expenses capped by policy (not by earnings)
2181
2305
  c07180: float
2182
2306
  Credit for child and dependent care expenses from Form 2441
2307
+ CDCC_refund: float
2308
+ Refundable amount of c07180 amount
2183
2309
  """
2184
2310
  # credit for at most two cared-for individuals and for actual expenses
2185
2311
  max_credit = min(f2441, 2) * CDCC_c
@@ -2190,7 +2316,7 @@ def F2441(MARS, earned_p, earned_s, f2441, CDCC_c, e32800,
2190
2316
  c32890 = earned_s # earned income of spouse when present
2191
2317
  else:
2192
2318
  c32890 = earned_p
2193
- c33000 = max(0., min(c32800, min(c32880, c32890)))
2319
+ c33000 = max(0., min(c32800, c32880, c32890))
2194
2320
  # credit rate is limited at high AGI
2195
2321
  # ... first phase-down from CDCC_crt to CDCC_frt
2196
2322
  steps_fractional = max(0., c00100 - CDCC_ps) / CDCC_po_step_size
@@ -2215,7 +2341,7 @@ def F2441(MARS, earned_p, earned_s, f2441, CDCC_c, e32800,
2215
2341
  else:
2216
2342
  c07180 = min(max(0., c05800 - e07300), c33200)
2217
2343
  CDCC_refund = 0.
2218
- return (c07180, CDCC_refund)
2344
+ return (c32800, c07180, CDCC_refund)
2219
2345
 
2220
2346
 
2221
2347
  @JIT(nopython=True)
@@ -2272,7 +2398,8 @@ def EITC(MARS, DSI, EIC, c00100, e00300, e00400, e00600, c01000,
2272
2398
  Parameters
2273
2399
  ----------
2274
2400
  MARS: int
2275
- Filing (marital) status. (1=single, 2=joint, 3=separate, 4=household-head, 5=widow(er))
2401
+ Filing (marital) status. (1=single, 2=joint, 3=separate,
2402
+ 4=household-head, 5=widow(er))
2276
2403
  DSI: int
2277
2404
  1 if claimed as dependent on another return, otherwise 0
2278
2405
  EIC: int
@@ -2288,7 +2415,8 @@ def EITC(MARS, DSI, EIC, c00100, e00300, e00400, e00600, c01000,
2288
2415
  c01000: float
2289
2416
  Limitation on capital losses
2290
2417
  e02000: float
2291
- Schedule E total rental, royalty, partnership, S-corporation, etc, income/loss
2418
+ Schedule E total rental, royalty, partnership, S-corporation,
2419
+ etc, income/loss
2292
2420
  e26270: float
2293
2421
  Schedule E combined partnership and S-corporation net income/loss
2294
2422
  age_head: int
@@ -2308,7 +2436,8 @@ def EITC(MARS, DSI, EIC, c00100, e00300, e00400, e00600, c01000,
2308
2436
  EITC_MaxEligAge: int
2309
2437
  Maximum age for childless EITC eligibility
2310
2438
  EITC_ps_MarriedJ: list
2311
- Extra earned income credit phaseout start AGI for married filling jointly
2439
+ Extra earned income credit phaseout start AGI for
2440
+ married filling jointly
2312
2441
  EITC_rt: list
2313
2442
  Earned income credit phasein rate
2314
2443
  EITC_c: list
@@ -2432,7 +2561,7 @@ def RefundablePayrollTaxCredit(was_plus_sey_p, was_plus_sey_s,
2432
2561
 
2433
2562
  @iterate_jit(nopython=True)
2434
2563
  def ChildDepTaxCredit(age_head, age_spouse, nu18, n24, MARS, c00100, XTOT, num,
2435
- c05800, e07260, CR_ResidentialEnergy_hc,
2564
+ c05800, e07260, CR_ResidentialEnergy_hc,
2436
2565
  e07300, CR_ForeignTax_hc,
2437
2566
  c07180,
2438
2567
  c07230,
@@ -2450,9 +2579,11 @@ def ChildDepTaxCredit(age_head, age_spouse, nu18, n24, MARS, c00100, XTOT, num,
2450
2579
  Parameters
2451
2580
  ----------
2452
2581
  n24: int
2453
- Number of children who are Child-Tax-Credit eligible, one condition for which is being under age 17
2582
+ Number of children who are Child-Tax-Credit eligible, one condition
2583
+ for which is being under age 17
2454
2584
  MARS: int
2455
- Filing (marital) status. (1=single, 2=joint, 3=separate, 4=household-head, 5=widow(er))
2585
+ Filing (marital) status. (1=single, 2=joint, 3=separate,
2586
+ 4=household-head, 5=widow(er))
2456
2587
  c00100: float
2457
2588
  Adjusted Gross Income (AGI)
2458
2589
  XTOT: int
@@ -2573,7 +2704,8 @@ def PersonalTaxCredit(MARS, c00100, XTOT, nu18,
2573
2704
  Parameters
2574
2705
  ----------
2575
2706
  MARS: int
2576
- Filing (marital) status. (1=single, 2=joint, 3=separate, 4=household-head, 5=widow(er))
2707
+ Filing (marital) status. (1=single, 2=joint, 3=separate,
2708
+ 4=household-head, 5=widow(er))
2577
2709
  c00100: float
2578
2710
  Adjusted Gross Income (AGI)
2579
2711
  XTOT: int
@@ -2633,15 +2765,18 @@ def PersonalTaxCredit(MARS, c00100, XTOT, nu18,
2633
2765
  # calculate Recovery Rebate Credit from CARES Act 2020 and/or ARPA 2021
2634
2766
  if c00100 < RRC_ps[MARS - 1]:
2635
2767
  recovery_rebate_credit = RRC_c * XTOT
2636
- recovery_rebate_credit += RRC_c_unit[MARS-1] + RRC_c_kids * nu18
2637
- elif c00100 < RRC_pe[MARS - 1] and c00100 > 0:
2638
- prt = ((c00100 - RRC_ps[MARS - 1])/
2639
- (RRC_pe[MARS - 1] - RRC_ps[MARS - 1]))
2768
+ recovery_rebate_credit += RRC_c_unit[MARS - 1] + RRC_c_kids * nu18
2769
+ elif 0 < c00100 < RRC_pe[MARS - 1]:
2770
+ prt = (
2771
+ (c00100 - RRC_ps[MARS - 1]) /
2772
+ (RRC_pe[MARS - 1] - RRC_ps[MARS - 1])
2773
+ )
2640
2774
  recovery_rebate_credit = RRC_c * XTOT * (1 - prt)
2641
2775
  else:
2642
2776
  recovery_rebate_credit = max(
2643
- 0, RRC_c_unit[MARS-1] + RRC_c_kids * nu18 - RRC_prt *
2644
- (c00100 - RRC_ps[MARS -1]))
2777
+ 0, RRC_c_unit[MARS - 1] + RRC_c_kids * nu18 - RRC_prt *
2778
+ (c00100 - RRC_ps[MARS - 1])
2779
+ )
2645
2780
  return (personal_refundable_credit, personal_nonrefundable_credit,
2646
2781
  recovery_rebate_credit)
2647
2782
 
@@ -2659,7 +2794,8 @@ def AmOppCreditParts(exact, e87521, num, c00100, CR_AmOppRefundable_hc,
2659
2794
  exact: int
2660
2795
  Whether or not to do rounding of phaseout fraction
2661
2796
  e87521: float
2662
- Total tentative AmOppCredit amount for all students. From Form 8863, line 1.
2797
+ Total tentative AmOppCredit amount for all students.
2798
+ From Form 8863, line 1.
2663
2799
  num: int
2664
2800
  2 when MARS is 2 (married filing jointly), otherwise 1
2665
2801
  c00100: float
@@ -2726,7 +2862,8 @@ def SchR(age_head, age_spouse, MARS, c00100,
2726
2862
  age_spouse: int
2727
2863
  Age in years of spouse (secondary adult, if present)
2728
2864
  MARS: int
2729
- Filing (marital) status. (1=single, 2=joint, 3=separate, 4=household-head, 5=widow(er))
2865
+ Filing (marital) status. (1=single, 2=joint, 3=separate,
2866
+ 4=household-head, 5=widow(er))
2730
2867
  c00100: float
2731
2868
  Adjusted Gross Income (AGI)
2732
2869
  c05800: float
@@ -2810,7 +2947,8 @@ def EducationTaxCredit(exact, e87530, MARS, c00100, c05800,
2810
2947
  e87530: float
2811
2948
  Adjusted qualified lifetime learning expenses for all students
2812
2949
  MARS: int
2813
- Filing (marital) status. (1=single, 2=joint, 3=separate, 4=household-head, 5=widow(er))
2950
+ Filing (marital) status. (1=single, 2=joint, 3=separate,
2951
+ 4=household-head, 5=widow(er))
2814
2952
  c00100: float
2815
2953
  Adjusted Gross Income (AGI)
2816
2954
  c05800: float
@@ -2892,7 +3030,8 @@ def CharityCredit(e19800, e20100, c00100, CR_Charity_rt, CR_Charity_f,
2892
3030
  CR_Charity_frt: float
2893
3031
  Charity credit floor rate
2894
3032
  MARS: int
2895
- Filing (marital) status. (1=single, 2=joint, 3=separate, 4=household-head, 5=widow(er))
3033
+ Filing (marital) status. (1=single, 2=joint, 3=separate,
3034
+ 4=household-head, 5=widow(er))
2896
3035
  charity_credit: float
2897
3036
  Credit for charitable giving
2898
3037
 
@@ -3070,7 +3209,8 @@ def AdditionalCTC(codtc_limited, ACTC_c, n24, earned, ACTC_Income_thd,
3070
3209
  ACTC_c: float
3071
3210
  Maximum refundable additional child tax credit
3072
3211
  n24: int
3073
- Number of children who are Child-Tax-Credit eligible, one condition for which is being under age 17
3212
+ Number of children who are Child-Tax-Credit eligible, one condition
3213
+ for which is being under age 17
3074
3214
  earned: float
3075
3215
  Earned income for filing unit
3076
3216
  ACTC_Income_thd: float
@@ -3080,9 +3220,11 @@ def AdditionalCTC(codtc_limited, ACTC_c, n24, earned, ACTC_Income_thd,
3080
3220
  nu06: int
3081
3221
  Number of dependents under 6 years old
3082
3222
  ACTC_rt_bonus_under6family: float
3083
- Bonus additional child tax credit rate for families with qualifying children under 6
3223
+ Bonus additional child tax credit rate for families with qualifying
3224
+ children under 6
3084
3225
  ACTC_ChildNum: float
3085
- Additional Child Tax Credit minimum number of qualified children for different formula
3226
+ Additional Child Tax Credit minimum number of qualified children for
3227
+ different formula
3086
3228
  ptax_was: float
3087
3229
  Employee and employer OASDI plus HI FICA tax
3088
3230
  c03260: float
@@ -3192,7 +3334,8 @@ def C1040(c05800, c07180, c07200, c07220, c07230, c07240, c07260, c07300,
3192
3334
  c07100: float
3193
3335
  Total non-refundable credits used to reduce positive tax liability
3194
3336
  c09200: float
3195
- Income tax liabilities (including othertaxes) after non-refundable credits are used, but before refundable credits are applied
3337
+ Income tax liabilities (including othertaxes) after non-refundable
3338
+ credits are used, but before refundable credits are applied
3196
3339
  odc: float
3197
3340
  Other Dependent Credit
3198
3341
  charity_credit: float
@@ -3207,7 +3350,8 @@ def C1040(c05800, c07180, c07200, c07220, c07230, c07240, c07260, c07300,
3207
3350
  othertaxes: float
3208
3351
  Sum of niit, e09700, e09800, and e09900
3209
3352
  c09200: float
3210
- Income tax liabilities (including othertaxes) after non-refundable credits are used, but before refundable credits are applied
3353
+ Income tax liabilities (including othertaxes) after non-refundable
3354
+ credits are used, but before refundable credits are applied
3211
3355
  """
3212
3356
  # total used nonrefundable credits (as computed in NonrefundableCredits)
3213
3357
  c07100 = (c07180 + c07200 + c07600 + c07300 + c07400 +
@@ -3240,36 +3384,44 @@ def CTC_new(CTC_new_c, CTC_new_rt, CTC_new_c_under6_bonus,
3240
3384
  CTC_new_rt: float
3241
3385
  New refundalbe child tax credit amount phasein rate
3242
3386
  CTC_new_c_under6_bonus: float
3243
- Bonus new refundable child tax credit maximum for qualifying children under six
3387
+ Bonus new refundable child tax credit maximum for qualifying
3388
+ children under six
3244
3389
  CTC_new_ps: list
3245
3390
  New refundable child tax credit phaseout starting AGI
3246
3391
  CTC_new_prt: float
3247
3392
  New refundable child tax credit amount phaseout rate
3248
3393
  CTC_new_for_all: bool
3249
- Whether or not maximum amount of the new refundable child tax credit is available to all
3394
+ Whether or not maximum amount of the new refundable child tax credit
3395
+ is available to all
3250
3396
  CTC_new_refund_limited: bool
3251
- New child tax credit refund limited to a decimal fraction of payroll taxes
3397
+ New child tax credit refund limited to a decimal fraction of
3398
+ payroll taxes
3252
3399
  CTC_new_refund_limit_payroll_rt: float
3253
- New child tax credit refund limit rate (decimal fraction of payroll taxes)
3400
+ New child tax credit refund limit rate (decimal fraction of
3401
+ payroll taxes)
3254
3402
  CTC_new_refund_limited_all_payroll: bool
3255
- New child tax credit refund limit applies to all FICA taxes, not just OASDI
3403
+ New child tax credit refund limit applies to all FICA taxes, not
3404
+ just OASDI
3256
3405
  payrolltax: float
3257
3406
  Total (employee + employer) payroll tax liability
3258
3407
  exact: int
3259
3408
  Whether or not exact phase-out calculation is being done
3260
3409
  n24: int
3261
- Number of children who are Child-Tax-Credit eligible, one condition for which is being under age 17
3410
+ Number of children who are Child-Tax-Credit eligible, one
3411
+ condition for which is being under age 17
3262
3412
  nu06: int
3263
3413
  Number of dependents under 6 years old
3264
3414
  c00100: float
3265
3415
  Adjusted Gross Income (AGI)
3266
3416
  MARS: int
3267
- Filing (marital) status. (1=single, 2=joint, 3=separate, 4=household-head, 5=widow(er))
3417
+ Filing (marital) status. (1=single, 2=joint, 3=separate,
3418
+ 4=household-head, 5=widow(er))
3268
3419
  ptax_oasdi: float
3269
3420
  Employee and employer OASDI FICA tax plus self employment tax
3270
3421
  Excludes HI FICA so positive ptax_oasdi is less than ptax_was + setax
3271
3422
  c09200: float
3272
- Income tax liabilities (including othertaxes) after non-refundable credits are used, but before refundable credits are applied
3423
+ Income tax liabilities (including othertaxes) after non-refundable
3424
+ credits are used, but before refundable credits are applied
3273
3425
  ctc_new: float
3274
3426
  New refundable child tax credit
3275
3427
 
@@ -3279,9 +3431,9 @@ def CTC_new(CTC_new_c, CTC_new_rt, CTC_new_c_under6_bonus,
3279
3431
  New refundable child tax credit
3280
3432
  """
3281
3433
  if CTC_include17:
3282
- tu18 = int(age_head < 18) # taxpayer is under age 18
3283
- su18 = int(MARS == 2 and age_spouse < 18) # spouse is under age 18
3284
- childnum = n24 + max(0, nu18 - tu18 - su18 - n24)
3434
+ tu18 = int(age_head < 18) # taxpayer is under age 18
3435
+ su18 = int(MARS == 2 and age_spouse < 18) # spouse is under age 18
3436
+ childnum = n24 + max(0, nu18 - tu18 - su18 - n24)
3285
3437
  else:
3286
3438
  childnum = n24
3287
3439
  if childnum > 0:
@@ -3300,8 +3452,7 @@ def CTC_new(CTC_new_c, CTC_new_rt, CTC_new_c_under6_bonus,
3300
3452
  ctc_new = min(ctc_new, ctc_new_reduced)
3301
3453
  if ctc_new > 0. and CTC_new_refund_limited:
3302
3454
  refund_new = max(0., ctc_new - c09200)
3303
- if not CTC_new_refund_limited_all_payroll:
3304
- limit_new = CTC_new_refund_limit_payroll_rt * ptax_oasdi
3455
+ limit_new = CTC_new_refund_limit_payroll_rt * ptax_oasdi
3305
3456
  if CTC_new_refund_limited_all_payroll:
3306
3457
  limit_new = CTC_new_refund_limit_payroll_rt * payrolltax
3307
3458
  limited_new = max(0., refund_new - limit_new)
@@ -3403,7 +3554,8 @@ def Taxes(income, MARS, tbrk_base,
3403
3554
  income: float
3404
3555
  Taxable income
3405
3556
  MARS: int
3406
- Filing (marital) status. (1=single, 2=joint, 3=separate, 4=household-head, 5=widow(er))
3557
+ Filing (marital) status. (1=single, 2=joint, 3=separate,
3558
+ 4=household-head, 5=widow(er))
3407
3559
  tbrk_base: float
3408
3560
  Amount of income used to determine the braket the filer is in
3409
3561
  rate1: list
@@ -3596,7 +3748,8 @@ def FairShareTax(c00100, MARS, ptax_was, setax, ptax_amc,
3596
3748
  c00100: float
3597
3749
  Adjusted Gross Income (AGI)
3598
3750
  MARS: int
3599
- Filing (marital) status. (1=single, 2=joint, 3=separate, 4=household-head, 5=widow(er))
3751
+ Filing (marital) status. (1=single, 2=joint, 3=separate,
3752
+ 4=household-head, 5=widow(er))
3600
3753
  ptax_was: float
3601
3754
  Employee and employer OASDI plus HI FICA tax
3602
3755
  setax: float
@@ -3717,7 +3870,8 @@ def ExpandIncome(e00200, pencon_p, pencon_s, e00300, e00400, e00600,
3717
3870
  e01500: float
3718
3871
  Total pensions and annuities
3719
3872
  e02000: float
3720
- Schedule E total rental, royalty, partnership, S-corporation, etc, income/loss
3873
+ Schedule E total rental, royalty, partnership, S-corporation,
3874
+ etc, income/loss
3721
3875
  e02100: float
3722
3876
  Farm net income/loss for filing unit from Schedule F
3723
3877
  p22250: float
@@ -3729,7 +3883,8 @@ def ExpandIncome(e00200, pencon_p, pencon_s, e00300, e00400, e00600,
3729
3883
  ptax_was: float
3730
3884
  Employee and employer OASDI and HI FICA tax
3731
3885
  benefit_value_total: float
3732
- Consumption value of all benefits received by tax unit, which is included in expanded income
3886
+ Consumption value of all benefits received by tax unit, which
3887
+ is included in expanded income
3733
3888
  expanded_income: float
3734
3889
  Broad income measure that includes benefit_value_total
3735
3890