comparison mercurial/cext/parsers.pyi @ 51941:e58f02e2f6a9

typing: add stub functions for `cext/charencoding` I'm not sure if it's better to have a separate file, and currently pytype doesn't really know how to handle these, so it's no help in figuring that out. Technically, these methods are part of the `mercurial.cext.parsers` module, so put them into the existing stub until there's a reason to split it out.
author Matt Harbison <matt_harbison@yahoo.com>
date Sat, 05 Oct 2024 17:32:26 -0400
parents f8bf1a8e9181
children 8060257fd918
comparison
equal deleted inserted replaced
51940:54d9f496f07a 51941:e58f02e2f6a9
9 Union, 9 Union,
10 ) 10 )
11 11
12 version: int 12 version: int
13 versionerrortext: str 13 versionerrortext: str
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
14 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: ...