The agent engineering platform.
Python agentsaiai-agentsanthropicchatgptdeepagentsenterpriseframeworkgeminigenerative-ailangchainlanggraphllmmultiagentopen-sourceopenaipydanticpythonragtypescript
docs: ignore nb echo:false blocks (#21624)
Erick Friisfe8c9d621af9
diff --git a/docs/scripts/notebook_convert.py b/docs/scripts/notebook_convert.pyindex c606c98e03..97f2dca253 100644--- a/docs/scripts/notebook_convert.py+++ b/docs/scripts/notebook_convert.py@@ -7,7 +7,7 @@ from typing import Iterable, Tupleimport nbformatfrom nbconvert.exporters import MarkdownExporter-from nbconvert.preprocessors import Preprocessor, RegexRemovePreprocessor+from nbconvert.preprocessors import Preprocessorclass EscapePreprocessor(Preprocessor):@@ -79,11 +79,30 @@ class ExtractAttachmentsPreprocessor(Preprocessor):return cell, resources+class CustomRegexRemovePreprocessor(Preprocessor):+ def check_conditions(self, cell):+ pattern = re.compile(r"(?s)(?:\s*\Z)|(?:.*#\s*\|\s*output:\s*false.*)")+ rtn = not pattern.match(cell.source)+ if not rtn:+ print("--remove--")+ print(cell.source)+ return False+ else:+ print("--keep--")+ print(cell.source)+ return True++ def preprocess(self, nb, resources):+ nb.cells = [cell for cell in nb.cells if self.check_conditions(cell)]++ return nb, resources++exporter = MarkdownExporter(preprocessors=[EscapePreprocessor,ExtractAttachmentsPreprocessor,- RegexRemovePreprocessor(patterns=[r"^\s*$"]),+ CustomRegexRemovePreprocessor,],template_name="mdoutput",extra_template_basedirs=["./scripts/notebook_convert_templates"],