aboutsummaryrefslogtreecommitdiffstats
path: root/backend
diff options
context:
space:
mode:
authorGravatar decorator-factory <[email protected]>2020-12-15 09:30:53 +0300
committerGravatar decorator-factory <[email protected]>2020-12-15 09:36:48 +0300
commitfc04997fa483464d5daee52a9d70745df555f5b1 (patch)
tree1cbfdd2219c56c4cf8f5a590ad2e72cf3b63bc75 /backend
parentMerge branch 'ks123/routes-parsing' into testing-strategies (diff)
Fix f-string referencing the wrong nametesting-strategies
Fix missing type annotation Lint fix
Diffstat (limited to 'backend')
-rw-r--r--backend/route.py2
-rw-r--r--backend/route_manager.py4
2 files changed, 3 insertions, 3 deletions
diff --git a/backend/route.py b/backend/route.py
index d8c38fc..d778bf0 100644
--- a/backend/route.py
+++ b/backend/route.py
@@ -9,7 +9,7 @@ class Route(HTTPEndpoint):
path: str
@classmethod
- def check_parameters(cls):
+ def check_parameters(cls) -> None:
if not hasattr(cls, "name"):
raise ValueError(f"Route {cls.__name__} has not defined a name")
diff --git a/backend/route_manager.py b/backend/route_manager.py
index c48ea8e..031c9b3 100644
--- a/backend/route_manager.py
+++ b/backend/route_manager.py
@@ -36,7 +36,7 @@ def route_classes() -> t.Iterator[tuple[Path, type[Route]]]:
routes_directory = Path("backend") / "routes"
for module_path in routes_directory.rglob("*.py"):
- import_name = f"{'.'.join(file.parent.parts)}.{file.stem}"
+ import_name = f"{'.'.join(module_path.parent.parts)}.{module_path.stem}"
route_module = importlib.import_module(import_name)
for _member_name, member in inspect.getmembers(route_module):
if is_route_class(member):
@@ -50,7 +50,7 @@ def create_route_map() -> list[BaseRoute]:
for module_path, member in route_classes():
# module_path == Path("backend/routes/foo/bar/baz/bin.py")
# => levels == ["foo", "bar", "baz"]
- levels = file.parent.parts[2:]
+ levels = module_path.parent.parts[2:]
current_level = None
for level in levels:
if current_level is None: