|
1 | | -from _typeshed import Incomplete |
2 | | -from typing import Any |
| 1 | +from typing_extensions import Self |
| 2 | + |
| 3 | +from .context import CryptContext |
| 4 | +from .hash import htdigest |
3 | 5 |
|
4 | 6 | class _CommonFile: |
5 | | - encoding: Any |
6 | | - return_unicode: Any |
| 7 | + encoding: str |
| 8 | + return_unicode: bool |
7 | 9 | autosave: bool |
8 | 10 | @classmethod |
9 | | - def from_string(cls, data, **kwds): ... |
| 11 | + def from_string( |
| 12 | + cls, |
| 13 | + data: str | bytes, |
| 14 | + *, |
| 15 | + new: bool = False, |
| 16 | + autoload: bool = True, |
| 17 | + autosave: bool = False, |
| 18 | + encoding: str = "utf-8", |
| 19 | + return_unicode: bool = True, |
| 20 | + ) -> Self: ... |
10 | 21 | @classmethod |
11 | | - def from_path(cls, path, **kwds): ... |
| 22 | + def from_path( |
| 23 | + cls, |
| 24 | + path: str, |
| 25 | + *, |
| 26 | + new: bool = False, |
| 27 | + autoload: bool = True, |
| 28 | + autosave: bool = False, |
| 29 | + encoding: str = "utf-8", |
| 30 | + return_unicode: bool = True, |
| 31 | + ) -> Self: ... |
12 | 32 | def __init__( |
13 | 33 | self, |
14 | | - path: Incomplete | None = None, |
| 34 | + path: str | None = None, |
15 | 35 | new: bool = False, |
16 | 36 | autoload: bool = True, |
17 | 37 | autosave: bool = False, |
18 | 38 | encoding: str = "utf-8", |
19 | | - return_unicode=True, |
| 39 | + return_unicode: bool = True, |
20 | 40 | ) -> None: ... |
21 | 41 | @property |
22 | | - def path(self): ... |
| 42 | + def path(self) -> str: ... |
23 | 43 | @path.setter |
24 | | - def path(self, value) -> None: ... |
| 44 | + def path(self, value: str) -> None: ... |
25 | 45 | @property |
26 | | - def mtime(self): ... |
27 | | - def load_if_changed(self): ... |
28 | | - def load(self, path: Incomplete | None = None, force: bool = True): ... |
29 | | - def load_string(self, data) -> None: ... |
30 | | - def save(self, path: Incomplete | None = None) -> None: ... |
31 | | - def to_string(self): ... |
| 46 | + def mtime(self) -> float: ... |
| 47 | + def load_if_changed(self) -> bool: ... |
| 48 | + def load(self, path: str | None = None, force: bool = True) -> bool: ... |
| 49 | + def load_string(self, data: str | bytes) -> None: ... |
| 50 | + def save(self, path: str | None = None) -> None: ... |
| 51 | + def to_string(self) -> bytes: ... |
32 | 52 |
|
33 | 53 | class HtpasswdFile(_CommonFile): |
34 | | - context: Any |
35 | | - def __init__(self, path: Incomplete | None = None, default_scheme: Incomplete | None = None, context=..., **kwds) -> None: ... |
36 | | - def users(self): ... |
37 | | - def set_password(self, user, password): ... |
38 | | - def update(self, user, password): ... |
39 | | - def get_hash(self, user): ... |
40 | | - def set_hash(self, user, hash): ... |
41 | | - def find(self, user): ... |
42 | | - def delete(self, user): ... |
43 | | - def check_password(self, user, password): ... |
44 | | - def verify(self, user, password): ... |
| 54 | + context: CryptContext |
| 55 | + def __init__( |
| 56 | + self, |
| 57 | + path: str | None = None, |
| 58 | + default_scheme: str | None = None, |
| 59 | + context: CryptContext = ..., |
| 60 | + *, |
| 61 | + new: bool = False, |
| 62 | + autoload: bool = True, |
| 63 | + autosave: bool = False, |
| 64 | + encoding: str = "utf-8", |
| 65 | + return_unicode: bool = True, |
| 66 | + ) -> None: ... |
| 67 | + def users(self) -> list[str | bytes]: ... |
| 68 | + def set_password(self, user: str, password: str | bytes) -> bool: ... |
| 69 | + def update(self, user: str, password: str | bytes) -> bool: ... |
| 70 | + def get_hash(self, user: str) -> bytes | None: ... |
| 71 | + def set_hash(self, user: str, hash: str | bytes) -> bool: ... |
| 72 | + def find(self, user: str) -> bytes | None: ... |
| 73 | + def delete(self, user: str) -> bool: ... |
| 74 | + def check_password(self, user: str, password: str | bytes) -> bool | None: ... |
| 75 | + def verify(self, user: str, password: str | bytes) -> bool | None: ... |
45 | 76 |
|
46 | 77 | class HtdigestFile(_CommonFile): |
47 | | - default_realm: Any |
48 | | - def __init__(self, path: Incomplete | None = None, default_realm: Incomplete | None = None, **kwds) -> None: ... |
49 | | - def realms(self): ... |
50 | | - def users(self, realm: Incomplete | None = None): ... |
51 | | - def set_password(self, user, realm: Incomplete | None = None, password=...): ... |
52 | | - def update(self, user, realm, password): ... |
53 | | - def get_hash(self, user, realm: Incomplete | None = None): ... |
54 | | - def set_hash(self, user, realm: Incomplete | None = None, hash=...): ... |
55 | | - def find(self, user, realm): ... |
56 | | - def delete(self, user, realm: Incomplete | None = None): ... |
57 | | - def delete_realm(self, realm): ... |
58 | | - def check_password(self, user, realm: Incomplete | None = None, password=...): ... |
59 | | - def verify(self, user, realm, password): ... |
| 78 | + default_realm: str | None |
| 79 | + def __init__( |
| 80 | + self, |
| 81 | + path: str | None = None, |
| 82 | + default_realm: str | None = None, |
| 83 | + *, |
| 84 | + new: bool = False, |
| 85 | + autoload: bool = True, |
| 86 | + autosave: bool = False, |
| 87 | + encoding: str = "utf-8", |
| 88 | + return_unicode: bool = True, |
| 89 | + ) -> None: ... |
| 90 | + def realms(self) -> list[str | bytes]: ... |
| 91 | + def users(self, realm: str | None = None) -> list[str | bytes]: ... |
| 92 | + def set_password(self, user: str, realm: str | None = None, password: str | bytes = ...) -> bool: ... |
| 93 | + def update(self, user: str, realm: str | None, password: str | bytes) -> bool: ... |
| 94 | + def get_hash(self, user: str, realm: str | None = None) -> htdigest | None: ... |
| 95 | + def set_hash(self, user: str, realm: str | None = None, hash: str | bytes = ...) -> bool: ... |
| 96 | + def find(self, user: str, realm: str | None) -> htdigest | None: ... |
| 97 | + def delete(self, user: str, realm: str | None = None) -> bool: ... |
| 98 | + def delete_realm(self, realm: str | None) -> int: ... |
| 99 | + def check_password(self, user: str, realm: str | None = None, password: str | bytes = ...) -> bool | None: ... |
| 100 | + def verify(self, user: str, realm: str | None, password: str | bytes) -> bool | None: ... |
0 commit comments