Skip to content

Commit

Permalink
Fix pylint R1703 and R1705 warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
martinholmer committed Jan 3, 2025
1 parent aabb7e3 commit 36c86ff
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 24 deletions.
3 changes: 1 addition & 2 deletions taxcalc/calculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,7 @@ def policy_param(self, param_name, param_value=None):
val = getattr(self.__policy, param_name)
if param_name.startswith("_"):
return val
else:
return val[0] # drop down a dimension.
return val[0] # drop down a dimension.
setattr(self.__policy, param_name, param_value)
return None

Expand Down
13 changes: 5 additions & 8 deletions taxcalc/parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -491,8 +491,7 @@ def get_index_rate(self, param, label_to_extend_val):
self.set_rates()
if param in self._wage_indexed:
return self.wage_growth_rates(year=label_to_extend_val)
else:
return self.inflation_rates(year=label_to_extend_val)
return self.inflation_rates(year=label_to_extend_val)

def set_rates(self):
"""
Expand Down Expand Up @@ -774,8 +773,7 @@ def __getattr__(self, attr):
return self.to_array(
attr[1:], year=list(range(self.start_year, self.end_year + 1))
)
else:
raise AttributeError(f"{attr} is not defined.")
raise AttributeError(f"{attr} is not defined.")


TaxcalcReform = Union[str, Mapping[int, Any]]
Expand Down Expand Up @@ -815,7 +813,6 @@ def is_paramtools_format(params: Union[TaxcalcReform, ParamToolsAdjustment]):
for data in params.values():
if isinstance(data, dict):
return False # taxcalc reform
else:
# Not doing a specific check to see if the value is a list
# since it could be a list or just a scalar value.
return True
# Not doing a specific check to see if the value is a list
# since it could be a list or just a scalar value.
return True
5 changes: 2 additions & 3 deletions taxcalc/tests/test_compare.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,12 +264,11 @@ def isfloat(value):
if abs(float(tok1) - float(tok2)) <= smallamt:
continue
return True
elif not tok1_isfloat and not tok2_isfloat:
if not tok1_isfloat and not tok2_isfloat:
if tok1 == tok2:
continue
return True
else:
return True
return True
return False


Expand Down
5 changes: 2 additions & 3 deletions taxcalc/tests/test_cpscsv.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,12 +154,11 @@ def isfloat(value):
if abs(float(tok1) - float(tok2)) <= smallamt:
continue
return True
elif not tok1_isfloat and not tok2_isfloat:
if not tok1_isfloat and not tok2_isfloat:
if tok1 == tok2:
continue
return True
else:
return True
return True
return False


Expand Down
6 changes: 1 addition & 5 deletions taxcalc/tests/test_growdiff.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,7 @@ def test_boolean_value_infomation(tests_path):
val = val[0]
if isinstance(val, list):
val = val[0]
valstr = str(val)
if valstr in ('True', 'False'):
val_is_boolean = True
else:
val_is_boolean = False
val_is_boolean = str(val) in ('True', 'False')
type_is_boolean = gdd[param]['type'] == 'bool'
if val_is_boolean and not type_is_boolean:
print('param,value_type,val,val_is_boolean=',
Expand Down
5 changes: 2 additions & 3 deletions taxcalc/tests/test_pufcsv.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,12 +179,11 @@ def isfloat(value):
if abs(float(tok1) - float(tok2)) <= smallamt:
continue
return True
elif not tok1_isfloat and not tok2_isfloat:
if not tok1_isfloat and not tok2_isfloat:
if tok1 == tok2:
continue
return True
else:
return True
return True
return False


Expand Down

0 comments on commit 36c86ff

Please sign in to comment.