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:
JD Solanki 2024-04-14 17:26:26 +05:30 committed by GitHub
parent 3425c834cc
commit aa1a15996c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 1 deletions

View File

@ -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