From b85f46eb07945414aa7ed9c329bddb4414808121 Mon Sep 17 00:00:00 2001 From: Wolf Honore Date: Sat, 23 Jan 2021 09:06:06 -0500 Subject: [PATCH] Fix (start/end)swith arguments (#4949) --- stdlib/2/UserString.pyi | 4 ++-- stdlib/2/__builtin__.pyi | 20 +++++++++++++++----- stdlib/2/builtins.pyi | 20 +++++++++++++++----- stdlib/3/builtins.pyi | 18 +++++++++++++----- stdlib/3/collections/__init__.pyi | 4 ++-- 5 files changed, 47 insertions(+), 19 deletions(-) diff --git a/stdlib/2/UserString.pyi b/stdlib/2/UserString.pyi index df7bbc363..33de48739 100644 --- a/stdlib/2/UserString.pyi +++ b/stdlib/2/UserString.pyi @@ -27,7 +27,7 @@ class UserString(Sequence[UserString]): def count(self, sub: int, start: int = ..., end: int = ...) -> int: ... def decode(self: _UST, encoding: Optional[str] = ..., errors: Optional[str] = ...) -> _UST: ... def encode(self: _UST, encoding: Optional[str] = ..., errors: Optional[str] = ...) -> _UST: ... - def endswith(self, suffix: Text, start: int = ..., end: int = ...) -> bool: ... + def endswith(self, suffix: Union[Text, Tuple[Text, ...]], start: Optional[int] = ..., end: Optional[int] = ...) -> bool: ... def expandtabs(self: _UST, tabsize: int = ...) -> _UST: ... def find(self, sub: Text, start: int = ..., end: int = ...) -> int: ... def index(self, sub: Text, start: int = ..., end: int = ...) -> int: ... @@ -54,7 +54,7 @@ class UserString(Sequence[UserString]): def split(self, sep: Optional[Text] = ..., maxsplit: int = ...) -> List[Text]: ... def rsplit(self, sep: Optional[Text] = ..., maxsplit: int = ...) -> List[Text]: ... def splitlines(self, keepends: int = ...) -> List[Text]: ... - def startswith(self, suffix: Text, start: int = ..., end: int = ...) -> bool: ... + def startswith(self, prefix: Union[Text, Tuple[Text, ...]], start: Optional[int] = ..., end: Optional[int] = ...) -> bool: ... def strip(self: _UST, chars: Optional[Text] = ...) -> _UST: ... def swapcase(self: _UST) -> _UST: ... def title(self: _UST) -> _UST: ... diff --git a/stdlib/2/__builtin__.pyi b/stdlib/2/__builtin__.pyi index 0e01b635c..8f42584aa 100644 --- a/stdlib/2/__builtin__.pyi +++ b/stdlib/2/__builtin__.pyi @@ -296,7 +296,9 @@ class unicode(basestring, Sequence[unicode]): def count(self, x: unicode) -> int: ... def decode(self, encoding: unicode = ..., errors: unicode = ...) -> unicode: ... def encode(self, encoding: unicode = ..., errors: unicode = ...) -> str: ... - def endswith(self, suffix: Union[unicode, Tuple[unicode, ...]], start: int = ..., end: int = ...) -> bool: ... + def endswith( + self, __suffix: Union[unicode, Tuple[unicode, ...]], __start: Optional[int] = ..., __end: Optional[int] = ... + ) -> bool: ... def expandtabs(self, tabsize: int = ...) -> unicode: ... def find(self, sub: unicode, start: int = ..., end: int = ...) -> int: ... def format(self, *args: object, **kwargs: object) -> unicode: ... @@ -326,7 +328,9 @@ class unicode(basestring, Sequence[unicode]): def rstrip(self, chars: unicode = ...) -> unicode: ... def split(self, sep: Optional[unicode] = ..., maxsplit: int = ...) -> List[unicode]: ... def splitlines(self, keepends: bool = ...) -> List[unicode]: ... - def startswith(self, prefix: Union[unicode, Tuple[unicode, ...]], start: int = ..., end: int = ...) -> bool: ... + def startswith( + self, __prefix: Union[unicode, Tuple[unicode, ...]], __start: Optional[int] = ..., __end: Optional[int] = ... + ) -> bool: ... def strip(self, chars: unicode = ...) -> unicode: ... def swapcase(self) -> unicode: ... def title(self) -> unicode: ... @@ -369,7 +373,9 @@ class str(Sequence[str], basestring): def count(self, x: Text, __start: Optional[int] = ..., __end: Optional[int] = ...) -> int: ... def decode(self, encoding: Text = ..., errors: Text = ...) -> unicode: ... def encode(self, encoding: Text = ..., errors: Text = ...) -> bytes: ... - def endswith(self, suffix: Union[Text, Tuple[Text, ...]]) -> bool: ... + def endswith( + self, __suffix: Union[Text, Tuple[Text, ...]], __start: Optional[int] = ..., __end: Optional[int] = ... + ) -> bool: ... def expandtabs(self, tabsize: int = ...) -> str: ... def find(self, sub: Text, __start: Optional[int] = ..., __end: Optional[int] = ...) -> int: ... def format(self, *args: object, **kwargs: object) -> str: ... @@ -418,7 +424,9 @@ class str(Sequence[str], basestring): @overload def split(self, sep: unicode, maxsplit: int = ...) -> List[unicode]: ... def splitlines(self, keepends: bool = ...) -> List[str]: ... - def startswith(self, prefix: Union[Text, Tuple[Text, ...]]) -> bool: ... + def startswith( + self, __prefix: Union[Text, Tuple[Text, ...]], __start: Optional[int] = ..., __end: Optional[int] = ... + ) -> bool: ... @overload def strip(self, __chars: str = ...) -> str: ... @overload @@ -468,7 +476,9 @@ class bytearray(MutableSequence[int], ByteString): def center(self, __width: int, __fillchar: bytes = ...) -> bytearray: ... def count(self, __sub: str) -> int: ... def decode(self, encoding: Text = ..., errors: Text = ...) -> str: ... - def endswith(self, __suffix: Union[bytes, Tuple[bytes, ...]]) -> bool: ... + def endswith( + self, __suffix: Union[bytes, Tuple[bytes, ...]], __start: Optional[int] = ..., __end: Optional[int] = ... + ) -> bool: ... def expandtabs(self, tabsize: int = ...) -> bytearray: ... def extend(self, iterable: Union[str, Iterable[int]]) -> None: ... def find(self, __sub: str, __start: int = ..., __end: int = ...) -> int: ... diff --git a/stdlib/2/builtins.pyi b/stdlib/2/builtins.pyi index 0e01b635c..8f42584aa 100644 --- a/stdlib/2/builtins.pyi +++ b/stdlib/2/builtins.pyi @@ -296,7 +296,9 @@ class unicode(basestring, Sequence[unicode]): def count(self, x: unicode) -> int: ... def decode(self, encoding: unicode = ..., errors: unicode = ...) -> unicode: ... def encode(self, encoding: unicode = ..., errors: unicode = ...) -> str: ... - def endswith(self, suffix: Union[unicode, Tuple[unicode, ...]], start: int = ..., end: int = ...) -> bool: ... + def endswith( + self, __suffix: Union[unicode, Tuple[unicode, ...]], __start: Optional[int] = ..., __end: Optional[int] = ... + ) -> bool: ... def expandtabs(self, tabsize: int = ...) -> unicode: ... def find(self, sub: unicode, start: int = ..., end: int = ...) -> int: ... def format(self, *args: object, **kwargs: object) -> unicode: ... @@ -326,7 +328,9 @@ class unicode(basestring, Sequence[unicode]): def rstrip(self, chars: unicode = ...) -> unicode: ... def split(self, sep: Optional[unicode] = ..., maxsplit: int = ...) -> List[unicode]: ... def splitlines(self, keepends: bool = ...) -> List[unicode]: ... - def startswith(self, prefix: Union[unicode, Tuple[unicode, ...]], start: int = ..., end: int = ...) -> bool: ... + def startswith( + self, __prefix: Union[unicode, Tuple[unicode, ...]], __start: Optional[int] = ..., __end: Optional[int] = ... + ) -> bool: ... def strip(self, chars: unicode = ...) -> unicode: ... def swapcase(self) -> unicode: ... def title(self) -> unicode: ... @@ -369,7 +373,9 @@ class str(Sequence[str], basestring): def count(self, x: Text, __start: Optional[int] = ..., __end: Optional[int] = ...) -> int: ... def decode(self, encoding: Text = ..., errors: Text = ...) -> unicode: ... def encode(self, encoding: Text = ..., errors: Text = ...) -> bytes: ... - def endswith(self, suffix: Union[Text, Tuple[Text, ...]]) -> bool: ... + def endswith( + self, __suffix: Union[Text, Tuple[Text, ...]], __start: Optional[int] = ..., __end: Optional[int] = ... + ) -> bool: ... def expandtabs(self, tabsize: int = ...) -> str: ... def find(self, sub: Text, __start: Optional[int] = ..., __end: Optional[int] = ...) -> int: ... def format(self, *args: object, **kwargs: object) -> str: ... @@ -418,7 +424,9 @@ class str(Sequence[str], basestring): @overload def split(self, sep: unicode, maxsplit: int = ...) -> List[unicode]: ... def splitlines(self, keepends: bool = ...) -> List[str]: ... - def startswith(self, prefix: Union[Text, Tuple[Text, ...]]) -> bool: ... + def startswith( + self, __prefix: Union[Text, Tuple[Text, ...]], __start: Optional[int] = ..., __end: Optional[int] = ... + ) -> bool: ... @overload def strip(self, __chars: str = ...) -> str: ... @overload @@ -468,7 +476,9 @@ class bytearray(MutableSequence[int], ByteString): def center(self, __width: int, __fillchar: bytes = ...) -> bytearray: ... def count(self, __sub: str) -> int: ... def decode(self, encoding: Text = ..., errors: Text = ...) -> str: ... - def endswith(self, __suffix: Union[bytes, Tuple[bytes, ...]]) -> bool: ... + def endswith( + self, __suffix: Union[bytes, Tuple[bytes, ...]], __start: Optional[int] = ..., __end: Optional[int] = ... + ) -> bool: ... def expandtabs(self, tabsize: int = ...) -> bytearray: ... def extend(self, iterable: Union[str, Iterable[int]]) -> None: ... def find(self, __sub: str, __start: int = ..., __end: int = ...) -> int: ... diff --git a/stdlib/3/builtins.pyi b/stdlib/3/builtins.pyi index 939effa78..d46a08dc0 100644 --- a/stdlib/3/builtins.pyi +++ b/stdlib/3/builtins.pyi @@ -330,7 +330,9 @@ class str(Sequence[str]): def center(self, __width: int, __fillchar: str = ...) -> str: ... def count(self, x: str, __start: Optional[int] = ..., __end: Optional[int] = ...) -> int: ... def encode(self, encoding: str = ..., errors: str = ...) -> bytes: ... - def endswith(self, suffix: Union[str, Tuple[str, ...]], start: Optional[int] = ..., end: Optional[int] = ...) -> bool: ... + def endswith( + self, __suffix: Union[str, Tuple[str, ...]], __start: Optional[int] = ..., __end: Optional[int] = ... + ) -> bool: ... def expandtabs(self, tabsize: int = ...) -> str: ... def find(self, sub: str, __start: Optional[int] = ..., __end: Optional[int] = ...) -> int: ... def format(self, *args: object, **kwargs: object) -> str: ... @@ -366,7 +368,9 @@ class str(Sequence[str]): def rstrip(self, __chars: Optional[str] = ...) -> str: ... def split(self, sep: Optional[str] = ..., maxsplit: int = ...) -> List[str]: ... def splitlines(self, keepends: bool = ...) -> List[str]: ... - def startswith(self, prefix: Union[str, Tuple[str, ...]], start: Optional[int] = ..., end: Optional[int] = ...) -> bool: ... + def startswith( + self, __prefix: Union[str, Tuple[str, ...]], __start: Optional[int] = ..., __end: Optional[int] = ... + ) -> bool: ... def strip(self, __chars: Optional[str] = ...) -> str: ... def swapcase(self) -> str: ... def title(self) -> str: ... @@ -414,7 +418,9 @@ class bytes(ByteString): def center(self, __width: int, __fillchar: bytes = ...) -> bytes: ... def count(self, sub: Union[bytes, int], start: Optional[int] = ..., end: Optional[int] = ...) -> int: ... def decode(self, encoding: str = ..., errors: str = ...) -> str: ... - def endswith(self, suffix: Union[bytes, Tuple[bytes, ...]]) -> bool: ... + def endswith( + self, __suffix: Union[bytes, Tuple[bytes, ...]], __start: Optional[int] = ..., __end: Optional[int] = ... + ) -> bool: ... def expandtabs(self, tabsize: int = ...) -> bytes: ... def find(self, sub: Union[bytes, int], start: Optional[int] = ..., end: Optional[int] = ...) -> int: ... if sys.version_info >= (3, 8): @@ -449,7 +455,7 @@ class bytes(ByteString): def split(self, sep: Optional[bytes] = ..., maxsplit: int = ...) -> List[bytes]: ... def splitlines(self, keepends: bool = ...) -> List[bytes]: ... def startswith( - self, prefix: Union[bytes, Tuple[bytes, ...]], start: Optional[int] = ..., end: Optional[int] = ... + self, __prefix: Union[bytes, Tuple[bytes, ...]], __start: Optional[int] = ..., __end: Optional[int] = ... ) -> bool: ... def strip(self, __bytes: Optional[bytes] = ...) -> bytes: ... def swapcase(self) -> bytes: ... @@ -500,7 +506,9 @@ class bytearray(MutableSequence[int], ByteString): def count(self, __sub: Union[bytes, int], __start: Optional[int] = ..., __end: Optional[int] = ...) -> int: ... def copy(self) -> bytearray: ... def decode(self, encoding: str = ..., errors: str = ...) -> str: ... - def endswith(self, __suffix: Union[bytes, Tuple[bytes, ...]]) -> bool: ... + def endswith( + self, __suffix: Union[bytes, Tuple[bytes, ...]], __start: Optional[int] = ..., __end: Optional[int] = ... + ) -> bool: ... def expandtabs(self, tabsize: int = ...) -> bytearray: ... def find(self, __sub: Union[bytes, int], __start: Optional[int] = ..., __end: Optional[int] = ...) -> int: ... if sys.version_info >= (3, 8): diff --git a/stdlib/3/collections/__init__.pyi b/stdlib/3/collections/__init__.pyi index 65f1e0e95..a321d71f7 100644 --- a/stdlib/3/collections/__init__.pyi +++ b/stdlib/3/collections/__init__.pyi @@ -141,7 +141,7 @@ class UserString(Sequence[str]): def encode(self: _UserStringT, encoding: Optional[str] = ..., errors: Optional[str] = ...) -> bytes: ... else: def encode(self: _UserStringT, encoding: Optional[str] = ..., errors: Optional[str] = ...) -> _UserStringT: ... - def endswith(self, suffix: Union[str, Tuple[str, ...]], start: int = ..., end: int = ...) -> bool: ... + def endswith(self, suffix: Union[str, Tuple[str, ...]], start: Optional[int] = ..., end: Optional[int] = ...) -> bool: ... def expandtabs(self: _UserStringT, tabsize: int = ...) -> _UserStringT: ... def find(self, sub: Union[str, UserString], start: int = ..., end: int = ...) -> int: ... def format(self, *args: Any, **kwds: Any) -> str: ... @@ -183,7 +183,7 @@ class UserString(Sequence[str]): def split(self, sep: Optional[str] = ..., maxsplit: int = ...) -> List[str]: ... def rsplit(self, sep: Optional[str] = ..., maxsplit: int = ...) -> List[str]: ... def splitlines(self, keepends: bool = ...) -> List[str]: ... - def startswith(self, prefix: Union[str, Tuple[str, ...]], start: int = ..., end: int = ...) -> bool: ... + def startswith(self, prefix: Union[str, Tuple[str, ...]], start: Optional[int] = ..., end: Optional[int] = ...) -> bool: ... def strip(self: _UserStringT, chars: Optional[str] = ...) -> _UserStringT: ... def swapcase(self: _UserStringT) -> _UserStringT: ... def title(self: _UserStringT) -> _UserStringT: ...