MCPcopy Index your code
hub / github.com/MongoEngine/mongoengine / Q

Class Q

mongoengine/queryset/visitor.py:166–189  ·  view source on GitHub ↗

A simple query object, used in a query tree to build up more complex query structures.

Source from the content-addressed store, hash-verified

164
165
166class Q(QNode):
167 """A simple query object, used in a query tree to build up more complex
168 query structures.
169 """
170
171 def __init__(self, **query):
172 self.query = query
173
174 def __repr__(self):
175 return "Q(**%s)" % repr(self.query)
176
177 def __bool__(self):
178 return bool(self.query)
179
180 def __eq__(self, other):
181 return self.__class__ == other.__class__ and self.query == other.query
182
183 def accept(self, visitor):
184 return visitor.visit_query(self)
185
186 @property
187 def empty(self):
188 warn_empty_is_deprecated()
189 return not bool(self.query)

Callers 15

__init__Method · 0.90
__call__Method · 0.90
search_textMethod · 0.90
test_empty_qMethod · 0.90
test_q_with_dbrefMethod · 0.90
test_and_combinationMethod · 0.90
test_or_combinationMethod · 0.90
test_q_cloneMethod · 0.90
test_qMethod · 0.90

Calls

no outgoing calls

Tested by 15

test_empty_qMethod · 0.72
test_q_with_dbrefMethod · 0.72
test_and_combinationMethod · 0.72
test_or_combinationMethod · 0.72
test_q_cloneMethod · 0.72
test_qMethod · 0.72
test_q_regexMethod · 0.72
test_q_reprMethod · 0.72
test_q_listsMethod · 0.72