|
| 1 | +from _typeshed import Incomplete |
| 2 | +from collections.abc import Generator, Iterable |
| 3 | +from os import PathLike |
| 4 | +from typing import TypeVar |
| 5 | +from typing_extensions import TypeAlias |
| 6 | + |
| 7 | +_DirNode: TypeAlias = Incomplete # scantree.DirNode |
| 8 | +_RecursionPath: TypeAlias = Incomplete # scantree.RecursionPath |
| 9 | +_RP = TypeVar("_RP", bound=_RecursionPath) |
| 10 | + |
| 11 | +__all__ = [ |
| 12 | + "__version__", |
| 13 | + "algorithms_guaranteed", |
| 14 | + "algorithms_available", |
| 15 | + "dirhash", |
| 16 | + "dirhash_impl", |
| 17 | + "included_paths", |
| 18 | + "Filter", |
| 19 | + "get_match_patterns", |
| 20 | + "Protocol", |
| 21 | +] |
| 22 | + |
| 23 | +__version__: str |
| 24 | +algorithms_guaranteed: set[str] |
| 25 | +algorithms_available: set[str] |
| 26 | + |
| 27 | +def dirhash( |
| 28 | + directory: str | PathLike[str], |
| 29 | + algorithm: str, |
| 30 | + match: Iterable[str] = ("*",), |
| 31 | + ignore: Iterable[str] | None = None, |
| 32 | + linked_dirs: bool = True, |
| 33 | + linked_files: bool = True, |
| 34 | + empty_dirs: bool = False, |
| 35 | + entry_properties: Iterable[str] = ("name", "data"), |
| 36 | + allow_cyclic_links: bool = False, |
| 37 | + chunk_size: int = 1048576, |
| 38 | + jobs: int = 1, |
| 39 | +) -> str: ... |
| 40 | +def dirhash_impl( |
| 41 | + directory: str | PathLike[str], |
| 42 | + algorithm: str, |
| 43 | + filter_: Filter | None = None, |
| 44 | + protocol: Protocol | None = None, |
| 45 | + chunk_size: int = 1048576, |
| 46 | + jobs: int = 1, |
| 47 | +) -> str: ... |
| 48 | +def included_paths( |
| 49 | + directory: str | PathLike[str], |
| 50 | + match: Iterable[str] = ("*",), |
| 51 | + ignore: Iterable[str] | None = None, |
| 52 | + linked_dirs: bool = True, |
| 53 | + linked_files: bool = True, |
| 54 | + empty_dirs: bool = False, |
| 55 | + allow_cyclic_links: bool = False, |
| 56 | +) -> list[str]: ... |
| 57 | + |
| 58 | +class Filter: |
| 59 | + linked_dirs: bool |
| 60 | + linked_files: bool |
| 61 | + empty_dirs: bool |
| 62 | + |
| 63 | + def __init__( |
| 64 | + self, |
| 65 | + match_patterns: Iterable[str] | None = None, |
| 66 | + linked_dirs: bool = True, |
| 67 | + linked_files: bool = True, |
| 68 | + empty_dirs: bool = False, |
| 69 | + ) -> None: ... |
| 70 | + @property |
| 71 | + def match_patterns(self) -> tuple[str, ...]: ... |
| 72 | + def include(self, recursion_path: _RecursionPath) -> bool: ... |
| 73 | + def match_file(self, filepath: str | PathLike[str]) -> bool: ... |
| 74 | + def __call__(self, paths: Iterable[_RP]) -> Generator[_RP, None, None]: ... |
| 75 | + |
| 76 | +def get_match_patterns( |
| 77 | + match: Iterable[str] | None = None, |
| 78 | + ignore: Iterable[str] | None = None, |
| 79 | + ignore_extensions: Iterable[str] | None = None, |
| 80 | + ignore_hidden: bool = False, |
| 81 | +) -> list[str]: ... |
| 82 | + |
| 83 | +class Protocol: |
| 84 | + class EntryProperties: |
| 85 | + NAME: str |
| 86 | + DATA: str |
| 87 | + IS_LINK: str |
| 88 | + options: set[str] |
| 89 | + |
| 90 | + entry_properties: Iterable[str] |
| 91 | + allow_cyclic_links: bool |
| 92 | + def __init__(self, entry_properties: Iterable[str] = ("name", "data"), allow_cyclic_links: bool = False) -> None: ... |
| 93 | + def get_descriptor(self, dir_node: _DirNode) -> str: ... |
0 commit comments