mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-02-23 01:58:29 +08:00
Consistently use '= ...' for optional parameters.
This commit is contained in:
@@ -15,7 +15,7 @@ _T2 = TypeVar('_T2')
|
||||
|
||||
class deque(Generic[_T]):
|
||||
maxlen = ... # type: Optional[int]
|
||||
def __init__(self, iterable: Iterator[_T] = None, maxlen: int = None) -> None: ...
|
||||
def __init__(self, iterable: Iterator[_T] = ..., maxlen: int = ...) -> None: ...
|
||||
def append(self, x: _T) -> None: ...
|
||||
def appendleft(self, x: _T) -> None: ...
|
||||
def clear(self) -> None: ...
|
||||
|
||||
@@ -10,4 +10,4 @@ class MD5Type(object):
|
||||
def hexdigest(self) -> str: ...
|
||||
def update(self, arg: str) -> None: ...
|
||||
|
||||
def new(arg: str = None) -> MD5Type: ...
|
||||
def new(arg: str = ...) -> MD5Type: ...
|
||||
|
||||
@@ -4,8 +4,8 @@ from typing import Tuple
|
||||
_State = Tuple[int, ...]
|
||||
|
||||
class Random(object):
|
||||
def __init__(self, seed: object = None) -> None: ...
|
||||
def seed(self, x: object = None) -> None: ...
|
||||
def __init__(self, seed: object = ...) -> None: ...
|
||||
def seed(self, x: object = ...) -> None: ...
|
||||
def getstate(self) -> _State: ...
|
||||
def setstate(self, state: _State) -> None: ...
|
||||
def random(self) -> float: ...
|
||||
|
||||
@@ -12,4 +12,4 @@ class sha(object): # not actually exposed
|
||||
def hexdigest(self) -> str: ...
|
||||
def update(self, arg: str) -> None: ...
|
||||
|
||||
def new(arg: str = None) -> sha: ...
|
||||
def new(arg: str = ...) -> sha: ...
|
||||
|
||||
@@ -5,12 +5,12 @@ from typing import Optional
|
||||
def a2b_base64(string: str) -> str: ...
|
||||
def a2b_hex(hexstr: str) -> str: ...
|
||||
def a2b_hqx(string: str) -> str: ...
|
||||
def a2b_qp(string: str, header: bool = None) -> str: ...
|
||||
def a2b_qp(string: str, header: bool = ...) -> str: ...
|
||||
def a2b_uu(string: str) -> str: ...
|
||||
def b2a_base64(data: str) -> str: ...
|
||||
def b2a_hex(data: str) -> str: ...
|
||||
def b2a_hqx(data: str) -> str: ...
|
||||
def b2a_qp(data: str, quotetabs: bool = None, istext: bool = None, header: bool = None) -> str: ...
|
||||
def b2a_qp(data: str, quotetabs: bool = ..., istext: bool = ..., header: bool = ...) -> str: ...
|
||||
def b2a_uu(data: str) -> str: ...
|
||||
def crc32(data: str, crc: Optional[int]) -> int: ...
|
||||
def crc_hqx(data: str, oldcrc: int) -> int: ...
|
||||
|
||||
@@ -7,8 +7,8 @@ format_version = ... # type: str
|
||||
class Pickler: ...
|
||||
class Unpickler: ...
|
||||
|
||||
def dump(obj: Any, file: IO[str], protocol: int = None) -> None: ...
|
||||
def dumps(obj: Any, protocol: int = None) -> str: ...
|
||||
def dump(obj: Any, file: IO[str], protocol: int = ...) -> None: ...
|
||||
def dumps(obj: Any, protocol: int = ...) -> str: ...
|
||||
def load(file: IO[str]) -> Any: ...
|
||||
def loads(str: str) -> Any: ...
|
||||
|
||||
|
||||
@@ -13,9 +13,9 @@ class InputType(IO[str], Iterator[str]):
|
||||
def closed(self) -> bool: ...
|
||||
def flush(self) -> None: ...
|
||||
def isatty(self) -> bool: ...
|
||||
def read(self, size: int = -1) -> str: ...
|
||||
def readline(self, size: int = -1) -> str: ...
|
||||
def readlines(self, hint: int = -1) -> List[str]: ...
|
||||
def read(self, size: int = ...) -> str: ...
|
||||
def readline(self, size: int = ...) -> str: ...
|
||||
def readlines(self, hint: int = ...) -> List[str]: ...
|
||||
def seek(self, offset: int, whence: int = ...) -> None: ...
|
||||
def tell(self) -> int: ...
|
||||
def truncate(self, size: int = ...) -> Optional[int]: ...
|
||||
@@ -32,9 +32,9 @@ class OutputType(IO[str], Iterator[str]):
|
||||
def closed(self) -> bool: ...
|
||||
def flush(self) -> None: ...
|
||||
def isatty(self) -> bool: ...
|
||||
def read(self, size: int = -1) -> str: ...
|
||||
def readline(self, size: int = -1) -> str: ...
|
||||
def readlines(self, hint: int = -1) -> List[str]: ...
|
||||
def read(self, size: int = ...) -> str: ...
|
||||
def readline(self, size: int = ...) -> str: ...
|
||||
def readlines(self, hint: int = ...) -> List[str]: ...
|
||||
def seek(self, offset: int, whence: int = ...) -> None: ...
|
||||
def tell(self) -> int: ...
|
||||
def truncate(self, size: int = ...) -> Optional[int]: ...
|
||||
|
||||
@@ -18,7 +18,7 @@ class timezone(tzinfo):
|
||||
min = ... # type: tzinfo
|
||||
max = ... # type: tzinfo
|
||||
|
||||
def __init__(self, offset: timedelta, name: str = '') -> None: ...
|
||||
def __init__(self, offset: timedelta, name: str = ...) -> None: ...
|
||||
def __hash__(self) -> int: ...
|
||||
|
||||
_tzinfo = tzinfo
|
||||
@@ -29,7 +29,7 @@ class date(object):
|
||||
max = ... # type: date
|
||||
resolution = ... # type: timedelta
|
||||
|
||||
def __init__(self, year: int, month: int = None, day: int = None) -> None: ...
|
||||
def __init__(self, year: int, month: int = ..., day: int = ...) -> None: ...
|
||||
|
||||
@classmethod
|
||||
def fromtimestamp(cls, t: float) -> date: ...
|
||||
@@ -51,7 +51,7 @@ class date(object):
|
||||
def isoformat(self) -> str: ...
|
||||
def timetuple(self) -> tuple: ... # TODO return type
|
||||
def toordinal(self) -> int: ...
|
||||
def replace(self, year: int = None, month: int = None, day: int = None) -> date: ...
|
||||
def replace(self, year: int = ..., month: int = ..., day: int = ...) -> date: ...
|
||||
def __le__(self, other: date) -> bool: ...
|
||||
def __lt__(self, other: date) -> bool: ...
|
||||
def __ge__(self, other: date) -> bool: ...
|
||||
@@ -71,8 +71,8 @@ class time:
|
||||
max = ... # type: time
|
||||
resolution = ... # type: timedelta
|
||||
|
||||
def __init__(self, hour: int = 0, minute: int = 0, second: int = 0, microsecond: int = 0,
|
||||
tzinfo: tzinfo = None) -> None: ...
|
||||
def __init__(self, hour: int = ..., minute: int = ..., second: int = ..., microsecond: int = ...,
|
||||
tzinfo: tzinfo = ...) -> None: ...
|
||||
|
||||
@property
|
||||
def hour(self) -> int: ...
|
||||
@@ -96,8 +96,8 @@ class time:
|
||||
def utcoffset(self) -> Optional[int]: ...
|
||||
def tzname(self) -> Optional[str]: ...
|
||||
def dst(self) -> Optional[int]: ...
|
||||
def replace(self, hour: int = None, minute: int = None, second: int = None,
|
||||
microsecond: int = None, tzinfo: Union[_tzinfo, bool] = True) -> time: ...
|
||||
def replace(self, hour: int = ..., minute: int = ..., second: int = ...,
|
||||
microsecond: int = ..., tzinfo: Union[_tzinfo, bool] = ...) -> time: ...
|
||||
|
||||
_date = date
|
||||
_time = time
|
||||
@@ -107,9 +107,9 @@ class timedelta(SupportsAbs[timedelta]):
|
||||
max = ... # type: timedelta
|
||||
resolution = ... # type: timedelta
|
||||
|
||||
def __init__(self, days: int = 0, seconds: int = 0, microseconds: int = 0,
|
||||
milliseconds: int = 0, minutes: int = 0, hours: int = 0,
|
||||
weeks: int = 0) -> None: ...
|
||||
def __init__(self, days: int = ..., seconds: int = ..., microseconds: int = ...,
|
||||
milliseconds: int = ..., minutes: int = ..., hours: int = ...,
|
||||
weeks: int = ...) -> None: ...
|
||||
|
||||
@property
|
||||
def days(self) -> int: ...
|
||||
@@ -150,9 +150,9 @@ class datetime(object):
|
||||
max = ... # type: datetime
|
||||
resolution = ... # type: timedelta
|
||||
|
||||
def __init__(self, year: int, month: int = None, day: int = None, hour: int = None,
|
||||
minute: int = None, second: int = None, microseconds: int = None,
|
||||
tzinfo: tzinfo = None) -> None: ...
|
||||
def __init__(self, year: int, month: int = ..., day: int = ..., hour: int = ...,
|
||||
minute: int = ..., second: int = ..., microseconds: int = ...,
|
||||
tzinfo: tzinfo = ...) -> None: ...
|
||||
|
||||
@property
|
||||
def year(self) -> int: ...
|
||||
@@ -172,7 +172,7 @@ class datetime(object):
|
||||
def tzinfo(self) -> _tzinfo: ...
|
||||
|
||||
@classmethod
|
||||
def fromtimestamp(cls, t: float, tz: timezone = None) -> datetime: ...
|
||||
def fromtimestamp(cls, t: float, tz: timezone = ...) -> datetime: ...
|
||||
@classmethod
|
||||
def utcfromtimestamp(cls, t: float) -> datetime: ...
|
||||
@classmethod
|
||||
@@ -180,7 +180,7 @@ class datetime(object):
|
||||
@classmethod
|
||||
def fromordinal(cls, n: int) -> datetime: ...
|
||||
@classmethod
|
||||
def now(cls, tz: timezone = None) -> datetime: ...
|
||||
def now(cls, tz: timezone = ...) -> datetime: ...
|
||||
@classmethod
|
||||
def utcnow(cls) -> datetime: ...
|
||||
@classmethod
|
||||
@@ -195,12 +195,12 @@ class datetime(object):
|
||||
def date(self) -> _date: ...
|
||||
def time(self) -> _time: ...
|
||||
def timetz(self) -> _time: ...
|
||||
def replace(self, year: int = None, month: int = None, day: int = None, hour: int = None,
|
||||
minute: int = None, second: int = None, microsecond: int = None, tzinfo:
|
||||
Union[_tzinfo, bool] = True) -> datetime: ...
|
||||
def astimezone(self, tz: timezone = None) -> datetime: ...
|
||||
def replace(self, year: int = ..., month: int = ..., day: int = ..., hour: int = ...,
|
||||
minute: int = ..., second: int = ..., microsecond: int = ..., tzinfo:
|
||||
Union[_tzinfo, bool] = ...) -> datetime: ...
|
||||
def astimezone(self, tz: timezone = ...) -> datetime: ...
|
||||
def ctime(self) -> str: ...
|
||||
def isoformat(self, sep: str = 'T') -> str: ...
|
||||
def isoformat(self, sep: str = ...) -> str: ...
|
||||
@classmethod
|
||||
def strptime(cls, date_string: str, format: str) -> datetime: ...
|
||||
def utcoffset(self) -> Optional[int]: ...
|
||||
|
||||
@@ -74,12 +74,12 @@ LOCK_WRITE = ... # type: int
|
||||
|
||||
_ANYFILE = Union[int, io.IOBase]
|
||||
|
||||
def fcntl(fd: _ANYFILE, op: int, arg: Union[int, str] = 0) -> Union[int, str]: ...
|
||||
def fcntl(fd: _ANYFILE, op: int, arg: Union[int, str] = ...) -> Union[int, str]: ...
|
||||
|
||||
# TODO: arg: int or read-only buffer interface or read-write buffer interface
|
||||
def ioctl(fd: _ANYFILE, op: int, arg: Union[int, str] = 0,
|
||||
mutate_flag: bool = True) -> Union[int, str]: ...
|
||||
def ioctl(fd: _ANYFILE, op: int, arg: Union[int, str] = ...,
|
||||
mutate_flag: bool = ...) -> Union[int, str]: ...
|
||||
|
||||
def flock(fd: _ANYFILE, op: int) -> None: ...
|
||||
def lockf(fd: _ANYFILE, op: int, length: int = 0, start: int = 0,
|
||||
whence: int = 0) -> Union[int, str]: ...
|
||||
def lockf(fd: _ANYFILE, op: int, length: int = ..., start: int = ...,
|
||||
whence: int = ...) -> Union[int, str]: ...
|
||||
|
||||
@@ -5,11 +5,11 @@ from typing import List, Any, Tuple
|
||||
def enable() -> None: ...
|
||||
def disable() -> None: ...
|
||||
def isenabled() -> bool: ...
|
||||
def collect(generation: int = None) -> int: ...
|
||||
def collect(generation: int = ...) -> int: ...
|
||||
def set_debug(flags: int) -> None: ...
|
||||
def get_debug() -> int: ...
|
||||
def get_objects() -> List[Any]: ...
|
||||
def set_threshold(threshold0: int, threshold1: int = None, threshold2: int = None) -> None: ...
|
||||
def set_threshold(threshold0: int, threshold1: int = ..., threshold2: int = ...) -> None: ...
|
||||
def get_count() -> Tuple[int, int, int]: ...
|
||||
def get_threshold() -> Tuple[int, int, int]: ...
|
||||
def get_referrers(*objs: Any) -> List[Any]: ...
|
||||
|
||||
@@ -15,21 +15,21 @@ PY_SOURCE = ... # type: int
|
||||
SEARCH_ERROR = ... # type: int
|
||||
|
||||
def acquire_lock() -> None: ...
|
||||
def find_module(name: str, path: Iterable[str] = None) -> Optional[Tuple[str, str, Tuple[str, str, int]]]: ...
|
||||
def find_module(name: str, path: Iterable[str] = ...) -> Optional[Tuple[str, str, Tuple[str, str, int]]]: ...
|
||||
def get_magic() -> str: ...
|
||||
def get_suffixes() -> List[Tuple[str, str, int]]: ...
|
||||
def init_builtin(name: str) -> types.ModuleType: ...
|
||||
def init_frozen(name: str) -> types.ModuleType: ...
|
||||
def is_builtin(name: str) -> int: ...
|
||||
def is_frozen(name: str) -> bool: ...
|
||||
def load_compiled(name: str, pathname: str, file: IO[Any] = None) -> types.ModuleType: ...
|
||||
def load_dynamic(name: str, pathname: str, file: IO[Any] = None) -> types.ModuleType: ...
|
||||
def load_compiled(name: str, pathname: str, file: IO[Any] = ...) -> types.ModuleType: ...
|
||||
def load_dynamic(name: str, pathname: str, file: IO[Any] = ...) -> types.ModuleType: ...
|
||||
def load_module(name: str, file: str, pathname: str, description: Tuple[str, str, int]) -> types.ModuleType: ...
|
||||
def load_source(name: str, pathname: str, file: IO[Any] = None) -> types.ModuleType: ...
|
||||
def load_source(name: str, pathname: str, file: IO[Any] = ...) -> types.ModuleType: ...
|
||||
def lock_held() -> bool: ...
|
||||
def new_module(name: str) -> types.ModuleType: ...
|
||||
def release_lock() -> None: ...
|
||||
|
||||
class NullImporter:
|
||||
def __init__(self, path_string: str) -> None: ...
|
||||
def find_module(fullname: str, path: str = None) -> None: ...
|
||||
def find_module(fullname: str, path: str = ...) -> None: ...
|
||||
|
||||
@@ -8,8 +8,8 @@ from typing import (Iterator, TypeVar, Iterable, overload, Any, Callable, Tuple,
|
||||
_T = TypeVar('_T')
|
||||
_S = TypeVar('_S')
|
||||
|
||||
def count(start: int = 0,
|
||||
step: int = 1) -> Iterator[int]: ... # more general types?
|
||||
def count(start: int = ...,
|
||||
step: int = ...) -> Iterator[int]: ... # more general types?
|
||||
def cycle(iterable: Iterable[_T]) -> Iterator[_T]: ...
|
||||
|
||||
def repeat(object: _T, times: int = ...) -> Iterator[_T]: ...
|
||||
@@ -35,7 +35,7 @@ def groupby(iterable: Iterable[_T],
|
||||
def islice(iterable: Iterable[_T], stop: int) -> Iterator[_T]: ...
|
||||
@overload
|
||||
def islice(iterable: Iterable[_T], start: int, stop: int,
|
||||
step: int = 1) -> Iterator[_T]: ...
|
||||
step: int = ...) -> Iterator[_T]: ...
|
||||
|
||||
_T1 = TypeVar('_T1')
|
||||
_T2 = TypeVar('_T2')
|
||||
@@ -52,7 +52,7 @@ def imap(func: Callable[[_T1, _T2], _S],
|
||||
def starmap(func: Any, iterable: Iterable[Any]) -> Iterator[Any]: ...
|
||||
def takewhile(predicate: Callable[[_T], Any],
|
||||
iterable: Iterable[_T]) -> Iterator[_T]: ...
|
||||
def tee(iterable: Iterable[Any], n: int = 2) -> Iterator[Any]: ...
|
||||
def tee(iterable: Iterable[Any], n: int = ...) -> Iterator[Any]: ...
|
||||
|
||||
@overload
|
||||
def izip(iter1: Iterable[_T1]) -> Iterable[Tuple[_T1]]: ...
|
||||
@@ -67,14 +67,14 @@ def izip(iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3],
|
||||
iter4: Iterable[_T4]) -> Iterable[Tuple[_T1, _T2,
|
||||
_T3, _T4]]: ... # TODO more than four iterables
|
||||
def izip_longest(*p: Iterable[Any],
|
||||
fillvalue: Any = None) -> Iterator[Any]: ...
|
||||
fillvalue: Any = ...) -> Iterator[Any]: ...
|
||||
|
||||
# TODO: Return type should be Iterator[Tuple[..]], but unknown tuple shape.
|
||||
# Iterator[Sequence[_T]] loses this type information.
|
||||
def product(*p: Iterable[_T], repeat: int = 1) -> Iterator[Sequence[_T]]: ...
|
||||
def product(*p: Iterable[_T], repeat: int = ...) -> Iterator[Sequence[_T]]: ...
|
||||
|
||||
def permutations(iterable: Iterable[_T],
|
||||
r: int = None) -> Iterator[Sequence[_T]]: ...
|
||||
r: int = ...) -> Iterator[Sequence[_T]]: ...
|
||||
def combinations(iterable: Iterable[_T],
|
||||
r: int) -> Iterable[Sequence[_T]]: ...
|
||||
def combinations_with_replacement(iterable: Iterable[_T],
|
||||
|
||||
@@ -17,17 +17,17 @@ struct_time = NamedTuple('struct_time',
|
||||
|
||||
_TIME_TUPLE = Tuple[int, int, int, int, int, int, int, int, int]
|
||||
|
||||
def asctime(t: struct_time = None) -> str:
|
||||
def asctime(t: struct_time = ...) -> str:
|
||||
raise ValueError()
|
||||
|
||||
def clock() -> float: ...
|
||||
|
||||
def ctime(secs: float = None) -> str:
|
||||
def ctime(secs: float = ...) -> str:
|
||||
raise ValueError()
|
||||
|
||||
def gmtime(secs: float = None) -> struct_time: ...
|
||||
def gmtime(secs: float = ...) -> struct_time: ...
|
||||
|
||||
def localtime(secs: float = None) -> struct_time: ...
|
||||
def localtime(secs: float = ...) -> struct_time: ...
|
||||
|
||||
def mktime(t: struct_time) -> float:
|
||||
raise OverflowError()
|
||||
@@ -35,11 +35,11 @@ def mktime(t: struct_time) -> float:
|
||||
|
||||
def sleep(secs: float) -> None: ...
|
||||
|
||||
def strftime(format: str, t: struct_time = None) -> str:
|
||||
def strftime(format: str, t: struct_time = ...) -> str:
|
||||
raise MemoryError()
|
||||
raise ValueError()
|
||||
|
||||
def strptime(string: str, format: str = "%a %b %d %H:%M:%S %Y") -> struct_time:
|
||||
def strptime(string: str, format: str = ...) -> struct_time:
|
||||
raise ValueError()
|
||||
|
||||
def time() -> float:
|
||||
|
||||
Reference in New Issue
Block a user