diff --git a/mypy.ini b/mypy.ini new file mode 100644 index 0000000..976ba02 --- /dev/null +++ b/mypy.ini @@ -0,0 +1,2 @@ +[mypy] +ignore_missing_imports = True diff --git a/pyseed/seed_client.py b/pyseed/seed_client.py index bf92b0c..5f29800 100644 --- a/pyseed/seed_client.py +++ b/pyseed/seed_client.py @@ -3,20 +3,17 @@ See also https://github.com/seed-platform/py-seed/main/LICENSE """ -# Imports from Standard Library -from typing import Any, Dict, List, Optional, Set, Tuple, Union - -# Imports from Third Party Modules import json import logging -import openpyxl import os import time from collections import Counter from csv import DictReader from datetime import date from pathlib import Path -from urllib.parse import _NetlocResultMixinStr +from typing import Any, Dict, List, Optional, Union + +from openpyxl import Workbook # Local Imports from pyseed.seed_client_base import SEEDReadWriteClient @@ -1347,7 +1344,7 @@ def download_pm_report(self, pm_username: str, pm_password: str, pm_template: Di properties = response["properties"] # Create an XLSX workbook object. - workbook = openpyxl.Workbook() + workbook = Workbook() # Create a sheet object in the workbook. sheet = workbook.active @@ -1360,14 +1357,16 @@ def download_pm_report(self, pm_username: str, pm_password: str, pm_template: Di header_row.append(key) # Write the header row to the sheet object. - sheet.append(header_row) + if sheet: + sheet.append(header_row) # Loop over the list of dictionaries and write the data to the sheet object. for property in properties: row = [] for key in header_row: row.append(property[key]) - sheet.append(row) + if sheet: + sheet.append(row) # Report Template name report_template_name = pm_template['name'] diff --git a/requirements-test.txt b/requirements-test.txt index 8d50798..39ec4a5 100644 --- a/requirements-test.txt +++ b/requirements-test.txt @@ -1,9 +1,7 @@ -r requirements.txt flake8==4.0.1 mock==4.0.3 -mypy==0.910 -openpyxl==3.1.2 -openpyxl-stubs>=0.1.24 +mypy==1.10.0 pre-commit==2.19.0 pytest==7.1.2 pytest-cov==3.0.0