@@ -2220,15 +2220,13 @@ def GainsTax(e00650, c01000, c23650, p23250, e01100, e58990,
22202220 Regular tax on regular taxable income before credits
22212221 """
22222222 # pylint: disable=too-many-statements
2223- if c01000 > 0. or c23650 > 0. or p23250 > 0. or e01100 > 0. or e00650 > 0. :
2224- hasqdivltcg = 1 # has qualified dividends or long-term capital gains
2225- else :
2226- hasqdivltcg = 0 # no qualified dividends or long-term capital gains
2227-
2228- if CG_nodiff :
2229- hasqdivltcg = 0 # no special taxation of qual divids and l-t cap gains
2223+ has_qdivltcg = (
2224+ not CG_nodiff and
2225+ (c01000 > 0. or c23650 > 0. or p23250 > 0. or
2226+ e01100 > 0. or e00650 > 0. )
2227+ )
22302228
2231- if hasqdivltcg == 1 :
2229+ if has_qdivltcg :
22322230
22332231 # ---- Sch D TW lines 1-10 (common to QDCGTW) ----------------------
22342232 dwks1 = c04800 # line 1: taxable income
@@ -2245,10 +2243,10 @@ def GainsTax(e00650, c01000, c23650, p23250, e01100, e58990,
22452243 # filed) and to reduce dwks9 by negative e58990. See BUG? note in
22462244 # CODE_REVIEW_2025.md row 17.
22472245 if e01100 > 0. :
2248- c24510 = e01100
2246+ line9_base = e01100
22492247 else :
2250- c24510 = max (0. , dwks7 ) + e01100
2251- dwks9 = max (0. , c24510 - min (0. , e58990 )) # line 9
2248+ line9_base = max (0. , dwks7 ) + e01100
2249+ dwks9 = max (0. , line9_base - min (0. , e58990 )) # line 9
22522250 dwks10 = dwks6 + dwks9 # line 10
22532251
22542252 # ---- Sch D TW lines 11-13 (Sch D TW only; vanish in QDCGTW) -----
@@ -2310,7 +2308,7 @@ def GainsTax(e00650, c01000, c23650, p23250, e01100, e58990,
23102308 dwks45 = min (dwks43 , dwks44 ) # line 45: smaller of 43, 44
23112309 c24580 = dwks45
23122310
2313- else : # if hasqdivltcg is zero
2311+ else : # no qualified-rate preference
23142312
23152313 c24580 = c05200
23162314 dwks10 = max (0. , min (p23250 , c23650 )) + e01100
@@ -2319,10 +2317,10 @@ def GainsTax(e00650, c01000, c23650, p23250, e01100, e58990,
23192317 dwks18 = 0.
23202318 dwks43 = 0.
23212319
2322- # final calculations done no matter what the value of hasqdivltcg
2323- c05100 = c24580 # because foreign earned income exclusion is assumed zero
2324- c05700 = 0. # no Form 4972, Lump Sum Distributions
2325- taxbc = c05700 + c05100
2320+ # final assembly (foreign earned income exclusion assumed zero, so
2321+ # c05100 = c24580; Form 4972 lump-sum distributions not modeled)
2322+ c05700 = 0.
2323+ taxbc = c24580
23262324 return (dwks10 , dwks13 , dwks14 , dwks18 , dwks43 , c05700 , taxbc )
23272325
23282326
0 commit comments