Skip to content

Commit bd0cbf4

Browse files
adding stubs for passpy API (#6651)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
1 parent bf246b2 commit bd0cbf4

5 files changed

Lines changed: 40 additions & 0 deletions

File tree

stubs/passpy/METADATA.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
version = "1.0.*"

stubs/passpy/passpy/__init__.pyi

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from .exceptions import RecursiveCopyMoveError as RecursiveCopyMoveError, StoreNotInitialisedError as StoreNotInitialisedError
2+
from .store import Store as Store
3+
from .util import gen_password as gen_password
4+
5+
VERSION: str

stubs/passpy/passpy/exceptions.pyi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
class StoreNotInitialisedError(FileNotFoundError): ...
2+
class RecursiveCopyMoveError(OSError): ...

stubs/passpy/passpy/store.pyi

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
from _typeshed import StrPath
2+
from collections.abc import Iterator
3+
from typing import Match
4+
5+
class Store:
6+
def __init__(
7+
self,
8+
gpg_bin: str = ...,
9+
git_bin: str = ...,
10+
store_dir: str = ...,
11+
use_agent: bool = ...,
12+
interactive: bool = ...,
13+
verbose: bool = ...,
14+
) -> None: ...
15+
def __iter__(self) -> Iterator[str]: ...
16+
def is_init(self) -> bool: ...
17+
def init_store(self, gpg_ids: None | str | list[str], path: StrPath | None = ...) -> None: ...
18+
def init_git(self) -> None: ...
19+
def git(self, method: str, *args: object, **kwargs: object) -> None: ...
20+
def get_key(self, path: StrPath | None) -> str | None: ...
21+
def set_key(self, path: StrPath | None, key_data: str, force: bool = ...) -> None: ...
22+
def remove_path(self, path: StrPath, recursive: bool = ..., force: bool = ...) -> None: ...
23+
def gen_key(
24+
self, path: StrPath | None, length: int, symbols: bool = ..., force: bool = ..., inplace: bool = ...
25+
) -> str | None: ...
26+
def copy_path(self, old_path: StrPath, new_path: StrPath, force: bool = ...) -> None: ...
27+
def move_path(self, old_path: StrPath, new_path: StrPath, force: bool = ...) -> None: ...
28+
def list_dir(self, path: StrPath) -> tuple[list[str], list[str]]: ...
29+
def iter_dir(self, path: StrPath) -> Iterator[str]: ...
30+
def find(self, names: None | str | list[str]) -> list[str]: ...
31+
def search(self, term: str) -> dict[str, list[tuple[str, Match[str]]]]: ...

stubs/passpy/passpy/util.pyi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
def gen_password(length: int, symbols: bool = ...) -> str: ...

0 commit comments

Comments
 (0)