Fix linter issues

This commit is contained in:
Pavel Knyazev 2022-12-08 19:32:09 +03:00
parent 14ede0de19
commit 0371561abe
1 changed files with 4 additions and 2 deletions

View File

@ -205,14 +205,16 @@ def get_flat_dependant(
return flat_dependant
def preserve_path_params_order(dependant: Dependant):
def preserve_path_params_order(dependant: Dependant) -> Callable[[ModelField], int]:
assert dependant.path is not None
path_params_ordered = []
for elem in dependant.path.split("/"):
if elem.startswith("{") and elem.endswith("}"):
path_params_ordered.append(elem[1:-1])
def key(param: ModelField):
def key(param: ModelField) -> int:
return path_params_ordered.index(param.name)
return key