Skip to content

Commit 26d4451

Browse files
authored
[passlib] Add ___all__, improve passlib.hosts (#13712)
1 parent a245cef commit 26d4451

File tree

8 files changed

+31
-14
lines changed

8 files changed

+31
-14
lines changed

stubs/passlib/@tests/stubtest_allowlist.txt

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# TODO: missing from stub
2-
passlib.apache.__all__
3-
passlib.context.__all__
2+
passlib.hosts.__all__
43
passlib.crypto._blowfish.__all__
54
passlib.crypto._blowfish.base.__all__
65
passlib.crypto._blowfish.unrolled.__all__
@@ -28,11 +27,6 @@ passlib.handlers.sha1_crypt.__all__
2827
passlib.handlers.sha2_crypt.__all__
2928
passlib.handlers.sun_md5_crypt.__all__
3029
passlib.handlers.windows.__all__
31-
passlib.hosts.__all__
32-
passlib.ifc.__all__
33-
passlib.pwd.__all__
34-
passlib.registry.__all__
35-
passlib.totp.__all__
3630
passlib.utils.binary.__all__
3731
passlib.utils.decor.__all__
3832
passlib.utils.handlers.__all__

stubs/passlib/passlib/apache.pyi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,3 +98,5 @@ class HtdigestFile(_CommonFile):
9898
def delete_realm(self, realm: str | None) -> int: ...
9999
def check_password(self, user: str, realm: str | None = None, password: str | bytes = ...) -> bool | None: ...
100100
def verify(self, user: str, realm: str | None, password: str | bytes) -> bool | None: ...
101+
102+
__all__ = ["HtpasswdFile", "HtdigestFile"]

stubs/passlib/passlib/context.pyi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,3 +85,5 @@ class CryptContext:
8585
class LazyCryptContext(CryptContext):
8686
def __init__(self, schemes: Incomplete | None = None, **kwds) -> None: ...
8787
def __getattribute__(self, attr: str) -> Any: ...
88+
89+
__all__ = ["CryptContext", "LazyCryptContext", "CryptPolicy"]

stubs/passlib/passlib/hosts.pyi

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
import sys
2-
from typing import Any
32

43
from passlib.context import CryptContext
54

6-
linux_context: Any
7-
linux2_context: Any
8-
freebsd_context: Any
9-
openbsd_context: Any
10-
netbsd_context: Any
5+
linux_context: CryptContext
6+
linux2_context: CryptContext
7+
freebsd_context: CryptContext
8+
openbsd_context: CryptContext
9+
netbsd_context: CryptContext
1110
# Only exists if crypt is present
12-
if sys.version_info < (3, 13):
11+
if sys.version_info < (3, 13) and sys.platform != "win32":
1312
host_context: CryptContext
13+
__all__ = ["linux_context", "linux2_context", "openbsd_context", "netbsd_context", "freebsd_context", "host_context"]
14+
else:
15+
__all__ = ["linux_context", "linux2_context", "openbsd_context", "netbsd_context", "freebsd_context"]

stubs/passlib/passlib/ifc.pyi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,5 @@ class DisabledHash(PasswordHash, metaclass=ABCMeta):
3535
def disable(cls, hash: str | None = None) -> str: ...
3636
@classmethod
3737
def enable(cls, hash: str) -> str: ...
38+
39+
__all__ = ["PasswordHash"]

stubs/passlib/passlib/pwd.pyi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,3 +138,5 @@ def genphrase(
138138
sep: str | bytes | None = None,
139139
rng: random.Random | None = None,
140140
) -> Iterator[str]: ...
141+
142+
__all__ = ["genword", "default_charsets", "genphrase", "default_wordsets"]

stubs/passlib/passlib/registry.pyi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,5 @@ def register_crypt_handler(
1313
) -> None: ... # expected handler is object with attr handler.name
1414
def get_crypt_handler(name: str, default: Any = ...) -> Any: ... # returns handler or default
1515
def list_crypt_handlers(loaded_only: bool = False) -> list[str]: ...
16+
17+
__all__ = ["register_crypt_handler_path", "register_crypt_handler", "get_crypt_handler", "list_crypt_handlers"]

stubs/passlib/passlib/totp.pyi

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,3 +146,14 @@ class TotpMatch(SequenceMixin):
146146
def cache_seconds(self) -> int: ...
147147
@property
148148
def cache_time(self) -> int: ...
149+
150+
__all__ = [
151+
"AppWallet",
152+
"TOTP",
153+
"TokenError",
154+
"MalformedTokenError",
155+
"InvalidTokenError",
156+
"UsedTokenError",
157+
"TotpToken",
158+
"TotpMatch",
159+
]

0 commit comments

Comments
 (0)