diff --git a/docs/conf.py b/docs/conf.py index 28daf74f..ae117657 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -177,7 +177,6 @@ def field_type(field): return ctype class MystNbConfigDirective(_ConfigBase): - required_arguments = 1 option_spec = { "sphinx": directives.flag, @@ -197,7 +196,6 @@ def run(self): text = self.table_header() count = 0 for name, value, field in config.as_triple(): - # filter by sphinx options if "sphinx" in self.options and field.metadata.get("sphinx_exclude"): continue @@ -239,7 +237,6 @@ def run(self): return node.children class MystConfigDirective(_ConfigBase): - option_spec = { "sphinx": directives.flag, } @@ -250,7 +247,6 @@ def run(self): text = self.table_header() count = 0 for name, value, field in config.as_triple(): - # filter by sphinx options if "sphinx" in self.options and field.metadata.get("sphinx_exclude"): continue diff --git a/myst_nb/core/execute/inline.py b/myst_nb/core/execute/inline.py index c1b3b12a..06b53b07 100644 --- a/myst_nb/core/execute/inline.py +++ b/myst_nb/core/execute/inline.py @@ -34,7 +34,6 @@ class NotebookClientInline(NotebookClientBase): """ def start_client(self): - self._tmp_path = None if self.nb_config.execution_in_temp: self._tmp_path = mkdtemp() @@ -114,12 +113,10 @@ def close_client(self, exc_type, exc_val, exc_tb): def code_cell_outputs( self, cell_index: int ) -> tuple[int | None, list[NotebookNode]]: - cells = self.notebook.get("cells", []) # ensure all cells up to and including the requested cell have been executed while (not self._cell_error) and cell_index > self._last_cell_executed: - self._last_cell_executed += 1 try: next_cell = cells[self._last_cell_executed] diff --git a/myst_nb/core/nb_to_tokens.py b/myst_nb/core/nb_to_tokens.py index 89bf8cba..c8e48f03 100644 --- a/myst_nb/core/nb_to_tokens.py +++ b/myst_nb/core/nb_to_tokens.py @@ -37,7 +37,6 @@ def notebook_to_tokens( # (required to collect all reference definitions, before assessing references). block_tokens = [Token("nb_initialise", "", 0, map=[0, 0])] for cell_index, nb_cell in enumerate(notebook.cells): - # skip empty cells if len(nb_cell["source"].strip()) == 0: continue diff --git a/myst_nb/core/read.py b/myst_nb/core/read.py index a9d6c27b..ad011049 100644 --- a/myst_nb/core/read.py +++ b/myst_nb/core/read.py @@ -242,7 +242,6 @@ def _flush_markdown(start_line, token, md_metadata): md_metadata: dict = {} for token in tokens: - nesting_level += token.nesting if nesting_level != 0: diff --git a/myst_nb/core/render.py b/myst_nb/core/render.py index 5a2c04f0..e28b856b 100644 --- a/myst_nb/core/render.py +++ b/myst_nb/core/render.py @@ -192,7 +192,6 @@ def render_nb_cell_code(self: SelfType, token: SyntaxTreeNode) -> None: self.add_line_and_source_path(cell_container, token) with self.current_node_context(cell_container, append=True): - # render the code source code if not remove_input: cell_input = nodes.container( diff --git a/myst_nb/docutils_.py b/myst_nb/docutils_.py index eeac7a32..9738a0f0 100644 --- a/myst_nb/docutils_.py +++ b/myst_nb/docutils_.py @@ -301,7 +301,6 @@ def _render_nb_cell_code_outputs( self.add_line_and_source_path_r(_nodes, token) self.current_node.extend(_nodes) elif output.output_type in ("display_data", "execute_result"): - # Note, this is different to the sphinx implementation, # here we directly select a single output, based on the mime_priority, # as opposed to output all mime types, and select in a post-transform diff --git a/myst_nb/ext/glue/roles.py b/myst_nb/ext/glue/roles.py index 94b96bb6..ee8a5b20 100644 --- a/myst_nb/ext/glue/roles.py +++ b/myst_nb/ext/glue/roles.py @@ -29,7 +29,6 @@ class PasteRoleAny(RoleBase): """ def run(self) -> tuple[list[nodes.Node], list[nodes.system_message]]: - # check if this is a pending reference doc_key = self.text.split("::", 1) if len(doc_key) == 2: diff --git a/myst_nb/sphinx_.py b/myst_nb/sphinx_.py index 588741c0..62bd9a7c 100644 --- a/myst_nb/sphinx_.py +++ b/myst_nb/sphinx_.py @@ -262,7 +262,6 @@ def _render_nb_cell_code_outputs( self.add_line_and_source_path_r(_nodes, token) self.current_node.extend(_nodes) elif output.output_type in ("display_data", "execute_result"): - # Note, this is different to the docutils implementation, # where we directly select a single output, based on the mime_priority. # Here, we do not know the mime priority until we know the output format @@ -504,9 +503,7 @@ class HideInputCells(SphinxPostTransform): formats = ("html",) def run(self, **kwargs): - for node in findall(self.document)(nodes.container): - if ( node.get("nb_element") == "cell_code" and node.get("hide_mode")