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

@@ -201,7 +201,7 @@ class Aptitude:
query = f"'({'|'.join(f'?exact-name({n})' for n in names)})'"
yield from self.search(query=query, fill_size=fill_size)
def remove(self, packages: Iterable[str], root_password: Optional[str], purge: bool = False) -> SimpleProcess:
def remove(self, packages: Iterable[str], root_password: Optional[str], purge: bool = False) -> SimpleProcess:
return SimpleProcess(cmd=self.gen_remove_cmd(packages, purge).split(' '), shell=True,
root_password=root_password, extra_env=self.vars_fixes, preserve_env=self._preserve_env)

View File

@@ -9,9 +9,9 @@ class DebianConfigManager(YAMLConfigManager):
def get_default_config(self) -> dict:
return {
'suggestions.exp': 24, # hours
'index_apps.exp': 1440, # 24 hours
'sync_pkgs.time': 1440, # 24 hours
'pkg_sources.app': None,
'remove.purge': False
}
'suggestions.exp': 24, # hours
'index_apps.exp': 1440, # 24 hours
'sync_pkgs.time': 1440, # 24 hours
'pkg_sources.app': None,
'remove.purge': False
}

View File

@@ -69,7 +69,7 @@ class DebianPackageManager(SoftwareManager, SettingsController):
for pkg in self.aptitude.search(words):
if fill_config.is_alive():
fill_config.join()
pkg.global_purge = bool(config_.get('remove.purge', False))
if pkg.installed:
pkg.bind_app(self.apps_index.get(pkg.name))
@@ -688,7 +688,7 @@ class DebianPackageManager(SoftwareManager, SettingsController):
try:
self.configman.save_config(config_)
return True, None
except:
except Exception:
return False, [traceback.format_exc()]
def gen_custom_actions(self) -> Generator[CustomSoftwareAction, None, None]:

View File

@@ -53,7 +53,7 @@ class ApplicationIndexer:
try:
timestamp = datetime.fromtimestamp(float(timestamp_str))
except:
except Exception:
self._log.error(f'Could not parse the Debian applications index timestamp: {timestamp_str} '
f'({self._file_timestamp_path})')
traceback.print_exc()

View File

@@ -96,7 +96,7 @@ class DebianSuggestionsDownloader(Thread):
try:
suggestions_timestamp = datetime.fromtimestamp(float(timestamp_str))
except:
except Exception:
self._log.error(f'Could not parse the Debian cached suggestions timestamp: {timestamp_str}')
traceback.print_exc()
return True
@@ -128,14 +128,14 @@ class DebianSuggestionsDownloader(Thread):
try:
with open(self.file_suggestions(), 'w+') as f:
f.write(text)
except:
except Exception:
self._log.error(f"An exception happened while writing the file '{self.file_suggestions()}'")
traceback.print_exc()
try:
with open(self.file_suggestions_timestamp(), 'w+') as f:
f.write(str(timestamp))
except:
except Exception:
self._log.error(f"An exception happened while writing the file '{self.file_suggestions_timestamp()}'")
traceback.print_exc()

View File

@@ -101,7 +101,7 @@ class UpdateApplicationIndex(Thread):
try:
self._indexer.update_index(self._mapping_apps.apps)
except:
except Exception:
finish_msg = self._i18n['error']
self._taskman.update_progress(self._id, 100, finish_msg)
@@ -150,7 +150,7 @@ class SynchronizePackages(Thread):
try:
last_timestamp = datetime.fromtimestamp(float(timestamp_str))
except:
except Exception:
logger.error(f'Could not parse the packages synchronization timestamp: {timestamp_str} '
f'({PACKAGE_SYNC_TIMESTAMP_FILE})')
traceback.print_exc()
@@ -169,7 +169,7 @@ class SynchronizePackages(Thread):
ti = time.time()
self._log.info("Begin: packages synchronization")
self._taskman.update_progress(self._id, 1, None)
handler = ProcessHandler(self._watcher)
updated, _ = handler.handle_simple(self._aptitude.update(self._root_password),
output_handler=self._notify_output)