Drop Python 3.8 branches (#13776)

This commit is contained in:
Sebastian Rittau
2025-04-03 10:35:36 +02:00
committed by GitHub
parent 1e43190554
commit 30b16c168d
117 changed files with 1023 additions and 2639 deletions
+39 -40
View File
@@ -125,49 +125,48 @@ class ResourceReader(metaclass=ABCMeta):
@abstractmethod
def contents(self) -> Iterator[str]: ...
if sys.version_info >= (3, 9):
@runtime_checkable
class Traversable(Protocol):
@runtime_checkable
class Traversable(Protocol):
@abstractmethod
def is_dir(self) -> bool: ...
@abstractmethod
def is_file(self) -> bool: ...
@abstractmethod
def iterdir(self) -> Iterator[Traversable]: ...
if sys.version_info >= (3, 11):
@abstractmethod
def is_dir(self) -> bool: ...
def joinpath(self, *descendants: str) -> Traversable: ...
else:
@abstractmethod
def is_file(self) -> bool: ...
@abstractmethod
def iterdir(self) -> Iterator[Traversable]: ...
if sys.version_info >= (3, 11):
@abstractmethod
def joinpath(self, *descendants: str) -> Traversable: ...
else:
@abstractmethod
def joinpath(self, child: str, /) -> Traversable: ...
def joinpath(self, child: str, /) -> Traversable: ...
# The documentation and runtime protocol allows *args, **kwargs arguments,
# but this would mean that all implementers would have to support them,
# which is not the case.
@overload
# The documentation and runtime protocol allows *args, **kwargs arguments,
# but this would mean that all implementers would have to support them,
# which is not the case.
@overload
@abstractmethod
def open(self, mode: Literal["r"] = "r", *, encoding: str | None = None, errors: str | None = None) -> IO[str]: ...
@overload
@abstractmethod
def open(self, mode: Literal["rb"]) -> IO[bytes]: ...
@property
@abstractmethod
def name(self) -> str: ...
if sys.version_info >= (3, 10):
def __truediv__(self, child: str, /) -> Traversable: ...
else:
@abstractmethod
def open(self, mode: Literal["r"] = "r", *, encoding: str | None = None, errors: str | None = None) -> IO[str]: ...
@overload
@abstractmethod
def open(self, mode: Literal["rb"]) -> IO[bytes]: ...
@property
@abstractmethod
def name(self) -> str: ...
if sys.version_info >= (3, 10):
def __truediv__(self, child: str, /) -> Traversable: ...
else:
@abstractmethod
def __truediv__(self, child: str, /) -> Traversable: ...
def __truediv__(self, child: str, /) -> Traversable: ...
@abstractmethod
def read_bytes(self) -> bytes: ...
@abstractmethod
def read_text(self, encoding: str | None = None) -> str: ...
@abstractmethod
def read_bytes(self) -> bytes: ...
@abstractmethod
def read_text(self, encoding: str | None = None) -> str: ...
class TraversableResources(ResourceReader):
@abstractmethod
def files(self) -> Traversable: ...
def open_resource(self, resource: str) -> BufferedReader: ...
def resource_path(self, resource: Any) -> str: ...
def is_resource(self, path: str) -> bool: ...
def contents(self) -> Iterator[str]: ...
class TraversableResources(ResourceReader):
@abstractmethod
def files(self) -> Traversable: ...
def open_resource(self, resource: str) -> BufferedReader: ...
def resource_path(self, resource: Any) -> str: ...
def is_resource(self, path: str) -> bool: ...
def contents(self) -> Iterator[str]: ...
+4 -5
View File
@@ -71,11 +71,10 @@ class EntryPoint(_EntryPointBase):
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: ...
@property
def module(self) -> str: ...
@property
def attr(self) -> str: ...
if sys.version_info >= (3, 10):
dist: ClassVar[Distribution | None]
def matches(
+15 -10
View File
@@ -2,6 +2,7 @@ import os
import sys
from collections.abc import Iterator
from contextlib import AbstractContextManager
from importlib.abc import Traversable
from pathlib import Path
from types import ModuleType
from typing import Any, BinaryIO, Literal, TextIO
@@ -12,13 +13,18 @@ if sys.version_info >= (3, 11):
else:
Package: TypeAlias = str | ModuleType
if sys.version_info >= (3, 9):
from importlib.abc import Traversable
__all__ = ["Package", "contents", "is_resource", "open_binary", "open_text", "path", "read_binary", "read_text"]
if sys.version_info >= (3, 9):
__all__ += ["as_file", "files"]
__all__ = [
"Package",
"as_file",
"contents",
"files",
"is_resource",
"open_binary",
"open_text",
"path",
"read_binary",
"read_text",
]
if sys.version_info >= (3, 10):
__all__ += ["ResourceReader"]
@@ -57,13 +63,12 @@ else:
if sys.version_info >= (3, 11):
from importlib.resources._common import as_file as as_file
elif sys.version_info >= (3, 9):
else:
def as_file(path: Traversable) -> AbstractContextManager[Path, Literal[False]]: ...
if sys.version_info >= (3, 11):
from importlib.resources._common import files as files
elif sys.version_info >= (3, 9):
else:
def files(package: Package) -> Traversable: ...
if sys.version_info >= (3, 10):