##// 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 from typing import (
1 from typing import (
2 Callable,
2 Callable,
3 Dict,
3 Dict,
4 Iterator,
4 Iterator,
5 List,
5 List,
6 Optional,
6 Optional,
7 Set,
7 Set,
8 Tuple,
8 Tuple,
9 Union,
9 Union,
10 )
10 )
11
11
12 version: int
12 version: int
13 versionerrortext: str
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 class DirstateItem:
30 class DirstateItem:
16 __doc__: str
31 __doc__: str
17
32
18 def __len__(self) -> int: ...
33 def __len__(self) -> int: ...
19 def __getitem__(self, key: int) -> Union[bytes, int]: ...
34 def __getitem__(self, key: int) -> Union[bytes, int]: ...
20
35
21 # From dirs.c
36 # From dirs.c
22
37
23 class dirs:
38 class dirs:
24 __doc__: str
39 __doc__: str
25 def __init__(self, source, skipchar: bytes): ...
40 def __init__(self, source, skipchar: bytes): ...
26 def __iter__(self) -> Iterator[bytes]: ...
41 def __iter__(self) -> Iterator[bytes]: ...
27 def addpath(self, path: bytes) -> None: ...
42 def addpath(self, path: bytes) -> None: ...
28 def delpath(self, path: bytes) -> None: ...
43 def delpath(self, path: bytes) -> None: ...
29
44
30 # From manifest.c
45 # From manifest.c
31 class lazymanifest:
46 class lazymanifest:
32 def __init__(self, nodelen: int, data: bytes): ...
47 def __init__(self, nodelen: int, data: bytes): ...
33 def __iter__(self) -> Iterator[bytes]: ...
48 def __iter__(self) -> Iterator[bytes]: ...
34
49
35 def __len__(self) -> int: ...
50 def __len__(self) -> int: ...
36 def __getitem__(self, item: bytes) -> Optional[Tuple[bytes, bytes]]: ...
51 def __getitem__(self, item: bytes) -> Optional[Tuple[bytes, bytes]]: ...
37 def __setitem__(self, key: bytes, value: Tuple[bytes, bytes]) -> None: ...
52 def __setitem__(self, key: bytes, value: Tuple[bytes, bytes]) -> None: ...
38 def __delitem__(self, key: bytes) -> None: ...
53 def __delitem__(self, key: bytes) -> None: ...
39
54
40 def iterkeys(self) -> Iterator[bytes]: ...
55 def iterkeys(self) -> Iterator[bytes]: ...
41 def iterentries(self) -> Iterator[Tuple[bytes, bytes, bytes]]: ...
56 def iterentries(self) -> Iterator[Tuple[bytes, bytes, bytes]]: ...
42 def copy(self) -> lazymanifest: ...
57 def copy(self) -> lazymanifest: ...
43 def filtercopy(self, matchfn: Callable[[bytes], bool]) -> lazymanifest: ...
58 def filtercopy(self, matchfn: Callable[[bytes], bool]) -> lazymanifest: ...
44 def diff(self, other: lazymanifest, clean: Optional[bool]) -> Dict[bytes, Tuple[bytes, Tuple]]: ...
59 def diff(self, other: lazymanifest, clean: Optional[bool]) -> Dict[bytes, Tuple[bytes, Tuple]]: ...
45 def text(self) -> bytes: ...
60 def text(self) -> bytes: ...
46
61
47 # From revlog.c
62 # From revlog.c
48
63
49 class index:
64 class index:
50 __doc__: str
65 __doc__: str
51
66
52 nodemap: Dict[bytes, int]
67 nodemap: Dict[bytes, int]
53
68
54 def ancestors(self, *args: int) -> Iterator[int]: ...
69 def ancestors(self, *args: int) -> Iterator[int]: ...
55 def commonancestorsheads(self, *args: int) -> List[int]: ...
70 def commonancestorsheads(self, *args: int) -> List[int]: ...
56 def clearcaches(self) -> None: ...
71 def clearcaches(self) -> None: ...
57 def get(self, value: bytes) -> Optional[int]: ...
72 def get(self, value: bytes) -> Optional[int]: ...
58 def get_rev(self, value: bytes) -> Optional[int]: ...
73 def get_rev(self, value: bytes) -> Optional[int]: ...
59 def has_node(self, value: Union[int, bytes]) -> bool: ...
74 def has_node(self, value: Union[int, bytes]) -> bool: ...
60 def rev(self, node: bytes) -> int: ...
75 def rev(self, node: bytes) -> int: ...
61 def computephasesmapsets(self, root: Dict[int, Set[int]]) -> Tuple[int, Dict[int, Set[bytes]]]: ...
76 def computephasesmapsets(self, root: Dict[int, Set[int]]) -> Tuple[int, Dict[int, Set[bytes]]]: ...
62 def reachableroots2(self, minroot: int, heads: List[int], roots: List[int], includepath: bool) -> List[int]: ...
77 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]: ...
78 def headrevs(self, filteredrevs: Optional[List[int]]) -> List[int]: ...
64 def headrevsfiltered(self, filteredrevs: Optional[List[int]]) -> List[int]: ...
79 def headrevsfiltered(self, filteredrevs: Optional[List[int]]) -> List[int]: ...
65 def issnapshot(self, value: int) -> bool: ...
80 def issnapshot(self, value: int) -> bool: ...
66 def findsnapshots(self, cache: Dict[int, List[int]], start_rev: int) -> None: ...
81 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]: ...
82 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]]: ...
83 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: ...
84 def append(self, value: Tuple[int, int, int, int, int, int, int, bytes]) -> None: ...
70 def partialmatch(self, node: bytes) -> bytes: ...
85 def partialmatch(self, node: bytes) -> bytes: ...
71 def shortest(self, value: bytes) -> int: ...
86 def shortest(self, value: bytes) -> int: ...
72 def stats(self) -> Dict[bytes, int]: ...
87 def stats(self) -> Dict[bytes, int]: ...
73
88
74 class nodetree:
89 class nodetree:
75 __doc__: str
90 __doc__: str
76
91
77 def insert(self, rev: int) -> None: ...
92 def insert(self, rev: int) -> None: ...
78 def shortest(self, node: bytes) -> int: ...
93 def shortest(self, node: bytes) -> int: ...
79
94
80 # The IndexObject type here is defined in C, and there's no type for a buffer
95 # The IndexObject type here is defined in C, and there's no type for a buffer
81 # return, as of py3.11. https://github.com/python/typing/issues/593
96 # return, as of py3.11. https://github.com/python/typing/issues/593
82 def parse_index2(data: object, inline: object, format: int = ...) -> Tuple[object, Optional[Tuple[int, object]]]: ...
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