Skip to content

Commit

Permalink
Fix pylint warnings in docs/guide/make/*py files
Browse files Browse the repository at this point in the history
  • Loading branch information
martinholmer committed Jan 4, 2025
1 parent 2bfee11 commit cf704ef
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
9 changes: 6 additions & 3 deletions docs/guide/make/make_io_vars.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import taxcalc as tc
"""
Helper functions used in make_uguide.py module.
"""
import pandas as pd
import numpy as np
import taxcalc as tc


def make_io_vars(path, iotype):
Expand Down Expand Up @@ -34,7 +37,7 @@ def form_one(row):
txt = '_IRS Form Location:_ \n'
formdict = row.form
for yrange in sorted(formdict.keys()):
txt += '{}: {} \n'.format(yrange, formdict[yrange])
txt += f'{yrange}: {formdict[yrange]} \n'
return txt

def form(df):
Expand Down Expand Up @@ -66,7 +69,7 @@ def create_io_df(path, iotype):
DataFrame including input and output variables.
"""
# Read json file and convert to a dict.
with open(path) as vfile:
with open(path, 'r', encoding='utf-8') as vfile:
json_text = vfile.read()
variables = tc.json_to_dict(json_text)
assert isinstance(variables, dict)
Expand Down
8 changes: 5 additions & 3 deletions docs/guide/make/make_params.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
"""
Helper functions used in make_uguide.py module.
"""
import os
from collections import OrderedDict
import numpy as np
import pandas as pd
import taxcalc as tc
Expand All @@ -14,7 +16,7 @@
END_YEAR_SHORT = 2020
END_YEAR_LONG = 2027

# Order for policy_params.md.
# Order for policy_params.md
SECTION_1_ORDER = ['Parameter Indexing',
'Payroll Taxes',
'Social Security Taxability',
Expand Down Expand Up @@ -45,7 +47,7 @@ def make_params(path, ptype):
Returns:
Single string with all parameter information.
"""
with open(path) as pfile:
with open(path, 'r', encoding='utf-8') as pfile:
json_text = pfile.read()
params = tc.json_to_dict(json_text)
df = pd.DataFrame(params).transpose().drop('schema')
Expand Down
8 changes: 6 additions & 2 deletions docs/guide/make/make_uguide.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import os
import sys
# Other scripts in this folder:
# pylint: disable=import-error
from make_params import make_params
from make_io_vars import make_io_vars

Expand All @@ -33,6 +33,9 @@


def main():
"""
High-level logic.
"""
# Policy parameters.
policy_param_text = make_params(POLICY_PATH, 'policy')
write_file(policy_param_text, 'policy_params')
Expand All @@ -52,7 +55,8 @@ def main():


def write_file(text, file):
""" Writes the concatenation of a template and calculated text to a file.
"""
Writes the concatenation of a template and calculated text to a file.
Args:
text: String with calculated documentation.
Expand Down

0 comments on commit cf704ef

Please sign in to comment.