Fix incorrectly Optional builtin function args (#500)

Many builtin functions were accidentally marked as Optional because
they were given default values of None.
This commit is contained in:
David Fisher
2016-08-25 19:07:00 -07:00
committed by Greg Price
parent 0ffe3abf70
commit e8df136ce8
2 changed files with 28 additions and 28 deletions

View File

@@ -4,7 +4,7 @@ from typing import (
TypeVar, Iterator, Iterable, overload,
Sequence, MutableSequence, Mapping, MutableMapping, Tuple, List, Any, Dict, Callable, Generic,
Set, AbstractSet, MutableSet, Sized, Reversible, SupportsInt, SupportsFloat, SupportsBytes,
SupportsAbs, SupportsRound, IO, Union, ItemsView, KeysView, ValuesView, ByteString
SupportsAbs, SupportsRound, IO, Union, ItemsView, KeysView, ValuesView, ByteString, Optional
)
from abc import abstractmethod, ABCMeta
from types import TracebackType
@@ -63,7 +63,7 @@ class type:
def mro(self) -> List[type]: ...
class int(SupportsInt, SupportsFloat, SupportsAbs[int]):
def __init__(self, x: Union[SupportsInt, str, bytes] = None, base: int = None) -> None: ...
def __init__(self, x: Union[SupportsInt, str, bytes] = ..., base: int = ...) -> None: ...
def bit_length(self) -> int: ...
def to_bytes(self, length: int, byteorder: str, *, signed: bool = ...) -> bytes: ...
@classmethod
@@ -112,7 +112,7 @@ class int(SupportsInt, SupportsFloat, SupportsAbs[int]):
def __hash__(self) -> int: ...
class float(SupportsFloat, SupportsInt, SupportsAbs[float]):
def __init__(self, x: Union[SupportsFloat, str, bytes]=None) -> None: ...
def __init__(self, x: Union[SupportsFloat, str, bytes] = ...) -> None: ...
def as_integer_ratio(self) -> Tuple[int, int]: ...
def hex(self) -> str: ...
def is_integer(self) -> bool: ...
@@ -188,7 +188,7 @@ class str(Sequence[str]):
@overload
def __init__(self, o: object) -> None: ...
@overload
def __init__(self, o: bytes, encoding: str = None, errors: str = 'strict') -> None: ...
def __init__(self, o: bytes, encoding: str = ..., errors: str = 'strict') -> None: ...
def capitalize(self) -> str: ...
def center(self, width: int, fillchar: str = ' ') -> str: ...
def count(self, x: str) -> int: ...
@@ -274,7 +274,7 @@ class bytes(ByteString):
@overload
def __init__(self, o: SupportsBytes) -> None: ...
def capitalize(self) -> bytes: ...
def center(self, width: int, fillchar: bytes = None) -> bytes: ...
def center(self, width: int, fillchar: bytes = ...) -> bytes: ...
def count(self, x: bytes) -> int: ...
def decode(self, encoding: str = 'utf-8', errors: str = 'strict') -> str: ...
def endswith(self, suffix: Union[bytes, Tuple[bytes, ...]]) -> bool: ...
@@ -289,14 +289,14 @@ class bytes(ByteString):
def istitle(self) -> bool: ...
def isupper(self) -> bool: ...
def join(self, iterable: Iterable[bytes]) -> bytes: ...
def ljust(self, width: int, fillchar: bytes = None) -> bytes: ...
def ljust(self, width: int, fillchar: bytes = ...) -> bytes: ...
def lower(self) -> bytes: ...
def lstrip(self, chars: bytes = None) -> bytes: ...
def partition(self, sep: bytes) -> Tuple[bytes, bytes, bytes]: ...
def replace(self, old: bytes, new: bytes, count: int = -1) -> bytes: ...
def rfind(self, sub: bytes, start: int = 0, end: int = 0) -> int: ...
def rindex(self, sub: bytes, start: int = 0, end: int = 0) -> int: ...
def rjust(self, width: int, fillchar: bytes = None) -> bytes: ...
def rjust(self, width: int, fillchar: bytes = ...) -> bytes: ...
def rpartition(self, sep: bytes) -> Tuple[bytes, bytes, bytes]: ...
def rsplit(self, sep: bytes = None, maxsplit: int = -1) -> List[bytes]: ...
def rstrip(self, chars: bytes = None) -> bytes: ...
@@ -306,7 +306,7 @@ class bytes(ByteString):
def strip(self, chars: bytes = None) -> bytes: ...
def swapcase(self) -> bytes: ...
def title(self) -> bytes: ...
def translate(self, table: bytes, delete: bytes = None) -> bytes: ...
def translate(self, table: Optional[bytes], delete: bytes = ...) -> bytes: ...
def upper(self) -> bytes: ...
def zfill(self, width: int) -> bytes: ...
@classmethod
@@ -346,7 +346,7 @@ class bytearray(MutableSequence[int], ByteString):
@overload
def __init__(self) -> None: ...
def capitalize(self) -> bytearray: ...
def center(self, width: int, fillchar: bytes = None) -> bytearray: ...
def center(self, width: int, fillchar: bytes = ...) -> bytearray: ...
def count(self, x: bytes) -> int: ...
def decode(self, encoding: str = 'utf-8', errors: str = 'strict') -> str: ...
def endswith(self, suffix: bytes) -> bool: ...
@@ -362,14 +362,14 @@ class bytearray(MutableSequence[int], ByteString):
def istitle(self) -> bool: ...
def isupper(self) -> bool: ...
def join(self, iterable: Iterable[bytes]) -> bytearray: ...
def ljust(self, width: int, fillchar: bytes = None) -> bytearray: ...
def ljust(self, width: int, fillchar: bytes = ...) -> bytearray: ...
def lower(self) -> bytearray: ...
def lstrip(self, chars: bytes = None) -> bytearray: ...
def partition(self, sep: bytes) -> Tuple[bytearray, bytearray, bytearray]: ...
def replace(self, old: bytes, new: bytes, count: int = -1) -> bytearray: ...
def rfind(self, sub: bytes, start: int = 0, end: int = 0) -> int: ...
def rindex(self, sub: bytes, start: int = 0, end: int = 0) -> int: ...
def rjust(self, width: int, fillchar: bytes = None) -> bytearray: ...
def rjust(self, width: int, fillchar: bytes = ...) -> bytearray: ...
def rpartition(self, sep: bytes) -> Tuple[bytearray, bytearray, bytearray]: ...
def rsplit(self, sep: bytes = None, maxsplit: int = -1) -> List[bytearray]: ...
def rstrip(self, chars: bytes = None) -> bytearray: ...
@@ -379,7 +379,7 @@ class bytearray(MutableSequence[int], ByteString):
def strip(self, chars: bytes = None) -> bytearray: ...
def swapcase(self) -> bytearray: ...
def title(self) -> bytearray: ...
def translate(self, table: bytes, delete: bytes = None) -> bytearray: ...
def translate(self, table: Optional[bytes], delete: bytes = ...) -> bytearray: ...
def upper(self) -> bytearray: ...
def zfill(self, width: int) -> bytearray: ...
@classmethod
@@ -537,7 +537,7 @@ class dict(MutableMapping[_KT, _VT], Generic[_KT, _VT]):
def __str__(self) -> str: ...
class set(MutableSet[_T], Generic[_T]):
def __init__(self, iterable: Iterable[_T]=None) -> None: ...
def __init__(self, iterable: Iterable[_T] = ...) -> None: ...
def add(self, element: _T) -> None: ...
def clear(self) -> None: ...
def copy(self) -> set[_T]: ...
@@ -574,7 +574,7 @@ class set(MutableSet[_T], Generic[_T]):
# TODO more set operations
class frozenset(AbstractSet[_T], Generic[_T]):
def __init__(self, iterable: Iterable[_T]=None) -> None: ...
def __init__(self, iterable: Iterable[_T] = ...) -> None: ...
def copy(self) -> frozenset[_T]: ...
def difference(self, *s: Iterable[Any]) -> frozenset[_T]: ...
def intersection(self, *s: Iterable[Any]) -> frozenset[_T]: ...
@@ -650,7 +650,7 @@ def compile(source: Any, filename: Union[str, bytes], mode: str, flags: int = 0,
def copyright() -> None: ...
def credits() -> None: ...
def delattr(o: Any, name: str) -> None: ...
def dir(o: object = None) -> List[str]: ...
def dir(o: object = ...) -> List[str]: ...
_N = TypeVar('_N', int, float)
def divmod(a: _N, b: _N) -> Tuple[_N, _N]: ...
def eval(source: str, globals: Dict[str, Any] = None,
@@ -660,7 +660,7 @@ def exec(object: str, globals: Dict[str, Any] = None,
def exit(code: int = None) -> None: ...
def filter(function: Callable[[_T], Any], iterable: Iterable[_T]) -> Iterator[_T]: ...
def format(o: object, format_spec: str = '') -> str: ...
def getattr(o: Any, name: str, default: Any = None) -> Any: ...
def getattr(o: Any, name: str, default: Any = ...) -> Any: ...
def globals() -> Dict[str, Any]: ...
def hasattr(o: Any, name: str) -> bool: ...
def hash(o: object) -> int: ...
@@ -683,14 +683,14 @@ def map(func: Callable[[_T1], _S], iter1: Iterable[_T1]) -> Iterator[_S]: ...
def map(func: Callable[[_T1, _T2], _S], iter1: Iterable[_T1],
iter2: Iterable[_T2]) -> Iterator[_S]: ... # TODO more than two iterables
@overload
def max(arg1: _T, arg2: _T, *args: _T, key: Callable[[_T], Any] = None) -> _T: ...
def max(arg1: _T, arg2: _T, *args: _T, key: Callable[[_T], Any] = ...) -> _T: ...
@overload
def max(iterable: Iterable[_T], key: Callable[[_T], Any] = None, default:_T = None) -> _T: ...
def max(iterable: Iterable[_T], key: Callable[[_T], Any] = ..., default:_T = ...) -> _T: ...
# TODO memoryview
@overload
def min(arg1: _T, arg2: _T, *args: _T, key: Callable[[_T], Any] = None) -> _T: ...
def min(arg1: _T, arg2: _T, *args: _T, key: Callable[[_T], Any] = ...) -> _T: ...
@overload
def min(iterable: Iterable[_T], key: Callable[[_T], Any] = None, default:_T = None) -> _T: ...
def min(iterable: Iterable[_T], key: Callable[[_T], Any] = ..., default:_T = ...) -> _T: ...
@overload
def next(i: Iterator[_T]) -> _T: ...
@overload
@@ -726,8 +726,8 @@ def round(number: SupportsRound[_T], ndigits: int) -> _T: ...
def setattr(object: Any, name: str, value: Any) -> None: ...
def sorted(iterable: Iterable[_T], *, key: Callable[[_T], Any] = None,
reverse: bool = False) -> List[_T]: ...
def sum(iterable: Iterable[_T], start: _T = None) -> _T: ...
def vars(object: Any = None) -> Dict[str, Any]: ...
def sum(iterable: Iterable[_T], start: _T = ...) -> _T: ...
def vars(object: Any = ...) -> Dict[str, Any]: ...
@overload
def zip(iter1: Iterable[_T1]) -> Iterator[Tuple[_T1]]: ...
@overload