Tree: Swap from map to list comprehensions

List comprehensions are the more "pythonic" way to approach mapping
values to a list. They're also more flexible across different collection
types rather than the inbuilt map method. It's best to keep one convention
rather than splitting down two.

Signed-off-by: kingbri <bdashore3@proton.me>
This commit is contained in:
kingbri 2024-05-25 21:13:58 -04:00 committed by Brian Dashore
parent 46d0d13914
commit 9fbbc5afca
4 changed files with 20 additions and 27 deletions

View file

@ -191,7 +191,7 @@ async def unload_model():
@router.get("/v1/template/list", dependencies=[Depends(check_api_key)])
async def get_templates():
templates = get_all_templates()
template_strings = list(map(lambda template: template.stem, templates))
template_strings = [template.stem for template in templates]
return TemplateList(data=template_strings)