1
1
from _typeshed import Incomplete
2
2
from asyncio import AbstractEventLoop
3
- from collections .abc import Generator
3
+ from collections .abc import Generator , Iterable
4
+ from tempfile import TemporaryDirectory , _BytesMode
4
5
from types import coroutine as coroutine
5
6
from typing import TypeVar
6
7
@@ -18,29 +19,33 @@ class AsyncSpooledTemporaryFile(AsyncBase[_T]):
18
19
def rollover (self ) -> Generator [Incomplete , Incomplete , Incomplete ]: ...
19
20
async def flush (self ) -> None : ...
20
21
async def isatty (self ) -> bool : ...
21
- async def read (self , __n : int = ...): ...
22
- async def readline (self , __limit : int | None = ...): ...
23
- async def readlines (self , __hint : int = ...): ...
22
+ # All must return `AnyStr`:
23
+ async def read (self , __n : int = ...) -> Incomplete : ...
24
+ async def readline (self , __limit : int | None = ...) -> Incomplete : ...
25
+ async def readlines (self , __hint : int = ...) -> list [Incomplete ]: ...
26
+ # ---
24
27
async def seek (self , offset : int , whence : int = ...) -> int : ...
25
28
async def tell (self ) -> int : ...
26
29
async def truncate (self , size : int | None = ...) -> None : ...
27
30
@property
28
- def closed (self ): ...
31
+ def closed (self ) -> bool : ...
29
32
@property
30
- def encoding (self ): ...
33
+ def encoding (self ) -> str : ...
31
34
@property
32
- def mode (self ): ...
35
+ def mode (self ) -> _BytesMode : ...
33
36
@property
34
- def name (self ): ...
35
- async def newlines (self ): ...
37
+ def name (self ) -> str : ...
36
38
@property
37
- def softspace (self ): ...
38
- async def write (self , s ): ...
39
- async def writelines (self , iterable ): ...
39
+ def newlines (self ) -> str : ...
40
+ # Both should work with `AnyStr`, like in `tempfile`:
41
+ async def write (self , s : Incomplete ) -> int : ...
42
+ async def writelines (self , iterable : Iterable [Incomplete ]) -> None : ...
40
43
41
44
class AsyncTemporaryDirectory :
42
45
async def cleanup (self ) -> None : ...
43
46
@property
44
- def name (self ): ...
45
- def __init__ (self , file , loop : AbstractEventLoop | None , executor : Incomplete | None ) -> None : ...
47
+ def name (self ) -> Incomplete : ... # should be `AnyStr`
48
+ def __init__ (
49
+ self , file : TemporaryDirectory [Incomplete ], loop : AbstractEventLoop | None , executor : Incomplete | None
50
+ ) -> None : ...
46
51
async def close (self ) -> None : ...
0 commit comments