Skip to content

Commit bdad6ec

Browse files
committed
Formatting
1 parent 2e837fa commit bdad6ec

File tree

2 files changed

+22
-18
lines changed

2 files changed

+22
-18
lines changed

material/plugins/privacy/plugin.py

+11-9
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ def _parse_fragment(self, fragment: str):
259259
# quote, we need to catch this here, as we're using pretty basic
260260
# regular expression based extraction
261261
raise PluginError(
262-
f"Could not parse due to possible syntax error in HTML: \n\n"
262+
"Couldn't parse due to possible syntax error in HTML: \n\n"
263263
+ fragment
264264
)
265265

@@ -413,11 +413,11 @@ def _fetch(self, file: File, config: MkDocsConfig):
413413
try:
414414
res = requests.get(
415415
file.url,
416-
headers={
417-
# Set user agent explicitly, so Google Fonts gives us *.woff2
418-
# files, which according to caniuse.com is the only format we
419-
# need to download as it covers the entire range of browsers
420-
# we're officially supporting.
416+
headers = {
417+
# Set user agent explicitly, so Google Fonts gives us
418+
# *.woff2 files, which according to caniuse.com is the
419+
# only format we need to download as it covers the range
420+
# range of browsers we're officially supporting.
421421
"User-Agent": " ".join(
422422
[
423423
"Mozilla/5.0 (Windows NT 10.0; Win64; x64)",
@@ -429,9 +429,11 @@ def _fetch(self, file: File, config: MkDocsConfig):
429429
timeout=DEFAULT_TIMEOUT_IN_SECS,
430430
)
431431
res.raise_for_status()
432-
except Exception as error: # this could be a ConnectionError or an HTTPError
433-
log.warning(f"Could not retrieve {file.url}: {error}")
434-
return False
432+
433+
# Intercept errors of type `ConnectionError` and `HTTPError`
434+
except Exception as error:
435+
log.warning(f"Couldn't retrieve {file.url}: {error}")
436+
return
435437

436438
# Compute expected file extension and append if missing
437439
mime = res.headers["content-type"].split(";")[0]

src/plugins/privacy/plugin.py

+11-9
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ def _parse_fragment(self, fragment: str):
259259
# quote, we need to catch this here, as we're using pretty basic
260260
# regular expression based extraction
261261
raise PluginError(
262-
f"Could not parse due to possible syntax error in HTML: \n\n"
262+
"Couldn't parse due to possible syntax error in HTML: \n\n"
263263
+ fragment
264264
)
265265

@@ -413,11 +413,11 @@ def _fetch(self, file: File, config: MkDocsConfig):
413413
try:
414414
res = requests.get(
415415
file.url,
416-
headers={
417-
# Set user agent explicitly, so Google Fonts gives us *.woff2
418-
# files, which according to caniuse.com is the only format we
419-
# need to download as it covers the entire range of browsers
420-
# we're officially supporting.
416+
headers = {
417+
# Set user agent explicitly, so Google Fonts gives us
418+
# *.woff2 files, which according to caniuse.com is the
419+
# only format we need to download as it covers the range
420+
# range of browsers we're officially supporting.
421421
"User-Agent": " ".join(
422422
[
423423
"Mozilla/5.0 (Windows NT 10.0; Win64; x64)",
@@ -429,9 +429,11 @@ def _fetch(self, file: File, config: MkDocsConfig):
429429
timeout=DEFAULT_TIMEOUT_IN_SECS,
430430
)
431431
res.raise_for_status()
432-
except Exception as error: # this could be a ConnectionError or an HTTPError
433-
log.warning(f"Could not retrieve {file.url}: {error}")
434-
return False
432+
433+
# Intercept errors of type `ConnectionError` and `HTTPError`
434+
except Exception as error:
435+
log.warning(f"Couldn't retrieve {file.url}: {error}")
436+
return
435437

436438
# Compute expected file extension and append if missing
437439
mime = res.headers["content-type"].split(";")[0]

0 commit comments

Comments
 (0)