Skip to content

Commit

Permalink
Merge pull request #1259 from martinholmer/pylint-style-changes
Browse files Browse the repository at this point in the history
Style revisions to eliminate pylint warnings
  • Loading branch information
martinholmer authored Mar 23, 2017
2 parents d2fefbd + e7b58a8 commit 2815c37
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 17 deletions.
2 changes: 1 addition & 1 deletion taxcalc/behavior.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,6 @@
"row_label": ["2013"],
"col_label": "",
"value": [0.0],
"validations": {"max":0.0}
"validations": {"max": 0.0}
}
}
26 changes: 12 additions & 14 deletions taxcalc/behavior.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,12 @@ def has_response(self):
the current_year; returns false if all elasticities are zero.
"""
# pylint: disable=no-member
if (self.BE_sub == 0.0 and self.BE_inc == 0.0 and self.BE_cg == 0.0 and
self.BE_charity_itemizers == 0.0 and
self.BE_charity_non_itemizers == 0.0):
return False
else:
return True
all_zero = (self.BE_sub == 0.0 and
self.BE_inc == 0.0 and
self.BE_cg == 0.0 and
self.BE_charity_itemizers == 0.0 and
self.BE_charity_non_itemizers == 0.0)
return not all_zero

def has_any_response(self):
"""
Expand Down Expand Up @@ -184,10 +184,9 @@ def response(calc_x, calc_y):
new_ltcg = calc_x.records.p23250 * exp_term
ltcg_chg = new_ltcg - calc_x.records.p23250
# calculate charitable giving effect
if (calc_y.behavior.BE_charity_itemizers == 0.0 and
calc_y.behavior.BE_charity_non_itemizers == 0.0):
charity_itemizers = np.zeros(calc_x.records.dim)
charity_non_itemizers = np.zeros(calc_x.records.dim)
no_charity_response = (calc_y.behavior.BE_charity_itemizers == 0.0 and
calc_y.behavior.BE_charity_non_itemizers == 0.0)
if no_charity_response:
c_charity_chg = np.zeros(calc_x.records.dim)
nc_charity_chg = np.zeros(calc_x.records.dim)
else:
Expand All @@ -198,14 +197,12 @@ def response(calc_x, calc_y):
c_charity_mtr_x, c_charity_mtr_y = Behavior._mtr_xy(
calc_x, calc_y, mtr_of='e19800', tax_type='combined')
c_charity_price_pch = (((1. + c_charity_mtr_y) /
(1. + c_charity_mtr_x)) -
1.)
(1. + c_charity_mtr_x)) - 1.)
# non-cash:
nc_charity_mtr_x, nc_charity_mtr_y = Behavior._mtr_xy(
calc_x, calc_y, mtr_of='e20100', tax_type='combined')
nc_charity_price_pch = (((1. + nc_charity_mtr_y) /
(1. + nc_charity_mtr_x)) -
1.)
(1. + nc_charity_mtr_x)) - 1.)
# identify itemizers under calc_y
itemizer = np.where(calc_y.records.c04470 >
calc_y.records._standard,
Expand Down Expand Up @@ -241,6 +238,7 @@ def _validate_elasticity_values(self):
"""
Check that behavioral-response elasticities have valid values.
"""
# pylint: disable=too-many-branches
msg = '{} elasticity cannot be {} in year {}; value is {}'
pos = 'positive'
neg = 'negative'
Expand Down
4 changes: 2 additions & 2 deletions taxcalc/tests/test_taxcalcio.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ def test_ceeu_with_behavior(lumpsumreformfile, assumpfile2):
assert tcio.tax_year() == taxyear


def test_bad_ctor_when_using_growmodel(lumpsumreformfile, assumpfile2):
def test_bad_ctor_with_growmodel(lumpsumreformfile, assumpfile2):
"""
Test improper TaxCalcIO constructor calls when using GrowModel analysis.
"""
Expand Down Expand Up @@ -513,7 +513,7 @@ def test_bad_assumption_file(reformfile1, assumpfile_bad1):
exact_calculations=False)


def test_growmodel_analysis(reformfile1, assumpfile1, assumpfile2):
def test_growmodel_analysis(reformfile1, assumpfile1):
"""
Test TaxCalcIO.growmodel_analysis method with no output.
"""
Expand Down

0 comments on commit 2815c37

Please sign in to comment.