

def value_repr(self, value, top_level=False):
    if (unicode_types and isinstance(value, unicode_types)):
        try:
            value = repr(value.encode('ascii'))
        except UnicodeEncodeError:
            pass
    if isinstance(value, dict):
        if (not value):
            (yield ('none', 'gray'))
            raise StopIteration()
        if (not top_level):
            (yield ('{', None))
        for (i, (key, value)) in enumerate(sorted(value.items())):
            if (i > 0):
                (yield (', ', None))
            (yield (key, 'key'))
            (yield (':', None))
            for output in self.value_repr(value):
                (yield output)
        if (not top_level):
            (yield ('}', None))
    elif isinstance(value, str):
        (yield (value, 'str'))
    elif isinstance(value, bool):
        (yield (str(value), 'bool'))
    elif isinstance(value, int_types):
        (yield (str(value), 'int'))
    else:
        (yield (repr(value), 'red'))

dataset/ETHPy150Open ohmu/poni/poni/listout.py ListOutput.value_repr/original