diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9d5ca3ea..93d1c2db 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -31,18 +31,17 @@ repos: - id: isort - repo: https://github.com/psf/black - rev: 22.12.0 + rev: 23.1.0 hooks: - id: black - repo: https://github.com/charliermarsh/ruff-pre-commit - rev: v0.0.218 + rev: v0.0.252 hooks: - id: ruff - args: ["--force-exclude"] - repo: https://github.com/pre-commit/mirrors-mypy - rev: v0.991 + rev: v1.0.1 hooks: - id: mypy args: [--config-file=pyproject.toml] diff --git a/docs/syntax/examples/example.py b/docs/syntax/examples/example.py index 96f37722..0b7508c5 100644 --- a/docs/syntax/examples/example.py +++ b/docs/syntax/examples/example.py @@ -1,5 +1,6 @@ """An example Python file.""" + # start example class MyClass: """An example class.""" diff --git a/myst_parser/config/main.py b/myst_parser/config/main.py index 387131c4..4f3889d2 100644 --- a/myst_parser/config/main.py +++ b/myst_parser/config/main.py @@ -513,7 +513,6 @@ def merge_file_level( # validate each update fields = {name: (value, field) for name, value, field in config.as_triple()} for name, value in updates.items(): - if name not in fields: warning(MystWarnings.MD_TOPMATTER, f"Unknown field: {name}") continue diff --git a/myst_parser/mdit_to_docutils/base.py b/myst_parser/mdit_to_docutils/base.py index 5b893cb6..ed1cdee0 100644 --- a/myst_parser/mdit_to_docutils/base.py +++ b/myst_parser/mdit_to_docutils/base.py @@ -299,7 +299,6 @@ def _render_finalise(self) -> None: # Add the wordcount, generated by the ``mdit_py_plugins.wordcount_plugin``. wordcount_metadata = self.md_env.get("wordcount", {}) if wordcount_metadata: - # save the wordcount to the sphinx BuildEnvironment metadata if self.sphinx_env is not None: meta = self.sphinx_env.metadata.setdefault(self.sphinx_env.docname, {}) @@ -1334,7 +1333,6 @@ def dict_to_fm_field_list( return field_list def render_table(self, token: SyntaxTreeNode) -> None: - # markdown-it table always contains at least a header: assert token.children header = token.children[0] diff --git a/myst_parser/mdit_to_docutils/html_to_nodes.py b/myst_parser/mdit_to_docutils/html_to_nodes.py index 454ca744..e327bbe8 100644 --- a/myst_parser/mdit_to_docutils/html_to_nodes.py +++ b/myst_parser/mdit_to_docutils/html_to_nodes.py @@ -82,7 +82,6 @@ def html_to_nodes( nodes_list = [] for child in root: - if child.name == "img": if "src" not in child.attrs: return [ diff --git a/myst_parser/mocking.py b/myst_parser/mocking.py index d91b9c5e..d56f7429 100644 --- a/myst_parser/mocking.py +++ b/myst_parser/mocking.py @@ -343,7 +343,6 @@ def __init__( self.lineno = lineno def run(self) -> list[nodes.Element]: - from docutils.parsers.rst.directives.body import CodeBlock, NumberLines if not self.document.settings.file_insertion_enabled: diff --git a/myst_parser/parsers/docutils_.py b/myst_parser/parsers/docutils_.py index dfce7856..21043503 100644 --- a/myst_parser/parsers/docutils_.py +++ b/myst_parser/parsers/docutils_.py @@ -329,7 +329,6 @@ def stylesheet_call(self, *args, **kwargs): class SimpleWriter(Writer): - settings_spec = filter_settings_spec( Writer.settings_spec, "template", diff --git a/pyproject.toml b/pyproject.toml index 8f6de6dc..7e6a4fe0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -111,6 +111,7 @@ no_lines_before = "LOCALFOLDER" [tool.ruff] line-length = 100 extend-select = ["B0", "C4", "ICN", "ISC", "N", "RUF", "SIM"] +extend-ignore = ["RUF005"] [tool.mypy] show_error_codes = true diff --git a/tests/test_sphinx/conftest.py b/tests/test_sphinx/conftest.py index 6ce0cb91..0e25b6ce 100644 --- a/tests/test_sphinx/conftest.py +++ b/tests/test_sphinx/conftest.py @@ -65,7 +65,6 @@ def read( regress_ext=".html", replace=None, ): - outpath = path(os.path.join(str(app.srcdir), "_build", buildername, filename)) if not outpath.exists(): raise OSError(f"no output file exists: {outpath}")