

@classmethod
def _query(cls, *args, **kwds):
    'Create a Query object for this class.\n\n    Args:\n      distinct: Optional bool, short hand for group_by = projection.\n      *args: Used to apply an initial filter\n      **kwds: are passed to the Query() constructor.\n\n    Returns:\n      A Query object.\n    '
    if ('distinct' in kwds):
        if ('group_by' in kwds):
            raise TypeError('cannot use distinct= and group_by= at the same time')
        projection = kwds.get('projection')
        if (not projection):
            raise TypeError('cannot use distinct= without projection=')
        if kwds.pop('distinct'):
            kwds['group_by'] = projection
    from .query import Query
    qry = Query(kind=cls._get_kind(), **kwds)
    qry = qry.filter(*cls._default_filters())
    qry = qry.filter(*args)
    return qry

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