From ddb18aef4b8aa74ddc96e3a544e25652e236a629 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 20 Feb 2023 16:50:49 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- myst_parser/_docs.py | 2 -- myst_parser/config/main.py | 1 - myst_parser/mdit_to_docutils/base.py | 3 --- myst_parser/mdit_to_docutils/html_to_nodes.py | 1 - myst_parser/mocking.py | 1 - tests/test_sphinx/conftest.py | 1 - 6 files changed, 9 deletions(-) diff --git a/myst_parser/_docs.py b/myst_parser/_docs.py index 86544fd4..48b7375d 100644 --- a/myst_parser/_docs.py +++ b/myst_parser/_docs.py @@ -58,7 +58,6 @@ def field_type(field): class MystConfigDirective(_ConfigBase): - option_spec = { "sphinx": directives.flag, "extensions": directives.flag, @@ -71,7 +70,6 @@ def run(self): text = self.table_header() count = 0 for name, value, field in config.as_triple(): - if field.metadata.get("deprecated"): continue diff --git a/myst_parser/config/main.py b/myst_parser/config/main.py index e1bec56d..42be2720 100644 --- a/myst_parser/config/main.py +++ b/myst_parser/config/main.py @@ -514,7 +514,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 93bfc9e8..f4d9f0fc 100644 --- a/myst_parser/mdit_to_docutils/base.py +++ b/myst_parser/mdit_to_docutils/base.py @@ -321,7 +321,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, {}) @@ -846,7 +845,6 @@ def render_heading(self, token: SyntaxTreeNode) -> None: self.document.note_implicit_target(new_section, new_section) if level <= self.md_config.heading_anchors: - # Create an implicit reference slug. # The problem with this reference slug, # is that it might not be in the "normalised" format required by docutils, @@ -1291,7 +1289,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 563711f1..a15bbec8 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/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}")