sapling/eden/scm/edenscm/mercurial/cext/parsers.pyi
Adam Simpkins 1c6360fe73 add more annotations for edenscmnative.parsers
Summary:
Add type annotations for the `edenscmnative.parsers` methods that handle
serializing and deserializing the dirstate data.

Reviewed By: quark-zju

Differential Revision: D19958218

fbshipit-source-id: 6e20efbc1b0a6ba15b297e47a1e6eec8ed47ee52
2020-03-11 16:21:30 -07:00

49 lines
1.8 KiB
Python

# Copyright (c) Facebook, Inc. and its affiliates.
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2.
from typing import Callable, Dict, Iterable, Tuple, Union
# dirstatetuple is really a custom type separate from Tuple, but it behaves
# basically like a Tuple, and we can't really get the same type checking behavior
# without using Tuple.
# (state, mode, size, mtime)
dirstatetuple = Tuple[str, int, int, int]
def isasciistr(s: Union[bytes, str]) -> bool: ...
def asciilower(s: bytes) -> bytes: ...
def asciiupper(s: bytes) -> bytes: ...
def jsonescapeu8fast(origstr: bytes, paranoid: bool) -> bytes: ...
def make_file_foldmap(
dmap: Dict[bytes, dirstatetuple],
spec: int,
normcase_fallback: Callable[[bytes], bytes],
) -> Dict[bytes, bytes]: ...
def dict_new_presized(minsize: int) -> Dict[str, dirstatetuple]: ...
def parse_dirstate(
dmap: Dict[str, dirstatetuple], copymap: Dict[str, str], st: bytes
) -> Tuple[bytes, bytes]: ...
def pack_dirstate(
dmap: Dict[str, dirstatetuple],
copymap: Dict[str, str],
pl: Tuple[bytes, bytes],
now: int,
) -> bytes: ...
class lazymanifest:
def __init__(self, data: bytes) -> None: ...
def __len__(self) -> int: ...
def __getitem__(self, key: str) -> Tuple[bytes, str]: ...
def __setitem__(self, key: str, hash_and_flags: Tuple[bytes, str]) -> None: ...
def __contains__(self, key: str) -> bool: ...
def keys(self) -> Iterable[str]: ...
def iterkeys(self) -> Iterable[str]: ...
def iterentries(self) -> Iterable[Tuple[str, bytes, str]]: ...
def copy(self) -> "lazymanifest": ...
def filtercopy(self) -> "lazymanifest": ...
def diff(
self, other: "lazymanifest", listclean: bool = False
) -> Dict[str, Tuple[Tuple[bytes, str], Tuple[bytes, str]]]: ...
def text(self) -> bytes: ...