Skip to content
Snippets Groups Projects
Commit 08c02683 authored by DAVID Axel's avatar DAVID Axel
Browse files

refactor: :recycle: Use LowercaseStrEnum instead of Enum

parent 1c7e6b93
No related branches found
No related tags found
No related merge requests found
......@@ -73,7 +73,6 @@ def __fallback() -> str:
error_text
str
"""
return "OOPS! Nothing was found here!"
......
......@@ -47,7 +47,6 @@ class VigenereAPIOpenAPIHandler(OpenAPIHandler):
VersionTypeError
Thrown if 'version' is not a Version object.
"""
if not isinstance(version, Version):
raise VersionTypeError(version)
......
......@@ -44,7 +44,6 @@ def get_route_filter(excluded: Collection[str]) -> Callable[[str, Route], bool]:
filter
Callable[[str, Route], bool]
"""
if not isinstance(excluded, Collection):
raise ExcludedPathsTypeError(excluded)
......@@ -78,7 +77,6 @@ def get_route_filter(excluded: Collection[str]) -> Callable[[str, Route], bool]:
route_shown
bool
"""
if not isinstance(path, str):
raise PathTypeError(path)
......
......@@ -18,7 +18,7 @@
"""The caesar controller's documentation."""
from dataclasses import dataclass
from enum import Enum, unique
from enum import auto, unique
from http import HTTPStatus
from typing import final
......@@ -30,17 +30,17 @@ from blacksheep.server.openapi.common import (
ResponseInfo,
)
from strenum import LowercaseStrEnum
from vigenere_api.models import CaesarData
@final
@unique
class CaesarOperation(Enum):
class CaesarOperation(LowercaseStrEnum):
"""All Caesar operations."""
value: str
CIPHER = "cipher"
DECIPHER = "decipher"
CIPHER = auto()
DECIPHER = auto()
CAESAR_DATA1 = (
......
......@@ -19,4 +19,5 @@
from .errors import VigenereAPITypeError
from .model import Model
__all__ = ["Model", "VigenereAPITypeError"]
......@@ -23,6 +23,7 @@ from typing import final, Union
from pydantic import StrictInt, StrictStr, validator
from vigenere_api.helpers import Model
from .errors import (
AlgorithmKeyTypeError,
AlgorithmTextTypeError,
......@@ -35,6 +36,7 @@ from .errors import (
)
from .helper import move_char
Key = Union[StrictInt, StrictStr]
......
......@@ -21,6 +21,7 @@ from typing import final
from pydantic import validator
from vigenere_api.helpers import Model
from .errors import (
InvalidMajorValueError,
InvalidMinorValueError,
......@@ -141,7 +142,6 @@ class Version(Model):
version
str
"""
return f"{self.major}.{self.minor}.{self.patch}"
......@@ -154,5 +154,4 @@ def get_version() -> Version:
version
Version
"""
return Version(major=1, minor=0, patch=0)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment