massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-pyright / node_modules / pyright / dist / typeshed-fallback / stdlib / difflib.pyi
1 import sys
2 from typing import Any, AnyStr, Callable, Generic, Iterable, Iterator, NamedTuple, Sequence, TypeVar, Union, overload
3
4 if sys.version_info >= (3, 9):
5     from types import GenericAlias
6
7 _T = TypeVar("_T")
8 _JunkCallback = Union[Callable[[str], bool], Callable[[str], bool]]
9
10 class Match(NamedTuple):
11     a: int
12     b: int
13     size: int
14
15 class SequenceMatcher(Generic[_T]):
16     def __init__(
17         self, isjunk: Callable[[_T], bool] | None = ..., a: Sequence[_T] = ..., b: Sequence[_T] = ..., autojunk: bool = ...
18     ) -> None: ...
19     def set_seqs(self, a: Sequence[_T], b: Sequence[_T]) -> None: ...
20     def set_seq1(self, a: Sequence[_T]) -> None: ...
21     def set_seq2(self, b: Sequence[_T]) -> None: ...
22     if sys.version_info >= (3, 9):
23         def find_longest_match(self, alo: int = ..., ahi: int | None = ..., blo: int = ..., bhi: int | None = ...) -> Match: ...
24     else:
25         def find_longest_match(self, alo: int, ahi: int, blo: int, bhi: int) -> Match: ...
26     def get_matching_blocks(self) -> list[Match]: ...
27     def get_opcodes(self) -> list[tuple[str, int, int, int, int]]: ...
28     def get_grouped_opcodes(self, n: int = ...) -> Iterable[list[tuple[str, int, int, int, int]]]: ...
29     def ratio(self) -> float: ...
30     def quick_ratio(self) -> float: ...
31     def real_quick_ratio(self) -> float: ...
32     if sys.version_info >= (3, 9):
33         def __class_getitem__(cls, item: Any) -> GenericAlias: ...
34
35 # mypy thinks the signatures of the overloads overlap, but the types still work fine
36 @overload
37 def get_close_matches(  # type: ignore
38     word: AnyStr, possibilities: Iterable[AnyStr], n: int = ..., cutoff: float = ...
39 ) -> list[AnyStr]: ...
40 @overload
41 def get_close_matches(
42     word: Sequence[_T], possibilities: Iterable[Sequence[_T]], n: int = ..., cutoff: float = ...
43 ) -> list[Sequence[_T]]: ...
44
45 class Differ:
46     def __init__(self, linejunk: _JunkCallback | None = ..., charjunk: _JunkCallback | None = ...) -> None: ...
47     def compare(self, a: Sequence[str], b: Sequence[str]) -> Iterator[str]: ...
48
49 def IS_LINE_JUNK(line: str, pat: Any = ...) -> bool: ...  # pat is undocumented
50 def IS_CHARACTER_JUNK(ch: str, ws: str = ...) -> bool: ...  # ws is undocumented
51 def unified_diff(
52     a: Sequence[str],
53     b: Sequence[str],
54     fromfile: str = ...,
55     tofile: str = ...,
56     fromfiledate: str = ...,
57     tofiledate: str = ...,
58     n: int = ...,
59     lineterm: str = ...,
60 ) -> Iterator[str]: ...
61 def context_diff(
62     a: Sequence[str],
63     b: Sequence[str],
64     fromfile: str = ...,
65     tofile: str = ...,
66     fromfiledate: str = ...,
67     tofiledate: str = ...,
68     n: int = ...,
69     lineterm: str = ...,
70 ) -> Iterator[str]: ...
71 def ndiff(
72     a: Sequence[str], b: Sequence[str], linejunk: _JunkCallback | None = ..., charjunk: _JunkCallback | None = ...
73 ) -> Iterator[str]: ...
74
75 class HtmlDiff(object):
76     def __init__(
77         self,
78         tabsize: int = ...,
79         wrapcolumn: int | None = ...,
80         linejunk: _JunkCallback | None = ...,
81         charjunk: _JunkCallback | None = ...,
82     ) -> None: ...
83     def make_file(
84         self,
85         fromlines: Sequence[str],
86         tolines: Sequence[str],
87         fromdesc: str = ...,
88         todesc: str = ...,
89         context: bool = ...,
90         numlines: int = ...,
91         *,
92         charset: str = ...,
93     ) -> str: ...
94     def make_table(
95         self,
96         fromlines: Sequence[str],
97         tolines: Sequence[str],
98         fromdesc: str = ...,
99         todesc: str = ...,
100         context: bool = ...,
101         numlines: int = ...,
102     ) -> str: ...
103
104 def restore(delta: Iterable[str], which: int) -> Iterator[str]: ...
105 def diff_bytes(
106     dfunc: Callable[[Sequence[str], Sequence[str], str, str, str, str, int, str], Iterator[str]],
107     a: Sequence[bytes],
108     b: Sequence[bytes],
109     fromfile: bytes = ...,
110     tofile: bytes = ...,
111     fromfiledate: bytes = ...,
112     tofiledate: bytes = ...,
113     n: int = ...,
114     lineterm: bytes = ...,
115 ) -> Iterator[bytes]: ...