From 9a8fe7006795471638e91f6e810a39c3ba2afe1f Mon Sep 17 00:00:00 2001 From: Marvin Kastner Date: Tue, 20 Aug 2024 17:32:02 +0200 Subject: [PATCH] Fix qodana issues --- conflowgen/analyses/abstract_analysis.py | 2 +- .../application/services/export_container_flow_service.py | 2 +- docs/conf.py | 2 +- setup.py | 1 + 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/conflowgen/analyses/abstract_analysis.py b/conflowgen/analyses/abstract_analysis.py index c5fbad4d..9361a0bd 100644 --- a/conflowgen/analyses/abstract_analysis.py +++ b/conflowgen/analyses/abstract_analysis.py @@ -119,7 +119,7 @@ def _restrict_container_picked_up_by_vehicle_type( if container_picked_up_by_vehicle_type == "scheduled vehicles": container_picked_up_by_vehicle_type = ModeOfTransport.get_scheduled_vehicles() list_of_vehicle_types = container_picked_up_by_vehicle_type - if hashable(container_picked_up_by_vehicle_type) \ + elif hashable(container_picked_up_by_vehicle_type) \ and container_picked_up_by_vehicle_type in set(ModeOfTransport): selected_containers = selected_containers.where( Container.picked_up_by == container_picked_up_by_vehicle_type diff --git a/conflowgen/application/services/export_container_flow_service.py b/conflowgen/application/services/export_container_flow_service.py index 251aa174..bdd59ab2 100644 --- a/conflowgen/application/services/export_container_flow_service.py +++ b/conflowgen/application/services/export_container_flow_service.py @@ -149,7 +149,7 @@ def _convert_table_to_pandas_dataframe( # extract data from sql database data = list(model.select().dicts()) - if type(model) == ModelSelect: # pylint: disable=unidiomatic-typecheck # TODO: check if isinstance works + if isinstance(model, ModelSelect): model = model.model foreign_keys_to_resolve = {} diff --git a/docs/conf.py b/docs/conf.py index 6590cf2f..efb4a3ad 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -193,7 +193,7 @@ database_names = ["demo_continental_gateway", "demo_deham_cta", "demo_poc"] # List of database names to download sqlite_databases_directory = "notebooks/data/prepared_dbs/" os.system("echo 'Current directory:'") - os.system("pwd") # Print current directory; we expect to be in the docs folder + os.system("pwd") # Print current directory; we expect to be in the docs folder os.makedirs(sqlite_databases_directory, exist_ok=True) # Create the destination folder if it doesn't exist for database_name in database_names: os.system(f'echo "Fetching {database_name}"') diff --git a/setup.py b/setup.py index 63fed8d0..6b83f9b8 100644 --- a/setup.py +++ b/setup.py @@ -53,6 +53,7 @@ 'parameterized', # for parameterized testing 'seaborn', # some visuals in unittests are generated by seaborn 'nbconvert', # used to run tests in Jupyter notebooks, see ./test/notebooks/test_run_notebooks.py + 'nbformat', # used to run tests in Jupyter notebooks # build documentation 'sphinx >=6.2', # build the documentation - restrict version to improve pip version resolution