8000 Complete stubtest for `aiofiles` + fix on Windows (#9184) · python/typeshed@033d21e · GitHub
[go: up one dir, main page]

Skip to content

Commit 033d21e

Browse files
authored
Complete stubtest for aiofiles + fix on Windows (#9184)
1 parent 82c0ea7 commit 033d21e

File tree

6 files changed

+20
-6
lines changed

6 files changed

+20
-6
lines changed

stubs/aiofiles/@tests/stubtest_allowlist.txt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# Some arguments only exist on FreeBSD and MacOS
2-
aiofiles.os.sendfile
3-
41
# These all delegate using *args,**kwargs, but stubs use signature of
52
# method they are being delegated to.
63
aiofiles.threadpool.binary.AsyncBufferedIOBase.close
@@ -51,6 +48,7 @@ aiofiles.ospath.samefile
5148
aiofiles.ospath.sameopenfile
5249

5350
# Same issues as above
51+
aiofiles.tempfile.temptypes.AsyncSpooledTemporaryFile.close
5452
aiofiles.tempfile.temptypes.AsyncSpooledTemporaryFile.fileno
5553
aiofiles.tempfile.temptypes.AsyncSpooledTemporaryFile.flush
5654
aiofiles.tempfile.temptypes.AsyncSpooledTemporaryFile.isatty
@@ -61,3 +59,7 @@ aiofiles.tempfile.temptypes.AsyncTemporaryDirectory.cleanup
6159
# Metaclass differs:
6260
aiofiles.base.AiofilesContextManager
6361
aiofiles.tempfile.AiofilesContextManagerTempDir
62+
63+
# Helper decorator, too complex to type
64+
aiofiles.os.wrap
65+
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# This function gets the wrong signature from functools.wraps()
2+
aiofiles.os.sendfile
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# This function gets the wrong signature from functools.wraps()
2+
aiofiles.os.sendfile

stubs/aiofiles/METADATA.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
11
version = "22.1.*"
2+
3+
[tool.stubtest]
4+
ignore_missing_stub = false
5+
# linux and darwin are equivalent
6+
platforms = ["linux", "win32"]

stubs/aiofiles/aiofiles/os.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ from os import stat_result
66
from typing import Any, overload
77
from typing_extensions import TypeAlias
88

9-
from . import ospath
9+
from aiofiles import ospath
1010

1111
path = ospath
1212

stubs/aiofiles/aiofiles/tempfile/temptypes.pyi

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ from tempfile import TemporaryDirectory, _BytesMode
55
from types import coroutine as coroutine
66
from typing import TypeVar
77

8-
from ..base import AsyncBase as AsyncBase
9-
from ..threadpool.utils import (
8+
from aiofiles.base import AsyncBase as AsyncBase
9+
from aiofiles.threadpool.utils import (
1010
cond_delegate_to_executor as cond_delegate_to_executor,
1111
delegate_to_executor as delegate_to_executor,
1212
proxy_property_directly as proxy_property_directly,
@@ -17,6 +17,7 @@ _T = TypeVar("_T")
1717
class AsyncSpooledTemporaryFile(AsyncBase[_T]):
1818
def fileno(self) -> Generator[Incomplete, Incomplete, Incomplete]: ...
1919
def rollover(self) -> Generator[Incomplete, Incomplete, Incomplete]: ...
20+
async def close(self) -> None: ...
2021
async def flush(self) -> None: ...
2122
async def isatty(self) -> bool: ...
2223
# All must return `AnyStr`:
@@ -37,6 +38,8 @@ class AsyncSpooledTemporaryFile(AsyncBase[_T]):
3738
def name(self) -> str: ...
3839
@property
3940
def newlines(self) -> str: ...
41+
@property
42+
def softspace(self) -> bool: ...
4043
# Both should work with `AnyStr`, like in `tempfile`:
4144
async def write(self, s: Incomplete) -> int: ...
4245
async def writelines(self, iterable: Iterable[Incomplete]) -> None: ...

0 commit comments

Comments
 (0)
0