refactor: use slots and strongly typed properties

This commit is contained in:
2026-04-20 10:48:58 +02:00
parent fc7d3cb0e8
commit 5fb10ffb9d
10 changed files with 161 additions and 91 deletions
+15 -6
View File
@@ -7,17 +7,26 @@ import typing
from . import project
if typing.TYPE_CHECKING:
from . import params, registry
from .params import Parameters
from .registry import Registry
class TokenManager:
__slots__ = [
"logger",
"registry",
"token_hashes",
"token_salt",
"tokens_file",
]
FILE = ".tokens"
def __init__(self, params: params.Parameters, registry: registry.Registry) -> None:
self.logger = logging.getLogger(self.__class__.__name__)
self.token_salt = params.token_salt
self.tokens_file = pathlib.Path(params.data_dir) / self.FILE
self.registry = registry
def __init__(self, params: Parameters, registry: Registry) -> None:
self.logger: logging.Logger = logging.getLogger(self.__class__.__name__)
self.token_salt: str = params.token_salt
self.tokens_file: pathlib.Path = pathlib.Path(params.data_dir) / self.FILE
self.registry: Registry = registry
self.token_hashes: list[str] = []
def init(self) -> None: