
    ?d	                     \    d Z ddlmZ ddlmZ ddlmZ d Z G d dej                        Z	y)	zIdentify 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                 :    t               }|j                  |        y)zRun 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)treeidentify_containerss     A/usr/lib/python3/dist-packages/yapf/yapflib/identify_container.pyIdentifyContainersr      s     ,-D!    c                       e Zd ZdZd Zd Zy)r   zH_IdentifyContainers - see file-level docstring for detailed description.c                 J   |j                   D ]  }| j                  |        t        |j                         dk7  ry |j                   d   j                  t        j
                  k7  ry t        j                  |j                   d         dk(  rU|j                   d   j                   D ]8  }t        j                  t        j                  |      |j                   d          : y t        j                  t        j                  |j                   d         |j                   d          y )N   r      arglist)
childrenr   lentypegrammar_tokenLPARr   NodeNameSetOpeningBracketFirstLeafNodeselfnodechilds      r   Visit_trailerz!_IdentifyContainers.Visit_trailer)   s     
jj 4==Q}}Q 2 22T]]1-.);==#,, A%&&&&u-t}}Q/?	AA $$

$
$T]]1%5
6a8HJr   c                 x   |j                   D ]  }| j                  |        t        |j                         dk7  ry |j                   d   j                  t        j
                  k7  ry |j                   d   j                   D ]8  }t        j                  t        j                  |      |j                   d          : y )Nr   r   r   )	r   r   r   r   r   r   r   r   r   r   s      r   
Visit_atomz_IdentifyContainers.Visit_atom:   s     
jj 4==Q}}Q 2 22q!** ?$$

$
$U
+T]]1-=??r   N)__name__
__module____qualname____doc__r   r!    r   r   r   r   &   s    PJ"?r   r   N)
r%   lib2to3.pgen2r   r   yapf.pytreer   r   r   PyTreeVisitorr   r&   r   r   <module>r*      s,    1 $ &"?.66 ?r   