This is an automated email from the ASF dual-hosted git repository.

jrmccluskey pushed a commit to branch pydocUpdate
in repository https://gitbox.apache.org/repos/asf/beam.git


The following commit(s) were added to refs/heads/pydocUpdate by this push:
     new 255e6cc42a9 fix edge case
255e6cc42a9 is described below

commit 255e6cc42a9346fd9a7b72a17e1a06a0d3259592
Author: Jack McCluskey <[email protected]>
AuthorDate: Thu Oct 10 16:19:17 2024 -0400

    fix edge case
---
 sdks/python/apache_beam/dataframe/frame_base.py | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/sdks/python/apache_beam/dataframe/frame_base.py 
b/sdks/python/apache_beam/dataframe/frame_base.py
index 90f34d45dd9..3b9755232e8 100644
--- a/sdks/python/apache_beam/dataframe/frame_base.py
+++ b/sdks/python/apache_beam/dataframe/frame_base.py
@@ -606,6 +606,21 @@ def with_docs_from(base_type, name=None, 
removed_method=False):
              "    :skipif: True"),
             re.sub(r"^", "    ", content, flags=re.MULTILINE),
         ])
+      elif "Examples" in content and ">>>" in content:
+        # some new examples don't have the correct heading
+        # this catches those examples
+        split_content = content.split("Examples")
+        content = '\n\n'.join([
+            split_content[0],
+            "Examples\n",
+            # Indent the code snippet under a doctest heading,
+            # add skipif option. This makes sure our doctest
+            # framework doesn't run these pandas tests.
+            (".. doctest::\n"
+             "    :skipif: True"),
+            re.sub(r"^", "    ", content, flags=re.MULTILINE),
+            split_content[1]
+        ])
       else:
         content = content.replace('DataFrame', 'DeferredDataFrame').replace(
             'Series', 'DeferredSeries')

Reply via email to