From 79a4ebd28d34dc920a4bfa36f822a9f03a8fecff Mon Sep 17 00:00:00 2001 From: Nicola Soranzo Date: Wed, 25 Sep 2024 17:47:14 +0100 Subject: [PATCH] Enable ``ignore-without-code`` mypy error code --- lib/galaxy/celery/base_task.py | 2 +- lib/galaxy/schema/schema.py | 2 +- lib/galaxy/webapps/galaxy/api/history_contents.py | 6 +++--- mypy.ini | 1 + tools/filters/sff_extract.py | 4 ++-- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/galaxy/celery/base_task.py b/lib/galaxy/celery/base_task.py index 94bb8d75956f..c4e986cc94b6 100644 --- a/lib/galaxy/celery/base_task.py +++ b/lib/galaxy/celery/base_task.py @@ -80,7 +80,7 @@ class GalaxyTaskBeforeStartUserRateLimitPostgres(GalaxyTaskBeforeStartUserRateLi We take advantage of efficiencies in its dialect. """ - def calculate_task_start_time( # type: ignore + def calculate_task_start_time( self, user_id: int, sa_session: galaxy_scoped_session, task_interval_secs: float, now: datetime.datetime ) -> datetime.datetime: with transaction(sa_session): diff --git a/lib/galaxy/schema/schema.py b/lib/galaxy/schema/schema.py index 8b9c1ecc0bdd..9e461bd5655d 100644 --- a/lib/galaxy/schema/schema.py +++ b/lib/galaxy/schema/schema.py @@ -3338,7 +3338,7 @@ class HDACustom(HDADetailed): # TODO: Fix this workaround for partial_model not supporting UUID fields for some reason. # The error otherwise is: `PydanticUserError: 'UuidVersion' cannot annotate 'nullable'.` # Also ignoring mypy complaints about the type redefinition. - uuid: Optional[UUID4] # type: ignore + uuid: Optional[UUID4] # type: ignore[assignment] # Add fields that are not part of any view here visualizations: Annotated[ diff --git a/lib/galaxy/webapps/galaxy/api/history_contents.py b/lib/galaxy/webapps/galaxy/api/history_contents.py index 95641f244c85..2386807211ba 100644 --- a/lib/galaxy/webapps/galaxy/api/history_contents.py +++ b/lib/galaxy/webapps/galaxy/api/history_contents.py @@ -7,6 +7,7 @@ List, Literal, Optional, + Set, Union, ) @@ -335,11 +336,10 @@ def parse_content_types(types: Union[List[str], str]) -> List[HistoryContentType def parse_dataset_details(details: Optional[str]): """Parses the different values that the `dataset_details` parameter can have from a string.""" - dataset_details = None if details is not None and details != "all": - dataset_details = set(util.listify(details)) + dataset_details: Union[None, Set[str], str] = set(util.listify(details)) else: # either None or 'all' - dataset_details = details # type: ignore + dataset_details = details return dataset_details diff --git a/mypy.ini b/mypy.ini index 0ec6ae269986..70250f4d521f 100644 --- a/mypy.ini +++ b/mypy.ini @@ -1,4 +1,5 @@ [mypy] +enable_error_code = ignore-without-code plugins = pydantic.mypy show_error_codes = True ignore_missing_imports = True diff --git a/tools/filters/sff_extract.py b/tools/filters/sff_extract.py index 9c67a644c8ff..d7bcf05bf196 100644 --- a/tools/filters/sff_extract.py +++ b/tools/filters/sff_extract.py @@ -42,9 +42,9 @@ fake_sff_name = "fake_sff_name" # readname as key: lines with matches from SSAHA, one best match -ssahapematches = {} # type: ignore +ssahapematches = {} # type: ignore[var-annotated] # linker readname as key: length of linker sequence -linkerlengths = {} # type: ignore +linkerlengths = {} # type: ignore[var-annotated] # set to true if something really fishy is going on with the sequences stern_warning = False