From 29b226030b0bc0f1d9ef71af1bedd1b4d138e3eb Mon Sep 17 00:00:00 2001 From: Svetak Sundhar Date: Thu, 27 Apr 2023 13:57:56 -0400 Subject: [PATCH] Revert "Revert "Rename _namespace to _get_display_data_namespace" (#26431)" This reverts commit ae9213270d3bafc64e5f72e74f564226e8ddf6ae. --- sdks/python/apache_beam/transforms/display.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/sdks/python/apache_beam/transforms/display.py b/sdks/python/apache_beam/transforms/display.py index cd9de00be246..a8f60a894d6e 100644 --- a/sdks/python/apache_beam/transforms/display.py +++ b/sdks/python/apache_beam/transforms/display.py @@ -58,7 +58,8 @@ class HasDisplayData(object): """ Basic mixin for elements that contain display data. - It implements only the display_data method and a _namespace method. + It implements only the display_data method and a + _get_display_data_namespace method. """ def display_data(self): # type: () -> dict @@ -85,7 +86,7 @@ def display_data(self): """ return {} - def _namespace(self): + def _get_display_data_namespace(self): # type: () -> str return '{}.{}'.format(self.__module__, self.__class__.__name__) @@ -109,7 +110,7 @@ def _populate_items(self, display_data_dict): for key, element in display_data_dict.items(): if isinstance(element, HasDisplayData): subcomponent_display_data = DisplayData( - element._namespace(), element.display_data()) + element._get_display_data_namespace(), element.display_data()) self.items += subcomponent_display_data.items continue @@ -216,7 +217,7 @@ def create_from_options(cls, pipeline_options): for k, v in pipeline_options.display_data().items() } - return cls(pipeline_options._namespace(), items) + return cls(pipeline_options._get_display_data_namespace(), items) @classmethod def create_from(cls, has_display_data): @@ -236,7 +237,9 @@ def create_from(cls, has_display_data): raise ValueError( 'Element of class {}.{} does not subclass HasDisplayData'.format( has_display_data.__module__, has_display_data.__class__.__name__)) - return cls(has_display_data._namespace(), has_display_data.display_data()) + return cls( + has_display_data._get_display_data_namespace(), + has_display_data.display_data()) class DisplayDataItem(object):