
    -hQ                        d dl mZ d dlmZ d dlmZ d dlmZ erd dlm	Z	 dd
Z
ddZddZddZddZddZddZddZddZdS )    )annotations)AST)TYPE_CHECKING)LastNodeError)Iteratornoder   returnstrc                >    | j         j                                        S )zvReturn the kind of an AST node.

    Parameters:
        node: The AST node.

    Returns:
        The node kind.
    )	__class____name__lowerr   s    U/var/www/FlaskApp/flask-venv/lib/python3.11/site-packages/_griffe/agents/nodes/ast.pyast_kindr      s     >"((***    Iterator[AST]c              #    K   | j         D ]}	 t          | |          }n# t          $ r Y  w xY wt          |t                    r| |_        |V  Et          |t                    r%|D ]"}t          |t                    r| |_        |V  #dS )z}Return the children of an AST node.

    Parameters:
        node: The AST node.

    Yields:
        The node children.
    N)_fieldsgetattrAttributeError
isinstancer   parentlist)r   
field_namefieldchilds       r   ast_childrenr      s       l    
	D*--EE 	 	 	H	eS!! 	 ELKKKKt$$ 	     eS))  #'ELKKK   s   
++c              #  N   K   t          | j                  D ]}|| ur|V   dS dS )zReturn the previous siblings of this node, starting from the closest.

    Parameters:
        node: The AST node.

    Yields:
        The previous siblings.
    Nr   r   )r   siblings     r   ast_previous_siblingsr"   2   sH        ,,  $MMMMFF	 r   c              #  X   K   t          | j                  }|D ]}|| u r n	|E d{V  dS )zReturn the next siblings of this node, starting from the closest.

    Parameters:
        node: The AST node.

    Yields:
        The next siblings.
    Nr    r   siblingsr!   s      r   ast_next_siblingsr&   B   sW       DK((H  d??E r   c              #  ^   K   t          | j                  }|D ]}|| ur|V   |E d{V  dS )zvReturn the siblings of this node.

    Parameters:
        node: The AST node.

    Yields:
        The siblings.
    Nr    r$   s      r   ast_siblingsr(   R   s]       DK((H  $MMMMr   c                j    	 t          |           ^ }}n# t          $ r t          d          dw xY w|S )zReturn the previous sibling of this node.

    Parameters:
        node: The AST node.

    Raises:
        LastNodeError: When the node does not have previous siblings.

    Returns:
        The sibling.
    zthere is no previous nodeN)r"   
ValueErrorr   )r   _lasts      r   ast_previousr-   d   sP    C(..DD C C C788dBCKs    0c                x    	 t          t          |                     S # t          $ r t          d          dw xY w)zReturn the next sibling of this node.

    Parameters:
        node: The AST node.

    Raises:
        LastNodeError: When the node does not have next siblings.

    Returns:
        The sibling.
    zthere is no next nodeN)nextr&   StopIterationr   r   s    r   ast_nextr1   w   sJ    ?%d++,,, ? ? ?344$>?s    9c                    	 t          t          |                     S # t          $ r}t          d          |d}~ww xY w)zReturn the first child of this node.

    Parameters:
        node: The AST node.

    Raises:
        LastNodeError: When the node does not have children.

    Returns:
        The child.
    there are no children nodeN)r/   r   r0   r   )r   errors     r   ast_first_childr5      sR    EL&&''' E E E899uDEs    
=8=c                r    	 t          |           ^ }}n"# t          $ r}t          d          |d}~ww xY w|S )zReturn the lasts child of this node.

    Parameters:
        node: The AST node.

    Raises:
        LastNodeError: When the node does not have children.

    Returns:
        The child.
    r3   N)r   r*   r   )r   r+   r,   r4   s       r   ast_last_childr7      sT    E%%DD E E E899uDEKs    
4/4N)r   r   r	   r
   )r   r   r	   r   )r   r   r	   r   )
__future__r   astr   typingr   _griffe.exceptionsr   collections.abcr   r   r   r"   r&   r(   r-   r1   r5   r7    r   r   <module>r>      s+   # " " " " "                   , , , , , , )((((((	+ 	+ 	+ 	+       0           $   &? ? ? ?$E E E E$     r   