mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-06 12:14:27 +08:00
tempfile.mkdtemp() should return a str when passed no arguments. (#2893)
Otherwise, pytype expands `AnyStr` to `Union[str, bytes]`, leading to spurious type errors later on. * Mark the `dir` argument to mkdtemp as AnyStr.
This commit is contained in:
committed by
Sebastian Rittau
parent
f7c00b8b33
commit
9b9ff64fc5
@@ -5,7 +5,7 @@
|
||||
|
||||
import sys
|
||||
from types import TracebackType
|
||||
from typing import Any, AnyStr, Generic, IO, Iterable, Iterator, List, Optional, Tuple, Type
|
||||
from typing import Any, AnyStr, Generic, IO, Iterable, Iterator, List, Optional, overload, Tuple, Type
|
||||
|
||||
# global variables
|
||||
TMP_MAX: int
|
||||
@@ -74,8 +74,11 @@ if sys.version_info >= (3, 5):
|
||||
|
||||
def mkstemp(suffix: Optional[AnyStr] = ..., prefix: Optional[AnyStr] = ..., dir: Optional[AnyStr] = ...,
|
||||
text: bool = ...) -> Tuple[int, AnyStr]: ...
|
||||
@overload
|
||||
def mkdtemp() -> str: ...
|
||||
@overload
|
||||
def mkdtemp(suffix: Optional[AnyStr] = ..., prefix: Optional[AnyStr] = ...,
|
||||
dir: Optional[str] = ...) -> AnyStr: ...
|
||||
dir: Optional[AnyStr] = ...) -> AnyStr: ...
|
||||
def mktemp(suffix: Optional[AnyStr] = ..., prefix: Optional[AnyStr] = ..., dir: Optional[AnyStr] = ...) -> AnyStr: ...
|
||||
|
||||
def gettempdirb() -> bytes: ...
|
||||
|
||||
Reference in New Issue
Block a user