class documentation

class Node:

Known subclasses: django.db.models.query_utils.Q, django.db.models.sql.where.WhereNode

View In Hierarchy

A single internal node in the tree graph. A Node should be viewed as a connection (the root) with the children being either leaf nodes or other Node instances.
Class Method ​_new​_instance No summary
Method __bool__ Return whether or not this node has children.
Method __contains__ Return True if 'other' is a direct child of this instance.
Method __deepcopy__ Undocumented
Method __eq__ Undocumented
Method __hash__ Undocumented
Method __init__ Construct a new Node. If no connector is given, use the default.
Method __len__ Return the number of children this node has.
Method __repr__ Undocumented
Method __str__ Undocumented
Method add Combine this tree and the data represented by data using the connector conn_type. The combine is done by squashing the node other away if possible.
Method negate Negate the sense of the root connector.
Class Variable default Undocumented
Instance Variable children Undocumented
Instance Variable connector Undocumented
Instance Variable negated Undocumented
@classmethod
def _new_instance(cls, children=None, connector=None, negated=False):
Create a new instance of this class when new Nodes (or subclasses) are needed in the internal code in this class. Normally, it just shadows __init__(). However, subclasses with an __init__ signature that aren't an extension of Node.__init__ might need to implement this method to allow a Node to create a new instance of them (if they have any extra setting up to do).
def __bool__(self):
Return whether or not this node has children.
def __contains__(self, other):
Return True if 'other' is a direct child of this instance.
def __deepcopy__(self, memodict):

Undocumented

def __eq__(self, other):

Undocumented

def __hash__(self):

Undocumented

def __init__(self, children=None, connector=None, negated=False):
Construct a new Node. If no connector is given, use the default.
def __len__(self):
Return the number of children this node has.
def __repr__(self):

Undocumented

def __str__(self):

Undocumented

def add(self, data, conn_type):

Combine this tree and the data represented by data using the connector conn_type. The combine is done by squashing the node other away if possible.

This tree (self) will never be pushed to a child node of the combined tree, nor will the connector or negated properties change.

Return a node which can be used in place of data regardless if the node other got squashed or not.

def negate(self):
Negate the sense of the root connector.
default: str =

Undocumented

children =

Undocumented

connector =

Undocumented

negated =

Undocumented