Skip to content

Commit

Permalink
tighten type ignores
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-c committed Nov 23, 2021
1 parent 286add3 commit 90145da
Show file tree
Hide file tree
Showing 56 changed files with 265 additions and 263 deletions.
2 changes: 1 addition & 1 deletion lib/galaxy/__init__.py
Expand Up @@ -3,4 +3,4 @@
"""

from pkgutil import extend_path
__path__ = extend_path(__path__, __name__) # type: ignore
__path__ = extend_path(__path__, __name__) # type: ignore[has-type]
2 changes: 1 addition & 1 deletion lib/galaxy/app.py
Expand Up @@ -291,7 +291,7 @@ def __init__(self, **kwargs) -> None:
# Tours registry
tour_registry = build_tours_registry(self.config.tour_config_dir)
self.tour_registry = tour_registry
self[ToursRegistry] = tour_registry # type: ignore
self[ToursRegistry] = tour_registry # type: ignore[misc]
# Webhooks registry
self.webhooks_registry = self._register_singleton(WebhooksRegistry, WebhooksRegistry(self.config.webhooks_dir))
# Load security policy.
Expand Down
2 changes: 1 addition & 1 deletion lib/galaxy/config/script.py
Expand Up @@ -8,7 +8,7 @@
try:
import pip
except ImportError:
pip = None # type: ignore
pip = None # type: ignore[assignment]


CONFIGURE_URL = "https://docs.galaxyproject.org/en/master/admin/"
Expand Down
6 changes: 3 additions & 3 deletions lib/galaxy/containers/docker.py
Expand Up @@ -13,13 +13,13 @@
try:
import docker
except ImportError:
docker = None # type: ignore
docker = None # type: ignore[assignment]

try:
from requests.exceptions import ConnectionError, ReadTimeout
except ImportError:
ConnectionError = None # type: ignore
ReadTimeout = None # type: ignore
ConnectionError = None # type: ignore[assignment,misc]
ReadTimeout = None # type: ignore[assignment,misc]

from galaxy.containers import Container, ContainerInterface
from galaxy.containers.docker_decorators import (
Expand Down
12 changes: 6 additions & 6 deletions lib/galaxy/datatypes/constructive_solid_geometry.py
@@ -1,11 +1,11 @@
# TODO: revisit ignoring type and write some tests for this, the multi-inheritance in this
# this file is challenging, it should be broken into true mixins.
# type: ignore
"""
Constructive Solid Geometry file formats.
"""

import abc
from typing import List

from galaxy import util
from galaxy.datatypes import data
Expand Down Expand Up @@ -122,15 +122,15 @@ def display_peek(self, dataset):
return f"Ply file ({nice_size(dataset.get_size())})"


class PlyAscii(Ply, data.Text):
class PlyAscii(Ply, data.Text): # type: ignore[misc]
file_ext = "plyascii"
subtype = 'ascii'

def __init__(self, **kwd):
data.Text.__init__(self, **kwd)


class PlyBinary(Ply, Binary):
class PlyBinary(Ply, Binary): # type: ignore[misc]
file_ext = "plybinary"
subtype = 'binary'

Expand Down Expand Up @@ -313,7 +313,7 @@ def set_meta(self, dataset, **kwd):
# FIELD FieldData 2
processing_field_section = True
num_fields = int(items[-1])
fields_processed = []
fields_processed: List[str] = []
elif processing_field_section:
if len(fields_processed) == num_fields:
processing_field_section = False
Expand Down Expand Up @@ -445,15 +445,15 @@ def display_peek(self, dataset):
return f"Vtk file ({nice_size(dataset.get_size())})"


class VtkAscii(Vtk, data.Text):
class VtkAscii(Vtk, data.Text): # type: ignore[misc]
file_ext = "vtkascii"
subtype = 'ASCII'

def __init__(self, **kwd):
data.Text.__init__(self, **kwd)


class VtkBinary(Vtk, Binary):
class VtkBinary(Vtk, Binary): # type: ignore[misc]
file_ext = "vtkbinary"
subtype = 'BINARY'

Expand Down
2 changes: 1 addition & 1 deletion lib/galaxy/files/sources/ftp.py
@@ -1,7 +1,7 @@
try:
from fs.ftpfs import FTPFS
except ImportError:
FTPFS = None # type: ignore
FTPFS = None # type: ignore[misc,assignment]

from ._pyfilesystem2 import PyFilesystem2FilesSource

Expand Down
2 changes: 1 addition & 1 deletion lib/galaxy/jobs/runners/util/cli/factory.py
Expand Up @@ -5,7 +5,7 @@
)
code_dir = 'lib'
except ImportError:
from pulsar.managers.util.cli import ( # type: ignore
from pulsar.managers.util.cli import ( # type: ignore[no-redef]
CliInterface,
split_params
)
Expand Down
2 changes: 1 addition & 1 deletion lib/galaxy/jobs/runners/util/cli/job/__init__.py
Expand Up @@ -13,7 +13,7 @@
except ImportError:

# Not in Galaxy, map Galaxy job states to Pulsar ones.
class job_states(str, Enum): # type: ignore
class job_states(str, Enum): # type: ignore[no-redef]
RUNNING = 'running'
OK = 'complete'
QUEUED = 'queued'
Expand Down
4 changes: 2 additions & 2 deletions lib/galaxy/managers/tags.py
Expand Up @@ -16,8 +16,8 @@

taggable_item_names = {item: item for item in ItemTagAssociation.associated_item_names}
# This Enum is generated dynamically and mypy can not statically infer it's real type
# so it should be ignored. See:https://github.com/python/mypy/issues/4865#issuecomment-592560696
TaggableItemClass = Enum('TaggableItemClass', taggable_item_names) # type: ignore
# so it should be ignored. See: https://github.com/python/mypy/issues/4865#issuecomment-592560696
TaggableItemClass = Enum('TaggableItemClass', taggable_item_names) # type: ignore[misc]


class ItemTagsPayload(BaseModel):
Expand Down

0 comments on commit 90145da

Please sign in to comment.