mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-07 04:34:28 +08:00
Type fixes for tempfile.TemporaryDirectory (#5121)
If no arguments are passed to the TemporaryDirectory constructor, then the class defaults to using str. Overload the __init__ function to cover this case.
This commit is contained in:
@@ -310,7 +310,10 @@ class SpooledTemporaryFile(IO[AnyStr]):
|
||||
def __next__(self) -> AnyStr: ...
|
||||
|
||||
class TemporaryDirectory(Generic[AnyStr]):
|
||||
name: str
|
||||
name: AnyStr
|
||||
@overload
|
||||
def __init__(self: TemporaryDirectory[str], suffix: None = ..., prefix: None = ..., dir: None = ...) -> None: ...
|
||||
@overload
|
||||
def __init__(
|
||||
self, suffix: Optional[AnyStr] = ..., prefix: Optional[AnyStr] = ..., dir: Optional[_DirT[AnyStr]] = ...
|
||||
) -> None: ...
|
||||
|
||||
Reference in New Issue
Block a user