a
    Ø
þd	  ã                   @   sF   d Z ddlmZ ddlmZ ddlmZ dd„ ZG dd„ dejƒZ	d	S )
zãIdentify containers for lib2to3 trees.

This module identifies containers and the elements in them. Each element points
to the opening bracket and vice-versa.

  IdentifyContainers(): the main function exported by this module.
é    )Útoken)Úpytree_utils)Úpytree_visitorc                 C   s   t ƒ }| | ¡ dS )z™Run the identify containers visitor over the tree, modifying it in place.

  Arguments:
    tree: the top-level pytree node to annotate with subtypes.
  N)Ú_IdentifyContainersÚVisit)ÚtreeZidentify_containers© r   úh/var/www/html/stable-diffusion-webui/venv/lib/python3.9/site-packages/yapf/yapflib/identify_container.pyÚIdentifyContainers   s    r
   c                   @   s    e Zd ZdZdd„ Zdd„ ZdS )r   zH_IdentifyContainers - see file-level docstring for detailed description.c                 C   s    |j D ]}|  |¡ qt|j ƒdkr(d S |j d jtjkr>d S t |j d ¡dkr~|j d j D ]}t t 	|¡|j d ¡ q^nt t 	|j d ¡|j d ¡ d S )Né   r   é   Zarglist)
Úchildrenr   ÚlenÚtypeÚgrammar_tokenÚLPARr   ZNodeNameÚSetOpeningBracketÚFirstLeafNode©ÚselfÚnodeÚchildr   r   r	   ÚVisit_trailer)   s    
ÿÿz!_IdentifyContainers.Visit_trailerc                 C   sl   |j D ]}|  |¡ qt|j ƒdkr(d S |j d jtjkr>d S |j d j D ]}t t |¡|j d ¡ qJd S )Nr   r   r   )	r   r   r   r   r   r   r   r   r   r   r   r   r	   Ú
Visit_atom:   s    
ÿz_IdentifyContainers.Visit_atomN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r   r	   r   &   s   r   N)
r   Z yapf_third_party._ylib2to3.pgen2r   r   Zyapf.pytreer   r   r
   ZPyTreeVisitorr   r   r   r   r	   Ú<module>   s
   
