Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 90a753b

Browse filesBrowse files
committed
MAINT: don't format logs in log call.
In particular f-string: There are many reason not to use f-string in logs, - F-strings are eager, so might be slow. So this may affect performance (we can filter before formatting). - prevent structured logging or handler to highlight. - Security (untrusted input can lead to DOS on formatting, https://discuss.python.org/t/safer-logging-methods-for-f-strings-and-new-style-formatting/13802) But also % formatting in a couple of places.
1 parent 66f7956 commit 90a753b
Copy full SHA for 90a753b

File tree

Expand file treeCollapse file tree

5 files changed

+11
-11
lines changed
Filter options
Expand file treeCollapse file tree

5 files changed

+11
-11
lines changed

‎doc/sphinxext/redirect_from.py

Copy file name to clipboardExpand all lines: doc/sphinxext/redirect_from.py
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,10 @@ def _generate_redirects(app, exception):
112112
html = HTML_TEMPLATE.format(v=builder.get_relative_uri(k, v))
113113
if p.is_file():
114114
if p.read_text() != html:
115-
logger.warning(f'A redirect-from directive is trying to '
116-
f'create {p}, but that file already exists '
117-
f'(perhaps you need to run "make clean")')
115+
logger.warning('A redirect-from directive is trying to '
116+
'create %s, but that file already exists '
117+
'(perhaps you need to run "make clean")', p)
118118
else:
119-
logger.info(f'making refresh html file: {k} redirect to {v}')
119+
logger.info('making refresh html file: %s redirect to %s', k, v)
120120
p.parent.mkdir(parents=True, exist_ok=True)
121121
p.write_text(html, encoding='utf-8')

‎lib/matplotlib/_afm.py

Copy file name to clipboardExpand all lines: lib/matplotlib/_afm.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ def _parse_header(fh):
154154
try:
155155
converter = header_converters[key]
156156
except KeyError:
157-
_log.error('Found an unknown keyword in AFM header (was %r)' % key)
157+
_log.error("Found an unknown keyword in AFM header (was %r)", key)
158158
continue
159159
try:
160160
d[key] = converter(val)

‎lib/matplotlib/_mathtext.py

Copy file name to clipboardExpand all lines: lib/matplotlib/_mathtext.py
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,7 @@ def _get_glyph(self, fontname, font_class, sym):
530530
except ValueError:
531531
uniindex = ord('?')
532532
found_symbol = False
533-
_log.warning(f"No TeX to Unicode mapping for {sym!a}.")
533+
_log.warning("No TeX to Unicode mapping for %a.", sym)
534534

535535
fontname, uniindex = self._map_virtual_font(
536536
fontname, font_class, uniindex)
@@ -576,9 +576,9 @@ def _get_glyph(self, fontname, font_class, sym):
576576
if (fontname in ('it', 'regular')
577577
and isinstance(self, StixFonts)):
578578
return self._get_glyph('rm', font_class, sym)
579-
_log.warning(f"Font {new_fontname!r} does not have a glyph "
580-
f"for {sym!a} [U+{uniindex:x}], substituting "
581-
"with a dummy symbol.")
579+
_log.warning("Font %r does not have a glyph "
580+
"for %a [U+%x], substituting "
581+
"with a dummy symbol.", new_fontname, sym, uniindex)
582582
font = self._get_font('rm')
583583
uniindex = 0xA4 # currency char, for lack of anything better
584584
slanted = False

‎lib/matplotlib/backends/backend_webagg_core.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_webagg_core.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ def handle_event(self, event):
266266
return handler(event)
267267

268268
def handle_unknown_event(self, event):
269-
_log.warning(f'Unhandled message type {event["type"]}. {event}')
269+
_log.warning('Unhandled message type %s. %s', event["type"], event)
270270

271271
def handle_ack(self, event):
272272
# Network latency tends to decrease if traffic is flowing

‎lib/matplotlib/font_manager.py

Copy file name to clipboardExpand all lines: lib/matplotlib/font_manager.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -958,7 +958,7 @@ def json_dump(data, filename):
958958
try:
959959
json.dump(data, fh, cls=_JSONEncoder, indent=2)
960960
except OSError as e:
961-
_log.warning(f'Could not save font_manager cache {e}')
961+
_log.warning('Could not save font_manager cache %s', e)
962962

963963

964964
def json_load(filename):

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.