diff options
Diffstat (limited to '.venv/lib/python3.12/site-packages/aiofiles-stubs')
12 files changed, 794 insertions, 0 deletions
diff --git a/.venv/lib/python3.12/site-packages/aiofiles-stubs/METADATA.toml b/.venv/lib/python3.12/site-packages/aiofiles-stubs/METADATA.toml new file mode 100644 index 00000000..d649874b --- /dev/null +++ b/.venv/lib/python3.12/site-packages/aiofiles-stubs/METADATA.toml @@ -0,0 +1,6 @@ +version = "24.1.*" +upstream_repository = "https://github.com/Tinche/aiofiles" + +[tool.stubtest] +# linux and darwin are equivalent +platforms = ["linux", "win32"] diff --git a/.venv/lib/python3.12/site-packages/aiofiles-stubs/__init__.pyi b/.venv/lib/python3.12/site-packages/aiofiles-stubs/__init__.pyi new file mode 100644 index 00000000..bc52b8e0 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/aiofiles-stubs/__init__.pyi @@ -0,0 +1,10 @@ +from . import tempfile as tempfile +from .threadpool import ( + open as open, + stderr as stderr, + stderr_bytes as stderr_bytes, + stdin as stdin, + stdin_bytes as stdin_bytes, + stdout as stdout, + stdout_bytes as stdout_bytes, +) diff --git a/.venv/lib/python3.12/site-packages/aiofiles-stubs/base.pyi b/.venv/lib/python3.12/site-packages/aiofiles-stubs/base.pyi new file mode 100644 index 00000000..ea79abf4 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/aiofiles-stubs/base.pyi @@ -0,0 +1,24 @@ +from collections.abc import Awaitable, Callable, Generator +from contextlib import AbstractAsyncContextManager +from types import TracebackType +from typing import Any, BinaryIO, Generic, TextIO, TypeVar +from typing_extensions import Self + +_T = TypeVar("_T") +_V_co = TypeVar("_V_co", covariant=True) + +class AsyncBase(Generic[_T]): + def __init__(self, file: str, loop: Any, executor: Any) -> None: ... + def __aiter__(self) -> Self: ... + async def __anext__(self) -> _T: ... + +class AsyncIndirectBase(AsyncBase[_T]): + def __init__(self, name: str, loop: Any, executor: Any, indirect: Callable[[], TextIO | BinaryIO]) -> None: ... + +class AiofilesContextManager(Awaitable[_V_co], AbstractAsyncContextManager[_V_co]): + def __init__(self, coro: Awaitable[_V_co]) -> None: ... + def __await__(self) -> Generator[Any, Any, _V_co]: ... + async def __aenter__(self) -> _V_co: ... + async def __aexit__( + self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None + ) -> None: ... diff --git a/.venv/lib/python3.12/site-packages/aiofiles-stubs/os.pyi b/.venv/lib/python3.12/site-packages/aiofiles-stubs/os.pyi new file mode 100644 index 00000000..5a3de3b5 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/aiofiles-stubs/os.pyi @@ -0,0 +1,144 @@ +import sys +from _typeshed import BytesPath, FileDescriptorOrPath, GenericPath, ReadableBuffer, StrOrBytesPath, StrPath +from asyncio.events import AbstractEventLoop +from collections.abc import Sequence +from os import _ScandirIterator, stat_result +from typing import Any, AnyStr, overload + +from aiofiles import ospath +from aiofiles.ospath import wrap as wrap + +__all__ = [ + "path", + "stat", + "rename", + "renames", + "replace", + "remove", + "unlink", + "mkdir", + "makedirs", + "rmdir", + "removedirs", + "link", + "symlink", + "readlink", + "listdir", + "scandir", + "access", + "wrap", + "getcwd", +] + +if sys.platform != "win32": + __all__ += ["statvfs", "sendfile"] + +path = ospath + +async def stat( + path: FileDescriptorOrPath, + *, + dir_fd: int | None = None, + follow_symlinks: bool = True, + loop: AbstractEventLoop | None = ..., + executor: Any = ..., +) -> stat_result: ... +async def rename( + src: StrOrBytesPath, + dst: StrOrBytesPath, + *, + src_dir_fd: int | None = None, + dst_dir_fd: int | None = None, + loop: AbstractEventLoop | None = ..., + executor: Any = ..., +) -> None: ... +async def renames( + old: StrOrBytesPath, new: StrOrBytesPath, loop: AbstractEventLoop | None = ..., executor: Any = ... +) -> None: ... +async def replace( + src: StrOrBytesPath, + dst: StrOrBytesPath, + *, + src_dir_fd: int | None = None, + dst_dir_fd: int | None = None, + loop: AbstractEventLoop | None = ..., + executor: Any = ..., +) -> None: ... +async def remove( + path: StrOrBytesPath, *, dir_fd: int | None = None, loop: AbstractEventLoop | None = ..., executor: Any = ... +) -> None: ... +async def unlink( + path: StrOrBytesPath, *, dir_fd: int | None = ..., loop: AbstractEventLoop | None = ..., executor: Any = ... +) -> None: ... +async def mkdir( + path: StrOrBytesPath, mode: int = 511, *, dir_fd: int | None = None, loop: AbstractEventLoop | None = ..., executor: Any = ... +) -> None: ... +async def makedirs( + name: StrOrBytesPath, mode: int = 511, exist_ok: bool = False, *, loop: AbstractEventLoop | None = ..., executor: Any = ... +) -> None: ... +async def link( + src: StrOrBytesPath, + dst: StrOrBytesPath, + *, + src_dir_fd: int | None = ..., + dst_dir_fd: int | None = ..., + follow_symlinks: bool = ..., + loop: AbstractEventLoop | None = ..., + executor: Any = ..., +) -> None: ... +async def symlink( + src: StrOrBytesPath, + dst: StrOrBytesPath, + target_is_directory: bool = ..., + *, + dir_fd: int | None = ..., + loop: AbstractEventLoop | None = ..., + executor: Any = ..., +) -> None: ... +async def readlink( + path: AnyStr, *, dir_fd: int | None = ..., loop: AbstractEventLoop | None = ..., executor: Any = ... +) -> AnyStr: ... +async def rmdir( + path: StrOrBytesPath, *, dir_fd: int | None = None, loop: AbstractEventLoop | None = ..., executor: Any = ... +) -> None: ... +async def removedirs(name: StrOrBytesPath, *, loop: AbstractEventLoop | None = ..., executor: Any = ...) -> None: ... +@overload +async def scandir(path: None = None, *, loop: AbstractEventLoop | None = ..., executor: Any = ...) -> _ScandirIterator[str]: ... +@overload +async def scandir(path: int, *, loop: AbstractEventLoop | None = ..., executor: Any = ...) -> _ScandirIterator[str]: ... +@overload +async def scandir( + path: GenericPath[AnyStr], *, loop: AbstractEventLoop | None = ..., executor: Any = ... +) -> _ScandirIterator[AnyStr]: ... +@overload +async def listdir(path: StrPath | None, *, loop: AbstractEventLoop | None = ..., executor: Any = ...) -> list[str]: ... +@overload +async def listdir(path: BytesPath, *, loop: AbstractEventLoop | None = ..., executor: Any = ...) -> list[bytes]: ... +@overload +async def listdir(path: int, *, loop: AbstractEventLoop | None = ..., executor: Any = ...) -> list[str]: ... +async def access( + path: FileDescriptorOrPath, mode: int, *, dir_fd: int | None = None, effective_ids: bool = False, follow_symlinks: bool = True +) -> bool: ... +async def getcwd() -> str: ... + +if sys.platform != "win32": + from os import statvfs_result + + @overload + async def sendfile( + out_fd: int, in_fd: int, offset: int | None, count: int, *, loop: AbstractEventLoop | None = ..., executor: Any = ... + ) -> int: ... + @overload + async def sendfile( + out_fd: int, + in_fd: int, + offset: int, + count: int, + headers: Sequence[ReadableBuffer] = ..., + trailers: Sequence[ReadableBuffer] = ..., + flags: int = ..., + *, + loop: AbstractEventLoop | None = ..., + executor: Any = ..., + ) -> int: ... # FreeBSD and Mac OS X only + async def statvfs(path: FileDescriptorOrPath) -> statvfs_result: ... # Unix only diff --git a/.venv/lib/python3.12/site-packages/aiofiles-stubs/ospath.pyi b/.venv/lib/python3.12/site-packages/aiofiles-stubs/ospath.pyi new file mode 100644 index 00000000..a5863753 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/aiofiles-stubs/ospath.pyi @@ -0,0 +1,23 @@ +from _typeshed import FileDescriptorOrPath +from asyncio.events import AbstractEventLoop +from collections.abc import Awaitable, Callable +from os import PathLike +from typing import Any, AnyStr, TypeVar + +_R = TypeVar("_R") + +def wrap(func: Callable[..., _R]) -> Callable[..., Awaitable[_R]]: ... +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 islink(path: FileDescriptorOrPath) -> bool: ... +async def ismount(path: FileDescriptorOrPath) -> 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: FileDescriptorOrPath, f2: FileDescriptorOrPath, *, loop: AbstractEventLoop | None = ..., executor: Any = ... +) -> bool: ... +async def sameopenfile(fp1: int, fp2: int, *, loop: AbstractEventLoop | None = ..., executor: Any = ...) -> bool: ... +async def abspath(path: PathLike[AnyStr] | AnyStr) -> AnyStr: ... diff --git a/.venv/lib/python3.12/site-packages/aiofiles-stubs/py.typed b/.venv/lib/python3.12/site-packages/aiofiles-stubs/py.typed new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/.venv/lib/python3.12/site-packages/aiofiles-stubs/py.typed diff --git a/.venv/lib/python3.12/site-packages/aiofiles-stubs/tempfile/__init__.pyi b/.venv/lib/python3.12/site-packages/aiofiles-stubs/tempfile/__init__.pyi new file mode 100644 index 00000000..e8016aa8 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/aiofiles-stubs/tempfile/__init__.pyi @@ -0,0 +1,323 @@ +import sys +from _typeshed import ( + BytesPath, + Incomplete, + OpenBinaryMode, + OpenBinaryModeReading, + OpenBinaryModeUpdating, + OpenBinaryModeWriting, + OpenTextMode, + StrOrBytesPath, + StrPath, +) +from asyncio import AbstractEventLoop +from typing import AnyStr, Literal, overload + +from ..base import AiofilesContextManager +from ..threadpool.binary import AsyncBufferedIOBase, AsyncBufferedReader, AsyncFileIO +from ..threadpool.text import AsyncTextIOWrapper +from .temptypes import AsyncTemporaryDirectory + +# Text mode: always returns AsyncTextIOWrapper +@overload +def TemporaryFile( + mode: OpenTextMode, + buffering: int = -1, + encoding: str | None = None, + newline: str | None = None, + suffix: AnyStr | None = None, + prefix: AnyStr | None = None, + dir: StrOrBytesPath | None = None, + loop: AbstractEventLoop | None = None, + executor: Incomplete | None = None, +) -> AiofilesContextManager[AsyncTextIOWrapper]: ... + +# Unbuffered binary: returns a FileIO +@overload +def TemporaryFile( + mode: OpenBinaryMode, + buffering: Literal[0], + encoding: None = None, + newline: None = None, + suffix: AnyStr | None = None, + prefix: AnyStr | None = None, + dir: StrOrBytesPath | None = None, + loop: AbstractEventLoop | None = None, + executor: Incomplete | None = None, +) -> AiofilesContextManager[AsyncFileIO]: ... + +# Buffered binary reading/updating: AsyncBufferedReader +@overload +def TemporaryFile( + mode: OpenBinaryModeReading | OpenBinaryModeUpdating = "w+b", + buffering: Literal[-1, 1] = -1, + encoding: None = None, + newline: None = None, + suffix: AnyStr | None = None, + prefix: AnyStr | None = None, + dir: StrOrBytesPath | None = None, + loop: AbstractEventLoop | None = None, + executor: Incomplete | None = None, +) -> AiofilesContextManager[AsyncBufferedReader]: ... + +# Buffered binary writing: AsyncBufferedIOBase +@overload +def TemporaryFile( + mode: OpenBinaryModeWriting, + buffering: Literal[-1, 1] = -1, + encoding: None = None, + newline: None = None, + suffix: AnyStr | None = None, + prefix: AnyStr | None = None, + dir: StrOrBytesPath | None = None, + loop: AbstractEventLoop | None = None, + executor: Incomplete | None = None, +) -> AiofilesContextManager[AsyncBufferedIOBase]: ... + +# 3.12 added `delete_on_close` +if sys.version_info >= (3, 12): + # Text mode: always returns AsyncTextIOWrapper + @overload + def NamedTemporaryFile( + mode: OpenTextMode, + buffering: int = -1, + encoding: str | None = None, + newline: str | None = None, + suffix: AnyStr | None = None, + prefix: AnyStr | None = None, + dir: StrOrBytesPath | None = None, + delete: bool = True, + delete_on_close: bool = True, + loop: AbstractEventLoop | None = None, + executor: Incomplete | None = None, + ) -> AiofilesContextManager[AsyncTextIOWrapper]: ... + + # Unbuffered binary: returns a FileIO + @overload + def NamedTemporaryFile( + mode: OpenBinaryMode, + buffering: Literal[0], + encoding: None = None, + newline: None = None, + suffix: AnyStr | None = None, + prefix: AnyStr | None = None, + dir: StrOrBytesPath | None = None, + delete: bool = True, + delete_on_close: bool = True, + loop: AbstractEventLoop | None = None, + executor: Incomplete | None = None, + ) -> AiofilesContextManager[AsyncFileIO]: ... + + # Buffered binary reading/updating: AsyncBufferedReader + @overload + def NamedTemporaryFile( + mode: OpenBinaryModeReading | OpenBinaryModeUpdating = "w+b", + buffering: Literal[-1, 1] = -1, + encoding: None = None, + newline: None = None, + suffix: AnyStr | None = None, + prefix: AnyStr | None = None, + dir: StrOrBytesPath | None = None, + delete: bool = True, + delete_on_close: bool = True, + loop: AbstractEventLoop | None = None, + executor: Incomplete | None = None, + ) -> AiofilesContextManager[AsyncBufferedReader]: ... + + # Buffered binary writing: AsyncBufferedIOBase + @overload + def NamedTemporaryFile( + mode: OpenBinaryModeWriting, + buffering: Literal[-1, 1] = -1, + encoding: None = None, + newline: None = None, + suffix: AnyStr | None = None, + prefix: AnyStr | None = None, + dir: StrOrBytesPath | None = None, + delete: bool = True, + delete_on_close: bool = True, + loop: AbstractEventLoop | None = None, + executor: Incomplete | None = None, + ) -> AiofilesContextManager[AsyncBufferedIOBase]: ... + +else: + # Text mode: always returns AsyncTextIOWrapper + @overload + def NamedTemporaryFile( + mode: OpenTextMode, + buffering: int = -1, + encoding: str | None = None, + newline: str | None = None, + suffix: AnyStr | None = None, + prefix: AnyStr | None = None, + dir: StrOrBytesPath | None = None, + delete: bool = True, + loop: AbstractEventLoop | None = None, + executor: Incomplete | None = None, + ) -> AiofilesContextManager[AsyncTextIOWrapper]: ... + + # Unbuffered binary: returns a FileIO + @overload + def NamedTemporaryFile( + mode: OpenBinaryMode, + buffering: Literal[0], + encoding: None = None, + newline: None = None, + suffix: AnyStr | None = None, + prefix: AnyStr | None = None, + dir: StrOrBytesPath | None = None, + delete: bool = True, + loop: AbstractEventLoop | None = None, + executor: Incomplete | None = None, + ) -> AiofilesContextManager[AsyncFileIO]: ... + + # Buffered binary reading/updating: AsyncBufferedReader + @overload + def NamedTemporaryFile( + mode: OpenBinaryModeReading | OpenBinaryModeUpdating = "w+b", + buffering: Literal[-1, 1] = -1, + encoding: None = None, + newline: None = None, + suffix: AnyStr | None = None, + prefix: AnyStr | None = None, + dir: StrOrBytesPath | None = None, + delete: bool = True, + loop: AbstractEventLoop | None = None, + executor: Incomplete | None = None, + ) -> AiofilesContextManager[AsyncBufferedReader]: ... + + # Buffered binary writing: AsyncBufferedIOBase + @overload + def NamedTemporaryFile( + mode: OpenBinaryModeWriting, + buffering: Literal[-1, 1] = -1, + encoding: None = None, + newline: None = None, + suffix: AnyStr | None = None, + prefix: AnyStr | None = None, + dir: StrOrBytesPath | None = None, + delete: bool = True, + loop: AbstractEventLoop | None = None, + executor: Incomplete | None = None, + ) -> AiofilesContextManager[AsyncBufferedIOBase]: ... + +# Text mode: always returns AsyncTextIOWrapper +@overload +def SpooledTemporaryFile( + max_size: int = 0, + *, + mode: OpenTextMode, + buffering: int = -1, + encoding: str | None = None, + newline: str | None = None, + suffix: AnyStr | None = None, + prefix: AnyStr | None = None, + dir: StrOrBytesPath | None = None, + loop: AbstractEventLoop | None = None, + executor: Incomplete | None = None, +) -> AiofilesContextManager[AsyncTextIOWrapper]: ... +@overload +def SpooledTemporaryFile( + max_size: int, + mode: OpenTextMode, + buffering: int = -1, + encoding: str | None = None, + newline: str | None = None, + suffix: AnyStr | None = None, + prefix: AnyStr | None = None, + dir: StrOrBytesPath | None = None, + loop: AbstractEventLoop | None = None, + executor: Incomplete | None = None, +) -> AiofilesContextManager[AsyncTextIOWrapper]: ... + +# Unbuffered binary: returns a FileIO +@overload +def SpooledTemporaryFile( + max_size: int = 0, + mode: OpenBinaryMode = "w+b", + *, + buffering: Literal[0], + encoding: None = None, + newline: None = None, + suffix: AnyStr | None = None, + prefix: AnyStr | None = None, + dir: StrOrBytesPath | None = None, + loop: AbstractEventLoop | None = None, + executor: Incomplete | None = None, +) -> AiofilesContextManager[AsyncFileIO]: ... +@overload +def SpooledTemporaryFile( + max_size: int, + mode: OpenBinaryMode, + buffering: Literal[0], + encoding: None = None, + newline: None = None, + suffix: AnyStr | None = None, + prefix: AnyStr | None = None, + dir: StrOrBytesPath | None = None, + loop: AbstractEventLoop | None = None, + executor: Incomplete | None = None, +) -> AiofilesContextManager[AsyncFileIO]: ... + +# Buffered binary reading/updating: AsyncBufferedReader +@overload +def SpooledTemporaryFile( + max_size: int = 0, + mode: OpenBinaryModeReading | OpenBinaryModeUpdating = "w+b", + buffering: Literal[-1, 1] = -1, + encoding: None = None, + newline: None = None, + suffix: AnyStr | None = None, + prefix: AnyStr | None = None, + dir: StrOrBytesPath | None = None, + loop: AbstractEventLoop | None = None, + executor: Incomplete | None = None, +) -> AiofilesContextManager[AsyncBufferedReader]: ... + +# Buffered binary writing: AsyncBufferedIOBase +@overload +def SpooledTemporaryFile( + max_size: int = 0, + *, + mode: OpenBinaryModeWriting, + buffering: Literal[-1, 1] = -1, + encoding: None = None, + newline: None = None, + suffix: AnyStr | None = None, + prefix: AnyStr | None = None, + dir: StrOrBytesPath | None = None, + loop: AbstractEventLoop | None = None, + executor: Incomplete | None = None, +) -> AiofilesContextManager[AsyncBufferedIOBase]: ... +@overload +def SpooledTemporaryFile( + max_size: int, + mode: OpenBinaryModeWriting, + buffering: Literal[-1, 1] = -1, + encoding: None = None, + newline: None = None, + suffix: AnyStr | None = None, + prefix: AnyStr | None = None, + dir: StrOrBytesPath | None = None, + loop: AbstractEventLoop | None = None, + executor: Incomplete | None = None, +) -> AiofilesContextManager[AsyncBufferedIOBase]: ... +@overload +def TemporaryDirectory( + suffix: str | None = None, + prefix: str | None = None, + dir: StrPath | None = None, + loop: AbstractEventLoop | None = None, + executor: Incomplete | None = None, +) -> AiofilesContextManagerTempDir: ... +@overload +def TemporaryDirectory( + suffix: bytes | None = None, + prefix: bytes | None = None, + dir: BytesPath | None = None, + loop: AbstractEventLoop | None = None, + executor: Incomplete | None = None, +) -> AiofilesContextManagerTempDir: ... + +class AiofilesContextManagerTempDir(AiofilesContextManager[AsyncTemporaryDirectory]): + async def __aenter__(self) -> str: ... # type: ignore[override] diff --git a/.venv/lib/python3.12/site-packages/aiofiles-stubs/tempfile/temptypes.pyi b/.venv/lib/python3.12/site-packages/aiofiles-stubs/tempfile/temptypes.pyi new file mode 100644 index 00000000..23abf5cb --- /dev/null +++ b/.venv/lib/python3.12/site-packages/aiofiles-stubs/tempfile/temptypes.pyi @@ -0,0 +1,51 @@ +from _typeshed import Incomplete, OpenBinaryMode +from asyncio import AbstractEventLoop +from collections.abc import Generator, Iterable +from tempfile import TemporaryDirectory +from typing import TypeVar + +from aiofiles.base import AsyncBase as AsyncBase +from aiofiles.threadpool.utils import ( + cond_delegate_to_executor as cond_delegate_to_executor, + delegate_to_executor as delegate_to_executor, + proxy_property_directly as proxy_property_directly, +) + +_T = TypeVar("_T") + +class AsyncSpooledTemporaryFile(AsyncBase[_T]): + def fileno(self) -> Generator[Incomplete, Incomplete, Incomplete]: ... + def rollover(self) -> Generator[Incomplete, Incomplete, Incomplete]: ... + async def close(self) -> None: ... + async def flush(self) -> None: ... + async def isatty(self) -> bool: ... + # All must return `AnyStr`: + async def read(self, n: int = ..., /): ... + async def readline(self, limit: int | None = ..., /): ... + async def readlines(self, hint: int = ..., /) -> list[Incomplete]: ... + # --- + async def seek(self, offset: int, whence: int = ...) -> int: ... + async def tell(self) -> int: ... + async def truncate(self, size: int | None = ...) -> None: ... + @property + def closed(self) -> bool: ... + @property + def encoding(self) -> str: ... + @property + def mode(self) -> OpenBinaryMode: ... + @property + def name(self) -> str: ... + @property + def newlines(self) -> str: ... + # Both should work with `AnyStr`, like in `tempfile`: + async def write(self, s) -> int: ... + async def writelines(self, iterable: Iterable[Incomplete]) -> None: ... + +class AsyncTemporaryDirectory: + async def cleanup(self) -> None: ... + @property + def name(self): ... # should be `AnyStr` + def __init__( + self, file: TemporaryDirectory[Incomplete], loop: AbstractEventLoop | None, executor: Incomplete | None + ) -> None: ... + async def close(self) -> None: ... diff --git a/.venv/lib/python3.12/site-packages/aiofiles-stubs/threadpool/__init__.pyi b/.venv/lib/python3.12/site-packages/aiofiles-stubs/threadpool/__init__.pyi new file mode 100644 index 00000000..00c587cc --- /dev/null +++ b/.venv/lib/python3.12/site-packages/aiofiles-stubs/threadpool/__init__.pyi @@ -0,0 +1,106 @@ +from _typeshed import ( + FileDescriptorOrPath, + Incomplete, + OpenBinaryMode, + OpenBinaryModeReading, + OpenBinaryModeUpdating, + OpenBinaryModeWriting, + OpenTextMode, +) +from asyncio import AbstractEventLoop +from collections.abc import Callable +from typing import Literal, overload +from typing_extensions import TypeAlias + +from ..base import AiofilesContextManager +from .binary import AsyncBufferedIOBase, AsyncBufferedReader, AsyncFileIO, AsyncIndirectBufferedIOBase, _UnknownAsyncBinaryIO +from .text import AsyncTextIndirectIOWrapper, AsyncTextIOWrapper + +_Opener: TypeAlias = Callable[[str, int], int] + +# Text mode: always returns AsyncTextIOWrapper +@overload +def open( + file: FileDescriptorOrPath, + mode: OpenTextMode = "r", + buffering: int = -1, + encoding: str | None = None, + errors: str | None = None, + newline: str | None = None, + closefd: bool = True, + opener: _Opener | None = None, + *, + loop: AbstractEventLoop | None = None, + executor: Incomplete | None = None, +) -> AiofilesContextManager[AsyncTextIOWrapper]: ... + +# Unbuffered binary: returns a FileIO +@overload +def open( + file: FileDescriptorOrPath, + mode: OpenBinaryMode, + buffering: Literal[0], + encoding: None = None, + errors: None = None, + newline: None = None, + closefd: bool = True, + opener: _Opener | None = None, + *, + loop: AbstractEventLoop | None = None, + executor: Incomplete | None = None, +) -> AiofilesContextManager[AsyncFileIO]: ... + +# Buffered binary reading/updating: AsyncBufferedReader +@overload +def open( + file: FileDescriptorOrPath, + mode: OpenBinaryModeReading | OpenBinaryModeUpdating, + buffering: Literal[-1, 1] = -1, + encoding: None = None, + errors: None = None, + newline: None = None, + closefd: bool = True, + opener: _Opener | None = None, + *, + loop: AbstractEventLoop | None = None, + executor: Incomplete | None = None, +) -> AiofilesContextManager[AsyncBufferedReader]: ... + +# Buffered binary writing: AsyncBufferedIOBase +@overload +def open( + file: FileDescriptorOrPath, + mode: OpenBinaryModeWriting, + buffering: Literal[-1, 1] = -1, + encoding: None = None, + errors: None = None, + newline: None = None, + closefd: bool = True, + opener: _Opener | None = None, + *, + loop: AbstractEventLoop | None = None, + executor: Incomplete | None = None, +) -> AiofilesContextManager[AsyncBufferedIOBase]: ... + +# Buffering cannot be determined: fall back to _UnknownAsyncBinaryIO +@overload +def open( + file: FileDescriptorOrPath, + mode: OpenBinaryMode, + buffering: int = -1, + encoding: None = None, + errors: None = None, + newline: None = None, + closefd: bool = True, + opener: _Opener | None = None, + *, + loop: AbstractEventLoop | None = None, + executor: Incomplete | None = None, +) -> AiofilesContextManager[_UnknownAsyncBinaryIO]: ... + +stdin: AsyncTextIndirectIOWrapper +stdout: AsyncTextIndirectIOWrapper +stderr: AsyncTextIndirectIOWrapper +stdin_bytes: AsyncIndirectBufferedIOBase +stdout_bytes: AsyncIndirectBufferedIOBase +stderr_bytes: AsyncIndirectBufferedIOBase diff --git a/.venv/lib/python3.12/site-packages/aiofiles-stubs/threadpool/binary.pyi b/.venv/lib/python3.12/site-packages/aiofiles-stubs/threadpool/binary.pyi new file mode 100644 index 00000000..d10f98f2 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/aiofiles-stubs/threadpool/binary.pyi @@ -0,0 +1,55 @@ +from _typeshed import FileDescriptorOrPath, ReadableBuffer, WriteableBuffer +from collections.abc import Iterable +from io import FileIO + +from ..base import AsyncBase, AsyncIndirectBase + +# This class does not exist at runtime and instead these methods are +# all dynamically patched in. +class _UnknownAsyncBinaryIO(AsyncBase[bytes]): + async def close(self) -> None: ... + async def flush(self) -> None: ... + async def isatty(self) -> bool: ... + async def read(self, size: int = ..., /) -> bytes: ... + async def readinto(self, buffer: WriteableBuffer, /) -> int | None: ... + async def readline(self, size: int | None = ..., /) -> bytes: ... + async def readlines(self, hint: int = ..., /) -> list[bytes]: ... + async def seek(self, offset: int, whence: int = ..., /) -> int: ... + async def seekable(self) -> bool: ... + async def tell(self) -> int: ... + async def truncate(self, size: int | None = ..., /) -> int: ... + async def writable(self) -> bool: ... + async def write(self, b: ReadableBuffer, /) -> int: ... + async def writelines(self, lines: Iterable[ReadableBuffer], /) -> None: ... + def fileno(self) -> int: ... + def readable(self) -> bool: ... + @property + def closed(self) -> bool: ... + @property + def mode(self) -> str: ... + @property + def name(self) -> FileDescriptorOrPath: ... + +class AsyncBufferedIOBase(_UnknownAsyncBinaryIO): + async def read1(self, size: int = ..., /) -> bytes: ... + def detach(self) -> FileIO: ... + @property + def raw(self) -> FileIO: ... + +class AsyncIndirectBufferedIOBase(AsyncIndirectBase[bytes], _UnknownAsyncBinaryIO): + async def read1(self, size: int = ..., /) -> bytes: ... + def detach(self) -> FileIO: ... + @property + def raw(self) -> FileIO: ... + +class AsyncBufferedReader(AsyncBufferedIOBase): + async def peek(self, size: int = ..., /) -> bytes: ... + +class AsyncIndirectBufferedReader(AsyncIndirectBufferedIOBase): + async def peek(self, size: int = ..., /) -> bytes: ... + +class AsyncFileIO(_UnknownAsyncBinaryIO): + async def readall(self) -> bytes: ... + +class AsyncIndirectFileIO(AsyncIndirectBase[bytes], _UnknownAsyncBinaryIO): + async def readall(self) -> bytes: ... diff --git a/.venv/lib/python3.12/site-packages/aiofiles-stubs/threadpool/text.pyi b/.venv/lib/python3.12/site-packages/aiofiles-stubs/threadpool/text.pyi new file mode 100644 index 00000000..6003a085 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/aiofiles-stubs/threadpool/text.pyi @@ -0,0 +1,42 @@ +from _typeshed import FileDescriptorOrPath +from collections.abc import Iterable +from typing import BinaryIO + +from ..base import AsyncBase, AsyncIndirectBase + +class _UnknownAsyncTextIO(AsyncBase[str]): + async def close(self) -> None: ... + async def flush(self) -> None: ... + async def isatty(self) -> bool: ... + async def read(self, size: int | None = ..., /) -> str: ... + async def readline(self, size: int = ..., /) -> str: ... + async def readlines(self, hint: int = ..., /) -> list[str]: ... + async def seek(self, offset: int, whence: int = ..., /) -> int: ... + async def seekable(self) -> bool: ... + async def tell(self) -> int: ... + async def truncate(self, size: int | None = ..., /) -> int: ... + async def writable(self) -> bool: ... + async def write(self, b: str, /) -> int: ... + async def writelines(self, lines: Iterable[str], /) -> None: ... + def detach(self) -> BinaryIO: ... + def fileno(self) -> int: ... + def readable(self) -> bool: ... + @property + def buffer(self) -> BinaryIO: ... + @property + def closed(self) -> bool: ... + @property + def encoding(self) -> str: ... + @property + def errors(self) -> str | None: ... + @property + def line_buffering(self) -> bool: ... + @property + def newlines(self) -> str | tuple[str, ...] | None: ... + @property + def name(self) -> FileDescriptorOrPath: ... + @property + def mode(self) -> str: ... + +class AsyncTextIOWrapper(_UnknownAsyncTextIO): ... +class AsyncTextIndirectIOWrapper(AsyncIndirectBase[str], _UnknownAsyncTextIO): ... diff --git a/.venv/lib/python3.12/site-packages/aiofiles-stubs/threadpool/utils.pyi b/.venv/lib/python3.12/site-packages/aiofiles-stubs/threadpool/utils.pyi new file mode 100644 index 00000000..438a6851 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/aiofiles-stubs/threadpool/utils.pyi @@ -0,0 +1,10 @@ +from collections.abc import Callable +from typing import TypeVar + +_T = TypeVar("_T", bound=type) + +# All these function actually mutate the given type: +def delegate_to_executor(*attrs: str) -> Callable[[_T], _T]: ... +def proxy_method_directly(*attrs: str) -> Callable[[_T], _T]: ... +def proxy_property_directly(*attrs: str) -> Callable[[_T], _T]: ... +def cond_delegate_to_executor(*attrs: str) -> Callable[[_T], _T]: ... |