mirror of
https://github.com/theroyallab/tabbyAPI.git
synced 2026-04-28 02:01:24 +00:00
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:
@@ -63,15 +63,13 @@ def _get_repo_info(repo_id, revision, token):
|
||||
|
||||
api_client = HfApi()
|
||||
repo_tree = api_client.list_repo_files(repo_id, revision=revision, token=token)
|
||||
return list(
|
||||
map(
|
||||
lambda filename: {
|
||||
"filename": filename,
|
||||
"url": hf_hub_url(repo_id, filename, revision=revision),
|
||||
},
|
||||
repo_tree,
|
||||
)
|
||||
)
|
||||
return [
|
||||
{
|
||||
"filename": filename,
|
||||
"url": hf_hub_url(repo_id, filename, revision=revision),
|
||||
}
|
||||
for filename in repo_tree
|
||||
]
|
||||
|
||||
|
||||
def _get_download_folder(repo_id: str, repo_type: str, folder_name: Optional[str]):
|
||||
|
||||
Reference in New Issue
Block a user