From 08ad3431c58a6e6e299b2165a8d3789a3c48baf0 Mon Sep 17 00:00:00 2001 From: "Michael R. Crusoe" Date: Fri, 27 Sep 2024 12:32:22 +0200 Subject: [PATCH] prepare for mypy 1.12 --- cwl_utils/graph_split.py | 1 + mypy-stubs/cachecontrol/__init__.pyi | 9 ----- mypy-stubs/cachecontrol/cache.pyi | 12 ------- mypy-stubs/cachecontrol/caches/__init__.pyi | 5 --- mypy-stubs/cachecontrol/caches/file_cache.pyi | 35 ------------------- mypy-stubs/cachecontrol/compat.pyi | 7 ---- mypy-stubs/cachecontrol/controller.pyi | 18 ---------- mypy-stubs/cachecontrol/wrapper.pyi | 18 ---------- 8 files changed, 1 insertion(+), 104 deletions(-) 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 diff --git a/cwl_utils/graph_split.py b/cwl_utils/graph_split.py index e37e7b04..4c4c283b 100755 --- a/cwl_utils/graph_split.py +++ b/cwl_utils/graph_split.py @@ -146,6 +146,7 @@ def rewrite(document: Any, doc_id: str) -> Set[str]: def rewrite_id(entry: Any) -> Union[MutableMapping[Any, Any], str]: if isinstance(entry, MutableMapping): if entry["id"].startswith(this_id): + assert isinstance(this_id, str) # nosec B101 entry["id"] = cast(str, entry["id"])[len(this_id) + 1 :] return entry elif isinstance(entry, str): diff --git a/mypy-stubs/cachecontrol/__init__.pyi b/mypy-stubs/cachecontrol/__init__.pyi deleted file mode 100644 index d8c9745d..00000000 --- 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 3b3e109f..00000000 --- a/mypy-stubs/cachecontrol/cache.pyi +++ /dev/null @@ -1,12 +0,0 @@ -from datetime import datetime -from typing import IO - -class BaseCache: - def get(self, key: str) -> bytes | None: ... - def set(self, key: str, value: bytes, expires: int | datetime | None = None) -> None: ... - def delete(self, key: str) -> None: ... - def close(self) -> None: ... - -class SeparateBodyBaseCache(BaseCache): - def set_body(self, key: str, body: bytes) -> None: ... - def get_body(self, key: str) -> IO[bytes] | None: ... diff --git a/mypy-stubs/cachecontrol/caches/__init__.pyi b/mypy-stubs/cachecontrol/caches/__init__.pyi deleted file mode 100644 index 61a3698d..00000000 --- a/mypy-stubs/cachecontrol/caches/__init__.pyi +++ /dev/null @@ -1,5 +0,0 @@ -from cachecontrol.caches.file_cache import ( - SeparateBodyFileCache as SeparateBodyFileCache, -) - -__all__ = ["SeparateBodyFileCache"] diff --git a/mypy-stubs/cachecontrol/caches/file_cache.pyi b/mypy-stubs/cachecontrol/caches/file_cache.pyi deleted file mode 100644 index 42f67249..00000000 --- a/mypy-stubs/cachecontrol/caches/file_cache.pyi +++ /dev/null @@ -1,35 +0,0 @@ -from datetime import datetime -from pathlib import Path -from typing import IO, ContextManager - -from cachecontrol.cache import SeparateBodyBaseCache -from filelock import BaseFileLock - -class _LockClass: - path: str - -_lock_class = ContextManager[_LockClass] - -class _FileCacheMixin: - directory: str - forever: bool - filemode: int - dirmode: int - lock_class: _lock_class | None = None - def __init__( - self, - directory: str | Path, - forever: bool = False, - filemode: int = 384, - dirmode: int = 448, - lock_class: type[BaseFileLock] | None = None, - ) -> None: ... - @staticmethod - def encode(x: str) -> str: ... - def get(self, key: str) -> bytes | None: ... - def set(self, key: str, value: bytes, expires: int | datetime | None = None) -> None: ... - -class SeparateBodyFileCache(_FileCacheMixin, SeparateBodyBaseCache): - def get_body(self, key: str) -> IO[bytes] | None: ... - def set_body(self, key: str, body: bytes) -> 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 fabfae3f..00000000 --- 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 e8a06aa6..00000000 --- a/mypy-stubs/cachecontrol/controller.pyi +++ /dev/null @@ -1,18 +0,0 @@ -from typing import Collection - -from _typeshed import Incomplete - -from .cache import BaseCache - -class CacheController: - cache: BaseCache - cache_etags: bool - serializer: Incomplete - cacheable_status_codes: Collection[int] | None = None - def __init__( - self, - cache: BaseCache | None = None, - cache_etags: bool = True, - serializer: Incomplete | None = None, - status_codes: Collection[int] | None = None, - ) -> None: ... diff --git a/mypy-stubs/cachecontrol/wrapper.pyi b/mypy-stubs/cachecontrol/wrapper.pyi deleted file mode 100644 index 6244687f..00000000 --- a/mypy-stubs/cachecontrol/wrapper.pyi +++ /dev/null @@ -1,18 +0,0 @@ -from typing import Collection, Type - -from _typeshed import Incomplete -from requests import Session - -from .cache import BaseCache -from .controller import CacheController - -def CacheControl( - sess: Session, - cache: BaseCache | None = None, - cache_etags: bool = True, - serializer: Incomplete | None = None, - heuristic: Incomplete | None = None, - controller_class: Type[CacheController] | None = None, - adapter_class: Incomplete | None = None, - cacheable_methods: Collection[str] | None = None, -) -> Session: ...