##// END OF EJS Templates
typing: add stub functions for `cext/charencoding`...
Matt Harbison -
r52834:e58f02e2 default
parent child Browse files
Show More
@@ -1,82 +1,97
1 1 from typing import (
2 2 Callable,
3 3 Dict,
4 4 Iterator,
5 5 List,
6 6 Optional,
7 7 Set,
8 8 Tuple,
9 9 Union,
10 10 )
11 11
12 12 version: int
13 13 versionerrortext: str
14 14
15 # From charencode.c
16
17 # Note: the first 'bytes' arg of isasciistr() can be typed as 'Buffer' from the
18 # typing_extensions backport, once the related bug is fixed in pytype, or pytype
19 # is run under py3.12. The arg for asciilower(), asciiupper() and
20 # jsonescapeu8fast() is checked specifically for the 'bytes' type. The 'bytes'
21 # return is an instance of 'bytes', not an alias for 'Buffer'.
22 #
23 # https://github.com/google/pytype/issues/1772
24 def isasciistr(s: bytes) -> bool: ...
25 def asciilower(s: bytes) -> bytes: ...
26 def asciiupper(s: bytes) -> bytes: ...
27 def jsonescapeu8fast(u8chars: bytes, paranoid: bool) -> bytes: ...
28
29
15 30 class DirstateItem:
16 31 __doc__: str
17 32
18 33 def __len__(self) -> int: ...
19 34 def __getitem__(self, key: int) -> Union[bytes, int]: ...
20 35
21 36 # From dirs.c
22 37
23 38 class dirs:
24 39 __doc__: str
25 40 def __init__(self, source, skipchar: bytes): ...
26 41 def __iter__(self) -> Iterator[bytes]: ...
27 42 def addpath(self, path: bytes) -> None: ...
28 43 def delpath(self, path: bytes) -> None: ...
29 44
30 45 # From manifest.c
31 46 class lazymanifest:
32 47 def __init__(self, nodelen: int, data: bytes): ...
33 48 def __iter__(self) -> Iterator[bytes]: ...
34 49
35 50 def __len__(self) -> int: ...
36 51 def __getitem__(self, item: bytes) -> Optional[Tuple[bytes, bytes]]: ...
37 52 def __setitem__(self, key: bytes, value: Tuple[bytes, bytes]) -> None: ...
38 53 def __delitem__(self, key: bytes) -> None: ...
39 54
40 55 def iterkeys(self) -> Iterator[bytes]: ...
41 56 def iterentries(self) -> Iterator[Tuple[bytes, bytes, bytes]]: ...
42 57 def copy(self) -> lazymanifest: ...
43 58 def filtercopy(self, matchfn: Callable[[bytes], bool]) -> lazymanifest: ...
44 59 def diff(self, other: lazymanifest, clean: Optional[bool]) -> Dict[bytes, Tuple[bytes, Tuple]]: ...
45 60 def text(self) -> bytes: ...
46 61
47 62 # From revlog.c
48 63
49 64 class index:
50 65 __doc__: str
51 66
52 67 nodemap: Dict[bytes, int]
53 68
54 69 def ancestors(self, *args: int) -> Iterator[int]: ...
55 70 def commonancestorsheads(self, *args: int) -> List[int]: ...
56 71 def clearcaches(self) -> None: ...
57 72 def get(self, value: bytes) -> Optional[int]: ...
58 73 def get_rev(self, value: bytes) -> Optional[int]: ...
59 74 def has_node(self, value: Union[int, bytes]) -> bool: ...
60 75 def rev(self, node: bytes) -> int: ...
61 76 def computephasesmapsets(self, root: Dict[int, Set[int]]) -> Tuple[int, Dict[int, Set[bytes]]]: ...
62 77 def reachableroots2(self, minroot: int, heads: List[int], roots: List[int], includepath: bool) -> List[int]: ...
63 78 def headrevs(self, filteredrevs: Optional[List[int]]) -> List[int]: ...
64 79 def headrevsfiltered(self, filteredrevs: Optional[List[int]]) -> List[int]: ...
65 80 def issnapshot(self, value: int) -> bool: ...
66 81 def findsnapshots(self, cache: Dict[int, List[int]], start_rev: int) -> None: ...
67 82 def deltachain(self, rev: int, stop: int, generaldelta: bool) -> Tuple[List[int], bool]: ...
68 83 def slicechunktodensity(self, revs: List[int], targetdensity: float, mingapsize: int) -> List[List[int]]: ...
69 84 def append(self, value: Tuple[int, int, int, int, int, int, int, bytes]) -> None: ...
70 85 def partialmatch(self, node: bytes) -> bytes: ...
71 86 def shortest(self, value: bytes) -> int: ...
72 87 def stats(self) -> Dict[bytes, int]: ...
73 88
74 89 class nodetree:
75 90 __doc__: str
76 91
77 92 def insert(self, rev: int) -> None: ...
78 93 def shortest(self, node: bytes) -> int: ...
79 94
80 95 # The IndexObject type here is defined in C, and there's no type for a buffer
81 96 # return, as of py3.11. https://github.com/python/typing/issues/593
82 97 def parse_index2(data: object, inline: object, format: int = ...) -> Tuple[object, Optional[Tuple[int, object]]]: ...
General Comments 0
You need to be logged in to leave comments. Login now