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.ci] pre-commit autoupdate #1008

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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.8.4
rev: v0.9.2
hooks:
- id: ruff
args: [--fix]
- id: ruff-format

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.14.0
rev: v1.14.1
hooks:
- id: mypy
args: [--config-file=pyproject.toml]
Expand Down
2 changes: 1 addition & 1 deletion myst_parser/_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ def run(self):
:Name: `{name}`
:Description: {content}
:Arguments: {klass.required_arguments} required, {klass.optional_arguments} optional
:Content: {'yes' if klass.has_content else 'no'}
:Content: {"yes" if klass.has_content else "no"}
:Options:
"""
if klass.option_spec:
Expand Down
3 changes: 1 addition & 2 deletions myst_parser/config/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -522,8 +522,7 @@ def merge_file_level(
if "html_meta" in topmatter:
warning(
MystWarnings.MD_TOPMATTER,
"top-level 'html_meta' key is deprecated, "
"place under 'myst' key instead",
"top-level 'html_meta' key is deprecated, place under 'myst' key instead",
)
updates["html_meta"] = topmatter["html_meta"]
if "substitutions" in topmatter:
Expand Down
15 changes: 7 additions & 8 deletions myst_parser/mdit_to_docutils/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -976,8 +976,7 @@ def render_link_path(self, token: SyntaxTreeNode) -> None:
def render_link_project(self, token: SyntaxTreeNode) -> None:
"""Render a link token like `<project:...>`."""
destination = cast(str, token.attrGet("href") or "")
if destination.startswith("project:"):
destination = destination[8:]
destination = destination.removeprefix("project:")
if destination.startswith("#"):
return self.render_link_anchor(token, destination)
self.create_warning(
Expand Down Expand Up @@ -1796,13 +1795,13 @@ def run_directive(
)
return [error_msg]

assert isinstance(
result, list
), f'Directive "{name}" must return a list of nodes.'
assert isinstance(result, list), (
f'Directive "{name}" must return a list of nodes.'
)
for i in range(len(result)):
assert isinstance(
result[i], nodes.Node
), f'Directive "{name}" returned non-Node object (index {i}): {result[i]}'
assert isinstance(result[i], nodes.Node), (
f'Directive "{name}" returned non-Node object (index {i}): {result[i]}'
)
return result

def render_substitution_inline(self, token: SyntaxTreeNode) -> None:
Expand Down
6 changes: 2 additions & 4 deletions myst_parser/mdit_to_docutils/sphinx_.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,7 @@ def _handle_relative_docs(self, destination: str) -> str:

def render_link_project(self, token: SyntaxTreeNode) -> None:
destination = cast(str, token.attrGet("href") or "")
if destination.startswith("project:"):
destination = destination[8:]
destination = destination.removeprefix("project:")
if destination.startswith("#"):
return self.render_link_anchor(token, destination)

Expand Down Expand Up @@ -108,8 +107,7 @@ def render_link_project(self, token: SyntaxTreeNode) -> None:

def render_link_path(self, token: SyntaxTreeNode) -> None:
destination = self.md.normalizeLinkText(cast(str, token.attrGet("href") or ""))
if destination.startswith("path:"):
destination = destination[5:]
destination = destination.removeprefix("path:")
destination = self._handle_relative_docs(destination)
explicit = (token.info != "auto") and (len(token.children or []) > 0)
wrap_node = addnodes.download_reference(
Expand Down
3 changes: 1 addition & 2 deletions myst_parser/mocking.py
Original file line number Diff line number Diff line change
Expand Up @@ -461,8 +461,7 @@ def run(self) -> list[nodes.Element]:
3, ":number-lines: with non-integer start value"
) from err
endline = startline + len(file_content.splitlines())
if file_content.endswith("\n"):
file_content = file_content[:-1]
file_content = file_content.removesuffix("\n")
tokens = NumberLines([([], file_content)], startline, endline)
for classes, value in tokens:
if classes:
Expand Down
6 changes: 3 additions & 3 deletions myst_parser/parsers/docutils_.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@
for i, line in enumerate(inputstring.split("\n")):
if len(line) > document.settings.line_length_limit:
error = document.reporter.error(
f"Line {i+1} exceeds the line-length-limit:"
f"Line {i + 1} exceeds the line-length-limit:"
f" {document.settings.line_length_limit}."
)
document.append(error)
Expand Down Expand Up @@ -479,7 +479,7 @@
So here we override the visit/depart methods to output the correct <h> element
"""
if "level" in node:
self.body.append(self.starttag(node, f'h{node["level"]}', "", CLASS="rubric"))
self.body.append(self.starttag(node, f"h{node['level']}", "", CLASS="rubric"))

Check warning on line 482 in myst_parser/parsers/docutils_.py

View check run for this annotation

Codecov / codecov/patch

myst_parser/parsers/docutils_.py#L482

Added line #L482 was not covered by tests
else:
self.body.append(self.starttag(node, "p", "", CLASS="rubric"))

Expand All @@ -490,7 +490,7 @@
See explanation in `visit_rubric_html`
"""
if "level" in node:
self.body.append(f'</h{node["level"]}>\n')
self.body.append(f"</h{node['level']}>\n")

Check warning on line 493 in myst_parser/parsers/docutils_.py

View check run for this annotation

Codecov / codecov/patch

myst_parser/parsers/docutils_.py#L493

Added line #L493 was not covered by tests
else:
self.body.append("</p>\n")

Expand Down
Loading