Skip to content

Commit 2239733

Browse files
committed
Make ruff happy
1 parent 92e72b9 commit 2239733

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/crx_repo/client.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ class UpdateInfo(NamedTuple):
2222
size: int | None
2323
version: str
2424

25+
2526
class ExtensionDownloader:
2627
"""Extension downloader."""
2728
def __init__(
@@ -130,26 +131,27 @@ async def _check_update(
130131
"id": self.extension_id,
131132
}) + "&uc"
132133
}
134+
text = None
133135
async with session.get(
134136
self.CHROME_WEB_STORE_API_BASE,
135137
params=params,
136138
proxy=self.proxy,
137139
) as response:
140+
138141
try:
139142
text = await response.text()
140143
except ClientError as e:
141144
_logger.debug("Failed to get update response because %s.", e)
142-
return None
143145
except asyncio.TimeoutError:
144146
_logger.debug("Failed to get update response because async operation timeout.")
145-
return None
146147
else:
147148
if response.status != HTTPStatus.OK:
148149
_logger.debug(
149150
"Failed to send update check request, it returns `%s`",
150151
text
151152
)
152-
return None
153+
if text is None:
154+
return None
153155

154156
element = fromstring(text)
155157
updatecheck = element.find("./*/{http://www.google.com/update2/response}updatecheck")
@@ -171,7 +173,6 @@ async def _check_update(
171173
return None
172174
return UpdateInfo(url, sha256, size, version)
173175

174-
175176
def _requires_download(self, version: str) -> bool:
176177
current_version = self._get_current_version()
177178
if current_version is None:

0 commit comments

Comments
 (0)