Skip to content

Commit

Permalink
🔧 pre-commit autoupdate (#946)
Browse files Browse the repository at this point in the history
chrisjsewell authored Jul 16, 2024
1 parent ad0f24f commit d3d7fbb
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 13 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.4.1
rev: v0.5.2
hooks:
- id: ruff
args: [--fix]
- id: ruff-format

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.9.0
rev: v1.10.1
hooks:
- id: mypy
args: [--config-file=pyproject.toml]
Expand Down
5 changes: 1 addition & 4 deletions myst_parser/_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,7 @@ def field_type(field):
ftypes = (
get_args(field.type) if get_origin(field.type) is Union else [field.type]
)
ctype = " | ".join(
str("None" if ftype == type(None) else ftype) # type: ignore[comparison-overlap]
for ftype in ftypes
)
ctype = " | ".join(str("None" if ftype is None else ftype) for ftype in ftypes)
ctype = " ".join(ctype.splitlines())
ctype = ctype.replace("typing.", "")
ctype = ctype.replace("typing_extensions.", "")
Expand Down
4 changes: 2 additions & 2 deletions myst_parser/inventory.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def load(stream: IO, base_url: str | None = None) -> InventoryType:
elif line == "# Sphinx inventory version 2":
return _load_v2(reader, base_url)
else:
raise ValueError("invalid inventory header: %s" % line)
raise ValueError(f"invalid inventory header: {line}")


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

for line in stream.read_compressed_lines():
# be careful to handle names with embedded spaces correctly
Expand Down
2 changes: 1 addition & 1 deletion myst_parser/mdit_to_docutils/sphinx_.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ def add_math_target(self, node: nodes.math_block) -> nodes.target:
node["docname"] = self.sphinx_env.docname

# create target node
node_id = nodes.make_id("equation-%s" % node["label"])
node_id = nodes.make_id("equation-{}".format(node["label"]))
target = nodes.target("", "", ids=[node_id])
self.document.note_explicit_target(target)
return target
6 changes: 3 additions & 3 deletions myst_parser/parsers/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ def _scan_flow_scalar_non_spaces(
chunks.extend(_scan_flow_scalar_breaks(stream))
else:
raise TokenizeError(
"found unknown escape character %r" % ch,
f"found unknown escape character {ch!r}",
stream.get_position(),
"while scanning a double-quoted scalar",
start_mark,
Expand Down Expand Up @@ -585,7 +585,7 @@ def _scan_block_scalar_indicators(
ch = stream.peek()
if ch not in _CHARS_END_SPACE_NEWLINE:
raise TokenizeError(
"expected chomping or indentation indicators, but found %r" % ch,
f"expected chomping or indentation indicators, but found {ch!r}",
stream.get_position(),
"while scanning a block scalar",
start_mark,
Expand All @@ -605,7 +605,7 @@ def _scan_block_scalar_ignored_line(
ch = stream.peek()
if ch not in _CHARS_END_NEWLINE:
raise TokenizeError(
"expected a comment or a line break, but found %r" % ch,
f"expected a comment or a line break, but found {ch!r}",
stream.get_position(),
"while scanning a block scalar",
start_mark,
Expand Down
2 changes: 1 addition & 1 deletion myst_parser/sphinx_ext/mathjax.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def html_visit_displaymath(self: HTMLTranslator, node: nodes.math_block) -> None
)
if node["number"]:
number = get_node_equation_number(self, node)
self.body.append('<span class="eqno">(%s)' % number)
self.body.append(f'<span class="eqno">({number})')
self.add_permalink_ref(node, _("Permalink to this equation"))
self.body.append("</span>")
prefix, suffix = self.builder.config.mathjax_display
Expand Down

0 comments on commit d3d7fbb

Please sign in to comment.