mirror of https://github.com/tiangolo/fastapi.git
perf: instead of creating list of method use iterator
Changes according to [this](https://docs.astral.sh/ruff/rules/unnecessary-iterable-allocation-for-first-element/)
This commit is contained in:
parent
3425c834cc
commit
aa1a15996c
|
|
@ -183,7 +183,7 @@ def generate_unique_id(route: "APIRoute") -> str:
|
|||
operation_id = f"{route.name}{route.path_format}"
|
||||
operation_id = re.sub(r"\W", "_", operation_id)
|
||||
assert route.methods
|
||||
operation_id = f"{operation_id}_{list(route.methods)[0].lower()}"
|
||||
operation_id = f"{operation_id}_{next(iter(route.methods)).lower()}"
|
||||
return operation_id
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue