From f4f64faf2278eed5ed3760f31129db96750f7f22 Mon Sep 17 00:00:00 2001 From: Avasam Date: Tue, 27 Aug 2024 15:34:13 -0400 Subject: [PATCH] Pass mypy and link issues --- mypy.ini | 14 ++++++++++++++ pip_run/commands.py | 2 +- pip_run/compat/py310.py | 10 ++++++---- pip_run/compat/py38.py | 12 ++++-------- pip_run/read-deps.py | 4 ++-- pyproject.toml | 6 ++---- 6 files changed, 29 insertions(+), 19 deletions(-) diff --git a/mypy.ini b/mypy.ini index 83b0d15..ecd0610 100644 --- a/mypy.ini +++ b/mypy.ini @@ -12,3 +12,17 @@ explicit_package_bases = True # Disable overload-overlap due to many false-positives disable_error_code = overload-overlap + +# jaraco/jaraco.env#2 +# jaraco/jaraco.env#3 +[mypy-jaraco.env] +ignore_missing_imports = True + +# Tries to install grcpio which does not beuild. Only used for an example anyway +[mypy-pydragon] +ignore_missing_imports = True + +# jaraco/jaraco.develop#20 +# Lucretiel/autocommand#38 +[mypy-autocommand.*] +ignore_missing_imports = True diff --git a/pip_run/commands.py b/pip_run/commands.py index 0547c9f..0c259c3 100644 --- a/pip_run/commands.py +++ b/pip_run/commands.py @@ -2,7 +2,7 @@ import contextlib import pathlib -from jaraco import env # type: ignore # (python/mypy#15970) +from jaraco import env from jaraco.context import suppress from jaraco.functools import bypass_when from more_itertools import locate, split_at diff --git a/pip_run/compat/py310.py b/pip_run/compat/py310.py index 7335c34..caed790 100644 --- a/pip_run/compat/py310.py +++ b/pip_run/compat/py310.py @@ -2,10 +2,12 @@ Compatibility for Python 3.10 and earlier. """ +import sys + __all__ = ['tomllib'] -try: - import tomllib # type: ignore -except ImportError: # pragma: no cover - import tomli as tomllib # type: ignore +if sys.version_info >= (3, 11): + import tomllib +else: + import tomli as tomllib diff --git a/pip_run/compat/py38.py b/pip_run/compat/py38.py index 43a028a..69d6aab 100644 --- a/pip_run/compat/py38.py +++ b/pip_run/compat/py38.py @@ -7,11 +7,7 @@ str if sys.version_info < (3, 9) and platform.system() == 'Windows' else identity ) - -try: - from importlib.resources import files # type: ignore -except ImportError: # pragma: no cover - from importlib_resources import files # type: ignore - - -files = files +if sys.version_info >= (3, 9): + from importlib.resources import files as files +else: # pragma: no cover + from importlib_resources import files as files diff --git a/pip_run/read-deps.py b/pip_run/read-deps.py index 92004fe..24799e8 100644 --- a/pip_run/read-deps.py +++ b/pip_run/read-deps.py @@ -18,7 +18,7 @@ def separator(input) -> str: @autocommand.autocommand(__name__) def run( script: path.ExtantFile, - separator: separator = ' ', # type: ignore + separator: separator = ' ', # type: ignore[valid-type] ): """ >>> run(['examples/test-mongodb-covered-query.py']) @@ -30,5 +30,5 @@ def run( pytest jaraco.mongodb>=3.10 """ - joiner = separator.join # type: ignore + joiner = separator.join # type: ignore[attr-defined] print(joiner(DepsReader.try_read(pathlib.Path(script)).params())) diff --git a/pyproject.toml b/pyproject.toml index 08c5cda..19cf046 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -81,6 +81,8 @@ type = [ "pytest-mypy", # local + "pydragon", + "cowsay", ] @@ -100,7 +102,3 @@ namespaces = true [tool.setuptools_scm] - - -[tool.pytest-enabler.mypy] -# Disabled due to jaraco/skeleton#143