summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaselIT <cfederico87@gmail.com>2021-08-30 21:39:40 +0200
committerCaselIT <cfederico87@gmail.com>2021-08-30 21:39:40 +0200
commitecf6217ab5096bda75fd8ae4e819f412c020c096 (patch)
tree1f0ce6c2a63653dded848243140d25df01257f7b
parent9f7caecd701db7cd76bbcdcf462b92e4970b4ab3 (diff)
downloadalembic-ecf6217ab5096bda75fd8ae4e819f412c020c096.tar.gz
fix mypy errors
Change-Id: If49e0ff00f0b00ed914ddb8979ae49c3a8a10a0e
-rw-r--r--alembic/operations/batch.py12
-rw-r--r--alembic/util/compat.py4
-rw-r--r--alembic/util/pyfiles.py2
-rw-r--r--setup.cfg6
4 files changed, 17 insertions, 7 deletions
diff --git a/alembic/operations/batch.py b/alembic/operations/batch.py
index f5ff0bb..ef182fd 100644
--- a/alembic/operations/batch.py
+++ b/alembic/operations/batch.py
@@ -466,9 +466,11 @@ class ApplyBatchImpl:
if (
"existing_type" in kw
and isinstance(kw["existing_type"], SchemaEventTarget)
- and kw["existing_type"].name
+ and kw["existing_type"].name # type:ignore[attr-defined]
):
- self.named_constraints.pop(kw["existing_type"].name, None)
+ self.named_constraints.pop(
+ kw["existing_type"].name, None # type:ignore[attr-defined]
+ )
if type_ is not None:
type_ = sqltypes.to_instance(type_)
@@ -590,9 +592,11 @@ class ApplyBatchImpl:
if (
"existing_type" in kw
and isinstance(kw["existing_type"], SchemaEventTarget)
- and kw["existing_type"].name
+ and kw["existing_type"].name # type:ignore[attr-defined]
):
- self.named_constraints.pop(kw["existing_type"].name, None)
+ self.named_constraints.pop(
+ kw["existing_type"].name, None # type:ignore[attr-defined]
+ )
def create_column_comment(self, column):
"""the batch table creation function will issue create_column_comment
diff --git a/alembic/util/compat.py b/alembic/util/compat.py
index d0e6672..1e435a8 100644
--- a/alembic/util/compat.py
+++ b/alembic/util/compat.py
@@ -27,12 +27,12 @@ class EncodedIO(io.TextIOWrapper):
if py39:
from importlib import resources as importlib_resources
else:
- import importlib_resources # noqa
+ import importlib_resources # type:ignore[no-redef] # noqa
if py38:
from importlib import metadata as importlib_metadata
else:
- import importlib_metadata # noqa
+ import importlib_metadata # type:ignore[no-redef] # noqa
def importlib_metadata_get(group):
diff --git a/alembic/util/pyfiles.py b/alembic/util/pyfiles.py
index 3da32c3..b6662b7 100644
--- a/alembic/util/pyfiles.py
+++ b/alembic/util/pyfiles.py
@@ -58,7 +58,7 @@ def coerce_resource_to_filename(fname: str) -> str:
ref = compat.importlib_resources.files(tokens[0])
for tok in tokens[1:]:
ref = ref / tok
- fname = file_manager.enter_context(
+ fname = file_manager.enter_context( # type: ignore[assignment]
compat.importlib_resources.as_file(ref)
)
return fname
diff --git a/setup.cfg b/setup.cfg
index 992a7ac..d034e61 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -127,3 +127,9 @@ ignore_missing_imports = True
[mypy-sqlalchemy.testing.*]
ignore_missing_imports = True
+
+[mypy-importlib_resources.*]
+ignore_missing_imports = True
+
+[mypy-importlib_metadata.*]
+ignore_missing_imports = True