MCPcopy
hub / github.com/tortoise/tortoise-orm / __init__

Method __init__

tortoise/expressions.py:275–290  ·  view source on GitHub ↗
(self, *args: Q, join_type: str = AND, **kwargs: Any)

Source from the content-addressed store, hash-verified

273 OR = "OR"
274
275 def __init__(self, *args: Q, join_type: str = AND, **kwargs: Any) -> None:
276 if args and kwargs:
277 newarg = Q(join_type=join_type, **kwargs)
278 args = (newarg,) + args
279 kwargs = {}
280 if not all(isinstance(node, Q) for node in args):
281 raise OperationalError("All ordered arguments must be Q nodes")
282 #: Contains the sub-Q's that this Q is made up of
283 self.children: tuple[Q, ...] = args
284 #: Contains the filters applied to this Q
285 self.filters: dict[str, FilterInfoDict] = kwargs
286 if join_type not in {self.AND, self.OR}:
287 raise OperationalError("join_type must be AND or OR")
288 #: Specifies if this Q does an AND or OR on its children
289 self.join_type = join_type
290 self._is_negated = False
291
292 def __and__(self, other: Q) -> Q:
293 """

Callers

nothing calls this directly

Calls 2

OperationalErrorClass · 0.90
QClass · 0.85

Tested by

no test coverage detected