chore: fix formatting

This commit is contained in:
Vlad Stan 2023-01-17 15:05:17 +02:00
parent 6b360b927c
commit 77c17a2b63

View file

@ -291,26 +291,22 @@ class InstallableExtension(BaseModel):
return None return None
@classmethod @classmethod
async def from_manifest(cls, e: dict) -> Optional["InstallableExtension"]: async def from_manifest(cls, e: dict) -> "InstallableExtension":
try: installed_ext = await InstallableExtension.from_row(
installed_ext = await InstallableExtension.from_row( await get_installed_extension(e["id"])
await get_installed_extension(e["id"]) )
) return InstallableExtension(
return InstallableExtension( id=e["id"],
id=e["id"], name=e["name"],
name=e["name"], archive=e["archive"],
archive=e["archive"], hash=e["hash"],
hash=e["hash"], short_description=e["shortDescription"],
short_description=e["shortDescription"], icon=e["icon"],
icon=e["icon"], installed_release=installed_ext.installed_release
installed_release=installed_ext.installed_release if installed_ext
if installed_ext else None,
else None, dependencies=e["dependencies"] if "dependencies" in e else [],
dependencies=e["dependencies"] if "dependencies" in e else [], )
)
except Exception as e:
logger.warning(e)
return None
@classmethod # todo: remove @classmethod # todo: remove
async def get_extension_info( async def get_extension_info(
@ -353,12 +349,13 @@ class InstallableExtension(BaseModel):
manifest = resp.json() manifest = resp.json()
if "repos" in manifest: if "repos" in manifest:
for r in manifest["repos"]: for r in manifest["repos"]:
if r["id"] in extension_id_list:
continue
ext = await InstallableExtension.from_repo( ext = await InstallableExtension.from_repo(
r["id"], r["organisation"], r["repository"] r["id"], r["organisation"], r["repository"]
) )
if ext: if ext:
if ext.id in extension_id_list:
continue
extension_list += [ext] extension_list += [ext]
extension_id_list += [ext.id] extension_id_list += [ext.id]