mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-25 13:21:11 +08:00
committed by
Guido van Rossum
parent
b6b8554c6b
commit
b98580d299
@@ -8,40 +8,58 @@
|
||||
# Avoid using Union[str, bytes] for return values, as it implies that
|
||||
# an isinstance() check will often be required, which is inconvenient.
|
||||
|
||||
from typing import Tuple, IO
|
||||
from typing import Tuple, IO, Union, AnyStr, Any, overload
|
||||
|
||||
# global variables
|
||||
tempdir = ... # type: str
|
||||
template = ... # type: str
|
||||
|
||||
# TODO text files
|
||||
|
||||
# function stubs
|
||||
def TemporaryFile(
|
||||
mode: basestring = ..., bufsize: int = ..., suffix: basestring = ...,
|
||||
prefix: basestring = ..., dir: basestring = ...) -> IO[str]: ...
|
||||
mode: Union[bytes, unicode] = ...,
|
||||
bufsize: int = ...,
|
||||
suffix: Union[bytes, unicode] = ...,
|
||||
prefix: Union[bytes, unicode] = ...,
|
||||
dir: Union[bytes, unicode] = ...) -> IO[str]: ...
|
||||
def NamedTemporaryFile(
|
||||
mode: basestring = ..., bufsize: int = ..., suffix: basestring = ...,
|
||||
prefix: basestring = ..., dir: basestring = ..., delete: bool = ...
|
||||
) -> IO[str]: ...
|
||||
mode: Union[bytes, unicode] = ...,
|
||||
bufsize: int = ...,
|
||||
suffix: Union[bytes, unicode] = ...,
|
||||
prefix: Union[bytes, unicode] = ...,
|
||||
dir: Union[bytes, unicode] = ...,
|
||||
delete: bool = ...
|
||||
) -> IO[str]: ...
|
||||
def SpooledTemporaryFile(
|
||||
max_size: int = ..., mode: basestring = ..., buffering: int = ...,
|
||||
suffix: basestring = ..., prefix: basestring = ..., dir: basestring = ...) -> IO[str]:
|
||||
max_size: int = ...,
|
||||
mode: Union[bytes, unicode] = ...,
|
||||
buffering: int = ...,
|
||||
suffix: Union[bytes, unicode] = ...,
|
||||
prefix: Union[bytes, unicode] = ...,
|
||||
dir: Union[bytes, unicode] = ...) -> IO[str]:
|
||||
...
|
||||
|
||||
class TemporaryDirectory:
|
||||
name = ... # type: basestring
|
||||
def __init__(self, suffix: basestring = ..., prefix: basestring = ...,
|
||||
dir: basestring = ...) -> None: ...
|
||||
name = ... # type: Any # Can be str or unicode
|
||||
def __init__(self,
|
||||
suffix: Union[bytes, unicode] = ...,
|
||||
prefix: Union[bytes, unicode] = ...,
|
||||
dir: Union[bytes, unicode] = ...) -> None: ...
|
||||
def cleanup(self) -> None: ...
|
||||
def __enter__(self) -> basestring: ...
|
||||
def __enter__(self) -> Any: ... # Can be str or unicode
|
||||
def __exit__(self, type, value, traceback) -> bool: ...
|
||||
|
||||
def mkstemp(suffix: basestring = ..., prefix: basestring = ..., dir: basestring = ...,
|
||||
text: bool = ...) -> Tuple[int, basestring]: ...
|
||||
def mkdtemp(suffix: basestring = ..., prefix: basestring = ...,
|
||||
dir: basestring = ...) -> basestring: ...
|
||||
def mktemp(suffix: basestring = ..., prefix: basestring = ...,
|
||||
dir: basestring = ...) -> basestring: ...
|
||||
def gettempdir() -> basestring: ...
|
||||
def gettempprefix() -> basestring: ...
|
||||
@overload
|
||||
def mkstemp() -> Tuple[int, str]: ...
|
||||
@overload
|
||||
def mkstemp(suffix: AnyStr = ..., prefix: AnyStr = ..., dir: AnyStr = ...,
|
||||
text: bool = ...) -> Tuple[int, AnyStr]: ...
|
||||
@overload
|
||||
def mkdtemp() -> str: ...
|
||||
@overload
|
||||
def mkdtemp(suffix: AnyStr = ..., prefix: AnyStr = ..., dir: AnyStr = ...) -> AnyStr: ...
|
||||
@overload
|
||||
def mktemp() -> str: ...
|
||||
@overload
|
||||
def mktemp(suffix: AnyStr = ..., prefix: AnyStr = ..., dir: AnyStr = ...) -> AnyStr: ...
|
||||
def gettempdir() -> str: ...
|
||||
def gettempprefix() -> str: ...
|
||||
|
||||
Reference in New Issue
Block a user