diff options
author | S. Solomon Darnell | 2025-03-28 21:52:21 -0500 |
---|---|---|
committer | S. Solomon Darnell | 2025-03-28 21:52:21 -0500 |
commit | 4a52a71956a8d46fcb7294ac71734504bb09bcc2 (patch) | |
tree | ee3dc5af3b6313e921cd920906356f5d4febc4ed /.venv/lib/python3.12/site-packages/aiofiles-stubs/threadpool | |
parent | cc961e04ba734dd72309fb548a2f97d67d578813 (diff) | |
download | gn-ai-master.tar.gz |
Diffstat (limited to '.venv/lib/python3.12/site-packages/aiofiles-stubs/threadpool')
4 files changed, 213 insertions, 0 deletions
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]: ... |