Server : Apache System : Linux iad1-shared-b8-43 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64 User : dh_edsupp ( 6597262) PHP Version : 8.2.26 Disable Function : NONE Directory : /lib/python3/dist-packages/django/utils/__pycache__/ |
Upload File : |
o 3�a6 � @ s* d Z ddlZddlmZ G dd� d�ZdS )zT A class for storing a tree graph. Primarily used for filter constructs in the ORM. � N)� make_hashablec @ s~ e Zd ZdZdZddd�Zeddd��Zd d � Zdd� Z d d� Z dd� Zdd� Zdd� Z dd� Zdd� Zddd�Zdd� ZdS ) �Nodez� 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. �DEFAULTNFc C s, |r|dd� ng | _ |p| j| _|| _dS )z@Construct a new Node. If no connector is given, use the default.N)�children�default� connector�negated)�selfr r r � r �3/usr/lib/python3/dist-packages/django/utils/tree.py�__init__ s z Node.__init__c C s t |||�}| |_|S )a� 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). )r � __class__)�clsr r r �objr r r � _new_instance s zNode._new_instancec C s. | j rdnd}|| jd�dd� | jD ��f S )Nz(NOT (%s: %s))z(%s: %s)z, c s s � | ]}t |�V qd S �N)�str)�.0�cr r r � <genexpr>- s � zNode.__str__.<locals>.<genexpr>)r r �joinr )r �templater r r �__str__+ s zNode.__str__c C s d| j j| f S )Nz<%s: %s>)r �__name__�r r r r �__repr__/ s z Node.__repr__c C s, t | j| jd�}| j|_t�| j|�|_|S )N)r r )r r r r �copy�deepcopyr )r �memodictr r r r �__deepcopy__2 s zNode.__deepcopy__c C � t | j�S )z,Return the number of children this node has.)�lenr r r r r �__len__8 � zNode.__len__c C r )z-Return whether or not this node has children.)�boolr r r r r �__bool__<