diff --git a/stubs/passlib/@tests/stubtest_allowlist.txt b/stubs/passlib/@tests/stubtest_allowlist.txt index c95325367..fc0d9fa23 100644 --- a/stubs/passlib/@tests/stubtest_allowlist.txt +++ b/stubs/passlib/@tests/stubtest_allowlist.txt @@ -95,3 +95,7 @@ passlib.tests.* # was dropped from the standard library of Python 3.13, but is still available # in some environments. (passlib.hosts.host_context)? + +# Fields differs at runtime: +passlib.apache._CommonFile.encoding +passlib.apache._CommonFile.return_unicode diff --git a/stubs/passlib/passlib/apache.pyi b/stubs/passlib/passlib/apache.pyi index 4d261bd13..126a0c3a1 100644 --- a/stubs/passlib/passlib/apache.pyi +++ b/stubs/passlib/passlib/apache.pyi @@ -1,59 +1,100 @@ -from _typeshed import Incomplete -from typing import Any +from typing_extensions import Self + +from .context import CryptContext +from .hash import htdigest class _CommonFile: - encoding: Any - return_unicode: Any + encoding: str + return_unicode: bool autosave: bool @classmethod - def from_string(cls, data, **kwds): ... - @classmethod - def from_path(cls, path, **kwds): ... - def __init__( - self, - path: Incomplete | None = None, + def from_string( + cls, + data: str | bytes, + *, new: bool = False, autoload: bool = True, autosave: bool = False, encoding: str = "utf-8", - return_unicode=True, + return_unicode: bool = True, + ) -> Self: ... + @classmethod + def from_path( + cls, + path: str, + *, + new: bool = False, + autoload: bool = True, + autosave: bool = False, + encoding: str = "utf-8", + return_unicode: bool = True, + ) -> Self: ... + def __init__( + self, + path: str | None = None, + new: bool = False, + autoload: bool = True, + autosave: bool = False, + encoding: str = "utf-8", + return_unicode: bool = True, ) -> None: ... @property - def path(self): ... + def path(self) -> str: ... @path.setter - def path(self, value) -> None: ... + def path(self, value: str) -> None: ... @property - def mtime(self): ... - def load_if_changed(self): ... - def load(self, path: Incomplete | None = None, force: bool = True): ... - def load_string(self, data) -> None: ... - def save(self, path: Incomplete | None = None) -> None: ... - def to_string(self): ... + def mtime(self) -> float: ... + def load_if_changed(self) -> bool: ... + def load(self, path: str | None = None, force: bool = True) -> bool: ... + def load_string(self, data: str | bytes) -> None: ... + def save(self, path: str | None = None) -> None: ... + def to_string(self) -> bytes: ... class HtpasswdFile(_CommonFile): - context: Any - def __init__(self, path: Incomplete | None = None, default_scheme: Incomplete | None = None, context=..., **kwds) -> None: ... - def users(self): ... - def set_password(self, user, password): ... - def update(self, user, password): ... - def get_hash(self, user): ... - def set_hash(self, user, hash): ... - def find(self, user): ... - def delete(self, user): ... - def check_password(self, user, password): ... - def verify(self, user, password): ... + context: CryptContext + def __init__( + self, + path: str | None = None, + default_scheme: str | None = None, + context: CryptContext = ..., + *, + new: bool = False, + autoload: bool = True, + autosave: bool = False, + encoding: str = "utf-8", + return_unicode: bool = True, + ) -> None: ... + def users(self) -> list[str | bytes]: ... + def set_password(self, user: str, password: str | bytes) -> bool: ... + def update(self, user: str, password: str | bytes) -> bool: ... + def get_hash(self, user: str) -> bytes | None: ... + def set_hash(self, user: str, hash: str | bytes) -> bool: ... + def find(self, user: str) -> bytes | None: ... + def delete(self, user: str) -> bool: ... + def check_password(self, user: str, password: str | bytes) -> bool | None: ... + def verify(self, user: str, password: str | bytes) -> bool | None: ... class HtdigestFile(_CommonFile): - default_realm: Any - def __init__(self, path: Incomplete | None = None, default_realm: Incomplete | None = None, **kwds) -> None: ... - def realms(self): ... - def users(self, realm: Incomplete | None = None): ... - def set_password(self, user, realm: Incomplete | None = None, password=...): ... - def update(self, user, realm, password): ... - def get_hash(self, user, realm: Incomplete | None = None): ... - def set_hash(self, user, realm: Incomplete | None = None, hash=...): ... - def find(self, user, realm): ... - def delete(self, user, realm: Incomplete | None = None): ... - def delete_realm(self, realm): ... - def check_password(self, user, realm: Incomplete | None = None, password=...): ... - def verify(self, user, realm, password): ... + default_realm: str | None + def __init__( + self, + path: str | None = None, + default_realm: str | None = None, + *, + new: bool = False, + autoload: bool = True, + autosave: bool = False, + encoding: str = "utf-8", + return_unicode: bool = True, + ) -> None: ... + def realms(self) -> list[str | bytes]: ... + def users(self, realm: str | None = None) -> list[str | bytes]: ... + def set_password(self, user: str, realm: str | None = None, password: str | bytes = ...) -> bool: ... + def update(self, user: str, realm: str | None, password: str | bytes) -> bool: ... + def get_hash(self, user: str, realm: str | None = None) -> htdigest | None: ... + def set_hash(self, user: str, realm: str | None = None, hash: str | bytes = ...) -> bool: ... + def find(self, user: str, realm: str | None) -> htdigest | None: ... + def delete(self, user: str, realm: str | None = None) -> bool: ... + 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: ...