Skip to content

Commit d0c8ac4

Browse files
authored
Add stubs for dirhash package (#13437)
1 parent db7dbfe commit d0c8ac4

File tree

4 files changed

+101
-0
lines changed

4 files changed

+101
-0
lines changed

Diff for: pyrightconfig.stricter.json

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
"stubs/corus",
4040
"stubs/dateparser",
4141
"stubs/defusedxml",
42+
"stubs/dirhash",
4243
"stubs/docker",
4344
"stubs/docutils",
4445
"stubs/Flask-SocketIO",

Diff for: stubs/dirhash/METADATA.toml

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
version = "0.5.*"
2+
upstream_repository = "https://github.com/andhus/dirhash-python"

Diff for: stubs/dirhash/dirhash/__init__.pyi

+93
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
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: ...

Diff for: stubs/dirhash/dirhash/cli.pyi

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from collections.abc import Sequence
2+
from typing import Any
3+
4+
def main() -> None: ...
5+
def get_kwargs(args: Sequence[str]) -> dict[str, Any]: ... # value depends on the key

0 commit comments

Comments
 (0)