mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-02-17 07:14:12 +08:00
Use typing_extensions.Self instead of _typeshed.Self (#9702)
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
from _typeshed import Incomplete, Self, StrOrBytesPath, SupportsItems
|
||||
from _typeshed import Incomplete, StrOrBytesPath, SupportsItems
|
||||
from typing import Any
|
||||
from typing_extensions import Self
|
||||
|
||||
class CryptPolicy:
|
||||
@classmethod
|
||||
@@ -26,9 +27,9 @@ class CryptPolicy:
|
||||
|
||||
class CryptContext:
|
||||
@classmethod
|
||||
def from_string(cls: type[Self], source: str | bytes, section: str = ..., encoding: str = ...) -> Self: ...
|
||||
def from_string(cls, source: str | bytes, section: str = ..., encoding: str = ...) -> Self: ...
|
||||
@classmethod
|
||||
def from_path(cls: type[Self], path: StrOrBytesPath, section: str = ..., encoding: str = ...) -> Self: ...
|
||||
def from_path(cls, path: StrOrBytesPath, section: str = ..., encoding: str = ...) -> Self: ...
|
||||
def copy(self, **kwds: Any) -> CryptContext: ...
|
||||
def using(self, **kwds: Any) -> CryptContext: ...
|
||||
def replace(self, **kwds): ...
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from _typeshed import Self
|
||||
from typing import ClassVar
|
||||
from typing_extensions import Self
|
||||
|
||||
import passlib.utils.handlers as uh
|
||||
from passlib.utils.handlers import PrefixWrapper
|
||||
@@ -13,7 +13,7 @@ class Pbkdf2DigestHandler(uh.HasRounds, uh.HasRawSalt, uh.HasRawChecksum, uh.Gen
|
||||
max_rounds: ClassVar[int]
|
||||
rounds_cost: ClassVar[str]
|
||||
@classmethod
|
||||
def from_string(cls: type[Self], hash: str | bytes) -> Self: ... # type: ignore[override]
|
||||
def from_string(cls, hash: str | bytes) -> Self: ... # type: ignore[override]
|
||||
|
||||
# dynamically created by create_pbkdf2_hash()
|
||||
class pbkdf2_sha1(Pbkdf2DigestHandler):
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from _typeshed import Self
|
||||
from typing import ClassVar
|
||||
from typing_extensions import Self
|
||||
|
||||
import passlib.utils.handlers as uh
|
||||
|
||||
@@ -17,4 +17,4 @@ class phpass(uh.HasManyIdents, uh.HasRounds, uh.HasSalt, uh.GenericHandler): #
|
||||
ident_values: ClassVar[tuple[str, ...]]
|
||||
ident_aliases: ClassVar[dict[str, str]]
|
||||
@classmethod
|
||||
def from_string(cls: type[Self], hash: str | bytes) -> Self: ... # type: ignore[override]
|
||||
def from_string(cls, hash: str | bytes) -> Self: ... # type: ignore[override]
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from _typeshed import Self
|
||||
from typing import Any, ClassVar
|
||||
from typing_extensions import Self
|
||||
|
||||
import passlib.utils.handlers as uh
|
||||
|
||||
@@ -18,6 +18,6 @@ class sha1_crypt(uh.HasManyBackends, uh.HasRounds, uh.HasSalt, uh.GenericHandler
|
||||
max_rounds: ClassVar[int]
|
||||
rounds_cost: ClassVar[str]
|
||||
@classmethod
|
||||
def from_string(cls: type[Self], hash: str | bytes) -> Self: ... # type: ignore[override]
|
||||
def from_string(cls, hash: str | bytes) -> Self: ... # type: ignore[override]
|
||||
def to_string(self, config: bool = ...) -> str: ...
|
||||
backends: ClassVar[tuple[str, ...]]
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from _typeshed import Self
|
||||
from typing import ClassVar
|
||||
from typing_extensions import Self
|
||||
|
||||
import passlib.utils.handlers as uh
|
||||
|
||||
@@ -13,7 +13,7 @@ class _SHA2_Common(uh.HasManyBackends, uh.HasRounds, uh.HasSalt, uh.GenericHandl
|
||||
implicit_rounds: bool
|
||||
def __init__(self, implicit_rounds: bool | None = ..., **kwds) -> None: ...
|
||||
@classmethod
|
||||
def from_string(cls: type[Self], hash: str | bytes) -> Self: ... # type: ignore[override]
|
||||
def from_string(cls, hash: str | bytes) -> Self: ... # type: ignore[override]
|
||||
backends: ClassVar[tuple[str, ...]]
|
||||
|
||||
class sha256_crypt(_SHA2_Common):
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from _typeshed import Self
|
||||
from typing import ClassVar
|
||||
from typing_extensions import Self
|
||||
|
||||
import passlib.utils.handlers as uh
|
||||
|
||||
@@ -20,5 +20,5 @@ class sun_md5_crypt(uh.HasRounds, uh.HasSalt, uh.GenericHandler): # type: ignor
|
||||
@classmethod
|
||||
def identify(cls, hash): ...
|
||||
@classmethod
|
||||
def from_string(cls: type[Self], hash: str | bytes) -> Self: ... # type: ignore[override]
|
||||
def from_string(cls, hash: str | bytes) -> Self: ... # type: ignore[override]
|
||||
def to_string(self, _withchk: bool = ...) -> str: ...
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
from _typeshed import Self
|
||||
from abc import ABCMeta, abstractmethod
|
||||
from typing import Any, ClassVar
|
||||
from typing_extensions import Literal
|
||||
from typing_extensions import Literal, Self
|
||||
|
||||
class PasswordHash(metaclass=ABCMeta):
|
||||
is_disabled: ClassVar[bool]
|
||||
@@ -18,7 +17,7 @@ class PasswordHash(metaclass=ABCMeta):
|
||||
def verify(cls, secret: str | bytes, hash: str | bytes, **context_kwds): ...
|
||||
@classmethod
|
||||
@abstractmethod
|
||||
def using(cls: type[Self], relaxed: bool = ..., **kwds: Any) -> type[Self]: ...
|
||||
def using(cls, relaxed: bool = ..., **kwds: Any) -> type[Self]: ...
|
||||
@classmethod
|
||||
def needs_update(cls, hash: str, secret: str | bytes | None = ...) -> bool: ...
|
||||
@classmethod
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import abc
|
||||
from _typeshed import Incomplete, Self
|
||||
from _typeshed import Incomplete
|
||||
from typing import Any, ClassVar
|
||||
from typing_extensions import Self
|
||||
|
||||
from passlib.ifc import PasswordHash
|
||||
from passlib.utils.binary import BASE64_CHARS, HASH64_CHARS, LOWER_HEX_CHARS, PADDED_BASE64_CHARS, UPPER_HEX_CHARS
|
||||
@@ -20,13 +21,13 @@ def render_mc3(ident, rounds, salt, checksum, sep=..., rounds_base: int = ...):
|
||||
|
||||
class MinimalHandler(PasswordHash, metaclass=abc.ABCMeta):
|
||||
@classmethod
|
||||
def using(cls: Self, relaxed: bool = ...) -> type[Self]: ... # type: ignore[override]
|
||||
def using(cls, relaxed: bool = ...) -> type[Self]: ... # type: ignore[override]
|
||||
|
||||
class TruncateMixin(MinimalHandler, metaclass=abc.ABCMeta):
|
||||
truncate_error: ClassVar[bool]
|
||||
truncate_verify_reject: ClassVar[bool]
|
||||
@classmethod
|
||||
def using(cls: type[Self], truncate_error: object = ..., *, relaxed: bool = ...) -> type[Self]: ... # type: ignore[override]
|
||||
def using(cls, truncate_error: object = ..., *, relaxed: bool = ...) -> type[Self]: ... # type: ignore[override]
|
||||
|
||||
class GenericHandler(MinimalHandler):
|
||||
setting_kwds: ClassVar[tuple[str, ...]]
|
||||
@@ -40,7 +41,7 @@ class GenericHandler(MinimalHandler):
|
||||
@classmethod
|
||||
def identify(cls, hash: str | bytes) -> bool: ...
|
||||
@classmethod
|
||||
def from_string(cls: type[Self], hash: str | bytes, **context: Any) -> Self: ...
|
||||
def from_string(cls, hash: str | bytes, **context: Any) -> Self: ...
|
||||
def to_string(self) -> str: ...
|
||||
@classmethod
|
||||
def hash(cls, secret: str | bytes, **kwds: Any) -> str: ...
|
||||
|
||||
Reference in New Issue
Block a user