Skip to content

Commit 09bea01

Browse files
committed
Make ruff happy
1 parent 4cfce3e commit 09bea01

File tree

1 file changed

+25
-15
lines changed

1 file changed

+25
-15
lines changed

src/crx_repo/client.py

+25-15
Original file line numberDiff line numberDiff line change
@@ -105,21 +105,31 @@ async def _do_download(self):
105105
_logger.error("Failed to build because async operation timeout.")
106106
_logger.debug("Checking checksums of extension %s...", self.extension_id)
107107
sha256_hash = hash_calculator.hexdigest()
108-
if update.sha256 is not None and sha256_hash != update.sha256:
109-
_logger.error(
110-
"SHA256 checksum of %s mismatch. Removing file.",
111-
self.extension_id,
112-
)
113-
extension_path.unlink()
114-
else:
115-
if update.sha256 is None:
116-
_logger.warning("No sha256 is provied for this extension file, still keeping file.")
117-
else:
118-
_logger.info(
119-
"SHA256 checksum of %s match. Keeping file.",
120-
self.extension_id,
121-
)
122-
_ = extension_path.rename(extension_path.parent / extension_path.stem)
108+
self._after_extension_downloaded(update, sha256_hash, extension_path)
109+
110+
def _after_extension_downloaded(
111+
self,
112+
update: UpdateInfo,
113+
sha256_hash: str,
114+
extension_path: Path,
115+
):
116+
if update.sha256 is not None and sha256_hash != update.sha256:
117+
_logger.error(
118+
"SHA256 checksum of %s mismatch. Removing file.",
119+
self.extension_id,
120+
)
121+
extension_path.unlink()
122+
else:
123+
if update.sha256 is None:
124+
_logger.warning(
125+
"No sha256 is provied for this extension file, still keeping file."
126+
)
127+
else:
128+
_logger.info(
129+
"SHA256 checksum of %s match. Keeping file.",
130+
self.extension_id,
131+
)
132+
_ = extension_path.rename(extension_path.parent / extension_path.stem)
123133

124134
async def _check_update(
125135
self,

0 commit comments

Comments
 (0)