flake warnings (#304)

This commit is contained in:
Bruno Cabral
2022-12-12 02:44:27 -08:00
committed by GitHub
parent f10a3f1d1a
commit fb4109bd77
67 changed files with 252 additions and 248 deletions

View File

@@ -317,7 +317,7 @@ class FlatpakManager(SoftwareManager, SettingsController):
if not res:
self.logger.warning("Could not upgrade '{}'".format(req.pkg.id))
return False
except:
except Exception:
watcher.change_substatus('')
self.logger.error("An error occurred while upgrading '{}'".format(req.pkg.id))
traceback.print_exc()
@@ -394,7 +394,7 @@ class FlatpakManager(SoftwareManager, SettingsController):
if res.get(to_date):
try:
res[to_date] = datetime.strptime(res[to_date], DATE_FORMAT)
except:
except Exception:
self.context.logger.error('Could not convert date string {} as {}'.format(res[to_date], DATE_FORMAT))
pass
@@ -437,7 +437,7 @@ class FlatpakManager(SoftwareManager, SettingsController):
watcher.print('Creating dir {}'.format(EXPORTS_PATH))
try:
Path(EXPORTS_PATH).mkdir(parents=True, exist_ok=True)
except:
except Exception:
watcher.print('Error while creating the directory {}'.format(EXPORTS_PATH))
return False
@@ -530,7 +530,7 @@ class FlatpakManager(SoftwareManager, SettingsController):
if fields:
pkg.ref = fields[0]
pkg.branch = fields[1]
except:
except Exception:
traceback.print_exc()
if installed:
@@ -735,7 +735,7 @@ class FlatpakManager(SoftwareManager, SettingsController):
try:
self.configman.save_config(flatpak_config)
return True, None
except:
except Exception:
return False, [traceback.format_exc()]
def get_upgrade_requirements(self, pkgs: List[FlatpakApplication], root_password: Optional[str], watcher: ProcessWatcher) -> UpgradeRequirements:

View File

@@ -81,7 +81,7 @@ def get_version() -> Optional[Version]:
def get_app_info(app_id: str, branch: str, installation: str) -> Optional[str]:
try:
return run_cmd(f'flatpak info {app_id} {branch} --{installation}')
except:
except Exception:
traceback.print_exc()
return ''
@@ -235,7 +235,7 @@ def fill_updates(version: Version, installation: str, res: Dict[str, Set[str]]):
for line in output.split(f'Updating in {installation}:\n')[1].split('\n'):
if not line.startswith('Is this ok'):
res['full'].add('{}/{}'.format(installation, line.split('\t')[0].strip()))
except:
except Exception:
traceback.print_exc()
else:
updates = new_subprocess(('flatpak', 'update', f'--{installation}', '--no-deps')).stdout
@@ -270,7 +270,7 @@ def fill_updates(version: Version, installation: str, res: Dict[str, Set[str]]):
res['full'].add(update_id)
else:
res['full'].add(update_id)
except:
except Exception:
traceback.print_exc()
@@ -293,7 +293,7 @@ def get_app_commits(app_ref: str, origin: str, installation: str, handler: Proce
return
else:
return re.findall(r'Commit+:\s(.+)', output)
except:
except Exception:
raise NoInternetException()
@@ -479,11 +479,11 @@ def map_update_download_size(app_ids: Iterable[str], installation: str, version:
if size and len(size) > 1:
try:
res[related_id[0].strip()] = size_to_byte(size[0], size[1].strip())
except:
except Exception:
traceback.print_exc()
else:
try:
res[related_id[0].strip()] = size_to_byte(size_tuple[0], size_tuple[1].strip())
except:
except Exception:
traceback.print_exc()
return res

View File

@@ -11,7 +11,7 @@ class FlatpakApplication(SoftwarePackage):
def __init__(self, id: str = None, name: str = None, version: str = None, latest_version: str = None,
description: str = None, branch: str = None, arch: str = None, origin: str = None,
runtime: bool = False, ref: str = None, commit: str = None, installation: str = None,
i18n: I18n = None, partial: bool = False, updates_ignored: bool = False, installed: bool = False,
i18n: I18n = None, partial: bool = False, updates_ignored: bool = False, installed: bool = False,
update: bool = False, update_component: bool = False):
super(FlatpakApplication, self).__init__(id=id, name=name, version=version, latest_version=latest_version,
description=description, installed=installed, update=update)
@@ -126,8 +126,8 @@ class FlatpakApplication(SoftwarePackage):
def __eq__(self, other):
if isinstance(other, FlatpakApplication):
return self.id == other.id and self.installation == other.installation and self.branch == other.branch \
and self.runtime == other.runtime and self.partial == other.partial and \
self.update_component == other.update_component
and self.runtime == other.runtime and self.partial == other.partial and \
self.update_component == other.update_component
def __hash__(self) -> int:
hash_sum = 0

View File

@@ -89,7 +89,7 @@ class FlatpakAsyncDataLoader(Thread):
self.persist = self.app.supports_disk_cache()
else:
self.logger.warning("Could not retrieve app data for id '{}'. Server response: {}. Body: {}".format(self.app.id, res.status_code if res else '?', res.content.decode() if res else '?'))
except:
except Exception:
self.logger.error("Could not retrieve app data for id '{}'".format(self.app.id))
traceback.print_exc()