Fix PyLint: Consider explicitly re-raising

This commit is contained in:
Ivan Kravets committed 2022-07-02 18:37:57 +03:00
1 parent f01cd7570c
commit 19d518fc4c
45 files changed
+136 -138

No files matched your search

+2 -2
View File
@@ -70,7 +70,7 @@ class PackageManagerDownloadMixin(object):
fd = FileDownloader(url)
fd.set_destination(tmp_path)
fd.start(with_progress=with_progress, silent=silent)
except IOError as e:
except IOError as exc:
raise_error = not with_progress
if with_progress:
try:
@@ -86,7 +86,7 @@ class PackageManagerDownloadMixin(object):
fg="red",
)
)
raise e
raise exc
if checksum:
fd.verify(checksum)
os.close(tmp_fd)
+2 -2
View File
@@ -36,9 +36,9 @@ class PackageManagerInstallMixin(object):
try:
with FileUnpacker(src) as fu:
return fu.unpack(dst, with_progress=with_progress)
except IOError as e:
except IOError as exc:
if not with_progress:
raise e
raise exc
with FileUnpacker(src) as fu:
return fu.unpack(dst, with_progress=False)
+2 -2
View File
@@ -56,9 +56,9 @@ class PackageManagerRegistryMixin(object):
),
checksum or pkgfile["checksum"]["sha256"],
)
except Exception as e: # pylint: disable=broad-except
except Exception as exc: # pylint: disable=broad-except
self.log.warning(
click.style("Warning! Package Mirror: %s" % e, fg="yellow")
click.style("Warning! Package Mirror: %s" % exc, fg="yellow")
)
self.log.warning(
click.style("Looking for another mirror...", fg="yellow")
+2 -2
View File
@@ -187,9 +187,9 @@ class BasePackageManager( # pylint: disable=too-many-public-methods,too-many-in
result = ManifestParserFactory.new_from_file(item).as_dict()
self.memcache_set(cache_key, result)
return result
except ManifestException as e:
except ManifestException as exc:
if not PlatformioCLI.in_silence():
self.log.warning(click.style(str(e), fg="yellow"))
self.log.warning(click.style(str(exc), fg="yellow"))
raise MissingPackageManifestError(", ".join(self.manifest_names))
@staticmethod
+1 -1
View File
@@ -156,7 +156,7 @@ def build_contrib_pysite_package(target_dir, with_metadata=True):
raise UserSideException(
"\n\nPlease ensure that the next packages are installed:\n\n"
"sudo apt install python3-dev libffi-dev libssl-dev\n"
)
) from exc
raise exc
# build manifests
+2 -2
View File
@@ -53,9 +53,9 @@ class PlatformPackageManager(BasePackageManager): # pylint: disable=too-many-an
# set logging level for underlying tool manager
p.pm.set_log_level(self.log.getEffectiveLevel())
p.ensure_engine_compatible()
except IncompatiblePlatform as e:
except IncompatiblePlatform as exc:
super().uninstall(pkg, skip_dependencies=True)
raise e
raise exc
if project_env:
p.configure_project_packages(project_env, project_targets)
if not skip_dependencies: