Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions sdks/python/apache_beam/transforms/display.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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__)

Expand All @@ -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

Expand Down Expand Up @@ -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):
Expand All @@ -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):
Expand Down