[passlib] Add ___all__, improve passlib.hosts (#13712)

This commit is contained in:
Semyon Moroz
2025-03-25 16:14:03 +04:00
committed by GitHub
parent a245cefcf4
commit 26d445142f
8 changed files with 31 additions and 14 deletions
+1 -7
View File
@@ -1,6 +1,5 @@
# TODO: missing from stub
passlib.apache.__all__
passlib.context.__all__
passlib.hosts.__all__
passlib.crypto._blowfish.__all__
passlib.crypto._blowfish.base.__all__
passlib.crypto._blowfish.unrolled.__all__
@@ -28,11 +27,6 @@ passlib.handlers.sha1_crypt.__all__
passlib.handlers.sha2_crypt.__all__
passlib.handlers.sun_md5_crypt.__all__
passlib.handlers.windows.__all__
passlib.hosts.__all__
passlib.ifc.__all__
passlib.pwd.__all__
passlib.registry.__all__
passlib.totp.__all__
passlib.utils.binary.__all__
passlib.utils.decor.__all__
passlib.utils.handlers.__all__
+2
View File
@@ -98,3 +98,5 @@ class HtdigestFile(_CommonFile):
def delete_realm(self, realm: str | None) -> int: ...
def check_password(self, user: str, realm: str | None = None, password: str | bytes = ...) -> bool | None: ...
def verify(self, user: str, realm: str | None, password: str | bytes) -> bool | None: ...
__all__ = ["HtpasswdFile", "HtdigestFile"]
+2
View File
@@ -85,3 +85,5 @@ class CryptContext:
class LazyCryptContext(CryptContext):
def __init__(self, schemes: Incomplete | None = None, **kwds) -> None: ...
def __getattribute__(self, attr: str) -> Any: ...
__all__ = ["CryptContext", "LazyCryptContext", "CryptPolicy"]
+9 -7
View File
@@ -1,13 +1,15 @@
import sys
from typing import Any
from passlib.context import CryptContext
linux_context: Any
linux2_context: Any
freebsd_context: Any
openbsd_context: Any
netbsd_context: Any
linux_context: CryptContext
linux2_context: CryptContext
freebsd_context: CryptContext
openbsd_context: CryptContext
netbsd_context: CryptContext
# Only exists if crypt is present
if sys.version_info < (3, 13):
if sys.version_info < (3, 13) and sys.platform != "win32":
host_context: CryptContext
__all__ = ["linux_context", "linux2_context", "openbsd_context", "netbsd_context", "freebsd_context", "host_context"]
else:
__all__ = ["linux_context", "linux2_context", "openbsd_context", "netbsd_context", "freebsd_context"]
+2
View File
@@ -35,3 +35,5 @@ class DisabledHash(PasswordHash, metaclass=ABCMeta):
def disable(cls, hash: str | None = None) -> str: ...
@classmethod
def enable(cls, hash: str) -> str: ...
__all__ = ["PasswordHash"]
+2
View File
@@ -138,3 +138,5 @@ def genphrase(
sep: str | bytes | None = None,
rng: random.Random | None = None,
) -> Iterator[str]: ...
__all__ = ["genword", "default_charsets", "genphrase", "default_wordsets"]
+2
View File
@@ -13,3 +13,5 @@ def register_crypt_handler(
) -> None: ... # expected handler is object with attr handler.name
def get_crypt_handler(name: str, default: Any = ...) -> Any: ... # returns handler or default
def list_crypt_handlers(loaded_only: bool = False) -> list[str]: ...
__all__ = ["register_crypt_handler_path", "register_crypt_handler", "get_crypt_handler", "list_crypt_handlers"]
+11
View File
@@ -146,3 +146,14 @@ class TotpMatch(SequenceMixin):
def cache_seconds(self) -> int: ...
@property
def cache_time(self) -> int: ...
__all__ = [
"AppWallet",
"TOTP",
"TokenError",
"MalformedTokenError",
"InvalidTokenError",
"UsedTokenError",
"TotpToken",
"TotpMatch",
]