Improve passlib.win32 (#13711)

This commit is contained in:
Semyon Moroz
2025-03-25 17:52:56 +04:00
committed by GitHub
parent 2dba4324e1
commit 643e57e456
3 changed files with 22 additions and 7 deletions
@@ -32,7 +32,6 @@ passlib.utils.decor.__all__
passlib.utils.handlers.__all__
passlib.utils.md4.__all__
passlib.utils.pbkdf2.__all__
passlib.win32.__all__
# proxy module that uses some import magic incompatible with stubtest
passlib.hash
+9 -2
View File
@@ -1,5 +1,5 @@
from _typeshed import Incomplete
from typing import Any, ClassVar
from typing import Any, ClassVar, Literal, overload
import passlib.utils.handlers as uh
@@ -17,8 +17,15 @@ class nthash(uh.StaticHandler):
checksum_size: ClassVar[int]
@classmethod
def raw(cls, secret): ...
@overload
@classmethod
def raw_nthash(cls, secret, hex: bool = False): ...
def raw_nthash(cls, secret: str | bytes, hex: Literal[True]) -> str: ...
@overload
@classmethod
def raw_nthash(cls, secret: str | bytes, hex: Literal[False] = False) -> bytes: ...
@overload
@classmethod
def raw_nthash(cls, secret: str | bytes, hex: bool = False) -> str | bytes: ...
bsd_nthash: Any
+13 -4
View File
@@ -1,7 +1,16 @@
from typing import Any
from binascii import hexlify as hexlify
from typing import Final, Literal, overload
from passlib.hash import nthash as nthash
from passlib.handlers.windows import nthash as nthash
raw_nthash: Any
LM_MAGIC: Final[bytes]
raw_nthash = nthash.raw_nthash
def raw_lmhash(secret, encoding: str = "ascii", hex: bool = False): ...
@overload
def raw_lmhash(secret: str | bytes, encoding: str = "ascii", hex: Literal[False] = False) -> bytes: ...
@overload
def raw_lmhash(secret: str | bytes, encoding: str, hex: Literal[True]) -> str: ...
@overload
def raw_lmhash(secret: str | bytes, *, hex: Literal[True]) -> str: ...
__all__ = ["nthash", "raw_lmhash", "raw_nthash"]