HEX
Server: LiteSpeed
System: Linux php-prod-1.spaceapp.ru 5.15.0-157-generic #167-Ubuntu SMP Wed Sep 17 21:35:53 UTC 2025 x86_64
User: xnsbb3110 (1041)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //usr/local/CyberPanel/lib64/python3.10/site-packages/django/utils/__pycache__/tree.cpython-310.pyc
o

�h*�@s*dZddlZddlmZGdd�d�ZdS)zT
A class for storing a tree graph. Primarily used for filter constructs in the
ORM.
�N)�
make_hashablec@s�eZdZdZdZddd�Zeddd��Zd	d
�Zdd�Z	d
d�Z
e
Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�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.
    �DEFAULTNFcCs,|r|dd�ng|_|p|j|_||_dS)z@Construct a new Node. If no connector is given, use the default.N)�children�default�	connector�negated)�selfrrr�r
�G/usr/local/CyberPanel/lib/python3.10/site-packages/django/utils/tree.py�__init__s
z
Node.__init__cCst||p|j|�}||_|S)a
        Create a new instance using Node() instead of __init__() as some
        subclasses, e.g. django.db.models.query_utils.Q, may implement a custom
        __init__() with a signature that conflicts with the one defined in
        Node.__init__().
        )rr�	__class__)�clsrrr�objr
r
r�createszNode.createcCs.|jrdnd}||jd�dd�|jD��fS)Nz(NOT (%s: %s))z(%s: %s)z, css�|]}t|�VqdS�N)�str)�.0�cr
r
r�	<genexpr>*s�zNode.__str__.<locals>.<genexpr>)rr�joinr)r	�templater
r
r�__str__(s zNode.__str__cCsd|jj|fS)Nz<%s: %s>)r
�__name__�r	r
r
r�__repr__,sz
Node.__repr__cCs|j|j|jd�}|j|_|S�N)rr)rrrr)r	rr
r
r�__copy__/sz
Node.__copy__cCs&|j|j|jd�}t�|j|�|_|Sr)rrr�copy�deepcopyr)r	�memodictrr
r
r�__deepcopy__6szNode.__deepcopy__cC�
t|j�S)z,Return the number of children this node has.)�lenrrr
r
r�__len__;�
zNode.__len__cCr")z-Return whether or not this node has children.)�boolrrr
r
r�__bool__?r%z
Node.__bool__cCs
||jvS)z:Return True if 'other' is a direct child of this instance.)r�r	�otherr
r
r�__contains__Cr%zNode.__contains__cCs0|j|jko|j|jko|j|jko|j|jkSr)r
rrrr(r
r
r�__eq__Gs
�
�
�zNode.__eq__cCs t|j|j|jgt|j��R�Sr)�hashr
rrrrrr
r
r�__hash__Os���z
Node.__hash__cCsn|j|kr|��}||_||g|_|St|t�r/|js/|j|ks&t|�dkr/|j�|j�|S|j�|�|S)a�
        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.
        �)	rrr�
isinstancerrr#�extend�append)r	�data�	conn_typerr
r
r�addYs

��zNode.addcCs|j|_dS)z'Negate the sense of the root connector.N)rrr
r
r�negate|szNode.negate)NNF)r�
__module__�__qualname__�__doc__rr�classmethodrrrrrr!r$r'r*r+r-r4r5r
r
r
rrs$

#r)r8r�django.utils.hashablerrr
r
r
r�<module>s