mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-01-03 18:13:36 +08:00
Consistently use '= ...' for optional parameters.
This commit is contained in:
@@ -13,12 +13,12 @@ class _IOBase:
|
||||
def flush(self): ...
|
||||
def isatty(self): ...
|
||||
def readable(self): ...
|
||||
def readline(self, size: int = -1): ...
|
||||
def readlines(self, hint: int = -1): ...
|
||||
def readline(self, size: int = ...): ...
|
||||
def readlines(self, hint: int = ...): ...
|
||||
def seek(self, offset, whence=...): ...
|
||||
def seekable(self): ...
|
||||
def tell(self): ...
|
||||
def truncate(self, size: int = None) -> int: ...
|
||||
def truncate(self, size: int = ...) -> int: ...
|
||||
def writable(self): ...
|
||||
def writelines(self, lines): ...
|
||||
def __del__(self): ...
|
||||
@@ -29,13 +29,13 @@ class _IOBase:
|
||||
|
||||
class _BufferedIOBase(_IOBase):
|
||||
def detach(self): ...
|
||||
def read(self, size: int = -1): ...
|
||||
def read1(self, size: int = -1): ...
|
||||
def read(self, size: int = ...): ...
|
||||
def read1(self, size: int = ...): ...
|
||||
def readinto(self, b): ...
|
||||
def write(self, b): ...
|
||||
|
||||
class _RawIOBase(_IOBase):
|
||||
def read(self, size: int = -1): ...
|
||||
def read(self, size: int = ...): ...
|
||||
def readall(self): ...
|
||||
|
||||
class _TextIOBase(_IOBase):
|
||||
@@ -43,6 +43,6 @@ class _TextIOBase(_IOBase):
|
||||
errors = ... # type: Any
|
||||
newlines = ... # type: Any
|
||||
def detach(self): ...
|
||||
def read(self, size: int = -1): ...
|
||||
def readline(self, size: int = -1): ...
|
||||
def read(self, size: int = ...): ...
|
||||
def readline(self, size: int = ...): ...
|
||||
def write(self, b): ...
|
||||
|
||||
@@ -76,7 +76,7 @@ def dgettext(domain, msg): ...
|
||||
def gettext(msg): ...
|
||||
def localeconv(): ...
|
||||
def nl_langinfo(key): ...
|
||||
def setlocale(category: int, locale: Iterable[str] = None) -> str: ...
|
||||
def setlocale(category: int, locale: Iterable[str] = ...) -> str: ...
|
||||
def strcoll(string1, string2) -> int: ...
|
||||
def strxfrm(string): ...
|
||||
def textdomain(domain): ...
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
from typing import Any
|
||||
|
||||
class Random:
|
||||
def seed(self, x: Any = None) -> None: ...
|
||||
def seed(self, x: Any = ...) -> None: ...
|
||||
def getstate(self) -> tuple: ...
|
||||
def setstate(self, state: tuple) -> None: ...
|
||||
def random(self) -> float: ...
|
||||
|
||||
@@ -8,7 +8,7 @@ typecodes = ... # type: str
|
||||
|
||||
class array:
|
||||
def __init__(self, typecode: str,
|
||||
initializer: Iterable[Any] = None) -> None:
|
||||
initializer: Iterable[Any] = ...) -> None:
|
||||
typecode = ... # type: str
|
||||
itemsize = 0
|
||||
|
||||
@@ -24,7 +24,7 @@ class array:
|
||||
def fromunicode(self, s: str) -> None: ...
|
||||
def index(self, x: Any) -> int: ...
|
||||
def insert(self, i: int, x: Any) -> None: ...
|
||||
def pop(self, i: int = -1) -> Any: ...
|
||||
def pop(self, i: int = ...) -> Any: ...
|
||||
def remove(self, x: Any) -> None: ...
|
||||
def reverse(self) -> None: ...
|
||||
def tobytes(self) -> bytes: ...
|
||||
|
||||
@@ -8,15 +8,15 @@ def a2b_uu(string: bytes) -> bytes: ...
|
||||
def b2a_uu(data: bytes) -> bytes: ...
|
||||
def a2b_base64(string: bytes) -> bytes: ...
|
||||
def b2a_base64(data: bytes) -> bytes: ...
|
||||
def a2b_qp(string: bytes, header: bool = False) -> bytes: ...
|
||||
def b2a_qp(data: bytes, quotetabs: bool = False, istext: bool = True,
|
||||
header: bool = False) -> bytes: ...
|
||||
def a2b_qp(string: bytes, header: bool = ...) -> bytes: ...
|
||||
def b2a_qp(data: bytes, quotetabs: bool = ..., istext: bool = ...,
|
||||
header: bool = ...) -> bytes: ...
|
||||
def a2b_hqx(string: bytes) -> bytes: ...
|
||||
def rledecode_hqx(data: bytes) -> bytes: ...
|
||||
def rlecode_hqx(data: bytes) -> bytes: ...
|
||||
def b2a_hqx(data: bytes) -> bytes: ...
|
||||
def crc_hqx(data: bytes, crc: int) -> int: ...
|
||||
def crc32(data: bytes, crc: int = None) -> int: ...
|
||||
def crc32(data: bytes, crc: int = ...) -> int: ...
|
||||
def b2a_hex(data: bytes) -> bytes: ...
|
||||
def hexlify(data: bytes) -> bytes: ...
|
||||
def a2b_hex(hexstr: bytes) -> bytes: ...
|
||||
|
||||
@@ -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:
|
||||
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:
|
||||
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: ...
|
||||
@@ -151,9 +151,9 @@ class datetime:
|
||||
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, microsecond: int = None,
|
||||
tzinfo: tzinfo = None) -> None: ...
|
||||
def __init__(self, year: int, month: int = ..., day: int = ..., hour: int = ...,
|
||||
minute: int = ..., second: int = ..., microsecond: int = ...,
|
||||
tzinfo: tzinfo = ...) -> None: ...
|
||||
|
||||
@property
|
||||
def year(self) -> int: ...
|
||||
@@ -173,7 +173,7 @@ class datetime:
|
||||
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
|
||||
@@ -181,7 +181,7 @@ class datetime:
|
||||
@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:
|
||||
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]: ...
|
||||
|
||||
@@ -8,4 +8,4 @@ FD_CLOEXEC = 0
|
||||
F_GETFD = 0
|
||||
F_SETFD = 0
|
||||
|
||||
def fcntl(fd: int, op: int, arg: int = 0) -> int: ...
|
||||
def fcntl(fd: int, op: int, arg: int = ...) -> int: ...
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
import typing
|
||||
|
||||
def collect(generation: int = -1) -> int: ...
|
||||
def collect(generation: int = ...) -> int: ...
|
||||
def disable() -> None: ...
|
||||
def enable() -> None: ...
|
||||
def isenabled() -> bool: ...
|
||||
|
||||
@@ -6,5 +6,5 @@ from typing import TypeVar
|
||||
|
||||
_T = TypeVar('_T')
|
||||
|
||||
def cache_from_source(path: str, debug_override: bool = None) -> str: ...
|
||||
def cache_from_source(path: str, debug_override: bool = ...) -> str: ...
|
||||
def reload(module: _T) -> _T: ... # TODO imprecise signature
|
||||
|
||||
@@ -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]: ...
|
||||
|
||||
@overload
|
||||
@@ -36,21 +36,21 @@ 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]: ...
|
||||
|
||||
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]: ...
|
||||
def zip_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: Union[int, None] = None) -> Iterator[Sequence[_T]]: ...
|
||||
r: Union[int, None] = ...) -> Iterator[Sequence[_T]]: ...
|
||||
def combinations(iterable: Iterable[_T],
|
||||
r: int) -> Iterable[Sequence[_T]]: ...
|
||||
def combinations_with_replacement(iterable: Iterable[_T],
|
||||
|
||||
@@ -16,12 +16,12 @@ POLLNVAL = 0
|
||||
class poll:
|
||||
def __init__(self) -> None: ...
|
||||
def register(self, fd: Any,
|
||||
eventmask: int = POLLIN|POLLPRI|POLLOUT) -> None: ...
|
||||
eventmask: int = ...) -> None: ...
|
||||
def modify(self, fd: Any, eventmask: int) -> None: ...
|
||||
def unregister(self, fd: Any) -> None: ...
|
||||
def poll(self, timeout: int = None) -> List[Tuple[int, int]]: ...
|
||||
def poll(self, timeout: int = ...) -> List[Tuple[int, int]]: ...
|
||||
|
||||
def select(rlist: Sequence, wlist: Sequence, xlist: Sequence,
|
||||
timeout: float = None) -> Tuple[List[int],
|
||||
timeout: float = ...) -> Tuple[List[int],
|
||||
List[int],
|
||||
List[int]]: ...
|
||||
|
||||
@@ -37,15 +37,15 @@ class struct_time:
|
||||
# ----- functions -----
|
||||
def asctime(t: Union[Tuple[int, int, int, int, int, int, int, int, int],
|
||||
struct_time,
|
||||
None] = None) -> str: ... # return current time
|
||||
None] = ...) -> str: ... # return current time
|
||||
|
||||
def clock() -> float: ...
|
||||
|
||||
def ctime(secs: Union[float, None] = None) -> str: ... # return current time
|
||||
def ctime(secs: Union[float, None] = ...) -> str: ... # return current time
|
||||
|
||||
def gmtime(secs: Union[float, None] = None) -> struct_time: ... # return current time
|
||||
def gmtime(secs: Union[float, None] = ...) -> struct_time: ... # return current time
|
||||
|
||||
def localtime(secs: Union[float, None] = None) -> struct_time: ... # return current time
|
||||
def localtime(secs: Union[float, None] = ...) -> struct_time: ... # return current time
|
||||
|
||||
def mktime(t: Union[Tuple[int, int, int, int, int,
|
||||
int, int, int, int],
|
||||
@@ -56,9 +56,9 @@ def sleep(secs: Union[int, float]) -> None: ...
|
||||
def strftime(format: str, t: Union[Tuple[int, int, int, int, int,
|
||||
int, int, int, int],
|
||||
struct_time,
|
||||
None] = None) -> str: ... # return current time
|
||||
None] = ...) -> str: ... # return current time
|
||||
|
||||
def strptime(string: str,
|
||||
format: str = "%a %b %d %H:%M:%S %Y") -> struct_time: ...
|
||||
format: str = ...) -> struct_time: ...
|
||||
def time() -> float: ...
|
||||
def tzset() -> None: ... # Unix only
|
||||
|
||||
@@ -22,7 +22,7 @@ Z_NO_FLUSH = ... # type: int
|
||||
Z_SYNC_FLUSH = ... # type: int
|
||||
|
||||
def adler32(data, value=...) -> int: ...
|
||||
def compress(data, level: int = 6): ...
|
||||
def compress(data, level: int = ...): ...
|
||||
def compressobj(level=..., method=..., wbits=..., memlevel=...,
|
||||
strategy=..., zdict=...): ...
|
||||
def crc32(data, value=...) -> int: ...
|
||||
|
||||
Reference in New Issue
Block a user