[api] improvement: SoftwareManager.get_screenshots returning a generator instead of a list

This commit is contained in:
Vinicius Moreira
2022-02-24 10:32:20 -03:00
parent b2fb656dc0
commit 5a1269d07f
9 changed files with 23 additions and 29 deletions

View File

@@ -795,11 +795,9 @@ class AppImageManager(SoftwareManager):
def cache_to_disk(self, pkg: SoftwarePackage, icon_bytes: Optional[bytes], only_icon: bool):
self.serialize_to_disk(pkg, icon_bytes, only_icon)
def get_screenshots(self, pkg: AppImage) -> List[str]:
if pkg.has_screenshots():
return [pkg.url_screenshot]
return []
def get_screenshots(self, pkg: AppImage) -> Generator[str, None, None]:
if pkg.url_screenshot:
yield pkg.url_screenshot
def clear_data(self, logs: bool = True):
for f in glob.glob(f'{APPIMAGE_SHARED_DIR}/*.db'):