Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🔧 pre-commit autoupdate #946

Merged
merged 1 commit into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
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}")

Check warning on line 100 in myst_parser/inventory.py

View check run for this annotation

Codecov / codecov/patch

myst_parser/inventory.py#L100

Added line #L100 was not covered by tests


def _load_v1(stream: InventoryFileReader, base_url: str | None) -> InventoryType:
Expand Down Expand Up @@ -137,7 +137,7 @@
}
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}")

Check warning on line 140 in myst_parser/inventory.py

View check run for this annotation

Codecov / codecov/patch

myst_parser/inventory.py#L140

Added line #L140 was not covered by tests

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