def in_(self, value): """ Finds documents where an attribute is in the given list .. code-block:: python from underverse.model import Document as D # finds all users whose name is either 'Max' or 'Tamara' uv.users.find(D.name.in_(['Max', 'Tamara'])) """ self._desc = "%s in %s" % (self._name, value) self._predicate = P.in_(self._name, value) return self
def in_list(self, value): """ Finds documents where an attribute is in the given **list** .. note:: This predicate calls *list* on the input before it is compared. This can be useful for passing other generators to the predicate. However, if the input value is already a list, just call ``D.in_`` instead. .. code-block:: python from underverse.model import Document as D # finds all users whose name is either 'Max' or 'Tamara' uv.users.find(D.name.in_list(['Max', 'Tamara'])) """ _set = list(value) self._desc = "%s in set(%s)" % (self._name, _set) self._predicate = P.in_(self._name, _set) return self