From aadb695348de77f4791b7b0f947552ffc6bff02f Mon Sep 17 00:00:00 2001 From: DKPHUONG <82434977+DKER2@users.noreply.github.com> Date: Tue, 1 Oct 2024 07:12:54 +0700 Subject: [PATCH] Fix a bug in _get_function_body_without_inners for module sdks.python.transforms.core (#32591) --- sdks/python/apache_beam/transforms/core.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdks/python/apache_beam/transforms/core.py b/sdks/python/apache_beam/transforms/core.py index c6560ee4357e..e7180bc093b0 100644 --- a/sdks/python/apache_beam/transforms/core.py +++ b/sdks/python/apache_beam/transforms/core.py @@ -1461,7 +1461,7 @@ def partition_for(self, element, num_partitions, *args, **kwargs): def _get_function_body_without_inners(func): source_lines = inspect.getsourcelines(func)[0] - source_lines = dropwhile(lambda x: x.startswith("@"), source_lines) + source_lines = dropwhile(lambda x: x.strip().startswith("@"), source_lines) first_def_line = next(source_lines).strip() if first_def_line.startswith("def "): last_def_line_without_comment = first_def_line.split("#")[0] \