Skip to content

Commit d3d7fbb

Browse files
authored
🔧 pre-commit autoupdate (#946)
1 parent ad0f24f commit d3d7fbb

File tree

6 files changed

+10
-13
lines changed

6 files changed

+10
-13
lines changed

Diff for: .pre-commit-config.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ repos:
2121
- id: trailing-whitespace
2222

2323
- repo: https://github.com/astral-sh/ruff-pre-commit
24-
rev: v0.4.1
24+
rev: v0.5.2
2525
hooks:
2626
- id: ruff
2727
args: [--fix]
2828
- id: ruff-format
2929

3030
- repo: https://github.com/pre-commit/mirrors-mypy
31-
rev: v1.9.0
31+
rev: v1.10.1
3232
hooks:
3333
- id: mypy
3434
args: [--config-file=pyproject.toml]

Diff for: myst_parser/_docs.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,7 @@ def field_type(field):
9696
ftypes = (
9797
get_args(field.type) if get_origin(field.type) is Union else [field.type]
9898
)
99-
ctype = " | ".join(
100-
str("None" if ftype == type(None) else ftype) # type: ignore[comparison-overlap]
101-
for ftype in ftypes
102-
)
99+
ctype = " | ".join(str("None" if ftype is None else ftype) for ftype in ftypes)
103100
ctype = " ".join(ctype.splitlines())
104101
ctype = ctype.replace("typing.", "")
105102
ctype = ctype.replace("typing_extensions.", "")

Diff for: myst_parser/inventory.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def load(stream: IO, base_url: str | None = None) -> InventoryType:
9797
elif line == "# Sphinx inventory version 2":
9898
return _load_v2(reader, base_url)
9999
else:
100-
raise ValueError("invalid inventory header: %s" % line)
100+
raise ValueError(f"invalid inventory header: {line}")
101101

102102

103103
def _load_v1(stream: InventoryFileReader, base_url: str | None) -> InventoryType:
@@ -137,7 +137,7 @@ def _load_v2(stream: InventoryFileReader, base_url: str | None) -> InventoryType
137137
}
138138
line = stream.readline()
139139
if "zlib" not in line:
140-
raise ValueError("invalid inventory header (not compressed): %s" % line)
140+
raise ValueError(f"invalid inventory header (not compressed): {line}")
141141

142142
for line in stream.read_compressed_lines():
143143
# be careful to handle names with embedded spaces correctly

Diff for: myst_parser/mdit_to_docutils/sphinx_.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ def add_math_target(self, node: nodes.math_block) -> nodes.target:
235235
node["docname"] = self.sphinx_env.docname
236236

237237
# create target node
238-
node_id = nodes.make_id("equation-%s" % node["label"])
238+
node_id = nodes.make_id("equation-{}".format(node["label"]))
239239
target = nodes.target("", "", ids=[node_id])
240240
self.document.note_explicit_target(target)
241241
return target

Diff for: myst_parser/parsers/options.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ def _scan_flow_scalar_non_spaces(
440440
chunks.extend(_scan_flow_scalar_breaks(stream))
441441
else:
442442
raise TokenizeError(
443-
"found unknown escape character %r" % ch,
443+
f"found unknown escape character {ch!r}",
444444
stream.get_position(),
445445
"while scanning a double-quoted scalar",
446446
start_mark,
@@ -585,7 +585,7 @@ def _scan_block_scalar_indicators(
585585
ch = stream.peek()
586586
if ch not in _CHARS_END_SPACE_NEWLINE:
587587
raise TokenizeError(
588-
"expected chomping or indentation indicators, but found %r" % ch,
588+
f"expected chomping or indentation indicators, but found {ch!r}",
589589
stream.get_position(),
590590
"while scanning a block scalar",
591591
start_mark,
@@ -605,7 +605,7 @@ def _scan_block_scalar_ignored_line(
605605
ch = stream.peek()
606606
if ch not in _CHARS_END_NEWLINE:
607607
raise TokenizeError(
608-
"expected a comment or a line break, but found %r" % ch,
608+
f"expected a comment or a line break, but found {ch!r}",
609609
stream.get_position(),
610610
"while scanning a block scalar",
611611
start_mark,

Diff for: myst_parser/sphinx_ext/mathjax.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ def html_visit_displaymath(self: HTMLTranslator, node: nodes.math_block) -> None
106106
)
107107
if node["number"]:
108108
number = get_node_equation_number(self, node)
109-
self.body.append('<span class="eqno">(%s)' % number)
109+
self.body.append(f'<span class="eqno">({number})')
110110
self.add_permalink_ref(node, _("Permalink to this equation"))
111111
self.body.append("</span>")
112112
prefix, suffix = self.builder.config.mathjax_display

0 commit comments

Comments
 (0)