mirror of
https://github.com/koloideal/Argenta.git
synced 2026-06-10 10:05:28 +03:00
feat: impl docs (#4)
The entire public api is covered with documentation in two languages - Russian and English. the library now supports the latest three versions of python - 3.12, 3.13 and 3.14 minor design changes: now, when a Boolean flag is entered, its value is an empty string, not None. tests have been adapted to the supported versions of python, readmi has been redesigned in two languages, German is no longer available.
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
from argenta.command.flag.models import InputFlag, Flag
|
||||
from typing import Generic, TypeVar, override
|
||||
from collections.abc import Iterator
|
||||
__all__ = ["Flags", "InputFlags"]
|
||||
|
||||
from collections.abc import Iterator
|
||||
from typing import Generic, TypeVar, override
|
||||
|
||||
from argenta.command.flag.models import Flag, InputFlag
|
||||
|
||||
FlagType = TypeVar("FlagType")
|
||||
|
||||
@@ -30,6 +32,9 @@ class BaseFlags(Generic[FlagType]):
|
||||
:return: None
|
||||
"""
|
||||
self.flags.extend(flags)
|
||||
|
||||
def __len__(self) -> int:
|
||||
return len(self.flags)
|
||||
|
||||
def __iter__(self) -> Iterator[FlagType]:
|
||||
return iter(self.flags)
|
||||
@@ -52,7 +57,7 @@ class Flags(BaseFlags[Flag]):
|
||||
:return: entity of the flag or None
|
||||
"""
|
||||
return next((flag for flag in self.flags if flag.name == name), None)
|
||||
|
||||
|
||||
@override
|
||||
def __eq__(self, other: object) -> bool:
|
||||
if not isinstance(other, Flags):
|
||||
@@ -82,9 +87,9 @@ class InputFlags(BaseFlags[InputFlag]):
|
||||
:return: entity of the flag or None
|
||||
"""
|
||||
return next((flag for flag in self.flags if flag.name == name), None)
|
||||
|
||||
|
||||
@override
|
||||
def __eq__(self, other: object) -> bool:
|
||||
def __eq__(self, other: object) -> bool:
|
||||
if not isinstance(other, InputFlags):
|
||||
raise NotImplementedError
|
||||
|
||||
@@ -103,4 +108,3 @@ class InputFlags(BaseFlags[InputFlag]):
|
||||
return False
|
||||
else:
|
||||
raise TypeError
|
||||
|
||||
|
||||
Reference in New Issue
Block a user