Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Format-only changes that remove error-prone backslash continuations #1036

Merged
merged 1 commit into from
Nov 6, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions taxcalc/filings/forms/us1040.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,14 @@ def to_evars_indirect(self):

# e07600 - Prior year minimum tax credit
line = self.__EVAR_INDIRECT_FIELDS[self.year]['e07600']
if fields.get(line) and fields.get(line + 'b') and \
not (fields.get(line + 'a') or fields.get(line + 'c')):
if (fields.get(line) and fields.get(line + 'b') and
not (fields.get(line + 'a') or fields.get(line + 'c'))):
results['e07600'] = string_to_number(fields[line])

# e09800 - Social security tax on tip income
line = self.__EVAR_INDIRECT_FIELDS[self.year]['e09800']
if fields.get(line) and fields.get(line + 'a') and \
not fields.get(line + 'b'):
if (fields.get(line) and fields.get(line + 'a') and
not fields.get(line + 'b')):
results['e09800'] = string_to_number(fields[line])

return results
4 changes: 2 additions & 2 deletions taxcalc/filings/forms/us1040sa.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ def to_evars_indirect(self):
fields = self._fields

# e18400 - State and local income taxes
if fields.get('line5') and fields.get('line5a') and \
not fields.get('line5b'):
if (fields.get('line5') and fields.get('line5a') and
not fields.get('line5b')):
results['e18400'] = string_to_number(fields['line5'])

return results
39 changes: 18 additions & 21 deletions taxcalc/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -832,19 +832,18 @@ def EITC(MARS, DSI, EIC, c00100, e00300, e00400, e00600, c01000,
# (assume that an unknown age_* value implies EITC age eligibility)
# pylint: disable=bad-continuation,too-many-boolean-expressions
if MARS == 2:
if (age_head >= EITC_MinEligAge and
age_head <= EITC_MaxEligAge) or \
(age_spouse >= EITC_MinEligAge and
age_spouse <= EITC_MaxEligAge) or \
age_head == 0 or \
age_spouse == 0:
if (age_head == 0 or age_spouse == 0 or
(age_head >= EITC_MinEligAge and
age_head <= EITC_MaxEligAge) or
(age_spouse >= EITC_MinEligAge and
age_spouse <= EITC_MaxEligAge)):
c59660 = eitc
else:
c59660 = 0.
else: # if MARS != 2
if (age_head >= EITC_MinEligAge and
age_head <= EITC_MaxEligAge) or \
age_head == 0:
if (age_head == 0 or
(age_head >= EITC_MinEligAge and
age_head <= EITC_MaxEligAge)):
c59660 = eitc
else:
c59660 = 0.
Expand Down Expand Up @@ -1226,18 +1225,16 @@ def BenefitSurtax(calc):
adds the surtax amount to income tax, combined tax, and surtax liabilities.
"""
if calc.policy.ID_BenefitSurtax_crt != 1.:
benefit = ComputeBenefit(calc, calc.policy.ID_BenefitSurtax_Switch)
benefit_deduction = (calc.policy.ID_BenefitSurtax_crt *
calc.records.c00100)
benefit_exemption = \
calc.policy.ID_BenefitSurtax_em[calc.records.MARS - 1]
benefit_surtax = calc.policy.ID_BenefitSurtax_trt * np.where(
benefit > (benefit_deduction + benefit_exemption),
benefit - (benefit_deduction + benefit_exemption), 0.)
# add benefit_surtax to income & combined taxes and to surtax subtotal
calc.records._iitax += benefit_surtax
calc.records._combined += benefit_surtax
calc.records._surtax += benefit_surtax
ben = ComputeBenefit(calc, calc.policy.ID_BenefitSurtax_Switch)
ben_deduct = (calc.policy.ID_BenefitSurtax_crt * calc.records.c00100)
ben_exempt = calc.policy.ID_BenefitSurtax_em[calc.records.MARS - 1]
ben_surtax = calc.policy.ID_BenefitSurtax_trt * np.where(
ben > (ben_deduct + ben_exempt),
ben - (ben_deduct + ben_exempt), 0.)
# add ben_surtax to income & combined taxes and to surtax subtotal
calc.records._iitax += ben_surtax
calc.records._combined += ben_surtax
calc.records._surtax += ben_surtax


def BenefitLimitation(calc):
Expand Down
4 changes: 2 additions & 2 deletions taxcalc/simpletaxio.py
Original file line number Diff line number Diff line change
Expand Up @@ -554,8 +554,8 @@ def _validate_input(self):
raise ValueError(msg.format(num_all_dependents, lnum))
agecode = var[6]
if agecode < 100: # using old Internet-TAXSIM agecode
if (filing_status == 2 and agecode > 2) or \
(filing_status != 2 and agecode > 1):
if ((filing_status == 2 and agecode > 2) or
(filing_status != 2 and agecode > 1)):
msg = ('var[6]={} on line {} of simtax INPUT is has '
'illegal value')
raise ValueError(msg.format(agecode, lnum))
Expand Down
7 changes: 2 additions & 5 deletions taxcalc/tests/test_decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,9 @@ def Magic_calc(x, y, z):

def Magic(pm, pf):
# Adjustments
outputs = \
pf.a, pf.b = Magic_calc(pm, pf)

outputs = pf.a, pf.b = Magic_calc(pm, pf)
header = ['a', 'b']
return DataFrame(data=np.column_stack(outputs),
columns=header)
return DataFrame(data=np.column_stack(outputs), columns=header)


@iterate_jit(nopython=True)
Expand Down
6 changes: 3 additions & 3 deletions taxcalc/tests/test_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ def test_calc_and_used_vars(tests_path):
found_error2 = False
msg2 = 'calculated & returned variables are not function arguments\n'
for fname in fnames:
if fname == 'ComputeBenefit' or \
fname == 'BenefitSurtax' or \
fname == 'BenefitLimitation':
if (fname == 'ComputeBenefit' or
fname == 'BenefitSurtax' or
fname == 'BenefitLimitation'):
continue # because fname is not really a function
crvars_set = set(cvars[fname]) & set(rvars[fname])
if not crvars_set <= set(fargs[fname]):
Expand Down
15 changes: 6 additions & 9 deletions taxcalc/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,17 +346,14 @@ def add_columns(pdf):
"""
# weight of returns with positive AGI and
# itemized deduction greater than standard deduction
pdf['c04470'] = \
pdf['c04470'].where(((pdf['c00100'] > 0.) &
(pdf['c04470'] > pdf['_standard'])), 0.)
pdf['c04470'] = pdf['c04470'].where(
((pdf['c00100'] > 0.) & (pdf['c04470'] > pdf['_standard'])), 0.)
# weight of returns with positive AGI and itemized deduction
pdf['num_returns_ItemDed'] = \
pdf['s006'].where(((pdf['c00100'] > 0.) &
(pdf['c04470'] > 0.)), 0.)
pdf['num_returns_ItemDed'] = pdf['s006'].where(
((pdf['c00100'] > 0.) & (pdf['c04470'] > 0.)), 0.)
# weight of returns with positive AGI and standard deduction
pdf['num_returns_StandardDed'] = \
pdf['s006'].where(((pdf['c00100'] > 0.) &
(pdf['_standard'] > 0.)), 0.)
pdf['num_returns_StandardDed'] = pdf['s006'].where(
((pdf['c00100'] > 0.) & (pdf['_standard'] > 0.)), 0.)
# weight of returns with positive Alternative Minimum Tax (AMT)
pdf['num_returns_AMT'] = pdf['s006'].where(pdf['c09600'] > 0., 0.)
return pdf
Expand Down