mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-08 05:04:15 +02:00
flake warnings (#304)
This commit is contained in:
@@ -1 +0,0 @@
|
||||
|
||||
|
||||
@@ -107,7 +107,7 @@ class GenericSoftwareManager(SoftwareManager, SettingsController):
|
||||
try:
|
||||
Popen(['timeshift-launcher'], stderr=STDOUT)
|
||||
return True
|
||||
except:
|
||||
except Exception:
|
||||
traceback.print_exc()
|
||||
watcher.show_message(title=self.i18n["error"].capitalize(),
|
||||
body=self.i18n['action.backups.tool_error'].format(bold('Timeshift')),
|
||||
@@ -266,7 +266,7 @@ class GenericSoftwareManager(SoftwareManager, SettingsController):
|
||||
self.logger.info(f'Took {tf - ti:.2f} seconds')
|
||||
return res
|
||||
|
||||
def _add_category(self, pkg: SoftwarePackage, category: str):
|
||||
def _add_category(self, pkg: SoftwarePackage, category: str):
|
||||
if isinstance(pkg.categories, tuple):
|
||||
pkg.categories = tuple((*pkg.categories, category))
|
||||
elif isinstance(pkg.categories, list):
|
||||
@@ -331,7 +331,7 @@ class GenericSoftwareManager(SoftwareManager, SettingsController):
|
||||
disk_loader.join()
|
||||
self._update_post_transaction_status(res)
|
||||
return res
|
||||
except:
|
||||
except Exception:
|
||||
traceback.print_exc()
|
||||
return TransactionResult(success=False, installed=[], removed=[])
|
||||
finally:
|
||||
@@ -352,7 +352,7 @@ class GenericSoftwareManager(SoftwareManager, SettingsController):
|
||||
disk_loader.join()
|
||||
self._update_post_transaction_status(res)
|
||||
return res
|
||||
except:
|
||||
except Exception:
|
||||
traceback.print_exc()
|
||||
return TransactionResult(success=False, installed=[], removed=[])
|
||||
finally:
|
||||
@@ -617,7 +617,7 @@ class GenericSoftwareManager(SoftwareManager, SettingsController):
|
||||
try:
|
||||
clean_app_files(managers=self.managers, logs=False)
|
||||
restart_app()
|
||||
except:
|
||||
except Exception:
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
@@ -114,7 +114,7 @@ class AdaptableFileDownloader(FileDownloader):
|
||||
if size:
|
||||
base_substatus.write(f' ( {size} )')
|
||||
watcher.change_substatus(base_substatus.getvalue())
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
def _get_appropriate_threads_number(self, max_threads: int, known_size: int) -> int:
|
||||
@@ -193,7 +193,7 @@ class AdaptableFileDownloader(FileDownloader):
|
||||
watcher.change_substatus(msg.getvalue())
|
||||
|
||||
success, _ = handler.handle_simple(process)
|
||||
except:
|
||||
except Exception:
|
||||
traceback.print_exc()
|
||||
self._rm_bad_file(file_name, output_path, final_cwd, handler, root_password)
|
||||
|
||||
|
||||
@@ -587,16 +587,17 @@ class GenericSettingsManager(SettingsController):
|
||||
opts=ops_opts,
|
||||
id_='downgrade')
|
||||
|
||||
mode = new_select(label=self.i18n['core.config.backup.mode'],
|
||||
tip=None,
|
||||
value=core_config['backup']['mode'],
|
||||
opts=[
|
||||
(self.i18n['core.config.backup.mode.incremental'], 'incremental',
|
||||
self.i18n['core.config.backup.mode.incremental.tip']),
|
||||
(self.i18n['core.config.backup.mode.only_one'], 'only_one',
|
||||
self.i18n['core.config.backup.mode.only_one.tip'])
|
||||
],
|
||||
id_='mode')
|
||||
mode = new_select(
|
||||
label=self.i18n['core.config.backup.mode'],
|
||||
tip=None,
|
||||
value=core_config['backup']['mode'],
|
||||
opts=[
|
||||
(self.i18n['core.config.backup.mode.incremental'], 'incremental',
|
||||
self.i18n['core.config.backup.mode.incremental.tip']),
|
||||
(self.i18n['core.config.backup.mode.only_one'], 'only_one',
|
||||
self.i18n['core.config.backup.mode.only_one.tip'])
|
||||
],
|
||||
id_='mode')
|
||||
type_ = new_select(label=self.i18n['type'].capitalize(),
|
||||
tip=None,
|
||||
value=core_config['backup']['type'],
|
||||
|
||||
@@ -42,7 +42,7 @@ def check_for_update(logger: logging.Logger, http_client: HttpClient, i18n: I18n
|
||||
Path(notifications_dir).mkdir(parents=True, exist_ok=True)
|
||||
with open(release_file, 'w+') as f:
|
||||
f.write('')
|
||||
except:
|
||||
except Exception:
|
||||
logger.error("An error occurred while trying to create the update notification file: {}".format(release_file))
|
||||
|
||||
if tray:
|
||||
@@ -55,5 +55,5 @@ def check_for_update(logger: logging.Logger, http_client: HttpClient, i18n: I18n
|
||||
logger.warning("No official release found")
|
||||
else:
|
||||
logger.warning("No releases returned from the GitHub API")
|
||||
except:
|
||||
except Exception:
|
||||
logger.error("An error occurred while trying to retrieve the current releases")
|
||||
|
||||
@@ -99,9 +99,9 @@ class PackagesTable(QTableWidget):
|
||||
|
||||
def has_any_settings(self, pkg: PackageView):
|
||||
return pkg.model.has_history() or \
|
||||
pkg.model.can_be_downgraded() or \
|
||||
pkg.model.supports_ignored_updates() or \
|
||||
bool(pkg.model.get_custom_actions())
|
||||
pkg.model.can_be_downgraded() or \
|
||||
pkg.model.supports_ignored_updates() or \
|
||||
bool(pkg.model.get_custom_actions())
|
||||
|
||||
def show_pkg_actions(self, pkg: PackageView):
|
||||
menu_row = QMenu()
|
||||
@@ -123,11 +123,10 @@ class PackagesTable(QTableWidget):
|
||||
if pkg.model.can_be_downgraded():
|
||||
|
||||
def downgrade():
|
||||
if ConfirmationDialog(title=self.i18n['manage_window.apps_table.row.actions.downgrade'],
|
||||
body=self._parag(self.i18n[
|
||||
'manage_window.apps_table.row.actions.downgrade.popup.body'].format(
|
||||
self._bold(str(pkg)))),
|
||||
i18n=self.i18n).ask():
|
||||
if ConfirmationDialog(
|
||||
title=self.i18n['manage_window.apps_table.row.actions.downgrade'],
|
||||
body=self._parag(self.i18n['manage_window.apps_table.row.actions.downgrade.popup.body'].format(self._bold(str(pkg)))),
|
||||
i18n=self.i18n).ask():
|
||||
self.window.begin_downgrade(pkg)
|
||||
|
||||
menu_row.addAction(QCustomMenuAction(parent=menu_row,
|
||||
@@ -414,7 +413,7 @@ class PackagesTable(QTableWidget):
|
||||
elif pkg.model.icon_url:
|
||||
self.icon_cache.add_non_existing(pkg.model.icon_url, {'icon': icon, 'bytes': None})
|
||||
|
||||
except:
|
||||
except Exception:
|
||||
icon = QIcon(pkg.model.get_default_icon_path())
|
||||
|
||||
elif not pkg.model.icon_url:
|
||||
|
||||
@@ -216,7 +216,7 @@ class QtComponentsManager:
|
||||
if state['r'] != self._is_read_only(comp):
|
||||
self._set_read_only(comp, state['r'])
|
||||
|
||||
def restore_group_state(self, group_id: int, state_id: int):
|
||||
def restore_group_state(self, group_id: int, state_id: int):
|
||||
states = self._saved_states.get(state_id)
|
||||
|
||||
if states:
|
||||
@@ -808,7 +808,7 @@ class FormQt(QGroupBox):
|
||||
label, field = self._new_file_chooser(c)
|
||||
self.layout().addRow(label, field)
|
||||
elif isinstance(c, FormComponent):
|
||||
label, field = None, FormQt(c, self.i18n)
|
||||
label, field = None, FormQt(c, self.i18n)
|
||||
self.layout().addRow(field)
|
||||
elif isinstance(c, TwoStateButtonComponent):
|
||||
label, field = self._new_label(c), TwoStateButtonQt(c)
|
||||
@@ -1037,7 +1037,7 @@ class TabGroupQt(QTabWidget):
|
||||
for c in model.tabs:
|
||||
try:
|
||||
icon = QIcon(c.icon_path) if c.icon_path else QIcon()
|
||||
except:
|
||||
except Exception:
|
||||
traceback.print_exc()
|
||||
icon = QIcon()
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ class HistoryDialog(QDialog):
|
||||
|
||||
if current_status:
|
||||
item.setCursor(QCursor(Qt.WhatsThisCursor))
|
||||
item.setProperty('outdated', str(row != 0).lower())
|
||||
item.setProperty('outdated', str(row != 0).lower())
|
||||
|
||||
tip = '{}. {}.'.format(i18n['popup.history.selected.tooltip'], i18n['version.{}'.format('updated'if row == 0 else 'outdated')].capitalize())
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ class ValidatePassword(QThread):
|
||||
if isinstance(self.password, str):
|
||||
try:
|
||||
valid = validate_password(self.password)
|
||||
except:
|
||||
except Exception:
|
||||
traceback.print_exc()
|
||||
valid = False
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ def get_cli_path() -> str:
|
||||
return cli_path
|
||||
else:
|
||||
return shutil.which(CLI_NAME)
|
||||
|
||||
|
||||
|
||||
def list_updates(logger: logging.Logger) -> List[PackageUpdate]:
|
||||
cli_path = get_cli_path()
|
||||
@@ -94,7 +94,7 @@ class UpdateCheck(QThread):
|
||||
self._notify_updates()
|
||||
try:
|
||||
os.remove(TRAY_CHECK_FILE)
|
||||
except:
|
||||
except Exception:
|
||||
traceback.print_exc()
|
||||
else:
|
||||
self.sleep(self.check_interval)
|
||||
|
||||
@@ -48,7 +48,7 @@ class AsyncAction(QThread, ProcessWatcher):
|
||||
signal_root_password = pyqtSignal()
|
||||
signal_progress_control = pyqtSignal(bool)
|
||||
|
||||
def __init__(self, i18n: I18n, root_password: Optional[Tuple[bool, str]] = None):
|
||||
def __init__(self, i18n: I18n, root_password: Optional[Tuple[bool, str]] = None):
|
||||
super(AsyncAction, self).__init__()
|
||||
self.i18n = i18n
|
||||
self.wait_confirmation = False
|
||||
@@ -135,7 +135,7 @@ class AsyncAction(QThread, ProcessWatcher):
|
||||
def _generate_backup(self, app_config: dict, root_password: Optional[str]) -> bool:
|
||||
if app_config['backup']['mode'] not in ('only_one', 'incremental'):
|
||||
self.show_message(title=self.i18n['error'].capitalize(),
|
||||
body='{}: {}'.format(self.i18n['action.backup.invalid_mode'],bold(app_config['backup']['mode'])),
|
||||
body='{}: {}'.format(self.i18n['action.backup.invalid_mode'], bold(app_config['backup']['mode'])),
|
||||
type_=MessageType.ERROR)
|
||||
self.change_substatus('')
|
||||
return False
|
||||
@@ -414,7 +414,7 @@ class UpgradeSelected(AsyncAction):
|
||||
with open(self.SUMMARY_FILE.format(upgrade_id), 'w+') as f:
|
||||
f.write(summary_text.read())
|
||||
|
||||
except:
|
||||
except Exception:
|
||||
traceback.print_exc()
|
||||
|
||||
def _handle_internet_off(self):
|
||||
@@ -592,7 +592,7 @@ class RefreshApps(AsyncAction):
|
||||
refreshed_types = self.pkg_types
|
||||
|
||||
self.notify_finished({'installed': res.installed, 'total': res.total, 'types': refreshed_types})
|
||||
except:
|
||||
except Exception:
|
||||
traceback.print_exc()
|
||||
self.notify_finished({'installed': [], 'total': 0, 'types': set()})
|
||||
finally:
|
||||
@@ -631,7 +631,7 @@ class UninstallPackage(AsyncAction):
|
||||
self.manager.clean_cache_for(p)
|
||||
|
||||
self.notify_finished({'success': res.success, 'removed': res.removed, 'pkg': self.pkg})
|
||||
except:
|
||||
except Exception:
|
||||
traceback.print_exc()
|
||||
self.notify_finished({'success': False, 'removed': None, 'pkg': self.pkg})
|
||||
finally:
|
||||
@@ -948,7 +948,7 @@ class LaunchPackage(AsyncAction):
|
||||
super(LaunchPackage, self).msleep(250)
|
||||
self.manager.launch(self.pkg.model)
|
||||
self.notify_finished(True)
|
||||
except:
|
||||
except Exception:
|
||||
traceback.print_exc()
|
||||
finally:
|
||||
self.notify_finished(False)
|
||||
@@ -1083,7 +1083,7 @@ class SaveTheme(QThread):
|
||||
|
||||
try:
|
||||
configman.save_config(core_config)
|
||||
except:
|
||||
except Exception:
|
||||
traceback.print_exc()
|
||||
|
||||
|
||||
|
||||
@@ -1601,7 +1601,7 @@ class ManageWindow(QWidget):
|
||||
icon = QIcon(action.icon_path)
|
||||
else:
|
||||
icon = QIcon.fromTheme(action.icon_path)
|
||||
except:
|
||||
except Exception:
|
||||
icon = None
|
||||
else:
|
||||
icon = None
|
||||
|
||||
@@ -112,5 +112,5 @@ class DefaultMemoryCacheFactory(MemoryCacheFactory):
|
||||
|
||||
if self.cleaner:
|
||||
self.cleaner.register(instance)
|
||||
|
||||
|
||||
return instance
|
||||
|
||||
@@ -54,7 +54,7 @@ def get_locale_keys(key: str = None, locale_dir: str = resource.get_path('locale
|
||||
|
||||
if current_locale is None or current_locale[0] is None:
|
||||
current_locale = ('en', 'UTF-8')
|
||||
except:
|
||||
except Exception:
|
||||
current_locale = ('en', 'UTF-8')
|
||||
|
||||
else:
|
||||
@@ -83,7 +83,7 @@ def get_locale_keys(key: str = None, locale_dir: str = resource.get_path('locale
|
||||
try:
|
||||
keyval = line_strip.split('=')
|
||||
locale_obj[keyval[0].strip()] = keyval[1].strip()
|
||||
except:
|
||||
except Exception:
|
||||
print("Error decoding i18n line '{}'".format(line))
|
||||
|
||||
return locale_path.split('/')[-1], locale_obj
|
||||
|
||||
@@ -69,7 +69,7 @@ def clean_app_files(managers: List[SoftwareManager], logs: bool = True):
|
||||
shutil.rmtree(path)
|
||||
if logs:
|
||||
print('{}[bauh] Directory {} deleted{}'.format(Fore.YELLOW, path, Fore.RESET))
|
||||
except:
|
||||
except Exception:
|
||||
if logs:
|
||||
print('{}[bauh] An exception has happened when deleting {}{}'.format(Fore.RED, path, Fore.RESET))
|
||||
traceback.print_exc()
|
||||
|
||||
Reference in New Issue
Block a user