From 40d27a8eb12a21957f0752244e3ae3b16fb175d2 Mon Sep 17 00:00:00 2001 From: Sebastian Allard Date: Thu, 10 Aug 2023 16:26:14 +0200 Subject: [PATCH] Remove unused imports (#415)(patch) ### Fixed - Removed unused package imports --- cg_lims/EPPs/files/hamilton/normalization_file.py | 2 +- cg_lims/EPPs/move/rerun_samples.py | 2 +- cg_lims/EPPs/udf/calculate/calculate_water_volume_rna.py | 2 +- cg_lims/EPPs/udf/copy/artifact_to_artifact.py | 2 +- cg_lims/EPPs/udf/copy/artifact_to_sample.py | 3 --- cg_lims/EPPs/udf/copy/original_well_to_sample.py | 3 --- cg_lims/EPPs/udf/copy/process_to_sample.py | 4 ---- cg_lims/EPPs/udf/copy/qc_to_sample.py | 2 -- cg_lims/EPPs/udf/set/set_method.py | 4 ++-- cg_lims/get/files.py | 4 +--- cg_lims/models/api/master_steps/pool_samples_twist_v2.py | 2 +- cg_lims/objects.py | 3 +-- cg_lims/put/queue.py | 3 +-- cg_lims/scripts/one_time_scripts/load_arnold_flowcells.py | 1 - cg_lims/set/udfs.py | 1 + tests/EPPs/arnold/test_arnold_novaseq_standard.py | 2 +- tests/EPPs/files/test_make_kapa_csv.py | 1 - .../udf/calculate/test_calculate_average_size_and_set_qc.py | 5 ++--- tests/EPPs/udf/calculate/test_maf_calculate_volume.py | 1 - .../EPPs/udf/copy/test_aggregate_qc_flags_and_copy_fields.py | 5 ++--- tests/EPPs/udf/copy/test_measurement_to_analyte.py | 4 ++-- tests/EPPs/udf/set/test_qc_to_sample.py | 5 ++--- tests/EPPs/udf/set/test_set_method.py | 1 - tests/commands/test_base.py | 1 - tests/conftest.py | 4 ++-- 25 files changed, 22 insertions(+), 45 deletions(-) diff --git a/cg_lims/EPPs/files/hamilton/normalization_file.py b/cg_lims/EPPs/files/hamilton/normalization_file.py index 1b41697b..ffed7f83 100644 --- a/cg_lims/EPPs/files/hamilton/normalization_file.py +++ b/cg_lims/EPPs/files/hamilton/normalization_file.py @@ -10,7 +10,7 @@ from cg_lims import options from cg_lims.EPPs.files.hamilton.models import BarcodeFileRow from cg_lims.exceptions import LimsError, MissingUDFsError -from cg_lims.files.manage_csv_files import build_csv, sort_csv, sort_csv_plate_and_tube +from cg_lims.files.manage_csv_files import build_csv, sort_csv_plate_and_tube from cg_lims.get.artifacts import get_artifacts LOG = logging.getLogger(__name__) diff --git a/cg_lims/EPPs/move/rerun_samples.py b/cg_lims/EPPs/move/rerun_samples.py index 1e150a61..c852ea3f 100644 --- a/cg_lims/EPPs/move/rerun_samples.py +++ b/cg_lims/EPPs/move/rerun_samples.py @@ -5,7 +5,7 @@ from typing import List import click -from genologics.entities import Artifact, Process, Stage +from genologics.entities import Artifact from genologics.lims import Lims from cg_lims import options diff --git a/cg_lims/EPPs/udf/calculate/calculate_water_volume_rna.py b/cg_lims/EPPs/udf/calculate/calculate_water_volume_rna.py index ec7c8a26..216d2eb5 100644 --- a/cg_lims/EPPs/udf/calculate/calculate_water_volume_rna.py +++ b/cg_lims/EPPs/udf/calculate/calculate_water_volume_rna.py @@ -8,7 +8,7 @@ import click from genologics.entities import Artifact -from cg_lims.exceptions import InvalidValueError, LimsError, MissingUDFsError +from cg_lims.exceptions import LimsError, MissingUDFsError from cg_lims.get.artifacts import get_artifacts LOG = logging.getLogger(__name__) diff --git a/cg_lims/EPPs/udf/copy/artifact_to_artifact.py b/cg_lims/EPPs/udf/copy/artifact_to_artifact.py index 387b8aaa..c17a97fc 100644 --- a/cg_lims/EPPs/udf/copy/artifact_to_artifact.py +++ b/cg_lims/EPPs/udf/copy/artifact_to_artifact.py @@ -1,4 +1,4 @@ -from typing import List, Optional, Tuple, Iterator +from typing import List, Optional, Tuple from genologics.entities import Artifact from genologics.lims import Lims diff --git a/cg_lims/EPPs/udf/copy/artifact_to_sample.py b/cg_lims/EPPs/udf/copy/artifact_to_sample.py index 8eacb6f1..29f5c457 100644 --- a/cg_lims/EPPs/udf/copy/artifact_to_sample.py +++ b/cg_lims/EPPs/udf/copy/artifact_to_sample.py @@ -1,10 +1,7 @@ #!/usr/bin/env python -import logging import sys import click -from genologics.entities import Process -from genologics.lims import Lims from cg_lims import options from cg_lims.exceptions import LimsError, MissingUDFsError diff --git a/cg_lims/EPPs/udf/copy/original_well_to_sample.py b/cg_lims/EPPs/udf/copy/original_well_to_sample.py index ba56cf58..514b1d0f 100644 --- a/cg_lims/EPPs/udf/copy/original_well_to_sample.py +++ b/cg_lims/EPPs/udf/copy/original_well_to_sample.py @@ -2,9 +2,6 @@ import sys import click -from typing import List -from genologics.entities import Process, Artifact -from genologics.lims import Lims from cg_lims import options from cg_lims.exceptions import LimsError, InvalidValueError diff --git a/cg_lims/EPPs/udf/copy/process_to_sample.py b/cg_lims/EPPs/udf/copy/process_to_sample.py index 032e13aa..2ee5e396 100644 --- a/cg_lims/EPPs/udf/copy/process_to_sample.py +++ b/cg_lims/EPPs/udf/copy/process_to_sample.py @@ -1,13 +1,9 @@ #!/usr/bin/env python -import logging import sys import click -from genologics.entities import Process -from genologics.lims import Lims from cg_lims import options -from cg_lims.exceptions import LimsError, MissingUDFsError from cg_lims.get.samples import get_process_samples diff --git a/cg_lims/EPPs/udf/copy/qc_to_sample.py b/cg_lims/EPPs/udf/copy/qc_to_sample.py index 5301b993..5d8f28ec 100644 --- a/cg_lims/EPPs/udf/copy/qc_to_sample.py +++ b/cg_lims/EPPs/udf/copy/qc_to_sample.py @@ -2,8 +2,6 @@ import sys import click -from genologics.entities import Process -from genologics.lims import Lims from cg_lims import options from cg_lims.exceptions import LimsError, MissingUDFsError diff --git a/cg_lims/EPPs/udf/set/set_method.py b/cg_lims/EPPs/udf/set/set_method.py index 3ae0241f..fb228493 100644 --- a/cg_lims/EPPs/udf/set/set_method.py +++ b/cg_lims/EPPs/udf/set/set_method.py @@ -2,7 +2,7 @@ """ import logging import sys -from typing import List, Optional +from typing import List import click @@ -10,7 +10,7 @@ from genologics.entities import Process from cg_lims import options -from cg_lims.exceptions import LimsError, MissingUDFsError, AtlasResponseFailedError +from cg_lims.exceptions import LimsError, AtlasResponseFailedError LOG = logging.getLogger(__name__) diff --git a/cg_lims/get/files.py b/cg_lims/get/files.py index 3a5dc261..3181585d 100644 --- a/cg_lims/get/files.py +++ b/cg_lims/get/files.py @@ -1,12 +1,10 @@ import pathlib -from pathlib import Path from typing import Optional from genologics.config import BASEURI -from genologics.entities import Artifact, Process +from genologics.entities import Artifact from genologics.lims import Lims -from cg_lims.exceptions import FileError def get_log_content(lims: Lims, file_id: str) -> str: diff --git a/cg_lims/models/api/master_steps/pool_samples_twist_v2.py b/cg_lims/models/api/master_steps/pool_samples_twist_v2.py index aacd824e..132785fc 100644 --- a/cg_lims/models/api/master_steps/pool_samples_twist_v2.py +++ b/cg_lims/models/api/master_steps/pool_samples_twist_v2.py @@ -4,7 +4,7 @@ from pydantic.v1 import Field, validator from cg_lims.models.api.master_steps.base_step import get_artifact_udf, get_artifact_name, BaseStep -from cg_lims.get.artifacts import get_latest_analyte, get_artifacts +from cg_lims.get.artifacts import get_latest_analyte class PoolsamplesforhybridizationTWIST(BaseStep): diff --git a/cg_lims/objects.py b/cg_lims/objects.py index b0c34406..bc640cb0 100644 --- a/cg_lims/objects.py +++ b/cg_lims/objects.py @@ -1,6 +1,6 @@ """Base cg_lims calss definitions """ -from typing import Optional, List +from typing import Optional from genologics.entities import Artifact, Sample, Process from genologics.lims import Lims @@ -16,7 +16,6 @@ get_latest_analyte, ) import logging -from statistics import mean LOG = logging.getLogger(__name__) diff --git a/cg_lims/put/queue.py b/cg_lims/put/queue.py index b2f7d13b..75c6351f 100644 --- a/cg_lims/put/queue.py +++ b/cg_lims/put/queue.py @@ -1,9 +1,8 @@ import logging -import pathlib from typing import List from genologics.config import BASEURI -from genologics.entities import Artifact, Process, Sample +from genologics.entities import Artifact from genologics.lims import Lims from cg_lims.get.ids import unique_list_of_ids diff --git a/cg_lims/scripts/one_time_scripts/load_arnold_flowcells.py b/cg_lims/scripts/one_time_scripts/load_arnold_flowcells.py index 7aa6df5b..3d100b27 100644 --- a/cg_lims/scripts/one_time_scripts/load_arnold_flowcells.py +++ b/cg_lims/scripts/one_time_scripts/load_arnold_flowcells.py @@ -5,7 +5,6 @@ from genologics.lims import Lims import requests from requests import Response -import json from cg_lims import options from cg_lims.EPPs.arnold.flow_cell import build_flow_cell_document diff --git a/cg_lims/set/udfs.py b/cg_lims/set/udfs.py index 9f4f36ca..fd8e4e22 100644 --- a/cg_lims/set/udfs.py +++ b/cg_lims/set/udfs.py @@ -1,4 +1,5 @@ import logging + from typing import List, Tuple from genologics.entities import Artifact, Process diff --git a/tests/EPPs/arnold/test_arnold_novaseq_standard.py b/tests/EPPs/arnold/test_arnold_novaseq_standard.py index a7aeee03..42745b18 100644 --- a/tests/EPPs/arnold/test_arnold_novaseq_standard.py +++ b/tests/EPPs/arnold/test_arnold_novaseq_standard.py @@ -1,4 +1,4 @@ -from genologics.entities import Process, Processtype +from genologics.entities import Process from cg_lims.EPPs.arnold.sequencing import build_step_documents from cg_lims.models.arnold.base_step import BaseStep diff --git a/tests/EPPs/files/test_make_kapa_csv.py b/tests/EPPs/files/test_make_kapa_csv.py index 3ea8d489..773e7999 100644 --- a/tests/EPPs/files/test_make_kapa_csv.py +++ b/tests/EPPs/files/test_make_kapa_csv.py @@ -2,7 +2,6 @@ from pathlib import Path from genologics.entities import Artifact -from genologics.entities import Sample import pytest diff --git a/tests/EPPs/udf/calculate/test_calculate_average_size_and_set_qc.py b/tests/EPPs/udf/calculate/test_calculate_average_size_and_set_qc.py index 3b3d11e8..87830130 100644 --- a/tests/EPPs/udf/calculate/test_calculate_average_size_and_set_qc.py +++ b/tests/EPPs/udf/calculate/test_calculate_average_size_and_set_qc.py @@ -1,9 +1,8 @@ import pytest -from genologics.entities import Artifact, Process +from genologics.entities import Process from cg_lims.EPPs.udf.calculate.calculate_average_size_and_set_qc import calculate_average_size, set_average_and_qc -from cg_lims.exceptions import MissingUDFsError, MissingCgFieldError -from cg_lims.set.udfs import copy_artifact_to_artifact +from cg_lims.exceptions import MissingUDFsError from tests.conftest import server diff --git a/tests/EPPs/udf/calculate/test_maf_calculate_volume.py b/tests/EPPs/udf/calculate/test_maf_calculate_volume.py index 88675883..265f64ed 100644 --- a/tests/EPPs/udf/calculate/test_maf_calculate_volume.py +++ b/tests/EPPs/udf/calculate/test_maf_calculate_volume.py @@ -3,7 +3,6 @@ import pytest from genologics.entities import Artifact -from genologics.lims import Lims from pydantic.v1 import ValidationError from cg_lims.EPPs.udf.calculate.maf_calculate_volume import ( diff --git a/tests/EPPs/udf/copy/test_aggregate_qc_flags_and_copy_fields.py b/tests/EPPs/udf/copy/test_aggregate_qc_flags_and_copy_fields.py index e62c1593..d017ddd7 100644 --- a/tests/EPPs/udf/copy/test_aggregate_qc_flags_and_copy_fields.py +++ b/tests/EPPs/udf/copy/test_aggregate_qc_flags_and_copy_fields.py @@ -1,8 +1,7 @@ import pytest -from genologics.entities import Artifact, Process +from genologics.entities import Process -from cg_lims.EPPs.udf.copy.aggregate_qc_flags_and_copy_fields import get_copy_tasks, copy_udfs -from cg_lims.get.artifacts import get_artifacts +from cg_lims.EPPs.udf.copy.aggregate_qc_flags_and_copy_fields import get_copy_tasks from cg_lims.exceptions import MissingUDFsError from tests.conftest import server diff --git a/tests/EPPs/udf/copy/test_measurement_to_analyte.py b/tests/EPPs/udf/copy/test_measurement_to_analyte.py index 49387a2f..59d43cc4 100644 --- a/tests/EPPs/udf/copy/test_measurement_to_analyte.py +++ b/tests/EPPs/udf/copy/test_measurement_to_analyte.py @@ -1,8 +1,8 @@ import pytest -from genologics.entities import Artifact, Process +from genologics.entities import Process from cg_lims.EPPs.udf.copy.measurement_to_analyte import copy_udfs_to_all_analytes -from cg_lims.get.artifacts import get_artifacts, get_latest_analyte +from cg_lims.get.artifacts import get_artifacts from cg_lims.exceptions import MissingUDFsError from tests.conftest import server diff --git a/tests/EPPs/udf/set/test_qc_to_sample.py b/tests/EPPs/udf/set/test_qc_to_sample.py index 892dbfd2..37c408d9 100644 --- a/tests/EPPs/udf/set/test_qc_to_sample.py +++ b/tests/EPPs/udf/set/test_qc_to_sample.py @@ -1,9 +1,8 @@ import pytest -from genologics.entities import Artifact, Process +from genologics.entities import Process -from cg_lims.exceptions import MissingUDFsError, MissingCgFieldError +from cg_lims.exceptions import MissingUDFsError from cg_lims.EPPs.udf.copy.qc_to_sample import artifacts_to_sample -from cg_lims.set.udfs import copy_artifact_to_artifact from tests.conftest import server from cg_lims.get.artifacts import get_artifacts diff --git a/tests/EPPs/udf/set/test_set_method.py b/tests/EPPs/udf/set/test_set_method.py index 76feda14..00bde5ca 100644 --- a/tests/EPPs/udf/set/test_set_method.py +++ b/tests/EPPs/udf/set/test_set_method.py @@ -9,7 +9,6 @@ import responses import requests -import logging @pytest.fixture() diff --git a/tests/commands/test_base.py b/tests/commands/test_base.py index 754be927..3656d0fe 100644 --- a/tests/commands/test_base.py +++ b/tests/commands/test_base.py @@ -1,6 +1,5 @@ from pathlib import Path -import pytest from click.testing import CliRunner from cg_lims.commands.base import cli diff --git a/tests/conftest.py b/tests/conftest.py index 2005bd3e..0c77f189 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,5 +1,6 @@ -from typing import Dict, List, Optional +from typing import Dict, List from unittest.mock import patch + from genologics.lims import Lims from genologics.entities import Artifact, Process, Sample from pathlib import Path @@ -16,7 +17,6 @@ from limsmock.server import run_server -from pydantic.v1 import BaseModel, Field from tests.fixtures.flowcell_document import FLOW_CELL_DOCUMENT