

def __repr__(self):
    'Return an unambiguous string representation of an entity.'
    args = []
    for prop in self._properties.itervalues():
        if prop._has_value(self):
            val = prop._retrieve_value(self)
            if (val is None):
                rep = 'None'
            elif prop._repeated:
                reprs = [prop._value_to_repr(v) for v in self]
                if reprs:
                    reprs[0] = ('[' + reprs[0])
                    reprs[(- 1)] = (reprs[(- 1)] + ']')
                    rep = ', '.join(reprs)
                else:
                    rep = '[]'
            else:
                rep = prop._value_to_repr(val)
            args.append(('%s=%s' % (prop._code_name, rep)))
    args.sort()
    if (self._key is not None):
        args.insert(0, ('key=%r' % self._key))
    if self._projection:
        args.append(('_projection=%r' % (self._projection,)))
    s = ('%s(%s)' % (self.__class__.__name__, ', '.join(args)))
    return s

dataset/ETHPy150Open GoogleCloudPlatform/datastore-ndb-python/ndb/model.py Model.__repr__/VarMisuse@82/120 `val`->`self`