chore: update typing to collections.abc
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
This commit is contained in:
@@ -4,6 +4,7 @@ import functools
|
||||
import platform as platform_module
|
||||
import re
|
||||
import sys
|
||||
from collections.abc import Set
|
||||
from enum import Enum
|
||||
|
||||
from .typing import Final, Literal, PlatformName, assert_never
|
||||
@@ -132,7 +133,7 @@ class Architecture(Enum):
|
||||
|
||||
def allowed_architectures_check(
|
||||
platform: PlatformName,
|
||||
architectures: set[Architecture],
|
||||
architectures: Set[Architecture],
|
||||
) -> None:
|
||||
allowed_architectures = Architecture.all_archs(platform)
|
||||
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import subprocess
|
||||
from collections.abc import Sequence
|
||||
from dataclasses import dataclass
|
||||
from typing import Callable, Dict, List, Sequence
|
||||
from typing import Callable, Dict, List # noqa: TID251
|
||||
|
||||
import bashlex
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import dataclasses
|
||||
from typing import Any, Mapping, Sequence
|
||||
from collections.abc import Mapping, Sequence
|
||||
from typing import Any
|
||||
|
||||
import bashlex
|
||||
import bashlex.errors
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import typing
|
||||
from collections.abc import Callable
|
||||
from threading import RLock
|
||||
from typing import Any, Callable, Generic, TypeVar, overload
|
||||
from typing import Any, Generic, TypeVar
|
||||
|
||||
__all__ = ["cached_property"]
|
||||
|
||||
@@ -24,11 +26,11 @@ class cached_property(Generic[_T]):
|
||||
msg = f"Cannot assign the same cached_property to two different names ({self.attrname!r} and {name!r})."
|
||||
raise TypeError(msg)
|
||||
|
||||
@overload
|
||||
@typing.overload
|
||||
def __get__(self, instance: None, owner: type[Any] | None = ...) -> cached_property[_T]:
|
||||
...
|
||||
|
||||
@overload
|
||||
@typing.overload
|
||||
def __get__(self, instance: object, owner: type[Any] | None = ...) -> _T:
|
||||
...
|
||||
|
||||
|
||||
@@ -3,10 +3,10 @@ from __future__ import annotations
|
||||
import subprocess
|
||||
import sys
|
||||
import textwrap
|
||||
from collections.abc import Set
|
||||
from collections.abc import Iterator, Set
|
||||
from dataclasses import dataclass
|
||||
from pathlib import Path, PurePath, PurePosixPath
|
||||
from typing import Iterator, Tuple
|
||||
from typing import Tuple
|
||||
|
||||
from .architecture import Architecture
|
||||
from .logger import log
|
||||
|
||||
@@ -8,10 +8,11 @@ import re
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
from collections.abc import Set
|
||||
import typing
|
||||
from collections.abc import Sequence, Set
|
||||
from dataclasses import dataclass
|
||||
from pathlib import Path
|
||||
from typing import Sequence, Tuple, cast
|
||||
from typing import Tuple
|
||||
|
||||
from filelock import FileLock
|
||||
|
||||
@@ -55,7 +56,7 @@ def get_macos_version() -> tuple[int, int]:
|
||||
"""
|
||||
version_str, _, _ = platform.mac_ver()
|
||||
version = tuple(map(int, version_str.split(".")[:2]))
|
||||
return cast(Tuple[int, int], version)
|
||||
return typing.cast(Tuple[int, int], version)
|
||||
|
||||
|
||||
def get_macos_sdks() -> list[str]:
|
||||
|
||||
@@ -8,10 +8,12 @@ import shlex
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
import typing
|
||||
import uuid
|
||||
from collections.abc import Sequence
|
||||
from pathlib import Path, PurePath, PurePosixPath
|
||||
from types import TracebackType
|
||||
from typing import IO, Dict, Sequence, cast
|
||||
from typing import IO, Dict
|
||||
|
||||
from cibuildwheel.util import CIProvider, detect_ci_provider
|
||||
|
||||
@@ -329,7 +331,7 @@ class OCIContainer:
|
||||
capture_output=True,
|
||||
)
|
||||
)
|
||||
return cast(Dict[str, str], env)
|
||||
return typing.cast(Dict[str, str], env)
|
||||
|
||||
def environment_executor(self, command: list[str], environment: dict[str, str]) -> str:
|
||||
# used as an EnvironmentExecutor to evaluate commands and capture output
|
||||
|
||||
@@ -10,8 +10,10 @@ import shlex
|
||||
import sys
|
||||
import textwrap
|
||||
import traceback
|
||||
import typing
|
||||
from collections.abc import Callable, Generator, Iterator, Mapping, Set
|
||||
from pathlib import Path
|
||||
from typing import Any, Callable, Dict, Generator, Iterator, List, Mapping, Union, cast
|
||||
from typing import Any, Dict, List, Union
|
||||
|
||||
if sys.version_info >= (3, 11):
|
||||
import tomllib
|
||||
@@ -193,7 +195,7 @@ class OptionsReader:
|
||||
*,
|
||||
platform: PlatformName,
|
||||
env: Mapping[str, str],
|
||||
disallow: dict[str, set[str]] | None = None,
|
||||
disallow: Mapping[str, Set[str]] | None = None,
|
||||
) -> None:
|
||||
self.platform = platform
|
||||
self.env = env
|
||||
@@ -462,7 +464,7 @@ class Options:
|
||||
print(msg, file=sys.stderr)
|
||||
sys.exit(2)
|
||||
|
||||
container_engine = cast(ContainerEngine, container_engine_str)
|
||||
container_engine = typing.cast(ContainerEngine, container_engine_str)
|
||||
|
||||
return GlobalOptions(
|
||||
package_dir=package_dir,
|
||||
|
||||
+6
-14
@@ -11,23 +11,15 @@ import subprocess
|
||||
import sys
|
||||
import textwrap
|
||||
import time
|
||||
import typing
|
||||
import urllib.request
|
||||
from collections.abc import Generator, Iterable, Sequence
|
||||
from dataclasses import dataclass
|
||||
from enum import Enum
|
||||
from functools import lru_cache
|
||||
from pathlib import Path, PurePath
|
||||
from time import sleep
|
||||
from typing import (
|
||||
Any,
|
||||
ClassVar,
|
||||
Generator,
|
||||
Iterable,
|
||||
Sequence,
|
||||
TextIO,
|
||||
TypeVar,
|
||||
cast,
|
||||
overload,
|
||||
)
|
||||
from typing import Any, ClassVar, TextIO, TypeVar
|
||||
|
||||
import bracex
|
||||
import certifi
|
||||
@@ -107,7 +99,7 @@ CIBW_CACHE_PATH: Final[Path] = Path(
|
||||
IS_WIN: Final[bool] = sys.platform.startswith("win")
|
||||
|
||||
|
||||
@overload
|
||||
@typing.overload
|
||||
def call(
|
||||
*args: PathOrStr,
|
||||
env: dict[str, str] | None = None,
|
||||
@@ -117,7 +109,7 @@ def call(
|
||||
...
|
||||
|
||||
|
||||
@overload
|
||||
@typing.overload
|
||||
def call(
|
||||
*args: PathOrStr,
|
||||
env: dict[str, str] | None = None,
|
||||
@@ -149,7 +141,7 @@ def call(
|
||||
result = subprocess.run(args_, check=True, shell=IS_WIN, env=env, cwd=cwd, **kwargs)
|
||||
if not capture_stdout:
|
||||
return None
|
||||
return cast(str, result.stdout)
|
||||
return typing.cast(str, result.stdout)
|
||||
|
||||
|
||||
def shell(*commands: str, env: dict[str, str] | None = None, cwd: PathOrStr | None = None) -> None:
|
||||
|
||||
@@ -6,12 +6,11 @@ import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
import textwrap
|
||||
from collections.abc import Set
|
||||
from collections.abc import Sequence, Set
|
||||
from contextlib import suppress
|
||||
from dataclasses import dataclass
|
||||
from functools import lru_cache
|
||||
from pathlib import Path
|
||||
from typing import Sequence
|
||||
from zipfile import ZipFile
|
||||
|
||||
from filelock import FileLock
|
||||
|
||||
Reference in New Issue
Block a user