

def __init__(*args, **kwds):
    "Creates a new instance of this model (a.k.a. an entity).\n\n    The new entity must be written to the datastore using an explicit\n    call to .put().\n\n    Keyword Args:\n      key: Key instance for this model. If key is used, id and parent must\n        be None.\n      id: Key id for this model. If id is used, key must be None.\n      parent: Key instance for the parent model or None for a top-level one.\n        If parent is used, key must be None.\n      namespace: Optional namespace.\n      app: Optional app ID.\n      **kwds: Keyword arguments mapping to properties of this model.\n\n    Note: you cannot define a property named key; the .key attribute\n    always refers to the entity's key.  But you can define properties\n    named id or parent.  Values for the latter cannot be passed\n    through the constructor, but can be assigned to entity attributes\n    after the entity has been created.\n    "
    if (len(args) > 1):
        raise TypeError('Model constructor takes no positional arguments.')
    (self,) = args
    get_arg = self.__get_arg
    key = get_arg(kwds, 'key')
    id = get_arg(kwds, 'id')
    app = get_arg(kwds, 'app')
    namespace = get_arg(kwds, 'namespace')
    parent = get_arg(kwds, 'parent')
    projection = get_arg(kwds, 'projection')
    if (key is not None):
        if ((id is not None) or (parent is not None) or (app is not None) or (namespace is not None)):
            raise datastore_errors.BadArgumentError('Model constructor given key= does not accept id=, app=, namespace=, or parent=.')
        self._key = _validate_key(key, entity=self)
    elif ((id is not None) or (parent is not None) or (app is not None) or (namespace is not None)):
        self._key = Key(self._get_kind(), id, parent=parent, app=app, namespace=namespace)
    self._values = {
        
    }
    self._set_attributes(kwds)
    if projection:
        self._set_projection(projection)

dataset/ETHPy150Open GoogleCloudPlatform/datastore-ndb-python/ndb/model.py Model.__init__/original