ref: typehints, enum instead of raw string, abc and other (#1)

Full code coverage with annotations, fixing errors in various linters: ruff, wps, etc. Fixing errors in type checkers: ty, mypy, pyright. Formatting and bringing code to a consistent style, applying best practices in various aspects.
This commit is contained in:
kolo
2025-10-08 13:37:31 +03:00
committed by GitHub
parent 22f1171192
commit 73303b1c08
45 changed files with 983 additions and 996 deletions
+12 -18
View File
@@ -1,29 +1,23 @@
from argenta.response.status import Status
from argenta.command.flag.flags import (
ValidInputFlags,
UndefinedInputFlags,
InvalidValueInputFlags,
)
from typing import Literal
from argenta.command.flag.flags.models import InputFlags
from argenta.response.status import ResponseStatus
EMPTY_INPUT_FLAGS: InputFlags = InputFlags()
class Response:
__slots__ = ("status", "valid_flags", "undefined_flags", "invalid_value_flags")
__slots__: tuple[Literal['status', 'input_flags'], ...] = ("status", "input_flags")
def __init__(
self,
status: Status | None = None,
valid_flags: ValidInputFlags = ValidInputFlags(),
undefined_flags: UndefinedInputFlags = UndefinedInputFlags(),
invalid_value_flags: InvalidValueInputFlags = InvalidValueInputFlags(),
status: ResponseStatus,
input_flags: InputFlags = EMPTY_INPUT_FLAGS,
):
"""
Public. The entity of the user input sent to the handler
:param status: the status of the response
:param valid_flags: valid input flags
:param undefined_flags: undefined input flags
:param invalid_value_flags: input flags with invalid values
:param input_flags: all input flags
"""
self.status = status
self.valid_flags = valid_flags
self.undefined_flags = undefined_flags
self.invalid_value_flags = invalid_value_flags
self.status: ResponseStatus = status
self.input_flags: InputFlags = input_flags