Mercurial > hg
comparison mercurial/cext/parsers.pyi @ 46038:8dca9051a859
cext: add .pyi files for C extensions
I'm unsure if all the annotations are completely accurate. But having
these helps type checkers reason about our C extensions.
Differential Revision: https://phab.mercurial-scm.org/D9281
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Sat, 07 Nov 2020 16:28:30 -0800 |
parents | |
children | 12450fbea288 |
comparison
equal
deleted
inserted
replaced
46037:9624bf057c2a | 46038:8dca9051a859 |
---|---|
1 from typing import ( | |
2 Callable, | |
3 Dict, | |
4 Iterator, | |
5 List, | |
6 Optional, | |
7 Set, | |
8 Tuple, | |
9 Union, | |
10 ) | |
11 | |
12 version: int | |
13 versionerrortext: str | |
14 | |
15 class dirstatetuple: | |
16 __doc__: str | |
17 | |
18 def __len__(self) -> int: ... | |
19 def __getitem__(self, key: int) -> Union[bytes, int]: ... | |
20 | |
21 # From dirs.c | |
22 | |
23 class dirs: | |
24 __doc__: str | |
25 def __init__(self, source, skipchar: bytes): ... | |
26 def __iter__(self) -> Iterator[bytes]: ... | |
27 def addpath(self, path: bytes) -> None: ... | |
28 def delpath(self, path: bytes) -> None: ... | |
29 | |
30 # From manifest.c | |
31 class lazymanifest: | |
32 def __init__(self, data: bytes): ... | |
33 def __iter__(self) -> Iterator[bytes]: ... | |
34 | |
35 def __len__(self) -> int: ... | |
36 def __getitem__(self, item: bytes) -> Optional[Tuple[bytes, bytes]]: ... | |
37 def __setitem__(self, key: bytes, value: Tuple[bytes, bytes]) -> None: ... | |
38 def __delitem__(self, key: bytes) -> None: ... | |
39 | |
40 def iterkeys(self) -> Iterator[bytes]: ... | |
41 def iterentries(self) -> Iterator[Tuple[bytes, bytes, bytes]]: ... | |
42 def copy(self) -> lazymanifest: ... | |
43 def filtercopy(self, matchfn: Callable[[bytes], bool]) -> lazymanifest: ... | |
44 def diff(self, other: lazymanifest, clean: Optional[bool]) -> Dict[bytes, Tuple[bytes, Tuple]]: ... | |
45 def text(self) -> bytes: ... | |
46 | |
47 # From revlog.c | |
48 | |
49 class index: | |
50 __doc__: str | |
51 | |
52 nodemap: Dict[bytes, int] | |
53 | |
54 def ancestors(self, *args: int) -> Iterator[int]: ... | |
55 def commonancestorsheads(self, *args: int) -> List[int]: ... | |
56 def clearcaches(self) -> None: ... | |
57 def get(self, value: bytes) -> Optional[int]: ... | |
58 def get_rev(self, value: bytes) -> Optional[int]: ... | |
59 def has_node(self, value: Union[int, bytes]) -> bool: ... | |
60 def rev(self, node: bytes) -> int: ... | |
61 def computephasesmapsets(self, root: Dict[int, Set[bytes]]) -> Tuple[int, Dict[int, Set[bytes]]]: ... | |
62 def reachableroots2(self, minroot: int, heads: List[int], roots: List[int], includepath: bool) -> List[int]: ... | |
63 def headrevs(self, filteredrevs: Optional[List[int]]) -> List[int]: ... | |
64 def headrevsfiltered(self, filteredrevs: Optional[List[int]]) -> List[int]: ... | |
65 def issnapshot(self, value: int) -> bool: ... | |
66 def findsnapshots(self, cache: Dict[int, List[int]], start_rev: int) -> None: ... | |
67 def deltachain(self, rev: int, stop: int, generaldelta: bool) -> Tuple[List[int], bool]: ... | |
68 def slicechunktodensity(self, revs: List[int], targetdensity: float, mingapsize: int) -> List[List[int]]: ... | |
69 def append(self, value: Tuple[int, int, int, int, int, int, int, bytes]) -> None: ... | |
70 def partialmatch(self, node: bytes) -> bytes: ... | |
71 def shortest(self, value: bytes) -> int: ... | |
72 def stats(self) -> Dict[bytes, int]: ... | |
73 | |
74 class nodetree: | |
75 __doc__: str | |
76 | |
77 def insert(self, rev: int) -> None: ... | |
78 def shortest(self, node: bytes) -> int: ... |