From acd9e91242f22edae244d3faddfbdf798636acb7 Mon Sep 17 00:00:00 2001 From: Shane Jaroch Date: Sat, 18 Jun 2022 23:03:42 -0400 Subject: [PATCH] lint --- .pylintrc | 11 +++++++++++ setup.cfg | 33 +++++++++++++++++++++++++++++++++ sql/__init__.py | 6 +++--- 3 files changed, 47 insertions(+), 3 deletions(-) create mode 100644 .pylintrc create mode 100644 setup.cfg diff --git a/.pylintrc b/.pylintrc new file mode 100644 index 0000000..6a8a02a --- /dev/null +++ b/.pylintrc @@ -0,0 +1,11 @@ +[MASTER] + +fail-under=10 + + +[MESSAGES CONTROL] + +disable= + fixme, + consider-using-f-string, + diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..daec0d4 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,33 @@ +[pycodestyle] +max-line-length = 88 + + +[flake8] +per-file-ignores = + # Allow unused imports in __init__.py files + __init__.py:F401 + +max-line-length = 88 + +ignore = + W503, # line break before binary operator + + +[isort] +line_length=88 +known_first_party=sql + +# See: https://copdips.com/2020/04/making-isort-compatible-with-black.html +multi_line_output=3 +include_trailing_comma=true + + +[mypy] +ignore_missing_imports = True +show_error_codes = True +disable_error_code = import +disallow_untyped_calls = True +disallow_untyped_decorators = True +strict_optional = False +warn_redundant_casts = True +warn_unused_ignores = True diff --git a/sql/__init__.py b/sql/__init__.py index 0fe25d8..e44d253 100755 --- a/sql/__init__.py +++ b/sql/__init__.py @@ -9,7 +9,7 @@ NT_DB_NAME = "nt.sqlite" SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) -def build_ntsqlite(verbose=False): +def build_ntsqlite(verbose=False) -> bool: """Builds and inserts stock data into nt.sqlite""" # cd into this script's directory os.chdir(SCRIPT_DIR) @@ -39,8 +39,8 @@ def build_ntsqlite(verbose=False): # Loop over CSV files with open(file_path_full, encoding="utf-8") as csv_file: - reader = csv.DictReader(csv_file) - values = ",".join("?" * len(reader.fieldnames)) + dict_reader = csv.DictReader(csv_file) + values = ",".join("?" * len(dict_reader.fieldnames)) reader = csv.reader(csv_file) query = "INSERT INTO {0} VALUES ({1});".format( # nosec: B608 table_name, values -- 2.52.0