1 # Based on https://docs.python.org/2.7/library/difflib.html and https://docs.python.org/3.2/library/difflib.html
\r
5 TypeVar, Callable, Iterable, Iterator, List, NamedTuple, Sequence, Tuple,
\r
6 Generic, Optional, Text, Union, AnyStr
\r
11 if sys.version_info >= (3,):
\r
14 # Aliases can't point to type vars, so we need to redeclare AnyStr
\r
15 _StrType = TypeVar('_StrType', str, bytes)
\r
17 _JunkCallback = Union[Callable[[Text], bool], Callable[[str], bool]]
\r
19 Match = NamedTuple('Match', [
\r
25 class SequenceMatcher(Generic[_T]):
\r
26 def __init__(self, isjunk: Optional[Callable[[_T], bool]] = ...,
\r
27 a: Sequence[_T] = ..., b: Sequence[_T] = ...,
\r
28 autojunk: bool = ...) -> None: ...
\r
29 def set_seqs(self, a: Sequence[_T], b: Sequence[_T]) -> None: ...
\r
30 def set_seq1(self, a: Sequence[_T]) -> None: ...
\r
31 def set_seq2(self, b: Sequence[_T]) -> None: ...
\r
32 def find_longest_match(self, alo: int, ahi: int, blo: int,
\r
33 bhi: int) -> Match: ...
\r
34 def get_matching_blocks(self) -> List[Match]: ...
\r
35 def get_opcodes(self) -> List[Tuple[str, int, int, int, int]]: ...
\r
36 def get_grouped_opcodes(self, n: int = ...
\r
37 ) -> Iterable[List[Tuple[str, int, int, int, int]]]: ...
\r
38 def ratio(self) -> float: ...
\r
39 def quick_ratio(self) -> float: ...
\r
40 def real_quick_ratio(self) -> float: ...
\r
42 def get_close_matches(word: Sequence[_T], possibilities: Iterable[Sequence[_T]],
\r
43 n: int = ..., cutoff: float = ...) -> List[Sequence[_T]]: ...
\r
46 def __init__(self, linejunk: _JunkCallback = ..., charjunk: _JunkCallback = ...) -> None: ...
\r
47 def compare(self, a: Sequence[_StrType], b: Sequence[_StrType]) -> Iterator[_StrType]: ...
\r
49 def IS_LINE_JUNK(line: _StrType) -> bool: ...
\r
50 def IS_CHARACTER_JUNK(line: _StrType) -> bool: ...
\r
51 def unified_diff(a: Sequence[_StrType], b: Sequence[_StrType], fromfile: _StrType = ...,
\r
52 tofile: _StrType = ..., fromfiledate: _StrType = ..., tofiledate: _StrType = ...,
\r
53 n: int = ..., lineterm: _StrType = ...) -> Iterator[_StrType]: ...
\r
54 def context_diff(a: Sequence[_StrType], b: Sequence[_StrType], fromfile: _StrType =...,
\r
55 tofile: _StrType = ..., fromfiledate: _StrType = ..., tofiledate: _StrType = ...,
\r
56 n: int = ..., lineterm: _StrType = ...) -> Iterator[_StrType]: ...
\r
57 def ndiff(a: Sequence[_StrType], b: Sequence[_StrType],
\r
58 linejunk: _JunkCallback = ...,
\r
59 charjunk: _JunkCallback = ...
\r
60 ) -> Iterator[_StrType]: ...
\r
62 class HtmlDiff(object):
\r
63 def __init__(self, tabsize: int = ..., wrapcolumn: int = ...,
\r
64 linejunk: _JunkCallback = ...,
\r
65 charjunk: _JunkCallback = ...
\r
67 def make_file(self, fromlines: Sequence[_StrType], tolines: Sequence[_StrType],
\r
68 fromdesc: _StrType = ..., todesc: _StrType = ..., context: bool = ...,
\r
69 numlines: int = ...) -> _StrType: ...
\r
70 def make_table(self, fromlines: Sequence[_StrType], tolines: Sequence[_StrType],
\r
71 fromdesc: _StrType = ..., todesc: _StrType = ..., context: bool = ...,
\r
72 numlines: int = ...) -> _StrType: ...
\r
74 def restore(delta: Iterable[_StrType], which: int) -> Iterator[_StrType]: ...
\r
76 if sys.version_info >= (3, 5):
\r
78 dfunc: Callable[[Sequence[str], Sequence[str], str, str, str, str, int, str], Iterator[str]],
\r
81 fromfile: bytes = ...,
\r
82 tofile: bytes = ...,
\r
83 fromfiledate: bytes = ...,
\r
84 tofiledate: bytes = ...,
\r
86 lineterm: bytes = ...
\r
87 ) -> Iterator[bytes]: ...
\r