diff --git a/stubs/passlib/passlib/handlers/argon2.pyi b/stubs/passlib/passlib/handlers/argon2.pyi index 41585256b093..ca461275f944 100644 --- a/stubs/passlib/passlib/handlers/argon2.pyi +++ b/stubs/passlib/passlib/handlers/argon2.pyi @@ -1,4 +1,5 @@ from typing import Any, ClassVar +from typing_extensions import Self import passlib.utils.handlers as uh @@ -51,24 +52,24 @@ class _Argon2Common( # type: ignore[misc] @classmethod def identify(cls, hash): ... @classmethod - def from_string(cls, hash): ... + def from_string(cls, hash) -> Self: ... # type: ignore[override] def __init__(self, type=None, type_d: bool = False, version=None, memory_cost=None, data=None, **kwds) -> None: ... class _NoBackend(_Argon2Common): @classmethod - def hash(cls, secret): ... + def hash(cls, secret): ... # type: ignore[override] @classmethod - def verify(cls, secret, hash): ... + def verify(cls, secret, hash): ... # type: ignore[override] @classmethod - def genhash(cls, secret, config): ... + def genhash(cls, secret, config): ... # type: ignore[override] class _CffiBackend(_Argon2Common): @classmethod - def hash(cls, secret): ... + def hash(cls, secret): ... # type: ignore[override] @classmethod - def verify(cls, secret, hash): ... + def verify(cls, secret, hash): ... # type: ignore[override] @classmethod - def genhash(cls, secret, config): ... + def genhash(cls, secret, config): ... # type: ignore[override] class _PureBackend(_Argon2Common): ... diff --git a/stubs/passlib/passlib/handlers/bcrypt.pyi b/stubs/passlib/passlib/handlers/bcrypt.pyi index 0965bfdd36e8..384070eb3337 100644 --- a/stubs/passlib/passlib/handlers/bcrypt.pyi +++ b/stubs/passlib/passlib/handlers/bcrypt.pyi @@ -1,4 +1,5 @@ from typing import Any, ClassVar +from typing_extensions import Self import passlib.utils.handlers as uh @@ -19,9 +20,9 @@ class _BcryptCommon(uh.SubclassBackendMixin, uh.TruncateMixin, uh.HasManyIdents, rounds_cost: ClassVar[str] truncate_size: ClassVar[int | None] @classmethod - def from_string(cls, hash): ... + def from_string(cls, hash) -> Self: ... # type: ignore[override] @classmethod - def needs_update(cls, hash, **kwds): ... + def needs_update(cls, hash, **kwds): ... # type: ignore[override] @classmethod def normhash(cls, hash): ... @@ -50,7 +51,7 @@ class bcrypt_sha256(_wrapped_bcrypt): @classmethod def identify(cls, hash): ... @classmethod - def from_string(cls, hash): ... + def from_string(cls, hash) -> Self: ... # type: ignore[override] def __init__(self, version=None, **kwds) -> None: ... __all__ = ["bcrypt"] diff --git a/stubs/passlib/passlib/handlers/cisco.pyi b/stubs/passlib/passlib/handlers/cisco.pyi index 61b480739c4d..b1510e13c7c3 100644 --- a/stubs/passlib/passlib/handlers/cisco.pyi +++ b/stubs/passlib/passlib/handlers/cisco.pyi @@ -1,4 +1,5 @@ from typing import ClassVar +from typing_extensions import Self import passlib.utils.handlers as uh @@ -20,7 +21,7 @@ class cisco_type7(uh.GenericHandler): @classmethod def using(cls, salt: int | None = None, **kwds): ... # type: ignore[override] @classmethod - def from_string(cls, hash): ... + def from_string(cls, hash) -> Self: ... # type: ignore[override] salt: int def __init__(self, salt: int | None = None, **kwds) -> None: ... @classmethod diff --git a/stubs/passlib/passlib/handlers/des_crypt.pyi b/stubs/passlib/passlib/handlers/des_crypt.pyi index 6e3b7297bb80..3335c77ad1bb 100644 --- a/stubs/passlib/passlib/handlers/des_crypt.pyi +++ b/stubs/passlib/passlib/handlers/des_crypt.pyi @@ -1,4 +1,5 @@ from typing import ClassVar +from typing_extensions import Self import passlib.utils.handlers as uh @@ -11,7 +12,7 @@ class des_crypt(uh.TruncateMixin, uh.HasManyBackends, uh.HasSalt, uh.GenericHand salt_chars: ClassVar[str] truncate_size: ClassVar[int] @classmethod - def from_string(cls, hash): ... + def from_string(cls, hash) -> Self: ... # type: ignore[override] backends: ClassVar[tuple[str, ...]] class bsdi_crypt(uh.HasManyBackends, uh.HasRounds, uh.HasSalt, uh.GenericHandler): # type: ignore[misc] @@ -26,9 +27,9 @@ class bsdi_crypt(uh.HasManyBackends, uh.HasRounds, uh.HasSalt, uh.GenericHandler max_rounds: ClassVar[int] rounds_cost: ClassVar[str] @classmethod - def from_string(cls, hash): ... + def from_string(cls, hash) -> Self: ... # type: ignore[override] @classmethod - def using(cls, **kwds): ... + def using(cls, **kwds): ... # type: ignore[override] backends: ClassVar[tuple[str, ...]] class bigcrypt(uh.HasSalt, uh.GenericHandler): @@ -38,7 +39,7 @@ class bigcrypt(uh.HasSalt, uh.GenericHandler): max_salt_size: ClassVar[int] salt_chars: ClassVar[str] @classmethod - def from_string(cls, hash): ... + def from_string(cls, hash) -> Self: ... # type: ignore[override] class crypt16(uh.TruncateMixin, uh.HasSalt, uh.GenericHandler): # type: ignore[misc] name: ClassVar[str] @@ -49,6 +50,6 @@ class crypt16(uh.TruncateMixin, uh.HasSalt, uh.GenericHandler): # type: ignore[ salt_chars: ClassVar[str] truncate_size: ClassVar[int] @classmethod - def from_string(cls, hash): ... + def from_string(cls, hash) -> Self: ... # type: ignore[override] __all__ = ["des_crypt", "bsdi_crypt", "bigcrypt", "crypt16"] diff --git a/stubs/passlib/passlib/handlers/digests.pyi b/stubs/passlib/passlib/handlers/digests.pyi index 09d0970b53e5..01c3641210de 100644 --- a/stubs/passlib/passlib/handlers/digests.pyi +++ b/stubs/passlib/passlib/handlers/digests.pyi @@ -1,4 +1,6 @@ -from typing import Any, ClassVar +from _typeshed import Incomplete +from typing import ClassVar +from typing_extensions import deprecated import passlib.utils.handlers as uh @@ -8,11 +10,11 @@ class HexDigestHash(uh.StaticHandler): def create_hex_hash(digest, module="passlib.handlers.digests", django_name=None, required: bool = True): ... -hex_md4: Any -hex_md5: Any -hex_sha1: Any -hex_sha256: Any -hex_sha512: Any +hex_md4: Incomplete +hex_md5: Incomplete +hex_sha1: Incomplete +hex_sha256: Incomplete +hex_sha512: Incomplete class htdigest(uh.MinimalHandler): name: ClassVar[str] @@ -25,8 +27,10 @@ class htdigest(uh.MinimalHandler): def verify(cls, secret, hash, user, realm, encoding: str = "utf-8"): ... # type: ignore[override] @classmethod def identify(cls, hash): ... + @deprecated("Deprecated since Passlib 1.7, will be removed in 2.0") @classmethod - def genconfig(cls): ... + def genconfig(cls): ... # type: ignore[override] + @deprecated("Deprecated since Passlib 1.7, will be removed in 2.0") @classmethod def genhash(cls, secret, config, user, realm, encoding=None): ... # type: ignore[override] diff --git a/stubs/passlib/passlib/handlers/django.pyi b/stubs/passlib/passlib/handlers/django.pyi index f613ed7cb435..c7a2f38ab701 100644 --- a/stubs/passlib/passlib/handlers/django.pyi +++ b/stubs/passlib/passlib/handlers/django.pyi @@ -1,4 +1,5 @@ from typing import Any, ClassVar +from typing_extensions import Self import passlib.utils.handlers as uh from passlib.handlers.bcrypt import _wrapped_bcrypt @@ -9,12 +10,12 @@ class DjangoSaltedHash(uh.HasSalt, uh.GenericHandler): salt_chars: ClassVar[str] checksum_chars: ClassVar[str] @classmethod - def from_string(cls, hash): ... + def from_string(cls, hash) -> Self: ... # type: ignore[override] class DjangoVariableHash(uh.HasRounds, DjangoSaltedHash): # type: ignore[misc] min_rounds: ClassVar[int] @classmethod - def from_string(cls, hash): ... + def from_string(cls, hash) -> Self: ... # type: ignore[override] class django_salted_sha1(DjangoSaltedHash): name: ClassVar[str] @@ -37,7 +38,7 @@ class django_bcrypt_sha256(_wrapped_bcrypt): @classmethod def identify(cls, hash): ... @classmethod - def from_string(cls, hash): ... + def from_string(cls, hash) -> Self: ... # type: ignore[override] class django_pbkdf2_sha256(DjangoVariableHash): name: ClassVar[str] @@ -70,7 +71,7 @@ class django_des_crypt(uh.TruncateMixin, uh.HasSalt, uh.GenericHandler): # type truncate_size: ClassVar[int] use_duplicate_salt: bool @classmethod - def from_string(cls, hash): ... + def from_string(cls, hash) -> Self: ... # type: ignore[override] class django_disabled(DisabledHash, uh.StaticHandler): name: ClassVar[str] diff --git a/stubs/passlib/passlib/handlers/fshp.pyi b/stubs/passlib/passlib/handlers/fshp.pyi index a8addc70a042..73caa3bedf55 100644 --- a/stubs/passlib/passlib/handlers/fshp.pyi +++ b/stubs/passlib/passlib/handlers/fshp.pyi @@ -1,4 +1,5 @@ from typing import Any, ClassVar +from typing_extensions import Self import passlib.utils.handlers as uh @@ -21,8 +22,8 @@ class fshp(uh.HasRounds, uh.HasRawSalt, uh.HasRawChecksum, uh.GenericHandler): @property def checksum_alg(self): ... @property - def checksum_size(self): ... + def checksum_size(self): ... # type: ignore[override] @classmethod - def from_string(cls, hash): ... + def from_string(cls, hash) -> Self: ... # type: ignore[override] __all__ = ["fshp"] diff --git a/stubs/passlib/passlib/handlers/ldap_digests.pyi b/stubs/passlib/passlib/handlers/ldap_digests.pyi index a37b5a83926b..1abaf2aa8e9e 100644 --- a/stubs/passlib/passlib/handlers/ldap_digests.pyi +++ b/stubs/passlib/passlib/handlers/ldap_digests.pyi @@ -1,4 +1,5 @@ from typing import ClassVar +from typing_extensions import Self import passlib.utils.handlers as uh from passlib.handlers.misc import plaintext @@ -32,7 +33,7 @@ class _SaltedBase64DigestHelper(uh.HasRawSalt, uh.HasRawChecksum, uh.GenericHand max_salt_size: ClassVar[int] default_salt_size: ClassVar[int] @classmethod - def from_string(cls, hash): ... + def from_string(cls, hash) -> Self: ... # type: ignore[override] class ldap_md5(_Base64DigestHelper): name: ClassVar[str] @@ -67,7 +68,7 @@ class ldap_salted_sha512(_SaltedBase64DigestHelper): class ldap_plaintext(plaintext): name: ClassVar[str] @classmethod - def genconfig(cls): ... + def genconfig(cls): ... # type: ignore[override] @classmethod def identify(cls, hash): ... diff --git a/stubs/passlib/passlib/handlers/md5_crypt.pyi b/stubs/passlib/passlib/handlers/md5_crypt.pyi index 94fef0634106..0f3e2df5d8a7 100644 --- a/stubs/passlib/passlib/handlers/md5_crypt.pyi +++ b/stubs/passlib/passlib/handlers/md5_crypt.pyi @@ -1,4 +1,5 @@ from typing import ClassVar +from typing_extensions import Self import passlib.utils.handlers as uh @@ -8,7 +9,7 @@ class _MD5_Common(uh.HasSalt, uh.GenericHandler): max_salt_size: ClassVar[int] salt_chars: ClassVar[str] @classmethod - def from_string(cls, hash): ... + def from_string(cls, hash) -> Self: ... # type: ignore[override] class md5_crypt(uh.HasManyBackends, _MD5_Common): name: ClassVar[str] diff --git a/stubs/passlib/passlib/handlers/misc.pyi b/stubs/passlib/passlib/handlers/misc.pyi index 4e3cc4df76d7..7f7e8f24c0f6 100644 --- a/stubs/passlib/passlib/handlers/misc.pyi +++ b/stubs/passlib/passlib/handlers/misc.pyi @@ -1,4 +1,5 @@ from typing import Any, ClassVar +from typing_extensions import deprecated import passlib.utils.handlers as uh from passlib.ifc import DisabledHash @@ -43,8 +44,10 @@ class plaintext(uh.MinimalHandler): def hash(cls, secret: str | bytes, encoding=None): ... # type: ignore[override] @classmethod def verify(cls, secret: str | bytes, hash: str | bytes, encoding: str | None = None): ... # type: ignore[override] + @deprecated("Deprecated since Passlib 1.7, will be removed in 2.0") @classmethod - def genconfig(cls): ... + def genconfig(cls): ... # type: ignore[override] + @deprecated("Deprecated since Passlib 1.7, will be removed in 2.0") @classmethod def genhash(cls, secret, config, encoding: str | None = None): ... # type: ignore[override] diff --git a/stubs/passlib/passlib/handlers/mssql.pyi b/stubs/passlib/passlib/handlers/mssql.pyi index c1c7f1f8882d..a0687e911d02 100644 --- a/stubs/passlib/passlib/handlers/mssql.pyi +++ b/stubs/passlib/passlib/handlers/mssql.pyi @@ -1,4 +1,5 @@ from typing import ClassVar +from typing_extensions import Self import passlib.utils.handlers as uh @@ -8,7 +9,7 @@ class mssql2000(uh.HasRawSalt, uh.HasRawChecksum, uh.GenericHandler): min_salt_size: ClassVar[int] max_salt_size: ClassVar[int] @classmethod - def from_string(cls, hash): ... + def from_string(cls, hash) -> Self: ... # type: ignore[override] @classmethod def verify(cls, secret: str | bytes, hash: str | bytes) -> bool: ... # type: ignore[override] @@ -18,6 +19,6 @@ class mssql2005(uh.HasRawSalt, uh.HasRawChecksum, uh.GenericHandler): min_salt_size: ClassVar[int] max_salt_size: ClassVar[int] @classmethod - def from_string(cls, hash): ... + def from_string(cls, hash) -> Self: ... # type: ignore[override] __all__ = ["mssql2000", "mssql2005"] diff --git a/stubs/passlib/passlib/handlers/oracle.pyi b/stubs/passlib/passlib/handlers/oracle.pyi index 6b9931e7217d..0456bda1ea39 100644 --- a/stubs/passlib/passlib/handlers/oracle.pyi +++ b/stubs/passlib/passlib/handlers/oracle.pyi @@ -1,4 +1,5 @@ from typing import ClassVar +from typing_extensions import Self import passlib.utils.handlers as uh @@ -17,4 +18,4 @@ class oracle11(uh.HasSalt, uh.GenericHandler): max_salt_size: ClassVar[int] salt_chars: ClassVar[str] @classmethod - def from_string(cls, hash): ... + def from_string(cls, hash) -> Self: ... # type: ignore[override] diff --git a/stubs/passlib/passlib/handlers/pbkdf2.pyi b/stubs/passlib/passlib/handlers/pbkdf2.pyi index dfe0f112e9f4..e1a0040c0c9c 100644 --- a/stubs/passlib/passlib/handlers/pbkdf2.pyi +++ b/stubs/passlib/passlib/handlers/pbkdf2.pyi @@ -51,7 +51,7 @@ class cta_pbkdf2_sha1(uh.HasRounds, uh.HasRawSalt, uh.HasRawChecksum, uh.Generic max_rounds: ClassVar[int] rounds_cost: ClassVar[str] @classmethod - def from_string(cls, hash): ... + def from_string(cls, hash) -> Self: ... # type: ignore[override] class dlitz_pbkdf2_sha1(uh.HasRounds, uh.HasSalt, uh.GenericHandler): # type: ignore[misc] name: ClassVar[str] @@ -64,7 +64,7 @@ class dlitz_pbkdf2_sha1(uh.HasRounds, uh.HasSalt, uh.GenericHandler): # type: i max_rounds: ClassVar[int] rounds_cost: ClassVar[str] @classmethod - def from_string(cls, hash): ... + def from_string(cls, hash) -> Self: ... # type: ignore[override] class atlassian_pbkdf2_sha1(uh.HasRawSalt, uh.HasRawChecksum, uh.GenericHandler): name: ClassVar[str] @@ -73,7 +73,7 @@ class atlassian_pbkdf2_sha1(uh.HasRawSalt, uh.HasRawChecksum, uh.GenericHandler) min_salt_size: ClassVar[int] max_salt_size: ClassVar[int] @classmethod - def from_string(cls, hash): ... + def from_string(cls, hash) -> Self: ... # type: ignore[override] class grub_pbkdf2_sha512(uh.HasRounds, uh.HasRawSalt, uh.HasRawChecksum, uh.GenericHandler): # type: ignore[misc] name: ClassVar[str] @@ -86,6 +86,6 @@ class grub_pbkdf2_sha512(uh.HasRounds, uh.HasRawSalt, uh.HasRawChecksum, uh.Gene max_rounds: ClassVar[int] rounds_cost: ClassVar[str] @classmethod - def from_string(cls, hash): ... + def from_string(cls, hash) -> Self: ... # type: ignore[override] __all__ = ["pbkdf2_sha1", "pbkdf2_sha256", "pbkdf2_sha512", "cta_pbkdf2_sha1", "dlitz_pbkdf2_sha1", "grub_pbkdf2_sha512"] diff --git a/stubs/passlib/passlib/handlers/scram.pyi b/stubs/passlib/passlib/handlers/scram.pyi index ab7f2bf53228..1e07e4c9b39e 100644 --- a/stubs/passlib/passlib/handlers/scram.pyi +++ b/stubs/passlib/passlib/handlers/scram.pyi @@ -1,5 +1,6 @@ from _typeshed import Incomplete from typing import ClassVar +from typing_extensions import Self import passlib.utils.handlers as uh @@ -21,7 +22,7 @@ class scram(uh.HasRounds, uh.HasRawSalt, uh.HasRawChecksum, uh.GenericHandler): @classmethod def derive_digest(cls, password, salt, rounds, alg): ... @classmethod - def from_string(cls, hash): ... + def from_string(cls, hash) -> Self: ... # type: ignore[override] @classmethod def using(cls, default_algs=None, algs=None, **kwds): ... # type: ignore[override] def __init__(self, algs=None, **kwds) -> None: ... diff --git a/stubs/passlib/passlib/handlers/scrypt.pyi b/stubs/passlib/passlib/handlers/scrypt.pyi index 431ad7c9f7fc..ce01e8d62132 100644 --- a/stubs/passlib/passlib/handlers/scrypt.pyi +++ b/stubs/passlib/passlib/handlers/scrypt.pyi @@ -1,4 +1,5 @@ from typing import ClassVar +from typing_extensions import Self import passlib.utils.handlers as uh @@ -19,7 +20,7 @@ class scrypt(uh.ParallelismMixin, uh.HasRounds, uh.HasRawSalt, uh.HasRawChecksum @classmethod def using(cls, block_size=None, **kwds): ... # type: ignore[override] @classmethod - def from_string(cls, hash): ... + def from_string(cls, hash) -> Self: ... # type: ignore[override] @classmethod def parse(cls, hash): ... def to_string(self): ... diff --git a/stubs/passlib/passlib/utils/handlers.pyi b/stubs/passlib/passlib/utils/handlers.pyi index 420a1ef06584..c4ece5c75b0d 100644 --- a/stubs/passlib/passlib/utils/handlers.pyi +++ b/stubs/passlib/passlib/utils/handlers.pyi @@ -39,7 +39,7 @@ class GenericHandler(MinimalHandler): @classmethod def identify(cls, hash: str | bytes) -> bool: ... @classmethod - def from_string(cls, hash: str | bytes, **context: Any) -> Self: ... + def from_string(cls, hash: str | bytes, **context: Any) -> Self: ... # context parameters are passed to constructor def to_string(self) -> str: ... @classmethod def hash(cls, secret: str | bytes, **kwds: Any) -> str: ...