Skip to content

Commit 390058e

Browse files
hmc-cs-mdrissiMehdi DrissiAlexWaygood
authored
Update aiofiles for v23.1.* (#9711)
Co-authored-by: Mehdi Drissi <[email protected]> Co-authored-by: Alex Waygood <[email protected]>
1 parent a47dd76 commit 390058e

File tree

8 files changed

+71
-11
lines changed

8 files changed

+71
-11
lines changed

stubs/aiofiles/@tests/stubtest_allowlist.txt

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,15 @@ aiofiles.threadpool.binary.AsyncBufferedIOBase.readable
99
aiofiles.threadpool.binary.AsyncBufferedIOBase.seekable
1010
aiofiles.threadpool.binary.AsyncBufferedIOBase.tell
1111
aiofiles.threadpool.binary.AsyncBufferedIOBase.writable
12+
aiofiles.threadpool.binary.AsyncIndirectBufferedIOBase.close
13+
aiofiles.threadpool.binary.AsyncIndirectBufferedIOBase.detach
14+
aiofiles.threadpool.binary.AsyncIndirectBufferedIOBase.fileno
15+
aiofiles.threadpool.binary.AsyncIndirectBufferedIOBase.flush
16+
aiofiles.threadpool.binary.AsyncIndirectBufferedIOBase.isatty
17+
aiofiles.threadpool.binary.AsyncIndirectBufferedIOBase.readable
18+
aiofiles.threadpool.binary.AsyncIndirectBufferedIOBase.seekable
19+
aiofiles.threadpool.binary.AsyncIndirectBufferedIOBase.tell
20+
aiofiles.threadpool.binary.AsyncIndirectBufferedIOBase.writable
1221
aiofiles.threadpool.binary.AsyncFileIO.close
1322
aiofiles.threadpool.binary.AsyncFileIO.fileno
1423
aiofiles.threadpool.binary.AsyncFileIO.flush
@@ -18,6 +27,15 @@ aiofiles.threadpool.binary.AsyncFileIO.readall
1827
aiofiles.threadpool.binary.AsyncFileIO.seekable
1928
aiofiles.threadpool.binary.AsyncFileIO.tell
2029
aiofiles.threadpool.binary.AsyncFileIO.writable
30+
aiofiles.threadpool.binary.AsyncIndirectFileIO.close
31+
aiofiles.threadpool.binary.AsyncIndirectFileIO.fileno
32+
aiofiles.threadpool.binary.AsyncIndirectFileIO.flush
33+
aiofiles.threadpool.binary.AsyncIndirectFileIO.isatty
34+
aiofiles.threadpool.binary.AsyncIndirectFileIO.readable
35+
aiofiles.threadpool.binary.AsyncIndirectFileIO.readall
36+
aiofiles.threadpool.binary.AsyncIndirectFileIO.seekable
37+
aiofiles.threadpool.binary.AsyncIndirectFileIO.tell
38+
aiofiles.threadpool.binary.AsyncIndirectFileIO.writable
2139
aiofiles.threadpool.text.AsyncTextIOWrapper.close
2240
aiofiles.threadpool.text.AsyncTextIOWrapper.detach
2341
aiofiles.threadpool.text.AsyncTextIOWrapper.fileno
@@ -27,6 +45,15 @@ aiofiles.threadpool.text.AsyncTextIOWrapper.readable
2745
aiofiles.threadpool.text.AsyncTextIOWrapper.seekable
2846
aiofiles.threadpool.text.AsyncTextIOWrapper.tell
2947
aiofiles.threadpool.text.AsyncTextIOWrapper.writable
48+
aiofiles.threadpool.text.AsyncTextIndirectIOWrapper.close
49+
aiofiles.threadpool.text.AsyncTextIndirectIOWrapper.detach
50+
aiofiles.threadpool.text.AsyncTextIndirectIOWrapper.fileno
51+
aiofiles.threadpool.text.AsyncTextIndirectIOWrapper.flush
52+
aiofiles.threadpool.text.AsyncTextIndirectIOWrapper.isatty
53+
aiofiles.threadpool.text.AsyncTextIndirectIOWrapper.readable
54+
aiofiles.threadpool.text.AsyncTextIndirectIOWrapper.seekable
55+
aiofiles.threadpool.text.AsyncTextIndirectIOWrapper.tell
56+
aiofiles.threadpool.text.AsyncTextIndirectIOWrapper.writable
3057

3158
# These functions get the wrong signature from functools.wraps()
3259
aiofiles.os.stat

stubs/aiofiles/METADATA.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version = "22.1.*"
1+
version = "23.1.*"
22

33
[tool.stubtest]
44
# linux and darwin are equivalent

stubs/aiofiles/aiofiles/__init__.pyi

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,10 @@
11
from . import tempfile as tempfile
2-
from .threadpool import open as open
2+
from .threadpool import (
3+
open as open,
4+
stderr as stderr,
5+
stderr_bytes as stderr_bytes,
6+
stdin as stdin,
7+
stdin_bytes as stdin_bytes,
8+
stdout as stdout,
9+
stdout_bytes as stdout_bytes,
10+
)

stubs/aiofiles/aiofiles/base.pyi

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
from collections.abc import Coroutine, Generator, Iterator
1+
from collections.abc import Callable, Coroutine, Generator, Iterator
22
from types import CodeType, FrameType, TracebackType, coroutine
3-
from typing import Any, Generic, TypeVar
3+
from typing import Any, BinaryIO, Generic, TextIO, TypeVar
44
from typing_extensions import Self
55

66
_T = TypeVar("_T")
@@ -13,6 +13,9 @@ class AsyncBase(Generic[_T]):
1313
def __aiter__(self) -> Self: ...
1414
async def __anext__(self) -> _T: ...
1515

16+
class AsyncIndirectBase(AsyncBase[_T]):
17+
def __init__(self, name: str, loop: Any, executor: Any, indirect: Callable[[], TextIO | BinaryIO]) -> None: ...
18+
1619
class AiofilesContextManager(Generic[_T_co, _T_contra, _V_co]):
1720
def __init__(self, coro: Coroutine[_T_co, _T_contra, _V_co]) -> None: ...
1821
def send(self, value: _T_contra) -> _T_co: ...

stubs/aiofiles/aiofiles/tempfile/temptypes.pyi

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ class AsyncSpooledTemporaryFile(AsyncBase[_T]):
3838
def name(self) -> str: ...
3939
@property
4040
def newlines(self) -> str: ...
41-
@property
42-
def softspace(self) -> bool: ...
4341
# Both should work with `AnyStr`, like in `tempfile`:
4442
async def write(self, s: Incomplete) -> int: ...
4543
async def writelines(self, iterable: Iterable[Incomplete]) -> None: ...

stubs/aiofiles/aiofiles/threadpool/__init__.pyi

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ from typing import overload
1313
from typing_extensions import Literal, TypeAlias
1414

1515
from ..base import AiofilesContextManager
16-
from .binary import AsyncBufferedIOBase, AsyncBufferedReader, AsyncFileIO, _UnknownAsyncBinaryIO
17-
from .text import AsyncTextIOWrapper
16+
from .binary import AsyncBufferedIOBase, AsyncBufferedReader, AsyncFileIO, AsyncIndirectBufferedIOBase, _UnknownAsyncBinaryIO
17+
from .text import AsyncTextIndirectIOWrapper, AsyncTextIOWrapper
1818

1919
_Opener: TypeAlias = Callable[[str, int], int]
2020

@@ -97,3 +97,10 @@ def open(
9797
loop: AbstractEventLoop | None = ...,
9898
executor: Incomplete | None = ...,
9999
) -> AiofilesContextManager[None, None, _UnknownAsyncBinaryIO]: ...
100+
101+
stdin: AsyncTextIndirectIOWrapper
102+
stdout: AsyncTextIndirectIOWrapper
103+
stderr: AsyncTextIndirectIOWrapper
104+
stdin_bytes: AsyncIndirectBufferedIOBase
105+
stdout_bytes: AsyncIndirectBufferedIOBase
106+
stderr_bytes: AsyncIndirectBufferedIOBase

stubs/aiofiles/aiofiles/threadpool/binary.pyi

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@ from _typeshed import FileDescriptorOrPath, ReadableBuffer, WriteableBuffer
22
from collections.abc import Iterable
33
from io import FileIO
44

5-
from ..base import AsyncBase
5+
from ..base import AsyncBase, AsyncIndirectBase
66

7+
# This class does not exist at runtime and instead these methods are
8+
# all dynamically patched in.
79
class _UnknownAsyncBinaryIO(AsyncBase[bytes]):
810
async def close(self) -> None: ...
911
async def flush(self) -> None: ...
@@ -34,8 +36,20 @@ class AsyncBufferedIOBase(_UnknownAsyncBinaryIO):
3436
@property
3537
def raw(self) -> FileIO: ...
3638

39+
class AsyncIndirectBufferedIOBase(AsyncIndirectBase[bytes], _UnknownAsyncBinaryIO):
40+
async def read1(self, __size: int = ...) -> bytes: ...
41+
def detach(self) -> FileIO: ...
42+
@property
43+
def raw(self) -> FileIO: ...
44+
3745
class AsyncBufferedReader(AsyncBufferedIOBase):
3846
async def peek(self, __size: int = ...) -> bytes: ...
3947

48+
class AsyncIndirectBufferedReader(AsyncIndirectBufferedIOBase):
49+
async def peek(self, __size: int = ...) -> bytes: ...
50+
4051
class AsyncFileIO(_UnknownAsyncBinaryIO):
4152
async def readall(self) -> bytes: ...
53+
54+
class AsyncIndirectFileIO(AsyncIndirectBase[bytes], _UnknownAsyncBinaryIO):
55+
async def readall(self) -> bytes: ...

stubs/aiofiles/aiofiles/threadpool/text.pyi

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ from _typeshed import FileDescriptorOrPath
22
from collections.abc import Iterable
33
from typing import BinaryIO
44

5-
from ..base import AsyncBase
5+
from ..base import AsyncBase, AsyncIndirectBase
66

7-
class AsyncTextIOWrapper(AsyncBase[str]):
7+
class _UnknownAsyncTextIO(AsyncBase[str]):
88
async def close(self) -> None: ...
99
async def flush(self) -> None: ...
1010
async def isatty(self) -> bool: ...
@@ -37,3 +37,6 @@ class AsyncTextIOWrapper(AsyncBase[str]):
3737
def name(self) -> FileDescriptorOrPath: ...
3838
@property
3939
def mode(self) -> str: ...
40+
41+
class AsyncTextIOWrapper(_UnknownAsyncTextIO): ...
42+
class AsyncTextIndirectIOWrapper(AsyncIndirectBase[str], _UnknownAsyncTextIO): ...

0 commit comments

Comments
 (0)