From 0675307b1e40355f789c3cbd3e93f8f3109b2f4e Mon Sep 17 00:00:00 2001 From: Mark McDonald Date: Fri, 3 May 2024 09:55:08 +0800 Subject: [PATCH] Support spaces in license headers When running `pyink` (black) on a notebook with a license, it adds a space. We should permit this. --- tools/tensorflow_docs/tools/nbfmt/__main__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/tensorflow_docs/tools/nbfmt/__main__.py b/tools/tensorflow_docs/tools/nbfmt/__main__.py index f09b0c27192..b806d093a25 100644 --- a/tools/tensorflow_docs/tools/nbfmt/__main__.py +++ b/tools/tensorflow_docs/tools/nbfmt/__main__.py @@ -237,7 +237,7 @@ def update_license_cells(data: Dict[str, Any]) -> None: data: object representing a parsed JSON notebook. """ # This pattern in Apache and MIT license boilerplate. - license_re = re.compile(r"#@title.*License") + license_re = re.compile(r"#\s?@title.*License") for idx, cell in enumerate(data["cells"]): src_text = "".join(cell["source"])