From 2989ba97d9c88836963e60e3aed8066869205f2b Mon Sep 17 00:00:00 2001 From: "Michael R. Crusoe" Date: Tue, 8 Aug 2023 09:53:04 +0200 Subject: [PATCH] code: drop Python 3.6-3.7 support --- .github/workflows/ci-tests.yml | 11 +- CONTRIBUTING.md | 2 +- Makefile | 15 +- cwltool/checker.py | 9 +- cwltool/command_line_tool.py | 6 +- cwltool/context.py | 2 +- cwltool/cwlprov/__init__.py | 40 +- cwltool/cwlrdf.py | 4 +- cwltool/docker.py | 2 +- cwltool/docker_id.py | 4 +- cwltool/job.py | 2 +- cwltool/load_tool.py | 4 +- cwltool/singularity.py | 4 +- cwltool/software_requirements.py | 5 +- cwltool/utils.py | 32 +- docs/conf.py | 8 +- gittaggers.py | 7 +- mypy-stubs/argcomplete/__init__.pyi | 18 - mypy-stubs/cachecontrol/__init__.pyi | 9 - mypy-stubs/cachecontrol/cache.pyi | 5 - mypy-stubs/cachecontrol/caches/__init__.pyi | 11 - mypy-stubs/cachecontrol/caches/file_cache.pyi | 31 - mypy-stubs/cachecontrol/compat.pyi | 7 - mypy-stubs/cachecontrol/controller.pyi | 17 - mypy-stubs/cachecontrol/wrapper.pyi | 13 - mypy-stubs/graphviz/__init__.pyi | 12 - mypy-stubs/graphviz/_compat.pyi | 15 - mypy-stubs/graphviz/backend.pyi | 11 - mypy-stubs/graphviz/dot.pyi | 76 -- mypy-stubs/graphviz/files.pyi | 73 -- mypy-stubs/graphviz/lang.pyi | 20 - mypy-stubs/graphviz/tools.pyi | 9 - mypy-stubs/importlib_metadata/__init__.pyi | 162 --- mypy-stubs/importlib_metadata/_meta.pyi | 22 - mypy-stubs/subprocess.pyi | 1096 ----------------- mypy-stubs/urllib/__init__.py | 0 mypy-stubs/urllib/parse.pyi | 190 --- pyproject.toml | 10 +- requirements.txt | 4 - setup.py | 8 +- test-requirements.txt | 1 - tests/test_singularity_versions.py | 2 +- tests/util.py | 3 +- tox.ini | 41 +- 44 files changed, 91 insertions(+), 1932 deletions(-) delete mode 100644 mypy-stubs/argcomplete/__init__.pyi delete mode 100644 mypy-stubs/cachecontrol/__init__.pyi delete mode 100644 mypy-stubs/cachecontrol/cache.pyi delete mode 100644 mypy-stubs/cachecontrol/caches/__init__.pyi delete mode 100644 mypy-stubs/cachecontrol/caches/file_cache.pyi delete mode 100644 mypy-stubs/cachecontrol/compat.pyi delete mode 100644 mypy-stubs/cachecontrol/controller.pyi delete mode 100644 mypy-stubs/cachecontrol/wrapper.pyi delete mode 100644 mypy-stubs/graphviz/__init__.pyi delete mode 100644 mypy-stubs/graphviz/_compat.pyi delete mode 100644 mypy-stubs/graphviz/backend.pyi delete mode 100644 mypy-stubs/graphviz/dot.pyi delete mode 100644 mypy-stubs/graphviz/files.pyi delete mode 100644 mypy-stubs/graphviz/lang.pyi delete mode 100644 mypy-stubs/graphviz/tools.pyi delete mode 100644 mypy-stubs/importlib_metadata/__init__.pyi delete mode 100644 mypy-stubs/importlib_metadata/_meta.pyi delete mode 100644 mypy-stubs/subprocess.pyi delete mode 100644 mypy-stubs/urllib/__init__.py delete mode 100644 mypy-stubs/urllib/parse.pyi diff --git a/.github/workflows/ci-tests.yml b/.github/workflows/ci-tests.yml index b16619659..a2e0c38fb 100644 --- a/.github/workflows/ci-tests.yml +++ b/.github/workflows/ci-tests.yml @@ -28,19 +28,12 @@ jobs: tox: name: Tox - runs-on: ubuntu-20.04 # 22.04 doesn't support Python 3.6 + runs-on: ubuntu-22.04 strategy: matrix: py-ver-major: [3] - py-ver-minor: [6, 8, 9, 10, 11] + py-ver-minor: [8, 9, 10, 11] step: [lint, unit, bandit, mypy] - exclude: - - py-ver-major: 3 - py-ver-minor: 6 - step: mypy - - py-ver-major: 3 - py-ver-minor: 6 - step: lint env: py-semver: ${{ format('{0}.{1}', matrix.py-ver-major, matrix.py-ver-minor) }} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 8aa65142d..cd9e9105d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,6 +1,6 @@ Style guide: - PEP-8 (as implemented by the `black` code formatting tool) -- Python 3.6+ compatible code +- Python 3.8+ compatible code - PEP-484 type hints The development is done using `git`, we encourage you to get familiar with it. diff --git a/Makefile b/Makefile index 3aef78d53..f01090aeb 100644 --- a/Makefile +++ b/Makefile @@ -25,7 +25,7 @@ MODULE=cwltool # `SHELL=bash` doesn't work for some, so don't use BASH-isms like # `[[` conditional expressions. PYSOURCES=$(wildcard ${MODULE}/**.py cwltool/cwlprov/*.py tests/*.py) setup.py -DEVPKGS=diff_cover pylint pep257 pydocstyle 'tox<4' tox-pyenv \ +DEVPKGS=diff_cover pylint pep257 pydocstyle 'tox<4' tox-pyenv auto-walrus \ isort wheel autoflake pyupgrade bandit -rlint-requirements.txt\ -rtest-requirements.txt -rmypy-requirements.txt -rdocs/requirements.txt DEBDEVPKGS=pep8 python-autopep8 pylint python-coverage pydocstyle sloccount \ @@ -191,16 +191,6 @@ mypy: $(PYSOURCES) fi # if minimally required ruamel.yaml version is 0.15.99 or greater, than the above can be removed MYPYPATH=$$MYPYPATH:mypy-stubs mypy $^ -mypy_3.6: $(filter-out setup.py gittagger.py,$(PYSOURCES)) - if ! test -f $(shell python -c 'import ruamel.yaml; import os.path; print(os.path.dirname(ruamel.yaml.__file__))')/py.typed ; \ - then \ - rm -Rf mypy-stubs/ruamel/yaml ; \ - ln -s $(shell python -c 'import ruamel.yaml; import os.path; print(os.path.dirname(ruamel.yaml.__file__))') \ - mypy-stubs/ruamel/ ; \ - fi # if minimally required ruamel.yaml version is 0.15.99 or greater, than the above can be removed - MYPYPATH=$$MYPYPATH:mypy-stubs mypy --python-version 3.6 $^ - - mypyc: $(PYSOURCES) MYPYPATH=mypy-stubs CWLTOOL_USE_MYPYC=1 pip install --verbose -e . \ && pytest -rs -vv ${PYTEST_EXTRA} @@ -210,7 +200,8 @@ shellcheck: FORCE cwltool-in-docker.sh pyupgrade: $(PYSOURCES) - pyupgrade --exit-zero-even-if-changed --py36-plus $^ + pyupgrade --exit-zero-even-if-changed --py38-plus $^ + auto-walrus $^ release-test: check-python3 FORCE git diff-index --quiet HEAD -- || ( echo You have uncommitted changes, please commit them and try again; false ) diff --git a/cwltool/checker.py b/cwltool/checker.py index 7184c2666..c11561719 100644 --- a/cwltool/checker.py +++ b/cwltool/checker.py @@ -5,6 +5,7 @@ Dict, Iterator, List, + Literal, MutableMapping, MutableSequence, Optional, @@ -16,7 +17,6 @@ from schema_salad.exceptions import ValidationException from schema_salad.sourceline import SourceLine, bullets, strip_dup_lineno from schema_salad.utils import json_dumps -from typing_extensions import Literal from .errors import WorkflowException from .loghandler import _logger @@ -288,7 +288,9 @@ def static_checker( ) + "\n" + SourceLine(sink, "type").makeError( - " with sink '%s' of type %s" % (shortname(sink["id"]), json_dumps(sink["type"])) + " with sink '{}' of type {}".format( + shortname(sink["id"]), json_dumps(sink["type"]) + ) ) ) if extra_message is not None: @@ -507,8 +509,7 @@ def get_step_id(field_id: str) -> str: def is_conditional_step(param_to_step: Dict[str, CWLObjectType], parm_id: str) -> bool: - source_step = param_to_step.get(parm_id) - if source_step is not None: + if (source_step := param_to_step.get(parm_id)) is not None: if source_step.get("when") is not None: return True return False diff --git a/cwltool/command_line_tool.py b/cwltool/command_line_tool.py index 9464b3443..0b0d7f3ec 100644 --- a/cwltool/command_line_tool.py +++ b/cwltool/command_line_tool.py @@ -693,7 +693,7 @@ def _initialworkdir(self, j: JobBase, builder: Builder) -> None: for i, t2 in enumerate(ls): if not isinstance(t2, Mapping): raise SourceLine(initialWorkdir, "listing", WorkflowException, debug).makeError( - "Entry at index %s of listing is not a record, was %s" % (i, type(t2)) + f"Entry at index {i} of listing is not a record, was {type(t2)}" ) if "entry" not in t2: @@ -715,7 +715,9 @@ def _initialworkdir(self, j: JobBase, builder: Builder) -> None: if not isinstance(t2["entry"], Mapping): raise SourceLine(initialWorkdir, "listing", WorkflowException, debug).makeError( - "Entry at index %s of listing is not a record, was %s" % (i, type(t2["entry"])) + "Entry at index {} of listing is not a record, was {}".format( + i, type(t2["entry"]) + ) ) if t2["entry"].get("class") not in ("File", "Directory"): diff --git a/cwltool/context.py b/cwltool/context.py index 2fd1f84b5..7f30e4c30 100644 --- a/cwltool/context.py +++ b/cwltool/context.py @@ -12,6 +12,7 @@ Dict, Iterable, List, + Literal, Optional, TextIO, Tuple, @@ -22,7 +23,6 @@ from schema_salad.avro.schema import Names from schema_salad.ref_resolver import Loader from schema_salad.utils import FetcherCallableType -from typing_extensions import Literal from .mpi import MpiConfig from .pathmapper import PathMapper diff --git a/cwltool/cwlprov/__init__.py b/cwltool/cwlprov/__init__.py index 98e8c911c..b8ff8d14d 100644 --- a/cwltool/cwlprov/__init__.py +++ b/cwltool/cwlprov/__init__.py @@ -6,9 +6,7 @@ import re import uuid from getpass import getuser -from typing import IO, Any, Callable, Dict, List, Optional, Tuple, Union - -from typing_extensions import TypedDict +from typing import IO, Any, Callable, Dict, List, Optional, Tuple, TypedDict, Union def _whoami() -> Tuple[str, str]: @@ -112,24 +110,26 @@ def _valid_orcid(orcid: Optional[str]) -> str: "oa:motivatedBy": Dict[str, str], }, ) -Aggregate = TypedDict( - "Aggregate", - { - "uri": Optional[str], - "bundledAs": Optional[Dict[str, Any]], - "mediatype": Optional[str], - "conformsTo": Optional[Union[str, List[str]]], - "createdOn": Optional[str], - "createdBy": Optional[Dict[str, str]], - }, - total=False, -) + + +class Aggregate(TypedDict, total=False): + """RO Aggregate class.""" + + uri: Optional[str] + bundledAs: Optional[Dict[str, Any]] + mediatype: Optional[str] + conformsTo: Optional[Union[str, List[str]]] + createdOn: Optional[str] + createdBy: Optional[Dict[str, str]] + + # Aggregate.bundledAs is actually type Aggregate, but cyclic definitions are not supported -AuthoredBy = TypedDict( - "AuthoredBy", - {"orcid": Optional[str], "name": Optional[str], "uri": Optional[str]}, - total=False, -) +class AuthoredBy(TypedDict, total=False): + """RO AuthoredBy class.""" + + orcid: Optional[str] + name: Optional[str] + uri: Optional[str] def checksum_copy( diff --git a/cwltool/cwlrdf.py b/cwltool/cwlrdf.py index d91552690..7dcf85cbc 100644 --- a/cwltool/cwlrdf.py +++ b/cwltool/cwlrdf.py @@ -51,7 +51,7 @@ def dot_with_parameters(g: Graph, stdout: Union[TextIO, StreamWriter]) -> None: for step, run, _ in qres: stdout.write( - '"%s" [label="%s"]\n' % (lastpart(step), f"{lastpart(step)} ({lastpart(run)})") + '"{}" [label="{}"]\n'.format(lastpart(step), f"{lastpart(step)} ({lastpart(run)})") ) qres = cast( @@ -170,7 +170,7 @@ def dot_without_parameters(g: Graph, stdout: Union[TextIO, StreamWriter]) -> Non if str(runtype) != "https://w3id.org/cwl/cwl#Workflow": stdout.write( - '"%s" [label="%s"]\n' % (dotname[step], urllib.parse.urldefrag(str(step))[1]) + f'"{dotname[step]}" [label="{urllib.parse.urldefrag(str(step))[1]}"]\n' # noqa: B907 ) if currentwf is not None: diff --git a/cwltool/docker.py b/cwltool/docker.py index bd9637917..a92d59feb 100644 --- a/cwltool/docker.py +++ b/cwltool/docker.py @@ -47,7 +47,7 @@ def _get_docker_machine_mounts() -> List[str]: "-t", "vboxsf", ], - universal_newlines=True, + text=True, ).splitlines() ] return __docker_machine_mounts diff --git a/cwltool/docker_id.py b/cwltool/docker_id.py index 94174f505..bb436b2cb 100644 --- a/cwltool/docker_id.py +++ b/cwltool/docker_id.py @@ -30,9 +30,7 @@ def check_output_and_strip(cmd: List[str]) -> Optional[str]: :return: Stripped string output of the command, or ``None`` if error """ try: - result = subprocess.check_output( # nosec - cmd, stderr=subprocess.STDOUT, universal_newlines=True - ) + result = subprocess.check_output(cmd, stderr=subprocess.STDOUT, text=True) # nosec return result.strip() except (OSError, subprocess.CalledProcessError, TypeError, AttributeError): # OSError is raised if command doesn't exist diff --git a/cwltool/job.py b/cwltool/job.py index f109e48ae..9d257e083 100644 --- a/cwltool/job.py +++ b/cwltool/job.py @@ -810,7 +810,7 @@ def run( _logger.debug("%s error", container, exc_info=True) if docker_is_req: raise UnsupportedRequirement( - "{} is required to run this tool: {}".format(container, str(err)) + f"{container} is required to run this tool: {str(err)}" ) from err else: raise WorkflowException( diff --git a/cwltool/load_tool.py b/cwltool/load_tool.py index 622f9c761..d97f47861 100644 --- a/cwltool/load_tool.py +++ b/cwltool/load_tool.py @@ -379,9 +379,7 @@ def resolve_and_validate_document( loadingContext = loadingContext.copy() if not isinstance(workflowobj, MutableMapping): - raise ValueError( - "workflowjobj must be a dict, got '{}': {}".format(type(workflowobj), workflowobj) - ) + raise ValueError(f"workflowjobj must be a dict, got {type(workflowobj)!r}: {workflowobj}") jobobj = None if "cwl:tool" in workflowobj: diff --git a/cwltool/singularity.py b/cwltool/singularity.py index f78f912c9..e083eb092 100644 --- a/cwltool/singularity.py +++ b/cwltool/singularity.py @@ -43,9 +43,7 @@ def get_version() -> Tuple[List[int], str]: global _SINGULARITY_VERSION # pylint: disable=global-statement global _SINGULARITY_FLAVOR # pylint: disable=global-statement if _SINGULARITY_VERSION is None: - version_output = check_output( # nosec - ["singularity", "--version"], universal_newlines=True - ).strip() + version_output = check_output(["singularity", "--version"], text=True).strip() # nosec version_match = re.match(r"(.+) version ([0-9\.]+)", version_output) if version_match is None: diff --git a/cwltool/software_requirements.py b/cwltool/software_requirements.py index 7e114bb86..4587b97a8 100644 --- a/cwltool/software_requirements.py +++ b/cwltool/software_requirements.py @@ -91,9 +91,8 @@ def build_job_script(self, builder: "Builder", command: List[str]) -> str: resolution_config_dict=resolution_config_dict, conf_file=self.dependency_resolvers_config_file, ) - dependencies = get_dependencies(builder) - handle_dependencies = "" # str - if dependencies: + handle_dependencies: str = "" + if dependencies := get_dependencies(builder): handle_dependencies = "\n".join( tool_dependency_manager.dependency_shell_commands( dependencies, job_directory=builder.tmpdir diff --git a/cwltool/utils.py b/cwltool/utils.py index 455231847..fda43e112 100644 --- a/cwltool/utils.py +++ b/cwltool/utils.py @@ -1,5 +1,6 @@ """Shared functions and other definitions.""" import collections +import importlib.metadata import os import random import shutil @@ -22,16 +23,19 @@ TYPE_CHECKING, Any, Callable, + Deque, Dict, Generator, Iterable, List, + Literal, MutableMapping, MutableSequence, NamedTuple, Optional, Set, Tuple, + TypedDict, Union, cast, ) @@ -39,15 +43,9 @@ import requests from cachecontrol import CacheControl from cachecontrol.caches import FileCache -from mypy_extensions import TypedDict, mypyc_attr +from mypy_extensions import mypyc_attr from schema_salad.exceptions import ValidationException from schema_salad.ref_resolver import Loader -from typing_extensions import Deque, Literal - -if sys.version_info >= (3, 8): - import importlib.metadata as importlib_metadata -else: - import importlib_metadata if TYPE_CHECKING: from .command_line_tool import CallbackJob, ExpressionJob @@ -101,14 +99,15 @@ ) JSONAtomType = Union[Dict[str, Any], List[Any], str, int, float, bool, None] JSONType = Union[Dict[str, JSONAtomType], List[JSONAtomType], str, int, float, bool, None] -WorkflowStateItem = NamedTuple( - "WorkflowStateItem", - [ - ("parameter", CWLObjectType), - ("value", Optional[CWLOutputType]), - ("success", str), - ], -) + + +class WorkflowStateItem(NamedTuple): + """Workflow state item.""" + + parameter: CWLObjectType + value: Optional[CWLOutputType] + success: str + ParametersType = List[CWLObjectType] StepType = CWLObjectType # WorkflowStep @@ -118,8 +117,7 @@ def versionstring() -> str: """Version of CWLtool used to execute the workflow.""" - pkg = importlib_metadata.version("cwltool") - if pkg: + if pkg := importlib.metadata.version("cwltool"): return f"{sys.argv[0]} {pkg}" return "{} {}".format(sys.argv[0], "unknown version") diff --git a/docs/conf.py b/docs/conf.py index 94c3e1e64..fbc089caa 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -14,6 +14,7 @@ import sys from datetime import datetime import time +import importlib.metadata sys.path.insert(0, os.path.abspath("..")) @@ -81,12 +82,7 @@ # so a file named "default.css" will overwrite the builtin "default.css". html_static_path = ["_static"] - -if sys.version_info >= (3, 8): - import importlib.metadata as importlib_metadata -else: - import importlib_metadata -release = importlib_metadata.version("cwltool") +release = importlib.metadata.version("cwltool") version = ".".join(release.split(".")[:2]) autoapi_dirs = ["../cwltool"] diff --git a/gittaggers.py b/gittaggers.py index ab54b3e05..c25dbe1af 100644 --- a/gittaggers.py +++ b/gittaggers.py @@ -2,16 +2,13 @@ import sys import time -if sys.version_info >= (3, 8): - import importlib.metadata as importlib_metadata -else: - import importlib_metadata +import importlib.metadata from typing import Any from setuptools.command.egg_info import egg_info -SETUPTOOLS_VER = importlib_metadata.version("setuptools").split(".") +SETUPTOOLS_VER = importlib.metadata.version("setuptools").split(".") RECENT_SETUPTOOLS = ( int(SETUPTOOLS_VER[0]) > 40 diff --git a/mypy-stubs/argcomplete/__init__.pyi b/mypy-stubs/argcomplete/__init__.pyi deleted file mode 100644 index f9204a07b..000000000 --- a/mypy-stubs/argcomplete/__init__.pyi +++ /dev/null @@ -1,18 +0,0 @@ -import argparse -from typing import Any, Optional - -class CompletionFinder: - def __call__( - self, - argument_parser: argparse.ArgumentParser, - always_complete_options: bool = ..., - exit_method: Any = ..., - output_stream: Optional[Any] = ..., - exclude: Optional[Any] = ..., - validator: Optional[Any] = ..., - print_suppressed: bool = ..., - append_space: Optional[Any] = ..., - default_completer: Any = ..., - ) -> None: ... - -autocomplete: CompletionFinder diff --git a/mypy-stubs/cachecontrol/__init__.pyi b/mypy-stubs/cachecontrol/__init__.pyi deleted file mode 100644 index d8c9745da..000000000 --- a/mypy-stubs/cachecontrol/__init__.pyi +++ /dev/null @@ -1,9 +0,0 @@ -# Stubs for cachecontrol (Python 2) -# -# NOTE: This dynamically typed stub was automatically generated by stubgen. - -from typing import Any - -from .wrapper import CacheControl as CacheControl - -__email__ = ... # type: Any diff --git a/mypy-stubs/cachecontrol/cache.pyi b/mypy-stubs/cachecontrol/cache.pyi deleted file mode 100644 index 04b98f2ea..000000000 --- a/mypy-stubs/cachecontrol/cache.pyi +++ /dev/null @@ -1,5 +0,0 @@ -class BaseCache: - def get(self, key: str) -> str | None: ... - def set(self, key: str, value: str) -> None: ... - def delete(self, key: str) -> None: ... - def close(self) -> None: ... diff --git a/mypy-stubs/cachecontrol/caches/__init__.pyi b/mypy-stubs/cachecontrol/caches/__init__.pyi deleted file mode 100644 index 42c0ad685..000000000 --- a/mypy-stubs/cachecontrol/caches/__init__.pyi +++ /dev/null @@ -1,11 +0,0 @@ -# Stubs for cachecontrol.caches (Python 2) -# -# NOTE: This dynamically typed stub was automatically generated by stubgen. - -from typing import Any - -from .file_cache import FileCache as FileCache - -# from .redis_cache import RedisCache as RedisCache - -notice = ... # type: Any diff --git a/mypy-stubs/cachecontrol/caches/file_cache.pyi b/mypy-stubs/cachecontrol/caches/file_cache.pyi deleted file mode 100644 index 229c143ba..000000000 --- a/mypy-stubs/cachecontrol/caches/file_cache.pyi +++ /dev/null @@ -1,31 +0,0 @@ -from os import PathLike -from typing import ContextManager - -from ..cache import BaseCache as BaseCache -from ..controller import CacheController as CacheController - -class _LockClass: - path: str - -_lock_class = ContextManager[_LockClass] - -class FileCache(BaseCache): - directory: str | PathLike[str] - forever: bool - filemode: str - dirmode: str - lock_class: _lock_class - def __init__( - self, - directory: str | PathLike[str], - forever: bool = ..., - filemode: int = ..., - dirmode: int = ..., - use_dir_lock: bool | None = ..., - lock_class: _lock_class | None = ..., - ) -> None: ... - @staticmethod - def encode(x: str) -> str: ... - def get(self, key: str) -> None | str: ... - def set(self, key: str, value: str) -> None: ... - def delete(self, key: str) -> None: ... diff --git a/mypy-stubs/cachecontrol/compat.pyi b/mypy-stubs/cachecontrol/compat.pyi deleted file mode 100644 index fabfae3f8..000000000 --- a/mypy-stubs/cachecontrol/compat.pyi +++ /dev/null @@ -1,7 +0,0 @@ -# Stubs for cachecontrol.compat (Python 2) -# -# NOTE: This dynamically typed stub was automatically generated by stubgen. - -from typing import Any - -str = ... # type: Any diff --git a/mypy-stubs/cachecontrol/controller.pyi b/mypy-stubs/cachecontrol/controller.pyi deleted file mode 100644 index 5118fab02..000000000 --- a/mypy-stubs/cachecontrol/controller.pyi +++ /dev/null @@ -1,17 +0,0 @@ -from _typeshed import Incomplete - -logger: Incomplete -URI: Incomplete - -class CacheController: - cache: Incomplete - cache_etags: Incomplete - serializer: Incomplete - cacheable_status_codes: Incomplete - def __init__( - self, - cache: Incomplete | None = ..., - cache_etags: bool = ..., - serializer: Incomplete | None = ..., - status_codes: Incomplete | None = ..., - ) -> None: ... diff --git a/mypy-stubs/cachecontrol/wrapper.pyi b/mypy-stubs/cachecontrol/wrapper.pyi deleted file mode 100644 index a4da67289..000000000 --- a/mypy-stubs/cachecontrol/wrapper.pyi +++ /dev/null @@ -1,13 +0,0 @@ -from _typeshed import Incomplete -from requests import Session - -def CacheControl( - sess: Session, - cache: Incomplete | None = ..., - cache_etags: bool = ..., - serializer: Incomplete | None = ..., - heuristic: Incomplete | None = ..., - controller_class: Incomplete | None = ..., - adapter_class: Incomplete | None = ..., - cacheable_methods: Incomplete | None = ..., -) -> Session: ... diff --git a/mypy-stubs/graphviz/__init__.pyi b/mypy-stubs/graphviz/__init__.pyi deleted file mode 100644 index 023952bbe..000000000 --- a/mypy-stubs/graphviz/__init__.pyi +++ /dev/null @@ -1,12 +0,0 @@ -# Stubs for graphviz (Python 3.5) -# -# NOTE: This dynamically typed stub was automatically generated by stubgen. - -# from .backend import ENGINES as ENGINES, ExecutableNotFound as ExecutableNotFound, FORMATS as FORMATS, pipe as pipe, render as render, version as version, view as view -# from .dot import Digraph as Digraph, Graph as Graph -# from .files import Source as Source -# from .lang import nohtml as nohtml - -# ENGINES = ENGINES -# FORMATS = FORMATS -# ExecutableNotFound = ExecutableNotFound diff --git a/mypy-stubs/graphviz/_compat.pyi b/mypy-stubs/graphviz/_compat.pyi deleted file mode 100644 index 4308df0ad..000000000 --- a/mypy-stubs/graphviz/_compat.pyi +++ /dev/null @@ -1,15 +0,0 @@ -# Stubs for graphviz._compat (Python 3.5) -# -# NOTE: This dynamically typed stub was automatically generated by stubgen. - -from typing import Any - -PY2: Any -string_classes: Any -text_type = unicode - -def iteritems(d): ... -def makedirs(name, mode: int = ..., exist_ok: bool = ...): ... -def stderr_write_binary(data): ... - -text_type = str diff --git a/mypy-stubs/graphviz/backend.pyi b/mypy-stubs/graphviz/backend.pyi deleted file mode 100644 index 1582b9768..000000000 --- a/mypy-stubs/graphviz/backend.pyi +++ /dev/null @@ -1,11 +0,0 @@ -# Stubs for graphviz.backend (Python 3.5) -# -# NOTE: This dynamically typed stub was automatically generated by stubgen. - -class ExecutableNotFound(RuntimeError): - def __init__(self, args) -> None: ... - -def render(engine, format, filepath, quiet: bool = ...): ... -def pipe(engine, format, data, quiet: bool = ...): ... -def version(): ... -def view(filepath): ... diff --git a/mypy-stubs/graphviz/dot.pyi b/mypy-stubs/graphviz/dot.pyi deleted file mode 100644 index 45627097c..000000000 --- a/mypy-stubs/graphviz/dot.pyi +++ /dev/null @@ -1,76 +0,0 @@ -# Stubs for graphviz.dot (Python 3.5) -# -# NOTE: This dynamically typed stub was automatically generated by stubgen. - -from typing import Any, Optional - -from . import files - -class Dot(files.File): - name: Any = ... - comment: Any = ... - graph_attr: Any = ... - node_attr: Any = ... - edge_attr: Any = ... - body: Any = ... - strict: Any = ... - def __init__( - self, - name: Optional[Any] = ..., - comment: Optional[Any] = ..., - filename: Optional[Any] = ..., - directory: Optional[Any] = ..., - format: Optional[Any] = ..., - engine: Optional[Any] = ..., - encoding: Any = ..., - graph_attr: Optional[Any] = ..., - node_attr: Optional[Any] = ..., - edge_attr: Optional[Any] = ..., - body: Optional[Any] = ..., - strict: bool = ..., - ) -> None: ... - def clear(self, keep_attrs: bool = ...): ... - def __iter__(self, subgraph: bool = ...): ... - source: Any = ... - def node( - self, - name, - label: Optional[Any] = ..., - _attributes: Optional[Any] = ..., - **attrs, - ): ... - def edge( - self, - tail_name, - head_name, - label: Optional[Any] = ..., - _attributes: Optional[Any] = ..., - **attrs, - ): ... - def edges(self, tail_head_iter): ... - def attr(self, kw: Optional[Any] = ..., _attributes: Optional[Any] = ..., **attrs): ... - def subgraph( - self, - graph: Optional[Any] = ..., - name: Optional[Any] = ..., - comment: Optional[Any] = ..., - graph_attr: Optional[Any] = ..., - node_attr: Optional[Any] = ..., - edge_attr: Optional[Any] = ..., - body: Optional[Any] = ..., - ): ... - -class SubgraphContext: - parent: Any = ... - graph: Any = ... - def __init__(self, parent, kwargs) -> None: ... - def __enter__(self): ... - def __exit__(self, type_, value, traceback): ... - -class Graph(Dot): - @property - def directed(self): ... - -class Digraph(Dot): - @property - def directed(self): ... diff --git a/mypy-stubs/graphviz/files.pyi b/mypy-stubs/graphviz/files.pyi deleted file mode 100644 index b0b8bdedc..000000000 --- a/mypy-stubs/graphviz/files.pyi +++ /dev/null @@ -1,73 +0,0 @@ -# Stubs for graphviz.files (Python 3.5) -# -# NOTE: This dynamically typed stub was automatically generated by stubgen. - -from typing import Any, Optional - -class Base: - @property - def format(self): ... - @format.setter - def format(self, format): ... - @property - def engine(self): ... - @engine.setter - def engine(self, engine): ... - @property - def encoding(self): ... - @encoding.setter - def encoding(self, encoding): ... - def copy(self): ... - -class File(Base): - directory: str = ... - filename: Any = ... - format: Any = ... - engine: Any = ... - encoding: Any = ... - def __init__( - self, - filename: Optional[Any] = ..., - directory: Optional[Any] = ..., - format: Optional[Any] = ..., - engine: Optional[Any] = ..., - encoding: Any = ..., - ) -> None: ... - def pipe(self, format: Optional[Any] = ...): ... - @property - def filepath(self): ... - def save(self, filename: Optional[Any] = ..., directory: Optional[Any] = ...): ... - def render( - self, - filename: Optional[Any] = ..., - directory: Optional[Any] = ..., - view: bool = ..., - cleanup: bool = ..., - ): ... - def view( - self, - filename: Optional[Any] = ..., - directory: Optional[Any] = ..., - cleanup: bool = ..., - ): ... - -class Source(File): - @classmethod - def from_file( - cls, - filename, - directory: Optional[Any] = ..., - format: Optional[Any] = ..., - engine: Optional[Any] = ..., - encoding: Any = ..., - ): ... - source: Any = ... - def __init__( - self, - source, - filename: Optional[Any] = ..., - directory: Optional[Any] = ..., - format: Optional[Any] = ..., - engine: Optional[Any] = ..., - encoding: Any = ..., - ) -> None: ... diff --git a/mypy-stubs/graphviz/lang.pyi b/mypy-stubs/graphviz/lang.pyi deleted file mode 100644 index 28f163ea9..000000000 --- a/mypy-stubs/graphviz/lang.pyi +++ /dev/null @@ -1,20 +0,0 @@ -# Stubs for graphviz.lang (Python 3.5) -# -# NOTE: This dynamically typed stub was automatically generated by stubgen. - -from typing import Any, Optional - -def quote(identifier, html: Any = ..., valid_id: Any = ..., dot_keywords: Any = ...): ... -def quote_edge(identifier): ... -def a_list( - label: Optional[Any] = ..., - kwargs: Optional[Any] = ..., - attributes: Optional[Any] = ..., -): ... -def attr_list( - label: Optional[Any] = ..., - kwargs: Optional[Any] = ..., - attributes: Optional[Any] = ..., -): ... - -class NoHtml: ... diff --git a/mypy-stubs/graphviz/tools.pyi b/mypy-stubs/graphviz/tools.pyi deleted file mode 100644 index abad3ca9b..000000000 --- a/mypy-stubs/graphviz/tools.pyi +++ /dev/null @@ -1,9 +0,0 @@ -# Stubs for graphviz.tools (Python 3.5) -# -# NOTE: This dynamically typed stub was automatically generated by stubgen. - -from typing import Any - -def attach(object, name): ... -def mkdirs(filename, mode: int = ...): ... -def mapping_items(mapping, _iteritems: Any = ...): ... diff --git a/mypy-stubs/importlib_metadata/__init__.pyi b/mypy-stubs/importlib_metadata/__init__.pyi deleted file mode 100644 index ea406deac..000000000 --- a/mypy-stubs/importlib_metadata/__init__.pyi +++ /dev/null @@ -1,162 +0,0 @@ -import abc -import pathlib -import sys -from collections.abc import Iterable, Mapping -from email.message import Message -from importlib.abc import MetaPathFinder -from os import PathLike -from pathlib import Path -from re import Pattern -from typing import Any, ClassVar, NamedTuple, overload - -from _typeshed import StrPath -from typing_extensions import Self - -__all__ = [ - "Distribution", - "DistributionFinder", - "PackageNotFoundError", - "distribution", - "distributions", - "entry_points", - "files", - "metadata", - "requires", - "version", -] - -if sys.version_info >= (3, 10): - __all__ += ["PackageMetadata", "packages_distributions"] - -if sys.version_info >= (3, 10): - from importlib.metadata._meta import PackageMetadata as PackageMetadata - def packages_distributions() -> Mapping[str, list[str]]: ... - -class PackageNotFoundError(ModuleNotFoundError): - @property - def name(self) -> str: ... # type: ignore[override] - -class _EntryPointBase(NamedTuple): - name: str - value: str - group: str - -class EntryPoint(_EntryPointBase): - pattern: ClassVar[Pattern[str]] - if sys.version_info >= (3, 11): - def __init__(self, name: str, value: str, group: str) -> None: ... - - def load(self) -> Any: ... # Callable[[], Any] or an importable module - @property - def extras(self) -> list[str]: ... - if sys.version_info >= (3, 9): - @property - def module(self) -> str: ... - @property - def attr(self) -> str: ... - if sys.version_info >= (3, 10): - dist: ClassVar[Distribution | None] - def matches( - self, - *, - name: str = ..., - value: str = ..., - group: str = ..., - module: str = ..., - attr: str = ..., - extras: list[str] = ..., - ) -> bool: ... # undocumented - -class PackagePath(pathlib.PurePosixPath): - def read_text(self, encoding: str = "utf-8") -> str: ... - def read_binary(self) -> bytes: ... - def locate(self) -> PathLike[str]: ... - # The following attributes are not defined on PackagePath, but are dynamically added by Distribution.files: - hash: FileHash | None - size: int | None - dist: Distribution - -class FileHash: - mode: str - value: str - def __init__(self, spec: str) -> None: ... - -class Distribution: - @abc.abstractmethod - def read_text(self, filename: str) -> str | None: ... - @abc.abstractmethod - def locate_file(self, path: StrPath) -> PathLike[str]: ... - @classmethod - def from_name(cls, name: str) -> Distribution: ... - @overload - @classmethod - def discover(cls, *, context: DistributionFinder.Context) -> Iterable[Distribution]: ... - @overload - @classmethod - def discover( - cls, *, context: None = None, name: str | None = ..., path: list[str] = ..., **kwargs: Any - ) -> Iterable[Distribution]: ... - @staticmethod - def at(path: StrPath) -> PathDistribution: ... - - if sys.version_info >= (3, 10): - @property - def metadata(self) -> PackageMetadata: ... - @property - def entry_points(self) -> EntryPoints: ... - else: - @property - def metadata(self) -> Message: ... - @property - def entry_points(self) -> list[EntryPoint]: ... - - @property - def version(self) -> str: ... - @property - def files(self) -> list[PackagePath] | None: ... - @property - def requires(self) -> list[str] | None: ... - if sys.version_info >= (3, 10): - @property - def name(self) -> str: ... - -class DistributionFinder(MetaPathFinder): - class Context: - name: str | None - def __init__( - self, *, name: str | None = ..., path: list[str] = ..., **kwargs: Any - ) -> None: ... - @property - def path(self) -> list[str]: ... - - @abc.abstractmethod - def find_distributions( - self, context: DistributionFinder.Context = ... - ) -> Iterable[Distribution]: ... - -class MetadataPathFinder(DistributionFinder): - @classmethod - def find_distributions( - cls, context: DistributionFinder.Context = ... - ) -> Iterable[PathDistribution]: ... - if sys.version_info >= (3, 10): - # Yes, this is an instance method that has argumend named "cls" - def invalidate_caches(cls) -> None: ... - -class PathDistribution(Distribution): - def __init__(self, path: Path) -> None: ... - def read_text(self, filename: StrPath) -> str: ... - def locate_file(self, path: StrPath) -> PathLike[str]: ... - -def distribution(distribution_name: str) -> Distribution: ... -@overload -def distributions(*, context: DistributionFinder.Context) -> Iterable[Distribution]: ... -@overload -def distributions( - *, context: None = None, name: str | None = ..., path: list[str] = ..., **kwargs: Any -) -> Iterable[Distribution]: ... -def metadata(distribution_name: str) -> Message: ... -def entry_points() -> dict[str, list[EntryPoint]]: ... -def version(distribution_name: str) -> str: ... -def files(distribution_name: str) -> list[PackagePath] | None: ... -def requires(distribution_name: str) -> list[str] | None: ... diff --git a/mypy-stubs/importlib_metadata/_meta.pyi b/mypy-stubs/importlib_metadata/_meta.pyi deleted file mode 100644 index e3504fe40..000000000 --- a/mypy-stubs/importlib_metadata/_meta.pyi +++ /dev/null @@ -1,22 +0,0 @@ -from collections.abc import Iterator -from typing import Any, Protocol, TypeVar - -_T = TypeVar("_T") - -class PackageMetadata(Protocol): - def __len__(self) -> int: ... - def __contains__(self, item: str) -> bool: ... - def __getitem__(self, key: str) -> str: ... - def __iter__(self) -> Iterator[str]: ... - def get_all(self, name: str, failobj: _T = ...) -> list[Any] | _T: ... - @property - def json(self) -> dict[str, str | list[str]]: ... - -class SimplePath(Protocol): - def joinpath(self) -> SimplePath: ... - def parent(self) -> SimplePath: ... - def read_text(self) -> str: ... - # There was a bug in `SimplePath` definition in cpython, see #8451 - # Strictly speaking `__div__` was defined in 3.10, not __truediv__, - # but it should have always been `__truediv__`. - def __truediv__(self) -> SimplePath: ... diff --git a/mypy-stubs/subprocess.pyi b/mypy-stubs/subprocess.pyi deleted file mode 100644 index 4af9814fa..000000000 --- a/mypy-stubs/subprocess.pyi +++ /dev/null @@ -1,1096 +0,0 @@ -import sys -from types import TracebackType -from typing import ( - IO, - Any, - AnyStr, - Callable, - Generic, - Iterable, - Mapping, - Sequence, - Tuple, - Type, - TypeVar, - Union, - overload, -) - -from _typeshed import Self, StrOrBytesPath -from typing_extensions import Literal - -if sys.version_info >= (3, 9): - from types import GenericAlias - -# We prefer to annotate inputs to methods (eg subprocess.check_call) with these -# union types. -# For outputs we use laborious literal based overloads to try to determine -# which specific return types to use, and prefer to fall back to Any when -# this does not work, so the caller does not have to use an assertion to confirm -# which type. -# -# For example: -# -# try: -# x = subprocess.check_output(["ls", "-l"]) -# reveal_type(x) # bytes, based on the overloads -# except TimeoutError as e: -# reveal_type(e.cmd) # Any, but morally is _CMD -_FILE = Union[None, int, IO[Any]] -_TXT = Union[bytes, str] -if sys.version_info >= (3, 8): - _CMD = Union[StrOrBytesPath, Sequence[StrOrBytesPath]] -else: - # Python 3.6 doesn't support _CMD being a single PathLike. - # See: https://bugs.python.org/issue31961 - _CMD = Union[_TXT, Sequence[StrOrBytesPath]] -if sys.platform == "win32": - _ENV = Mapping[str, str] -else: - _ENV = Union[Mapping[bytes, StrOrBytesPath], Mapping[str, StrOrBytesPath]] - -_T = TypeVar("_T") - -class CompletedProcess(Generic[_T]): - # morally: _CMD - args: Any - returncode: int | None # this optional is REQUIRED for mypyc - # These can both be None, but requiring checks for None would be tedious - # and writing all the overloads would be horrific. - stdout: _T - stderr: _T - def __init__( - self, - args: _CMD, - returncode: int, - stdout: _T | None = ..., - stderr: _T | None = ..., - ) -> None: ... - def check_returncode(self) -> None: ... - if sys.version_info >= (3, 9): - def __class_getitem__(cls, item: Any) -> GenericAlias: ... - -if sys.version_info >= (3, 7): - # Nearly the same args as for 3.6, except for capture_output and text - @overload - def run( - args: _CMD, - bufsize: int = ..., - executable: StrOrBytesPath | None = ..., - stdin: _FILE = ..., - stdout: _FILE = ..., - stderr: _FILE = ..., - preexec_fn: Callable[[], Any] | None = ..., - close_fds: bool = ..., - shell: bool = ..., - cwd: StrOrBytesPath | None = ..., - env: _ENV | None = ..., - universal_newlines: bool = ..., - startupinfo: Any = ..., - creationflags: int = ..., - restore_signals: bool = ..., - start_new_session: bool = ..., - pass_fds: Any = ..., - *, - capture_output: bool = ..., - check: bool = ..., - encoding: str | None = ..., - errors: str | None = ..., - input: str | None = ..., - text: Literal[True], - timeout: float | None = ..., - ) -> CompletedProcess[str]: ... - @overload - def run( - args: _CMD, - bufsize: int = ..., - executable: StrOrBytesPath | None = ..., - stdin: _FILE = ..., - stdout: _FILE = ..., - stderr: _FILE = ..., - preexec_fn: Callable[[], Any] | None = ..., - close_fds: bool = ..., - shell: bool = ..., - cwd: StrOrBytesPath | None = ..., - env: _ENV | None = ..., - universal_newlines: bool = ..., - startupinfo: Any = ..., - creationflags: int = ..., - restore_signals: bool = ..., - start_new_session: bool = ..., - pass_fds: Any = ..., - *, - capture_output: bool = ..., - check: bool = ..., - encoding: str, - errors: str | None = ..., - input: str | None = ..., - text: bool | None = ..., - timeout: float | None = ..., - ) -> CompletedProcess[str]: ... - @overload - def run( - args: _CMD, - bufsize: int = ..., - executable: StrOrBytesPath | None = ..., - stdin: _FILE = ..., - stdout: _FILE = ..., - stderr: _FILE = ..., - preexec_fn: Callable[[], Any] | None = ..., - close_fds: bool = ..., - shell: bool = ..., - cwd: StrOrBytesPath | None = ..., - env: _ENV | None = ..., - universal_newlines: bool = ..., - startupinfo: Any = ..., - creationflags: int = ..., - restore_signals: bool = ..., - start_new_session: bool = ..., - pass_fds: Any = ..., - *, - capture_output: bool = ..., - check: bool = ..., - encoding: str | None = ..., - errors: str, - input: str | None = ..., - text: bool | None = ..., - timeout: float | None = ..., - ) -> CompletedProcess[str]: ... - @overload - def run( - args: _CMD, - bufsize: int = ..., - executable: StrOrBytesPath | None = ..., - stdin: _FILE = ..., - stdout: _FILE = ..., - stderr: _FILE = ..., - preexec_fn: Callable[[], Any] | None = ..., - close_fds: bool = ..., - shell: bool = ..., - cwd: StrOrBytesPath | None = ..., - env: _ENV | None = ..., - *, - universal_newlines: Literal[True], - startupinfo: Any = ..., - creationflags: int = ..., - restore_signals: bool = ..., - start_new_session: bool = ..., - pass_fds: Any = ..., - # where the *real* keyword only args start - capture_output: bool = ..., - check: bool = ..., - encoding: str | None = ..., - errors: str | None = ..., - input: str | None = ..., - text: bool | None = ..., - timeout: float | None = ..., - ) -> CompletedProcess[str]: ... - @overload - def run( - args: _CMD, - bufsize: int = ..., - executable: StrOrBytesPath | None = ..., - stdin: _FILE = ..., - stdout: _FILE = ..., - stderr: _FILE = ..., - preexec_fn: Callable[[], Any] | None = ..., - close_fds: bool = ..., - shell: bool = ..., - cwd: StrOrBytesPath | None = ..., - env: _ENV | None = ..., - universal_newlines: Literal[False] = ..., - startupinfo: Any = ..., - creationflags: int = ..., - restore_signals: bool = ..., - start_new_session: bool = ..., - pass_fds: Any = ..., - *, - capture_output: bool = ..., - check: bool = ..., - encoding: None = ..., - errors: None = ..., - input: bytes | None = ..., - text: Literal[None, False] = ..., - timeout: float | None = ..., - ) -> CompletedProcess[bytes]: ... - @overload - def run( - args: _CMD, - bufsize: int = ..., - executable: StrOrBytesPath | None = ..., - stdin: _FILE = ..., - stdout: _FILE = ..., - stderr: _FILE = ..., - preexec_fn: Callable[[], Any] | None = ..., - close_fds: bool = ..., - shell: bool = ..., - cwd: StrOrBytesPath | None = ..., - env: _ENV | None = ..., - universal_newlines: bool = ..., - startupinfo: Any = ..., - creationflags: int = ..., - restore_signals: bool = ..., - start_new_session: bool = ..., - pass_fds: Any = ..., - *, - capture_output: bool = ..., - check: bool = ..., - encoding: str | None = ..., - errors: str | None = ..., - input: _TXT | None = ..., - text: bool | None = ..., - timeout: float | None = ..., - ) -> CompletedProcess[Any]: ... - -else: - # Nearly same args as Popen.__init__ except for timeout, input, and check - @overload - def run( - args: _CMD, - bufsize: int = ..., - executable: StrOrBytesPath | None = ..., - stdin: _FILE = ..., - stdout: _FILE = ..., - stderr: _FILE = ..., - preexec_fn: Callable[[], Any] | None = ..., - close_fds: bool = ..., - shell: bool = ..., - cwd: StrOrBytesPath | None = ..., - env: _ENV | None = ..., - universal_newlines: bool = ..., - startupinfo: Any = ..., - creationflags: int = ..., - restore_signals: bool = ..., - start_new_session: bool = ..., - pass_fds: Any = ..., - *, - check: bool = ..., - encoding: str, - errors: str | None = ..., - input: str | None = ..., - timeout: float | None = ..., - ) -> CompletedProcess[str]: ... - @overload - def run( - args: _CMD, - bufsize: int = ..., - executable: StrOrBytesPath | None = ..., - stdin: _FILE = ..., - stdout: _FILE = ..., - stderr: _FILE = ..., - preexec_fn: Callable[[], Any] | None = ..., - close_fds: bool = ..., - shell: bool = ..., - cwd: StrOrBytesPath | None = ..., - env: _ENV | None = ..., - universal_newlines: bool = ..., - startupinfo: Any = ..., - creationflags: int = ..., - restore_signals: bool = ..., - start_new_session: bool = ..., - pass_fds: Any = ..., - *, - check: bool = ..., - encoding: str | None = ..., - errors: str, - input: str | None = ..., - timeout: float | None = ..., - ) -> CompletedProcess[str]: ... - @overload - def run( - args: _CMD, - bufsize: int = ..., - executable: StrOrBytesPath | None = ..., - stdin: _FILE = ..., - stdout: _FILE = ..., - stderr: _FILE = ..., - preexec_fn: Callable[[], Any] | None = ..., - close_fds: bool = ..., - shell: bool = ..., - cwd: StrOrBytesPath | None = ..., - env: _ENV | None = ..., - *, - universal_newlines: Literal[True], - startupinfo: Any = ..., - creationflags: int = ..., - restore_signals: bool = ..., - start_new_session: bool = ..., - pass_fds: Any = ..., - # where the *real* keyword only args start - check: bool = ..., - encoding: str | None = ..., - errors: str | None = ..., - input: str | None = ..., - timeout: float | None = ..., - ) -> CompletedProcess[str]: ... - @overload - def run( - args: _CMD, - bufsize: int = ..., - executable: StrOrBytesPath | None = ..., - stdin: _FILE = ..., - stdout: _FILE = ..., - stderr: _FILE = ..., - preexec_fn: Callable[[], Any] | None = ..., - close_fds: bool = ..., - shell: bool = ..., - cwd: StrOrBytesPath | None = ..., - env: _ENV | None = ..., - universal_newlines: Literal[False] = ..., - startupinfo: Any = ..., - creationflags: int = ..., - restore_signals: bool = ..., - start_new_session: bool = ..., - pass_fds: Any = ..., - *, - check: bool = ..., - encoding: None = ..., - errors: None = ..., - input: bytes | None = ..., - timeout: float | None = ..., - ) -> CompletedProcess[bytes]: ... - @overload - def run( - args: _CMD, - bufsize: int = ..., - executable: StrOrBytesPath | None = ..., - stdin: _FILE = ..., - stdout: _FILE = ..., - stderr: _FILE = ..., - preexec_fn: Callable[[], Any] | None = ..., - close_fds: bool = ..., - shell: bool = ..., - cwd: StrOrBytesPath | None = ..., - env: _ENV | None = ..., - universal_newlines: bool = ..., - startupinfo: Any = ..., - creationflags: int = ..., - restore_signals: bool = ..., - start_new_session: bool = ..., - pass_fds: Any = ..., - *, - check: bool = ..., - encoding: str | None = ..., - errors: str | None = ..., - input: _TXT | None = ..., - timeout: float | None = ..., - ) -> CompletedProcess[Any]: ... - -# Same args as Popen.__init__ -def call( - args: _CMD, - bufsize: int = ..., - executable: StrOrBytesPath | None = ..., - stdin: _FILE = ..., - stdout: _FILE = ..., - stderr: _FILE = ..., - preexec_fn: Callable[[], Any] | None = ..., - close_fds: bool = ..., - shell: bool = ..., - cwd: StrOrBytesPath | None = ..., - env: _ENV | None = ..., - universal_newlines: bool = ..., - startupinfo: Any = ..., - creationflags: int = ..., - restore_signals: bool = ..., - start_new_session: bool = ..., - pass_fds: Any = ..., - *, - timeout: float | None = ..., -) -> int: ... - -# Same args as Popen.__init__ -def check_call( - args: _CMD, - bufsize: int = ..., - executable: StrOrBytesPath = ..., - stdin: _FILE = ..., - stdout: _FILE = ..., - stderr: _FILE = ..., - preexec_fn: Callable[[], Any] | None = ..., - close_fds: bool = ..., - shell: bool = ..., - cwd: StrOrBytesPath | None = ..., - env: _ENV | None = ..., - universal_newlines: bool = ..., - startupinfo: Any = ..., - creationflags: int = ..., - restore_signals: bool = ..., - start_new_session: bool = ..., - pass_fds: Any = ..., - timeout: float | None = ..., -) -> int: ... - -if sys.version_info >= (3, 7): - # 3.7 added text - @overload - def check_output( - args: _CMD, - bufsize: int = ..., - executable: StrOrBytesPath | None = ..., - stdin: _FILE = ..., - stderr: _FILE = ..., - preexec_fn: Callable[[], Any] | None = ..., - close_fds: bool = ..., - shell: bool = ..., - cwd: StrOrBytesPath | None = ..., - env: _ENV | None = ..., - universal_newlines: bool = ..., - startupinfo: Any = ..., - creationflags: int = ..., - restore_signals: bool = ..., - start_new_session: bool = ..., - pass_fds: Any = ..., - *, - timeout: float | None = ..., - input: _TXT | None = ..., - encoding: str | None = ..., - errors: str | None = ..., - text: Literal[True], - ) -> str: ... - @overload - def check_output( - args: _CMD, - bufsize: int = ..., - executable: StrOrBytesPath | None = ..., - stdin: _FILE = ..., - stderr: _FILE = ..., - preexec_fn: Callable[[], Any] | None = ..., - close_fds: bool = ..., - shell: bool = ..., - cwd: StrOrBytesPath | None = ..., - env: _ENV | None = ..., - universal_newlines: bool = ..., - startupinfo: Any = ..., - creationflags: int = ..., - restore_signals: bool = ..., - start_new_session: bool = ..., - pass_fds: Any = ..., - *, - timeout: float | None = ..., - input: _TXT | None = ..., - encoding: str, - errors: str | None = ..., - text: bool | None = ..., - ) -> str: ... - @overload - def check_output( - args: _CMD, - bufsize: int = ..., - executable: StrOrBytesPath | None = ..., - stdin: _FILE = ..., - stderr: _FILE = ..., - preexec_fn: Callable[[], Any] | None = ..., - close_fds: bool = ..., - shell: bool = ..., - cwd: StrOrBytesPath | None = ..., - env: _ENV | None = ..., - universal_newlines: bool = ..., - startupinfo: Any = ..., - creationflags: int = ..., - restore_signals: bool = ..., - start_new_session: bool = ..., - pass_fds: Any = ..., - *, - timeout: float | None = ..., - input: _TXT | None = ..., - encoding: str | None = ..., - errors: str, - text: bool | None = ..., - ) -> str: ... - @overload - def check_output( - args: _CMD, - bufsize: int = ..., - executable: StrOrBytesPath | None = ..., - stdin: _FILE = ..., - stderr: _FILE = ..., - preexec_fn: Callable[[], Any] | None = ..., - close_fds: bool = ..., - shell: bool = ..., - cwd: StrOrBytesPath | None = ..., - env: _ENV | None = ..., - *, - universal_newlines: Literal[True], - startupinfo: Any = ..., - creationflags: int = ..., - restore_signals: bool = ..., - start_new_session: bool = ..., - pass_fds: Any = ..., - # where the real keyword only ones start - timeout: float | None = ..., - input: _TXT | None = ..., - encoding: str | None = ..., - errors: str | None = ..., - text: bool | None = ..., - ) -> str: ... - @overload - def check_output( - args: _CMD, - bufsize: int = ..., - executable: StrOrBytesPath | None = ..., - stdin: _FILE = ..., - stderr: _FILE = ..., - preexec_fn: Callable[[], Any] | None = ..., - close_fds: bool = ..., - shell: bool = ..., - cwd: StrOrBytesPath | None = ..., - env: _ENV | None = ..., - universal_newlines: Literal[False] = ..., - startupinfo: Any = ..., - creationflags: int = ..., - restore_signals: bool = ..., - start_new_session: bool = ..., - pass_fds: Any = ..., - *, - timeout: float | None = ..., - input: _TXT | None = ..., - encoding: None = ..., - errors: None = ..., - text: Literal[None, False] = ..., - ) -> bytes: ... - @overload - def check_output( - args: _CMD, - bufsize: int = ..., - executable: StrOrBytesPath | None = ..., - stdin: _FILE = ..., - stderr: _FILE = ..., - preexec_fn: Callable[[], Any] | None = ..., - close_fds: bool = ..., - shell: bool = ..., - cwd: StrOrBytesPath | None = ..., - env: _ENV | None = ..., - universal_newlines: bool = ..., - startupinfo: Any = ..., - creationflags: int = ..., - restore_signals: bool = ..., - start_new_session: bool = ..., - pass_fds: Any = ..., - *, - timeout: float | None = ..., - input: _TXT | None = ..., - encoding: str | None = ..., - errors: str | None = ..., - text: bool | None = ..., - ) -> Any: ... # morally: -> _TXT - -else: - @overload - def check_output( - args: _CMD, - bufsize: int = ..., - executable: StrOrBytesPath | None = ..., - stdin: _FILE = ..., - stderr: _FILE = ..., - preexec_fn: Callable[[], Any] | None = ..., - close_fds: bool = ..., - shell: bool = ..., - cwd: StrOrBytesPath | None = ..., - env: _ENV | None = ..., - universal_newlines: bool = ..., - startupinfo: Any = ..., - creationflags: int = ..., - restore_signals: bool = ..., - start_new_session: bool = ..., - pass_fds: Any = ..., - *, - timeout: float | None = ..., - input: _TXT | None = ..., - encoding: str, - errors: str | None = ..., - ) -> str: ... - @overload - def check_output( - args: _CMD, - bufsize: int = ..., - executable: StrOrBytesPath | None = ..., - stdin: _FILE = ..., - stderr: _FILE = ..., - preexec_fn: Callable[[], Any] | None = ..., - close_fds: bool = ..., - shell: bool = ..., - cwd: StrOrBytesPath | None = ..., - env: _ENV | None = ..., - universal_newlines: bool = ..., - startupinfo: Any = ..., - creationflags: int = ..., - restore_signals: bool = ..., - start_new_session: bool = ..., - pass_fds: Any = ..., - *, - timeout: float | None = ..., - input: _TXT | None = ..., - encoding: str | None = ..., - errors: str, - ) -> str: ... - @overload - def check_output( - args: _CMD, - bufsize: int = ..., - executable: StrOrBytesPath | None = ..., - stdin: _FILE = ..., - stderr: _FILE = ..., - preexec_fn: Callable[[], Any] | None = ..., - close_fds: bool = ..., - shell: bool = ..., - cwd: StrOrBytesPath | None = ..., - env: _ENV | None = ..., - startupinfo: Any = ..., - creationflags: int = ..., - restore_signals: bool = ..., - start_new_session: bool = ..., - pass_fds: Any = ..., - *, - universal_newlines: Literal[True], - timeout: float | None = ..., - input: _TXT | None = ..., - encoding: str | None = ..., - errors: str | None = ..., - ) -> str: ... - @overload - def check_output( - args: _CMD, - bufsize: int = ..., - executable: StrOrBytesPath | None = ..., - stdin: _FILE = ..., - stderr: _FILE = ..., - preexec_fn: Callable[[], Any] | None = ..., - close_fds: bool = ..., - shell: bool = ..., - cwd: StrOrBytesPath | None = ..., - env: _ENV | None = ..., - universal_newlines: Literal[False] = ..., - startupinfo: Any = ..., - creationflags: int = ..., - restore_signals: bool = ..., - start_new_session: bool = ..., - pass_fds: Any = ..., - *, - timeout: float | None = ..., - input: _TXT | None = ..., - encoding: None = ..., - errors: None = ..., - ) -> bytes: ... - @overload - def check_output( - args: _CMD, - bufsize: int = ..., - executable: StrOrBytesPath | None = ..., - stdin: _FILE = ..., - stderr: _FILE = ..., - preexec_fn: Callable[[], Any] | None = ..., - close_fds: bool = ..., - shell: bool = ..., - cwd: StrOrBytesPath | None = ..., - env: _ENV | None = ..., - universal_newlines: bool = ..., - startupinfo: Any = ..., - creationflags: int = ..., - restore_signals: bool = ..., - start_new_session: bool = ..., - pass_fds: Any = ..., - *, - timeout: float | None = ..., - input: _TXT | None = ..., - encoding: str | None = ..., - errors: str | None = ..., - ) -> Any: ... # morally: -> _TXT - -PIPE: int -STDOUT: int -DEVNULL: int - -class SubprocessError(Exception): ... - -class TimeoutExpired(SubprocessError): - def __init__( - self, - cmd: _CMD, - timeout: float, - output: _TXT | None = ..., - stderr: _TXT | None = ..., - ) -> None: ... - # morally: _CMD - cmd: Any - timeout: float - # morally: _TXT | None - output: Any - stdout: Any - stderr: Any - -class CalledProcessError(SubprocessError): - returncode: int | None # this optional is REQUIRED for mypyc - # morally: _CMD - cmd: Any - # morally: _TXT | None - output: Any - - # morally: _TXT | None - stdout: Any - stderr: Any - def __init__( - self, - returncode: int, - cmd: _CMD, - output: _TXT | None = ..., - stderr: _TXT | None = ..., - ) -> None: ... - -class Popen(Generic[AnyStr]): - args: _CMD - stdin: IO[AnyStr] | None - stdout: IO[AnyStr] | None - stderr: IO[AnyStr] | None - pid: int - returncode: int | None # this optional is REQUIRED for mypyc - universal_newlines: bool - - # Technically it is wrong that Popen provides __new__ instead of __init__ - # but this shouldn't come up hopefully? - - if sys.version_info >= (3, 7): - # text is added in 3.7 - @overload - def __new__( - cls, - args: _CMD, - bufsize: int = ..., - executable: StrOrBytesPath | None = ..., - stdin: _FILE | None = ..., - stdout: _FILE | None = ..., - stderr: _FILE | None = ..., - preexec_fn: Callable[[], Any] | None = ..., - close_fds: bool = ..., - shell: bool = ..., - cwd: StrOrBytesPath | None = ..., - env: _ENV | None = ..., - universal_newlines: bool = ..., - startupinfo: Any | None = ..., - creationflags: int = ..., - restore_signals: bool = ..., - start_new_session: bool = ..., - pass_fds: Any = ..., - *, - text: bool | None = ..., - encoding: str, - errors: str | None = ..., - ) -> Popen[str]: ... - @overload - def __new__( - cls, - args: _CMD, - bufsize: int = ..., - executable: StrOrBytesPath | None = ..., - stdin: _FILE | None = ..., - stdout: _FILE | None = ..., - stderr: _FILE | None = ..., - preexec_fn: Callable[[], Any] | None = ..., - close_fds: bool = ..., - shell: bool = ..., - cwd: StrOrBytesPath | None = ..., - env: _ENV | None = ..., - universal_newlines: bool = ..., - startupinfo: Any | None = ..., - creationflags: int = ..., - restore_signals: bool = ..., - start_new_session: bool = ..., - pass_fds: Any = ..., - *, - text: bool | None = ..., - encoding: str | None = ..., - errors: str, - ) -> Popen[str]: ... - @overload - def __new__( - cls, - args: _CMD, - bufsize: int = ..., - executable: StrOrBytesPath | None = ..., - stdin: _FILE | None = ..., - stdout: _FILE | None = ..., - stderr: _FILE | None = ..., - preexec_fn: Callable[[], Any] | None = ..., - close_fds: bool = ..., - shell: bool = ..., - cwd: StrOrBytesPath | None = ..., - env: _ENV | None = ..., - *, - universal_newlines: Literal[True], - startupinfo: Any | None = ..., - creationflags: int = ..., - restore_signals: bool = ..., - start_new_session: bool = ..., - pass_fds: Any = ..., - # where the *real* keyword only args start - text: bool | None = ..., - encoding: str | None = ..., - errors: str | None = ..., - ) -> Popen[str]: ... - @overload - def __new__( - cls, - args: _CMD, - bufsize: int = ..., - executable: StrOrBytesPath | None = ..., - stdin: _FILE | None = ..., - stdout: _FILE | None = ..., - stderr: _FILE | None = ..., - preexec_fn: Callable[[], Any] | None = ..., - close_fds: bool = ..., - shell: bool = ..., - cwd: StrOrBytesPath | None = ..., - env: _ENV | None = ..., - universal_newlines: bool = ..., - startupinfo: Any | None = ..., - creationflags: int = ..., - restore_signals: bool = ..., - start_new_session: bool = ..., - pass_fds: Any = ..., - *, - text: Literal[True], - encoding: str | None = ..., - errors: str | None = ..., - ) -> Popen[str]: ... - @overload - def __new__( - cls, - args: _CMD, - bufsize: int = ..., - executable: StrOrBytesPath | None = ..., - stdin: _FILE | None = ..., - stdout: _FILE | None = ..., - stderr: _FILE | None = ..., - preexec_fn: Callable[[], Any] | None = ..., - close_fds: bool = ..., - shell: bool = ..., - cwd: StrOrBytesPath | None = ..., - env: _ENV | None = ..., - universal_newlines: Literal[False] = ..., - startupinfo: Any | None = ..., - creationflags: int = ..., - restore_signals: bool = ..., - start_new_session: bool = ..., - pass_fds: Any = ..., - *, - text: Literal[None, False] = ..., - encoding: None = ..., - errors: None = ..., - ) -> Popen[bytes]: ... - @overload - def __new__( - cls, - args: _CMD, - bufsize: int = ..., - executable: StrOrBytesPath | None = ..., - stdin: _FILE | None = ..., - stdout: _FILE | None = ..., - stderr: _FILE | None = ..., - preexec_fn: Callable[[], Any] | None = ..., - close_fds: bool = ..., - shell: bool = ..., - cwd: StrOrBytesPath | None = ..., - env: _ENV | None = ..., - universal_newlines: bool = ..., - startupinfo: Any | None = ..., - creationflags: int = ..., - restore_signals: bool = ..., - start_new_session: bool = ..., - pass_fds: Any = ..., - *, - text: bool | None = ..., - encoding: str | None = ..., - errors: str | None = ..., - ) -> Popen[Any]: ... - else: - @overload - def __new__( - cls, - args: _CMD, - bufsize: int = ..., - executable: StrOrBytesPath | None = ..., - stdin: _FILE | None = ..., - stdout: _FILE | None = ..., - stderr: _FILE | None = ..., - preexec_fn: Callable[[], Any] | None = ..., - close_fds: bool = ..., - shell: bool = ..., - cwd: StrOrBytesPath | None = ..., - env: _ENV | None = ..., - universal_newlines: bool = ..., - startupinfo: Any | None = ..., - creationflags: int = ..., - restore_signals: bool = ..., - start_new_session: bool = ..., - pass_fds: Any = ..., - *, - encoding: str, - errors: str | None = ..., - ) -> Popen[str]: ... - @overload - def __new__( - cls, - args: _CMD, - bufsize: int = ..., - executable: StrOrBytesPath | None = ..., - stdin: _FILE | None = ..., - stdout: _FILE | None = ..., - stderr: _FILE | None = ..., - preexec_fn: Callable[[], Any] | None = ..., - close_fds: bool = ..., - shell: bool = ..., - cwd: StrOrBytesPath | None = ..., - env: _ENV | None = ..., - universal_newlines: bool = ..., - startupinfo: Any | None = ..., - creationflags: int = ..., - restore_signals: bool = ..., - start_new_session: bool = ..., - pass_fds: Any = ..., - *, - encoding: str | None = ..., - errors: str, - ) -> Popen[str]: ... - @overload - def __new__( - cls, - args: _CMD, - bufsize: int = ..., - executable: StrOrBytesPath | None = ..., - stdin: _FILE | None = ..., - stdout: _FILE | None = ..., - stderr: _FILE | None = ..., - preexec_fn: Callable[[], Any] | None = ..., - close_fds: bool = ..., - shell: bool = ..., - cwd: StrOrBytesPath | None = ..., - env: _ENV | None = ..., - *, - universal_newlines: Literal[True], - startupinfo: Any | None = ..., - creationflags: int = ..., - restore_signals: bool = ..., - start_new_session: bool = ..., - pass_fds: Any = ..., - # where the *real* keyword only args start - encoding: str | None = ..., - errors: str | None = ..., - ) -> Popen[str]: ... - @overload - def __new__( - cls, - args: _CMD, - bufsize: int = ..., - executable: StrOrBytesPath | None = ..., - stdin: _FILE | None = ..., - stdout: _FILE | None = ..., - stderr: _FILE | None = ..., - preexec_fn: Callable[[], Any] | None = ..., - close_fds: bool = ..., - shell: bool = ..., - cwd: StrOrBytesPath | None = ..., - env: _ENV | None = ..., - universal_newlines: Literal[False] = ..., - startupinfo: Any | None = ..., - creationflags: int = ..., - restore_signals: bool = ..., - start_new_session: bool = ..., - pass_fds: Any = ..., - *, - encoding: None = ..., - errors: None = ..., - ) -> Popen[bytes]: ... - @overload - def __new__( - cls, - args: _CMD, - bufsize: int = ..., - executable: StrOrBytesPath | None = ..., - stdin: _FILE | None = ..., - stdout: _FILE | None = ..., - stderr: _FILE | None = ..., - preexec_fn: Callable[[], Any] | None = ..., - close_fds: bool = ..., - shell: bool = ..., - cwd: StrOrBytesPath | None = ..., - env: _ENV | None = ..., - universal_newlines: bool = ..., - startupinfo: Any | None = ..., - creationflags: int = ..., - restore_signals: bool = ..., - start_new_session: bool = ..., - pass_fds: Any = ..., - *, - encoding: str | None = ..., - errors: str | None = ..., - ) -> Popen[Any]: ... - - def poll(self) -> int | None: ... - if sys.version_info >= (3, 7): - def wait(self, timeout: float | None = ...) -> int: ... - else: - def wait(self, timeout: float | None = ..., endtime: float | None = ...) -> int: ... - # Return str/bytes - def communicate( - self, - input: AnyStr | None = ..., - timeout: float | None = ..., - # morally this should be optional - ) -> Tuple[AnyStr, AnyStr]: ... - def send_signal(self, sig: int) -> None: ... - def terminate(self) -> None: ... - def kill(self) -> None: ... - def __enter__(self: Self) -> Self: ... - def __exit__( - self, - type: Type[BaseException] | None, - value: BaseException | None, - traceback: TracebackType | None, - ) -> None: ... - if sys.version_info >= (3, 9): - def __class_getitem__(cls, item: Any) -> GenericAlias: ... - -# The result really is always a str. -def getstatusoutput(cmd: _TXT) -> Tuple[int, str]: ... -def getoutput(cmd: _TXT) -> str: ... -def list2cmdline(seq: Iterable[str]) -> str: ... # undocumented - -if sys.platform == "win32": - class STARTUPINFO: - if sys.version_info >= (3, 7): - def __init__( - self, - *, - dwFlags: int = ..., - hStdInput: Any | None = ..., - hStdOutput: Any | None = ..., - hStdError: Any | None = ..., - wShowWindow: int = ..., - lpAttributeList: Mapping[str, Any] | None = ..., - ) -> None: ... - dwFlags: int - hStdInput: Any | None - hStdOutput: Any | None - hStdError: Any | None - wShowWindow: int - if sys.version_info >= (3, 7): - lpAttributeList: Mapping[str, Any] - STD_INPUT_HANDLE: Any - STD_OUTPUT_HANDLE: Any - STD_ERROR_HANDLE: Any - SW_HIDE: int - STARTF_USESTDHANDLES: int - STARTF_USESHOWWINDOW: int - CREATE_NEW_CONSOLE: int - CREATE_NEW_PROCESS_GROUP: int - if sys.version_info >= (3, 7): - ABOVE_NORMAL_PRIORITY_CLASS: int - BELOW_NORMAL_PRIORITY_CLASS: int - HIGH_PRIORITY_CLASS: int - IDLE_PRIORITY_CLASS: int - NORMAL_PRIORITY_CLASS: int - REALTIME_PRIORITY_CLASS: int - CREATE_NO_WINDOW: int - DETACHED_PROCESS: int - CREATE_DEFAULT_ERROR_MODE: int - CREATE_BREAKAWAY_FROM_JOB: int diff --git a/mypy-stubs/urllib/__init__.py b/mypy-stubs/urllib/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/mypy-stubs/urllib/parse.pyi b/mypy-stubs/urllib/parse.pyi deleted file mode 100644 index 81b2db34e..000000000 --- a/mypy-stubs/urllib/parse.pyi +++ /dev/null @@ -1,190 +0,0 @@ -# Stubs for urllib.parse -import sys -from typing import ( - Any, - AnyStr, - Callable, - Dict, - Generic, - Iterator, - List, - Mapping, - NamedTuple, - Optional, - Sequence, - Tuple, - Union, - overload, -) - -_Str = Union[bytes, str] - -uses_relative: List[str] -uses_netloc: List[str] -uses_params: List[str] -non_hierarchical: List[str] -uses_query: List[str] -uses_fragment: List[str] -scheme_chars: str -MAX_CACHE_SIZE = 0 - -class _ResultMixinBase(Generic[AnyStr]): - def geturl(self) -> AnyStr: ... - -class _ResultMixinStr(_ResultMixinBase[str]): - def encode(self, encoding: str = ..., errors: str = ...) -> _ResultMixinBytes: ... - -class _ResultMixinBytes(_ResultMixinBase[str]): - def decode(self, encoding: str = ..., errors: str = ...) -> _ResultMixinStr: ... - -class _NetlocResultMixinBase(Generic[AnyStr]): - username: AnyStr - password: AnyStr - hostname: AnyStr - port: int - -class _NetlocResultMixinStr(_NetlocResultMixinBase[str], _ResultMixinStr): ... -class _NetlocResultMixinBytes(_NetlocResultMixinBase[bytes], _ResultMixinBytes): ... - -class _DefragResultBase(Generic[AnyStr]): - url: AnyStr - fragment: AnyStr - @overload - def __getitem__(self, x: slice) -> AnyStr: ... - @overload - def __getitem__(self, x: int) -> AnyStr: ... - def __iter__(self) -> Iterator[AnyStr]: ... - -_SplitResultBase = NamedTuple( - "_SplitResultBase", - [ - ("scheme", str), - ("netloc", str), - ("path", str), - ("query", str), - ("fragment", str), - ], -) -_SplitResultBytesBase = NamedTuple( - "_SplitResultBytesBase", - [ - ("scheme", bytes), - ("netloc", bytes), - ("path", bytes), - ("query", bytes), - ("fragment", bytes), - ], -) - -_ParseResultBase = NamedTuple( - "_ParseResultBase", - [ - ("scheme", str), - ("netloc", str), - ("path", str), - ("params", str), - ("query", str), - ("fragment", str), - ], -) -_ParseResultBytesBase = NamedTuple( - "_ParseResultBytesBase", - [ - ("scheme", bytes), - ("netloc", bytes), - ("path", bytes), - ("params", bytes), - ("query", bytes), - ("fragment", bytes), - ], -) - -# Structured result objects for string data -class DefragResult(_DefragResultBase[str], _ResultMixinStr): ... -class SplitResult(_SplitResultBase, _NetlocResultMixinStr): ... -class ParseResult(_ParseResultBase, _NetlocResultMixinStr): ... - -# Structured result objects for bytes data -class DefragResultBytes(_DefragResultBase[bytes], _ResultMixinBytes): ... -class SplitResultBytes(_SplitResultBytesBase, _NetlocResultMixinBytes): ... -class ParseResultBytes(_ParseResultBytesBase, _NetlocResultMixinBytes): ... - -def parse_qs( - qs: AnyStr, - keep_blank_values: bool = ..., - strict_parsing: bool = ..., - encoding: str = ..., - errors: str = ..., -) -> Dict[AnyStr, List[AnyStr]]: ... -def parse_qsl( - qs: AnyStr, - keep_blank_values: bool = ..., - strict_parsing: bool = ..., - encoding: str = ..., - errors: str = ..., -) -> List[Tuple[AnyStr, AnyStr]]: ... -@overload -def quote(string: str, safe: _Str = ..., encoding: str = ..., errors: str = ...) -> str: ... -@overload -def quote(string: bytes, safe: _Str = ...) -> str: ... -def quote_from_bytes(bs: bytes, safe: _Str = ...) -> str: ... -@overload -def quote_plus(string: str, safe: _Str = ..., encoding: str = ..., errors: str = ...) -> str: ... -@overload -def quote_plus(string: bytes, safe: _Str = ...) -> str: ... -def unquote(string: str, encoding: str = ..., errors: str = ...) -> str: ... -def unquote_to_bytes(string: _Str) -> bytes: ... -def unquote_plus(string: str, encoding: str = ..., errors: str = ...) -> str: ... -@overload -def urldefrag(url: str) -> DefragResult: ... -@overload -def urldefrag(url: bytes) -> DefragResultBytes: ... - -if sys.version_info >= (3, 5): - def urlencode( - query: Union[ - Mapping[Any, Any], - Mapping[Any, Sequence[Any]], - Sequence[Tuple[Any, Any]], - Sequence[Tuple[Any, Sequence[Any]]], - ], - doseq: bool = ..., - safe: AnyStr = ..., - encoding: str = ..., - errors: str = ..., - quote_via: Callable[[str, AnyStr, str, str], str] = ..., - ) -> str: ... - -else: - def urlencode( - query: Union[ - Mapping[Any, Any], - Mapping[Any, Sequence[Any]], - Sequence[Tuple[Any, Any]], - Sequence[Tuple[Any, Sequence[Any]]], - ], - doseq: bool = ..., - safe: AnyStr = ..., - encoding: str = ..., - errors: str = ..., - ) -> str: ... - -def urljoin( - base: Optional[AnyStr], url: Optional[AnyStr], allow_fragments: bool = ... -) -> AnyStr: ... -@overload -def urlparse(url: str, scheme: str = ..., allow_fragments: bool = ...) -> ParseResult: ... -@overload -def urlparse(url: bytes, scheme: bytes = ..., allow_fragments: bool = ...) -> ParseResultBytes: ... -@overload -def urlsplit(url: Optional[str], scheme: str = ..., allow_fragments: bool = ...) -> SplitResult: ... -@overload -def urlsplit(url: bytes, scheme: bytes = ..., allow_fragments: bool = ...) -> SplitResultBytes: ... -@overload -def urlunparse(components: Tuple[AnyStr, AnyStr, AnyStr, AnyStr, AnyStr, AnyStr]) -> AnyStr: ... -@overload -def urlunparse(components: Sequence[AnyStr]) -> AnyStr: ... -@overload -def urlunsplit(components: Tuple[AnyStr, AnyStr, AnyStr, AnyStr, AnyStr]) -> AnyStr: ... -@overload -def urlunsplit(components: Sequence[AnyStr]) -> AnyStr: ... diff --git a/pyproject.toml b/pyproject.toml index f8526fab8..d506aed14 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,18 +1,18 @@ [build-system] requires = [ "setuptools>=45", - 'mypy==0.971; python_version == "3.6"', # last version for Python 3.6 - 'mypy==1.3.0; python_version >= "3.7"', # also update mypy-requirements.txt + "mypy==1.3.0", # also update mypy-requirements.txt "types-requests", "types-psutil", "importlib_resources>=1.4", # equivalent to Python 3.9 "ruamel.yaml>=0.16.0,<0.18", "schema-salad>=8.2.20211104054942,<9", - "cwl-utils >=0.19", - 'toml', + "cwl-utils>=0.19", + "toml", + "argcomplete>=1.12.0", ] build-backend = "setuptools.build_meta" [tool.black] line-length = 100 -target-version = [ "py36" ] +target-version = [ "py38" ] diff --git a/requirements.txt b/requirements.txt index b7223642d..9f9945be1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,18 +2,14 @@ requests>=2.6.1 ruamel.yaml>=0.15.0,<0.18 ruamel.yaml>=0.16;python_version>='3.10' rdflib>=4.2.2,<6.4 -rdflib<6.0.0;python_version<='3.6' shellescape>=3.4.1,<3.9 schema-salad>=8.4,<9 prov==1.5.1 mypy-extensions psutil>=5.6.6 -typing-extensions importlib_resources>=1.4 # equivalent to Python 3.9 -importlib_metadata;python_version<'3.8' # equivalent to Python 3.9 coloredlogs pydot>=1.4.1 argcomplete>=1.12.0 pyparsing!=3.0.2 # breaks --print-dot (pydot) https://github.com/pyparsing/pyparsing/issues/319 -pyparsing<3;python_version<='3.6' # breaks --print-dot cwl-utils>=0.22 diff --git a/setup.py b/setup.py index 06b9e11e1..271821aca 100644 --- a/setup.py +++ b/setup.py @@ -115,26 +115,22 @@ "ruamel.yaml >= 0.15, < 0.18", "ruamel.yaml >= 0.16.0;python_version>='3.10'", "rdflib >= 4.2.2, < 6.4.0", - "rdflib < 6.0.0;python_version<='3.6'", "shellescape >= 3.4.1, < 3.9", "schema-salad >= 8.4, < 9", "prov == 1.5.1", "mypy-extensions", "psutil >= 5.6.6", - "typing-extensions", "importlib_resources>=1.4", - "importlib_metadata;python_version<'3.8'", "coloredlogs", "pydot >= 1.4.1", "argcomplete", "pyparsing != 3.0.2", # breaks --print-dot (pydot) https://github.com/pyparsing/pyparsing/issues/319 - "pyparsing < 3 ;python_version<='3.6'", # breaks --print-dot (pydot) "cwl-utils >= 0.22", ], extras_require={ "deps": ["galaxy-tool-util >= 22.1.2, <23", "galaxy-util <23"], }, - python_requires=">=3.6, <4", + python_requires=">=3.8, <4", setup_requires=PYTEST_RUNNER, test_suite="tests", tests_require=[ @@ -144,7 +140,6 @@ "pytest-mock >= 1.10.0", "pytest-httpserver", "arcp >= 0.2.0", - "rdflib-jsonld>=0.4.0, <= 0.6.1;python_version<='3.6'", ], entry_points={"console_scripts": ["cwltool=cwltool.main:run"]}, zip_safe=True, @@ -161,7 +156,6 @@ "Operating System :: POSIX", "Operating System :: POSIX :: Linux", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", diff --git a/test-requirements.txt b/test-requirements.txt index f96c672e5..67151ee97 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -6,7 +6,6 @@ mock>=2.0.0 pytest-mock>=1.10.0 pytest-cov arcp>=0.2.0 -rdflib-jsonld>=0.4.0,<= 0.6.1;python_version<='3.6' -rrequirements.txt galaxy-tool-util>=22.1.2,<23 galaxy-util<23 diff --git a/tests/test_singularity_versions.py b/tests/test_singularity_versions.py index 3f79e8266..61b16177b 100644 --- a/tests/test_singularity_versions.py +++ b/tests/test_singularity_versions.py @@ -21,7 +21,7 @@ def reset_singularity_version_cache() -> None: def set_dummy_check_output(name: str, version: str) -> None: """Mock out subprocess.check_output.""" cwltool.singularity.check_output = ( # type: ignore[attr-defined] - lambda c, universal_newlines: name + " version " + version + lambda c, text: name + " version " + version ) diff --git a/tests/util.py b/tests/util.py index e5e128936..7f33f1c40 100644 --- a/tests/util.py +++ b/tests/util.py @@ -67,8 +67,7 @@ def env_accepts_null() -> bool: if _env_accepts_null is None: result = subprocess.run( ["env", "-0"], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, + capture_output=True, encoding="utf-8", ) _env_accepts_null = result.returncode == 0 diff --git a/tox.ini b/tox.ini index 5b2640429..2d692b423 100644 --- a/tox.ini +++ b/tox.ini @@ -1,9 +1,9 @@ [tox] envlist = py3{8,9,10,11}-lint - py3{6,7,8,9,10,11}-unit - py3{6,7,8,9,10,11}-bandit - py3{7,8,9,10,11}-mypy + py3{8,9,10,11}-unit + py3{8,9,10,11}-bandit + py3{8,9,10,11}-mypy py311-lintreadme py311-shellcheck py311-pydocstyle @@ -16,8 +16,6 @@ testpaths = tests [gh-actions] python = - 3.6: py36 - 3.7: py37 3.8: py38 3.9: py39 3.10: py310 @@ -25,13 +23,13 @@ python = [testenv] skipsdist = - py3{6,7,8,9,10,11}-!{unit,mypy,lintreadme} = True + py3{8,9,10,11}-!{unit,mypy,lintreadme} = True description = - py3{6,7,8,9,10,11}-unit: Run the unit tests + py3{8,9,10,11}-unit: Run the unit tests py3{8,9,10,11}-lint: Lint the Python code - py3{6,7,8,9,10,11}-bandit: Search for common security issues - py3{7,8,9,10,11}-mypy: Check for type safety + py3{8,9,10,11}-bandit: Search for common security issues + py3{8,9,10,11}-mypy: Check for type safety py311-pydocstyle: docstring style checker py311-shellcheck: syntax check for shell scripts py311-lintreadme: Lint the README.rst→.md conversion @@ -42,15 +40,15 @@ passenv = PROOT_NO_SECCOMP extras = - py3{6,7,8,9,10,11}-unit: deps + py3{8,9,10,11}-unit: deps deps = - py3{6,7,8,9,10,11}-{unit,lint,bandit,mypy}: -rrequirements.txt - py3{6,7,8,9,10,11}-{unit,mypy}: -rtest-requirements.txt + py3{8,9,10,11}-{unit,lint,bandit,mypy}: -rrequirements.txt + py3{8,9,10,11}-{unit,mypy}: -rtest-requirements.txt py3{8,9,10,11}-lint: -rlint-requirements.txt - py3{6,7,8,9,10,11}-bandit: bandit - py3{6,7,8,9,10,11}-bandit: importlib_metadata != 4.8.0 - py3{7,8,9,10,11}-mypy: -rmypy-requirements.txt + py3{8,9,10,11}-bandit: bandit + py3{8,9,10,11}-bandit: importlib_metadata != 4.8.0 + py3{8,9,10,11}-mypy: -rmypy-requirements.txt py311-pydocstyle: pydocstyle py311-pydocstyle: diff-cover py311-lintreadme: twine @@ -58,23 +56,22 @@ deps = py311-lintreadme: readme_renderer[rst] setenv = - py3{6,7,8,9,10,11}-unit: LC_ALL = C.UTF-8 + py3{8,9,10,11}-unit: LC_ALL = C.UTF-8 commands_pre = - py3{6,7,8,9,10,11}-unit: python -m pip install -U pip setuptools wheel + py3{8,9,10,11}-unit: python -m pip install -U pip setuptools wheel py311-lintreadme: python -m build --outdir {distdir} commands = - py3{6,7,8,9,10,11}-unit: make coverage-report coverage.xml PYTEST_EXTRA={posargs} - py3{6,7,8,9,10,11}-bandit: bandit -r cwltool + py3{8,9,10,11}-unit: make coverage-report coverage.xml PYTEST_EXTRA={posargs} + py3{8,9,10,11}-bandit: bandit -r cwltool py3{8,9,10,11}-lint: make flake8 format-check codespell-check - py3{7,8,9,10,11}-mypy: make mypy mypyc PYTEST_EXTRA={posargs} - py37-mypy: make mypy_3.6 + py3{8,9,10,11}-mypy: make mypy mypyc PYTEST_EXTRA={posargs} py311-shellcheck: make shellcheck py311-pydocstyle: make diff_pydocstyle_report py311-lintreadme: twine check {distdir}/* skip_install = - py3{6,7,8,9,10,11}-{bandit,lint,mypy,shellcheck,pydocstyle,lintreadme}: true + py3{8,9,10,11}-{bandit,lint,mypy,shellcheck,pydocstyle,lintreadme}: true allowlist_externals = make