mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-01-02 01:23:24 +08:00
Update aiofiles for v23.1.* (#9711)
Co-authored-by: Mehdi Drissi <mdrissi@snapchat.com> Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
This commit is contained in:
@@ -9,6 +9,15 @@ aiofiles.threadpool.binary.AsyncBufferedIOBase.readable
|
||||
aiofiles.threadpool.binary.AsyncBufferedIOBase.seekable
|
||||
aiofiles.threadpool.binary.AsyncBufferedIOBase.tell
|
||||
aiofiles.threadpool.binary.AsyncBufferedIOBase.writable
|
||||
aiofiles.threadpool.binary.AsyncIndirectBufferedIOBase.close
|
||||
aiofiles.threadpool.binary.AsyncIndirectBufferedIOBase.detach
|
||||
aiofiles.threadpool.binary.AsyncIndirectBufferedIOBase.fileno
|
||||
aiofiles.threadpool.binary.AsyncIndirectBufferedIOBase.flush
|
||||
aiofiles.threadpool.binary.AsyncIndirectBufferedIOBase.isatty
|
||||
aiofiles.threadpool.binary.AsyncIndirectBufferedIOBase.readable
|
||||
aiofiles.threadpool.binary.AsyncIndirectBufferedIOBase.seekable
|
||||
aiofiles.threadpool.binary.AsyncIndirectBufferedIOBase.tell
|
||||
aiofiles.threadpool.binary.AsyncIndirectBufferedIOBase.writable
|
||||
aiofiles.threadpool.binary.AsyncFileIO.close
|
||||
aiofiles.threadpool.binary.AsyncFileIO.fileno
|
||||
aiofiles.threadpool.binary.AsyncFileIO.flush
|
||||
@@ -18,6 +27,15 @@ aiofiles.threadpool.binary.AsyncFileIO.readall
|
||||
aiofiles.threadpool.binary.AsyncFileIO.seekable
|
||||
aiofiles.threadpool.binary.AsyncFileIO.tell
|
||||
aiofiles.threadpool.binary.AsyncFileIO.writable
|
||||
aiofiles.threadpool.binary.AsyncIndirectFileIO.close
|
||||
aiofiles.threadpool.binary.AsyncIndirectFileIO.fileno
|
||||
aiofiles.threadpool.binary.AsyncIndirectFileIO.flush
|
||||
aiofiles.threadpool.binary.AsyncIndirectFileIO.isatty
|
||||
aiofiles.threadpool.binary.AsyncIndirectFileIO.readable
|
||||
aiofiles.threadpool.binary.AsyncIndirectFileIO.readall
|
||||
aiofiles.threadpool.binary.AsyncIndirectFileIO.seekable
|
||||
aiofiles.threadpool.binary.AsyncIndirectFileIO.tell
|
||||
aiofiles.threadpool.binary.AsyncIndirectFileIO.writable
|
||||
aiofiles.threadpool.text.AsyncTextIOWrapper.close
|
||||
aiofiles.threadpool.text.AsyncTextIOWrapper.detach
|
||||
aiofiles.threadpool.text.AsyncTextIOWrapper.fileno
|
||||
@@ -27,6 +45,15 @@ aiofiles.threadpool.text.AsyncTextIOWrapper.readable
|
||||
aiofiles.threadpool.text.AsyncTextIOWrapper.seekable
|
||||
aiofiles.threadpool.text.AsyncTextIOWrapper.tell
|
||||
aiofiles.threadpool.text.AsyncTextIOWrapper.writable
|
||||
aiofiles.threadpool.text.AsyncTextIndirectIOWrapper.close
|
||||
aiofiles.threadpool.text.AsyncTextIndirectIOWrapper.detach
|
||||
aiofiles.threadpool.text.AsyncTextIndirectIOWrapper.fileno
|
||||
aiofiles.threadpool.text.AsyncTextIndirectIOWrapper.flush
|
||||
aiofiles.threadpool.text.AsyncTextIndirectIOWrapper.isatty
|
||||
aiofiles.threadpool.text.AsyncTextIndirectIOWrapper.readable
|
||||
aiofiles.threadpool.text.AsyncTextIndirectIOWrapper.seekable
|
||||
aiofiles.threadpool.text.AsyncTextIndirectIOWrapper.tell
|
||||
aiofiles.threadpool.text.AsyncTextIndirectIOWrapper.writable
|
||||
|
||||
# These functions get the wrong signature from functools.wraps()
|
||||
aiofiles.os.stat
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
version = "22.1.*"
|
||||
version = "23.1.*"
|
||||
|
||||
[tool.stubtest]
|
||||
# linux and darwin are equivalent
|
||||
|
||||
@@ -1,2 +1,10 @@
|
||||
from . import tempfile as tempfile
|
||||
from .threadpool import open as open
|
||||
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,
|
||||
)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from collections.abc import Coroutine, Generator, Iterator
|
||||
from collections.abc import Callable, Coroutine, Generator, Iterator
|
||||
from types import CodeType, FrameType, TracebackType, coroutine
|
||||
from typing import Any, Generic, TypeVar
|
||||
from typing import Any, BinaryIO, Generic, TextIO, TypeVar
|
||||
from typing_extensions import Self
|
||||
|
||||
_T = TypeVar("_T")
|
||||
@@ -13,6 +13,9 @@ class AsyncBase(Generic[_T]):
|
||||
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(Generic[_T_co, _T_contra, _V_co]):
|
||||
def __init__(self, coro: Coroutine[_T_co, _T_contra, _V_co]) -> None: ...
|
||||
def send(self, value: _T_contra) -> _T_co: ...
|
||||
|
||||
@@ -38,8 +38,6 @@ class AsyncSpooledTemporaryFile(AsyncBase[_T]):
|
||||
def name(self) -> str: ...
|
||||
@property
|
||||
def newlines(self) -> str: ...
|
||||
@property
|
||||
def softspace(self) -> bool: ...
|
||||
# Both should work with `AnyStr`, like in `tempfile`:
|
||||
async def write(self, s: Incomplete) -> int: ...
|
||||
async def writelines(self, iterable: Iterable[Incomplete]) -> None: ...
|
||||
|
||||
@@ -13,8 +13,8 @@ from typing import overload
|
||||
from typing_extensions import Literal, TypeAlias
|
||||
|
||||
from ..base import AiofilesContextManager
|
||||
from .binary import AsyncBufferedIOBase, AsyncBufferedReader, AsyncFileIO, _UnknownAsyncBinaryIO
|
||||
from .text import AsyncTextIOWrapper
|
||||
from .binary import AsyncBufferedIOBase, AsyncBufferedReader, AsyncFileIO, AsyncIndirectBufferedIOBase, _UnknownAsyncBinaryIO
|
||||
from .text import AsyncTextIndirectIOWrapper, AsyncTextIOWrapper
|
||||
|
||||
_Opener: TypeAlias = Callable[[str, int], int]
|
||||
|
||||
@@ -97,3 +97,10 @@ def open(
|
||||
loop: AbstractEventLoop | None = ...,
|
||||
executor: Incomplete | None = ...,
|
||||
) -> AiofilesContextManager[None, None, _UnknownAsyncBinaryIO]: ...
|
||||
|
||||
stdin: AsyncTextIndirectIOWrapper
|
||||
stdout: AsyncTextIndirectIOWrapper
|
||||
stderr: AsyncTextIndirectIOWrapper
|
||||
stdin_bytes: AsyncIndirectBufferedIOBase
|
||||
stdout_bytes: AsyncIndirectBufferedIOBase
|
||||
stderr_bytes: AsyncIndirectBufferedIOBase
|
||||
|
||||
@@ -2,8 +2,10 @@ from _typeshed import FileDescriptorOrPath, ReadableBuffer, WriteableBuffer
|
||||
from collections.abc import Iterable
|
||||
from io import FileIO
|
||||
|
||||
from ..base import AsyncBase
|
||||
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: ...
|
||||
@@ -34,8 +36,20 @@ class AsyncBufferedIOBase(_UnknownAsyncBinaryIO):
|
||||
@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: ...
|
||||
|
||||
@@ -2,9 +2,9 @@ from _typeshed import FileDescriptorOrPath
|
||||
from collections.abc import Iterable
|
||||
from typing import BinaryIO
|
||||
|
||||
from ..base import AsyncBase
|
||||
from ..base import AsyncBase, AsyncIndirectBase
|
||||
|
||||
class AsyncTextIOWrapper(AsyncBase[str]):
|
||||
class _UnknownAsyncTextIO(AsyncBase[str]):
|
||||
async def close(self) -> None: ...
|
||||
async def flush(self) -> None: ...
|
||||
async def isatty(self) -> bool: ...
|
||||
@@ -37,3 +37,6 @@ class AsyncTextIOWrapper(AsyncBase[str]):
|
||||
def name(self) -> FileDescriptorOrPath: ...
|
||||
@property
|
||||
def mode(self) -> str: ...
|
||||
|
||||
class AsyncTextIOWrapper(_UnknownAsyncTextIO): ...
|
||||
class AsyncTextIndirectIOWrapper(AsyncIndirectBase[str], _UnknownAsyncTextIO): ...
|
||||
|
||||
Reference in New Issue
Block a user