mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-05-06 21:43:59 +08:00
[passlib] Small changes (#14204)
* Add a few `Self` return annotations. * Add a few `# type: ignore[override]`. * Add a few `@deprecated` annotations. Should help with #14194
This commit is contained in:
@@ -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): ...
|
||||
|
||||
|
||||
@@ -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"]
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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"]
|
||||
|
||||
@@ -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]
|
||||
|
||||
|
||||
@@ -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]
|
||||
|
||||
@@ -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"]
|
||||
|
||||
@@ -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): ...
|
||||
|
||||
|
||||
@@ -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]
|
||||
|
||||
@@ -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]
|
||||
|
||||
|
||||
@@ -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"]
|
||||
|
||||
@@ -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]
|
||||
|
||||
@@ -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"]
|
||||
|
||||
@@ -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: ...
|
||||
|
||||
@@ -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): ...
|
||||
|
||||
@@ -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: ...
|
||||
|
||||
Reference in New Issue
Block a user