

def __getattr__(self, attrname):
    'Dynamically get a subproperty.'
    prop = self._modelclass._properties.get(attrname)
    if ((prop is None) or (prop._code_name != attrname)):
        for prop in self._modelclass._properties.values():
            if (prop._code_name == attrname):
                break
        else:
            prop = None
    if (prop is None):
        raise AttributeError(('Model subclass %s has no attribute %s' % (self._modelclass.__name__, attrname)))
    prop_copy = copy.copy(prop)
    prop_copy._name = ((self._name + '.') + prop_copy._name)
    setattr(self, attrname, prop_copy)
    return prop_copy

dataset/ETHPy150Open GoogleCloudPlatform/datastore-ndb-python/ndb/model.py StructuredProperty.__getattr__/original