mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-10 05:51:52 +08:00
clean python 3 specific stuff from stdlib/@python2 stubs (#5451)
This commit is contained in:
@@ -17,16 +17,10 @@ from typing import (
|
||||
overload,
|
||||
)
|
||||
|
||||
if sys.version_info >= (3, 9):
|
||||
from types import GenericAlias
|
||||
|
||||
_T = TypeVar("_T")
|
||||
|
||||
if sys.version_info >= (3,):
|
||||
_StrType = Text
|
||||
else:
|
||||
# Aliases can't point to type vars, so we need to redeclare AnyStr
|
||||
_StrType = TypeVar("_StrType", Text, bytes)
|
||||
# Aliases can't point to type vars, so we need to redeclare AnyStr
|
||||
_StrType = TypeVar("_StrType", Text, bytes)
|
||||
|
||||
_JunkCallback = Union[Callable[[Text], bool], Callable[[str], bool]]
|
||||
|
||||
@@ -42,20 +36,13 @@ class SequenceMatcher(Generic[_T]):
|
||||
def set_seqs(self, a: Sequence[_T], b: Sequence[_T]) -> None: ...
|
||||
def set_seq1(self, a: Sequence[_T]) -> None: ...
|
||||
def set_seq2(self, b: Sequence[_T]) -> None: ...
|
||||
if sys.version_info >= (3, 9):
|
||||
def find_longest_match(
|
||||
self, alo: int = ..., ahi: Optional[int] = ..., blo: int = ..., bhi: Optional[int] = ...
|
||||
) -> Match: ...
|
||||
else:
|
||||
def find_longest_match(self, alo: int, ahi: int, blo: int, bhi: int) -> Match: ...
|
||||
def find_longest_match(self, alo: int, ahi: int, blo: int, bhi: int) -> Match: ...
|
||||
def get_matching_blocks(self) -> List[Match]: ...
|
||||
def get_opcodes(self) -> List[Tuple[str, int, int, int, int]]: ...
|
||||
def get_grouped_opcodes(self, n: int = ...) -> Iterable[List[Tuple[str, int, int, int, int]]]: ...
|
||||
def ratio(self) -> float: ...
|
||||
def quick_ratio(self) -> float: ...
|
||||
def real_quick_ratio(self) -> float: ...
|
||||
if sys.version_info >= (3, 9):
|
||||
def __class_getitem__(cls, item: Any) -> GenericAlias: ...
|
||||
|
||||
# mypy thinks the signatures of the overloads overlap, but the types still work fine
|
||||
@overload
|
||||
@@ -105,28 +92,15 @@ class HtmlDiff(object):
|
||||
linejunk: Optional[_JunkCallback] = ...,
|
||||
charjunk: Optional[_JunkCallback] = ...,
|
||||
) -> None: ...
|
||||
if sys.version_info >= (3, 5):
|
||||
def make_file(
|
||||
self,
|
||||
fromlines: Sequence[_StrType],
|
||||
tolines: Sequence[_StrType],
|
||||
fromdesc: _StrType = ...,
|
||||
todesc: _StrType = ...,
|
||||
context: bool = ...,
|
||||
numlines: int = ...,
|
||||
*,
|
||||
charset: str = ...,
|
||||
) -> _StrType: ...
|
||||
else:
|
||||
def make_file(
|
||||
self,
|
||||
fromlines: Sequence[_StrType],
|
||||
tolines: Sequence[_StrType],
|
||||
fromdesc: _StrType = ...,
|
||||
todesc: _StrType = ...,
|
||||
context: bool = ...,
|
||||
numlines: int = ...,
|
||||
) -> _StrType: ...
|
||||
def make_file(
|
||||
self,
|
||||
fromlines: Sequence[_StrType],
|
||||
tolines: Sequence[_StrType],
|
||||
fromdesc: _StrType = ...,
|
||||
todesc: _StrType = ...,
|
||||
context: bool = ...,
|
||||
numlines: int = ...,
|
||||
) -> _StrType: ...
|
||||
def make_table(
|
||||
self,
|
||||
fromlines: Sequence[_StrType],
|
||||
@@ -138,16 +112,3 @@ class HtmlDiff(object):
|
||||
) -> _StrType: ...
|
||||
|
||||
def restore(delta: Iterable[_StrType], which: int) -> Iterator[_StrType]: ...
|
||||
|
||||
if sys.version_info >= (3, 5):
|
||||
def diff_bytes(
|
||||
dfunc: Callable[[Sequence[str], Sequence[str], str, str, str, str, int, str], Iterator[str]],
|
||||
a: Sequence[bytes],
|
||||
b: Sequence[bytes],
|
||||
fromfile: bytes = ...,
|
||||
tofile: bytes = ...,
|
||||
fromfiledate: bytes = ...,
|
||||
tofiledate: bytes = ...,
|
||||
n: int = ...,
|
||||
lineterm: bytes = ...,
|
||||
) -> Iterator[bytes]: ...
|
||||
|
||||
Reference in New Issue
Block a user