From: Shane Jaroch Date: Tue, 19 Jul 2022 14:54:01 +0000 (-0400) Subject: resolve some mypy errors? Idk about this verbosity X-Git-Url: https://git.nutra.tk/v2?a=commitdiff_plain;h=f76955d55293d166f833befbab2c52447d0cd07e;p=nutratech%2Fnt-sqlite.git resolve some mypy errors? Idk about this verbosity --- diff --git a/sql/__init__.py b/sql/__init__.py index dfbe034..78326cf 100755 --- a/sql/__init__.py +++ b/sql/__init__.py @@ -10,7 +10,7 @@ SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) CSV_DATA_DIR = os.path.join(SCRIPT_DIR, "data") -def build_ntsqlite(verbose=False) -> bool: +def build_ntsqlite(verbose: bool = False) -> bool: """Builds and inserts stock data into nt.sqlite3""" # cd into this script's directory os.chdir(SCRIPT_DIR) @@ -43,7 +43,7 @@ def build_ntsqlite(verbose=False) -> bool: # Loop over CSV files with open(file_path_full, encoding="utf-8") as csv_file: dict_reader = csv.DictReader(csv_file) - values = ",".join("?" * len(dict_reader.fieldnames)) + values = ",".join("?" * len(dict_reader.fieldnames or [])) reader = csv.reader(csv_file) # pylint: disable=consider-using-f-string query = "INSERT INTO {0} VALUES ({1});".format( # nosec: B608