diff --git a/stubs/Pillow/PIL/ImageFont.pyi b/stubs/Pillow/PIL/ImageFont.pyi index bc8614da47ed..e4b00c7b6ce8 100644 --- a/stubs/Pillow/PIL/ImageFont.pyi +++ b/stubs/Pillow/PIL/ImageFont.pyi @@ -1,4 +1,4 @@ -from _typeshed import Incomplete, StrOrBytesPath, SupportsRead +from _typeshed import FileDescriptorOrPath, Incomplete, SupportsRead from typing import Any, Protocol from typing_extensions import Literal @@ -109,7 +109,7 @@ class TransposedFont: def getsize(self, text: str | bytes, *args, **kwargs) -> tuple[int, int]: ... def getmask(self, text: str | bytes, mode: str = ..., *args, **kwargs): ... -def load(filename: StrOrBytesPath | int) -> ImageFont: ... +def load(filename: FileDescriptorOrPath) -> ImageFont: ... def truetype( font: str | bytes | SupportsRead[bytes] | None = ..., size: int = ..., diff --git a/stubs/Pygments/pygments/lexers/__init__.pyi b/stubs/Pygments/pygments/lexers/__init__.pyi index 5d043715e854..4421d7a29c99 100644 --- a/stubs/Pygments/pygments/lexers/__init__.pyi +++ b/stubs/Pygments/pygments/lexers/__init__.pyi @@ -1,17 +1,14 @@ -from _typeshed import Incomplete, StrOrBytesPath, StrPath +from _typeshed import FileDescriptorOrPath, Incomplete, StrPath from collections.abc import Iterator from typing import Any -from typing_extensions import TypeAlias from pygments.lexer import Lexer, LexerMeta -_OpenFile: TypeAlias = StrOrBytesPath | int # copy/pasted from builtins.pyi - def get_all_lexers(plugins: bool = ...) -> Iterator[tuple[str, tuple[str, ...], tuple[str, ...], tuple[str, ...]]]: ... def find_lexer_class(name: str) -> LexerMeta | None: ... def find_lexer_class_by_name(_alias: str) -> LexerMeta: ... def get_lexer_by_name(_alias: str, **options: Any) -> Lexer: ... -def load_lexer_from_file(filename: _OpenFile, lexername: str = ..., **options: Any) -> Lexer: ... +def load_lexer_from_file(filename: FileDescriptorOrPath, lexername: str = ..., **options: Any) -> Lexer: ... def find_lexer_class_for_filename(_fn: StrPath, code: str | bytes | None = ...) -> LexerMeta | None: ... def get_lexer_for_filename(_fn: StrPath, code: str | bytes | None = ..., **options: Any) -> Lexer: ... def get_lexer_for_mimetype(_mime: str, **options: Any) -> Lexer: ... diff --git a/stubs/aiofiles/aiofiles/os.pyi b/stubs/aiofiles/aiofiles/os.pyi index 789682dd0368..e7d3edb47c43 100644 --- a/stubs/aiofiles/aiofiles/os.pyi +++ b/stubs/aiofiles/aiofiles/os.pyi @@ -1,19 +1,16 @@ import sys -from _typeshed import GenericPath, StrOrBytesPath +from _typeshed import FileDescriptorOrPath, GenericPath, StrOrBytesPath from asyncio.events import AbstractEventLoop from collections.abc import Sequence from os import _ScandirIterator, stat_result from typing import Any, AnyStr, overload -from typing_extensions import TypeAlias from aiofiles import ospath path = ospath -_FdOrAnyPath: TypeAlias = int | StrOrBytesPath - async def stat( - path: _FdOrAnyPath, + path: FileDescriptorOrPath, *, dir_fd: int | None = ..., follow_symlinks: bool = ..., diff --git a/stubs/aiofiles/aiofiles/ospath.pyi b/stubs/aiofiles/aiofiles/ospath.pyi index 4b5735cfa427..e58e728984df 100644 --- a/stubs/aiofiles/aiofiles/ospath.pyi +++ b/stubs/aiofiles/aiofiles/ospath.pyi @@ -1,15 +1,15 @@ -from _typeshed import StrOrBytesPath +from _typeshed import FileDescriptorOrPath from asyncio.events import AbstractEventLoop from typing import Any -async def exists(path: StrOrBytesPath | int, *, loop: AbstractEventLoop | None = ..., executor: Any = ...) -> bool: ... -async def isfile(path: StrOrBytesPath | int, *, loop: AbstractEventLoop | None = ..., executor: Any = ...) -> bool: ... -async def isdir(s: StrOrBytesPath | int, *, loop: AbstractEventLoop | None = ..., executor: Any = ...) -> bool: ... -async def getsize(filename: StrOrBytesPath | int, *, loop: AbstractEventLoop | None = ..., executor: Any = ...) -> int: ... -async def getmtime(filename: StrOrBytesPath | int, *, loop: AbstractEventLoop | None = ..., executor: Any = ...) -> float: ... -async def getatime(filename: StrOrBytesPath | int, *, loop: AbstractEventLoop | None = ..., executor: Any = ...) -> float: ... -async def getctime(filename: StrOrBytesPath | int, *, loop: AbstractEventLoop | None = ..., executor: Any = ...) -> float: ... +async def exists(path: FileDescriptorOrPath, *, loop: AbstractEventLoop | None = ..., executor: Any = ...) -> bool: ... +async def isfile(path: FileDescriptorOrPath, *, loop: AbstractEventLoop | None = ..., executor: Any = ...) -> bool: ... +async def isdir(s: FileDescriptorOrPath, *, loop: AbstractEventLoop | None = ..., executor: Any = ...) -> bool: ... +async def getsize(filename: FileDescriptorOrPath, *, loop: AbstractEventLoop | None = ..., executor: Any = ...) -> int: ... +async def getmtime(filename: FileDescriptorOrPath, *, loop: AbstractEventLoop | None = ..., executor: Any = ...) -> float: ... +async def getatime(filename: FileDescriptorOrPath, *, loop: AbstractEventLoop | None = ..., executor: Any = ...) -> float: ... +async def getctime(filename: FileDescriptorOrPath, *, loop: AbstractEventLoop | None = ..., executor: Any = ...) -> float: ... async def samefile( - f1: StrOrBytesPath | int, f2: StrOrBytesPath | int, *, loop: AbstractEventLoop | None = ..., executor: Any = ... + f1: FileDescriptorOrPath, f2: FileDescriptorOrPath, *, loop: AbstractEventLoop | None = ..., executor: Any = ... ) -> bool: ... async def sameopenfile(fp1: int, fp2: int, *, loop: AbstractEventLoop | None = ..., executor: Any = ...) -> bool: ... diff --git a/stubs/aiofiles/aiofiles/threadpool/__init__.pyi b/stubs/aiofiles/aiofiles/threadpool/__init__.pyi index 1ed223aeacda..89dcc121a64c 100644 --- a/stubs/aiofiles/aiofiles/threadpool/__init__.pyi +++ b/stubs/aiofiles/aiofiles/threadpool/__init__.pyi @@ -1,11 +1,11 @@ from _typeshed import ( + FileDescriptorOrPath, Incomplete, OpenBinaryMode, OpenBinaryModeReading, OpenBinaryModeUpdating, OpenBinaryModeWriting, OpenTextMode, - StrOrBytesPath, ) from asyncio import AbstractEventLoop from collections.abc import Callable @@ -16,13 +16,12 @@ from ..base import AiofilesContextManager from .binary import AsyncBufferedIOBase, AsyncBufferedReader, AsyncFileIO, _UnknownAsyncBinaryIO from .text import AsyncTextIOWrapper -_OpenFile: TypeAlias = StrOrBytesPath | int _Opener: TypeAlias = Callable[[str, int], int] # Text mode: always returns AsyncTextIOWrapper @overload def open( - file: _OpenFile, + file: FileDescriptorOrPath, mode: OpenTextMode = ..., buffering: int = ..., encoding: str | None = ..., @@ -38,7 +37,7 @@ def open( # Unbuffered binary: returns a FileIO @overload def open( - file: _OpenFile, + file: FileDescriptorOrPath, mode: OpenBinaryMode, buffering: Literal[0], encoding: None = ..., @@ -54,7 +53,7 @@ def open( # Buffered binary reading/updating: AsyncBufferedReader @overload def open( - file: _OpenFile, + file: FileDescriptorOrPath, mode: OpenBinaryModeReading | OpenBinaryModeUpdating, buffering: Literal[-1, 1] = ..., encoding: None = ..., @@ -70,7 +69,7 @@ def open( # Buffered binary writing: AsyncBufferedIOBase @overload def open( - file: _OpenFile, + file: FileDescriptorOrPath, mode: OpenBinaryModeWriting, buffering: Literal[-1, 1] = ..., encoding: None = ..., @@ -86,7 +85,7 @@ def open( # Buffering cannot be determined: fall back to _UnknownAsyncBinaryIO @overload def open( - file: _OpenFile, + file: FileDescriptorOrPath, mode: OpenBinaryMode, buffering: int = ..., encoding: None = ..., diff --git a/stubs/aiofiles/aiofiles/threadpool/binary.pyi b/stubs/aiofiles/aiofiles/threadpool/binary.pyi index 2f7730064a5b..c6421325d27a 100644 --- a/stubs/aiofiles/aiofiles/threadpool/binary.pyi +++ b/stubs/aiofiles/aiofiles/threadpool/binary.pyi @@ -1,4 +1,4 @@ -from _typeshed import ReadableBuffer, StrOrBytesPath, WriteableBuffer +from _typeshed import FileDescriptorOrPath, ReadableBuffer, WriteableBuffer from collections.abc import Iterable from io import FileIO @@ -26,7 +26,7 @@ class _UnknownAsyncBinaryIO(AsyncBase[bytes]): @property def mode(self) -> str: ... @property - def name(self) -> StrOrBytesPath | int: ... + def name(self) -> FileDescriptorOrPath: ... class AsyncBufferedIOBase(_UnknownAsyncBinaryIO): async def read1(self, __size: int = ...) -> bytes: ... diff --git a/stubs/aiofiles/aiofiles/threadpool/text.pyi b/stubs/aiofiles/aiofiles/threadpool/text.pyi index 4712e342e266..b02cb83fbaec 100644 --- a/stubs/aiofiles/aiofiles/threadpool/text.pyi +++ b/stubs/aiofiles/aiofiles/threadpool/text.pyi @@ -1,4 +1,4 @@ -from _typeshed import StrOrBytesPath +from _typeshed import FileDescriptorOrPath from collections.abc import Iterable from typing import BinaryIO @@ -34,6 +34,6 @@ class AsyncTextIOWrapper(AsyncBase[str]): @property def newlines(self) -> str | tuple[str, ...] | None: ... @property - def name(self) -> StrOrBytesPath | int: ... + def name(self) -> FileDescriptorOrPath: ... @property def mode(self) -> str: ... diff --git a/stubs/chevron/chevron/main.pyi b/stubs/chevron/chevron/main.pyi index 99a589d52f14..a9e2f57e9253 100755 --- a/stubs/chevron/chevron/main.pyi +++ b/stubs/chevron/chevron/main.pyi @@ -1,8 +1,5 @@ -from _typeshed import StrOrBytesPath +from _typeshed import FileDescriptorOrPath from typing import Any -from typing_extensions import TypeAlias -_OpenFile: TypeAlias = StrOrBytesPath | int - -def main(template: _OpenFile, data: _OpenFile | None = ..., **kwargs: Any) -> str: ... +def main(template: FileDescriptorOrPath, data: FileDescriptorOrPath | None = ..., **kwargs: Any) -> str: ... def cli_main() -> None: ... diff --git a/stubs/netaddr/netaddr/eui/ieee.pyi b/stubs/netaddr/netaddr/eui/ieee.pyi index 53fe970383b4..9adf6459bf1d 100644 --- a/stubs/netaddr/netaddr/eui/ieee.pyi +++ b/stubs/netaddr/netaddr/eui/ieee.pyi @@ -1,5 +1,5 @@ import _csv -from _typeshed import StrOrBytesPath +from _typeshed import FileDescriptorOrPath, StrOrBytesPath from collections.abc import Iterable from typing import Any, BinaryIO, TextIO from typing_extensions import TypeAlias @@ -12,21 +12,21 @@ IAB_INDEX: _INDEX class FileIndexer(Subscriber): writer: _csv._writer - def __init__(self, index_file: TextIO | StrOrBytesPath | int) -> None: ... + def __init__(self, index_file: TextIO | FileDescriptorOrPath) -> None: ... def update(self, data: Iterable[Any]) -> None: ... class OUIIndexParser(Publisher): fh: BinaryIO - def __init__(self, ieee_file: BinaryIO | StrOrBytesPath | int) -> None: ... + def __init__(self, ieee_file: BinaryIO | FileDescriptorOrPath) -> None: ... def parse(self) -> None: ... class IABIndexParser(Publisher): fh: BinaryIO - def __init__(self, ieee_file: BinaryIO | StrOrBytesPath | int) -> None: ... + def __init__(self, ieee_file: BinaryIO | FileDescriptorOrPath) -> None: ... def parse(self) -> None: ... def create_index_from_registry( - registry_fh: BinaryIO | StrOrBytesPath | int, index_path: StrOrBytesPath, parser: type[OUIIndexParser] | type[IABIndexParser] + registry_fh: BinaryIO | FileDescriptorOrPath, index_path: StrOrBytesPath, parser: type[OUIIndexParser] | type[IABIndexParser] ) -> None: ... def create_indices() -> None: ... def load_index(index: _INDEX, fp: Iterable[bytes]) -> None: ... diff --git a/stubs/pyinstaller/PyInstaller/compat.pyi b/stubs/pyinstaller/PyInstaller/compat.pyi index 272a4cc82a2a..664a9b2dfdb3 100644 --- a/stubs/pyinstaller/PyInstaller/compat.pyi +++ b/stubs/pyinstaller/PyInstaller/compat.pyi @@ -1,11 +1,9 @@ # https://pyinstaller.org/en/stable/hooks.html#module-PyInstaller.compat -from _typeshed import FileDescriptor, GenericPath, StrOrBytesPath +from _typeshed import FileDescriptorOrPath, GenericPath from collections.abc import Iterable from types import ModuleType from typing import AnyStr, overload -from typing_extensions import Final, Literal, TypeAlias - -_OpenFile: TypeAlias = StrOrBytesPath | FileDescriptor +from typing_extensions import Final, Literal strict_collect_mode: bool is_64bits: Final[bool] @@ -48,7 +46,7 @@ architecture: Final[Literal["64bit", "n32bit", "32bit"]] system: Final[Literal["Cygwin", "Linux", "Darwin", "Java", "Windows"]] machine: Final[Literal["sw_64", "loongarch64", "arm", "intel", "ppc", "mips", "riscv", "s390x", "unknown", None]] -def is_wine_dll(filename: _OpenFile) -> bool: ... +def is_wine_dll(filename: FileDescriptorOrPath) -> bool: ... @overload def getenv(name: str, default: str) -> str: ... @overload diff --git a/stubs/python-xlib/Xlib/_typing.pyi b/stubs/python-xlib/Xlib/_typing.pyi index f7dd1ca6ced0..ff70161941b4 100644 --- a/stubs/python-xlib/Xlib/_typing.pyi +++ b/stubs/python-xlib/Xlib/_typing.pyi @@ -1,4 +1,3 @@ -from _typeshed import FileDescriptor, StrOrBytesPath from collections.abc import Callable from typing import TypeVar from typing_extensions import TypeAlias @@ -9,4 +8,3 @@ from Xlib.protocol.rq import Request _T = TypeVar("_T") ErrorHandler: TypeAlias = Callable[[XError, Request | None], _T] Unused: TypeAlias = object -OpenFile: TypeAlias = StrOrBytesPath | FileDescriptor diff --git a/stubs/python-xlib/Xlib/xauth.pyi b/stubs/python-xlib/Xlib/xauth.pyi index 51f3fa6c47c4..d0dd09704834 100644 --- a/stubs/python-xlib/Xlib/xauth.pyi +++ b/stubs/python-xlib/Xlib/xauth.pyi @@ -1,4 +1,4 @@ -from Xlib._typing import OpenFile +from _typeshed import FileDescriptorOrPath FamilyInternet: int FamilyDECnet: int @@ -9,7 +9,7 @@ FamilyLocal: int class Xauthority: entries: list[tuple[bytes, bytes, bytes, bytes, bytes]] - def __init__(self, filename: OpenFile | None = ...) -> None: ... + def __init__(self, filename: FileDescriptorOrPath | None = ...) -> None: ... def __len__(self) -> int: ... def __getitem__(self, i: int) -> tuple[bytes, bytes, bytes, bytes, bytes]: ... def get_best_auth( diff --git a/stubs/setuptools/setuptools/_distutils/dist.pyi b/stubs/setuptools/setuptools/_distutils/dist.pyi index ef47e4e4d15a..fc1bce261e57 100644 --- a/stubs/setuptools/setuptools/_distutils/dist.pyi +++ b/stubs/setuptools/setuptools/_distutils/dist.pyi @@ -1,10 +1,10 @@ -from _typeshed import StrOrBytesPath, SupportsWrite +from _typeshed import FileDescriptorOrPath, SupportsWrite from collections.abc import Iterable, Mapping from distutils.cmd import Command from typing import IO, Any class DistributionMetadata: - def __init__(self, path: int | StrOrBytesPath | None = ...) -> None: ... + def __init__(self, path: FileDescriptorOrPath | None = ...) -> None: ... name: str | None version: str | None author: str | None