mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-09 06:24:15 +02:00
[api] improvement: list_suggestions as an optional method (SoftwareManager)
This commit is contained in:
@@ -360,8 +360,7 @@ class SoftwareManager(ABC):
|
|||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@abstractmethod
|
def list_suggestions(self, limit: int, filter_installed: bool) -> Optional[List[PackageSuggestion]]:
|
||||||
def list_suggestions(self, limit: int, filter_installed: bool) -> List[PackageSuggestion]:
|
|
||||||
"""
|
"""
|
||||||
:param limit: max suggestions to be returned. If limit < 0, it should not be considered
|
:param limit: max suggestions to be returned. If limit < 0, it should not be considered
|
||||||
:param filter_installed: if the installed suggestions should not be retrieved
|
:param filter_installed: if the installed suggestions should not be retrieved
|
||||||
|
|||||||
@@ -767,7 +767,7 @@ class AppImageManager(SoftwareManager, SettingsController):
|
|||||||
if not dbfiles or len({f for f in (DATABASE_APPS_FILE, DATABASE_RELEASES_FILE) if f in dbfiles}) != 2:
|
if not dbfiles or len({f for f in (DATABASE_APPS_FILE, DATABASE_RELEASES_FILE) if f in dbfiles}) != 2:
|
||||||
return [self.i18n['appimage.warning.missing_db_files'].format(appimage=bold('AppImage'))]
|
return [self.i18n['appimage.warning.missing_db_files'].format(appimage=bold('AppImage'))]
|
||||||
|
|
||||||
def list_suggestions(self, limit: int, filter_installed: bool) -> List[PackageSuggestion]:
|
def list_suggestions(self, limit: int, filter_installed: bool) -> Optional[List[PackageSuggestion]]:
|
||||||
res = []
|
res = []
|
||||||
|
|
||||||
connection = self._get_db_connection(DATABASE_APPS_FILE)
|
connection = self._get_db_connection(DATABASE_APPS_FILE)
|
||||||
|
|||||||
@@ -2797,7 +2797,7 @@ class ArchManager(SoftwareManager, SettingsController):
|
|||||||
if not git.is_installed():
|
if not git.is_installed():
|
||||||
return [self.i18n['arch.warning.aur_missing_dep'].format(bold('git'))]
|
return [self.i18n['arch.warning.aur_missing_dep'].format(bold('git'))]
|
||||||
|
|
||||||
def list_suggestions(self, limit: int, filter_installed: bool) -> List[PackageSuggestion]:
|
def list_suggestions(self, limit: int, filter_installed: bool) -> Optional[List[PackageSuggestion]]:
|
||||||
self.logger.info("Downloading suggestions file {}".format(SUGGESTIONS_FILE))
|
self.logger.info("Downloading suggestions file {}".format(SUGGESTIONS_FILE))
|
||||||
file = self.http_client.get(SUGGESTIONS_FILE)
|
file = self.http_client.get(SUGGESTIONS_FILE)
|
||||||
|
|
||||||
|
|||||||
@@ -521,7 +521,7 @@ class DebianPackageManager(SoftwareManager, SettingsController):
|
|||||||
if suggestions:
|
if suggestions:
|
||||||
output.update(suggestions)
|
output.update(suggestions)
|
||||||
|
|
||||||
def list_suggestions(self, limit: int, filter_installed: bool) -> List[PackageSuggestion]:
|
def list_suggestions(self, limit: int, filter_installed: bool) -> Optional[List[PackageSuggestion]]:
|
||||||
name_priority = dict()
|
name_priority = dict()
|
||||||
|
|
||||||
fill_suggestions = Thread(target=self._fill_suggestions, args=(name_priority,))
|
fill_suggestions = Thread(target=self._fill_suggestions, args=(name_priority,))
|
||||||
|
|||||||
@@ -537,7 +537,7 @@ class FlatpakManager(SoftwareManager, SettingsController):
|
|||||||
def list_warnings(self, internet_available: bool) -> Optional[List[str]]:
|
def list_warnings(self, internet_available: bool) -> Optional[List[str]]:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def list_suggestions(self, limit: int, filter_installed: bool) -> List[PackageSuggestion]:
|
def list_suggestions(self, limit: int, filter_installed: bool) -> Optional[List[PackageSuggestion]]:
|
||||||
cli_version = flatpak.get_version()
|
cli_version = flatpak.get_version()
|
||||||
res = []
|
res = []
|
||||||
|
|
||||||
|
|||||||
@@ -361,7 +361,7 @@ class SnapManager(SoftwareManager, SettingsController):
|
|||||||
app.status = PackageStatus.READY
|
app.status = PackageStatus.READY
|
||||||
return app
|
return app
|
||||||
|
|
||||||
def list_suggestions(self, limit: int, filter_installed: bool) -> List[PackageSuggestion]:
|
def list_suggestions(self, limit: int, filter_installed: bool) -> Optional[List[PackageSuggestion]]:
|
||||||
res = []
|
res = []
|
||||||
|
|
||||||
if snapd.is_running():
|
if snapd.is_running():
|
||||||
|
|||||||
@@ -1023,7 +1023,7 @@ class WebApplicationManager(SoftwareManager, SettingsController):
|
|||||||
def _fill_config_async(self, output: dict):
|
def _fill_config_async(self, output: dict):
|
||||||
output.update(self.configman.get_config())
|
output.update(self.configman.get_config())
|
||||||
|
|
||||||
def list_suggestions(self, limit: int, filter_installed: bool) -> List[PackageSuggestion]:
|
def list_suggestions(self, limit: int, filter_installed: bool) -> Optional[List[PackageSuggestion]]:
|
||||||
web_config = {}
|
web_config = {}
|
||||||
|
|
||||||
thread_config = Thread(target=self._fill_config_async, args=(web_config,))
|
thread_config = Thread(target=self._fill_config_async, args=(web_config,))
|
||||||
|
|||||||
Reference in New Issue
Block a user