def _str_internal(self):
    """Internal helper function for both __str__ and __repr__."""
    def get_name(thing):
      try:
        return thing.__name__
      except AttributeError:
        return thing.__class__.__name__

    combine_fn_str = get_name(self.combine_fn)
    input_arg = '(%s)' % get_name(self.input_type) if self.input_type else ''
    if combine_fn_str == 'sum' and not input_arg:
      combine_call = ''
    else:
      combine_call = ' %s%s' % (combine_fn_str, input_arg)
    return 'Aggregator %s%s' % (self.name, combine_call)
dataset/ETHPy150Open GoogleCloudPlatform/DataflowPythonSDK/google/cloud/dataflow/transforms/aggregator.py/Aggregator._str_internal/original