
    Æe	                         d dl Z d dlZd dl  d dlmZ 	 d dl mZ ddZd Z G d de j                         Zd Zd Zy# e$ r2 ej                  dk  sJ ed ed      de	de
dededed	 ed
      diZY Yw xY w)    N)*)
fscommands)_const_node_type_names      NameConstantNumStrBytes.Ellipsisc                 ~   t        | t              rt        j                  |       } d| v r"| j	                  dd      j	                  dd      } | j                  d      s| dz  } 	 t        j                  | g|d|i|S # t        t        f$ r/}t               }d|_        ||_        t        |      |_        |d }~ww xY w)N   s   
   
filename   )
isinstancestrr   unicode_to_file_datareplaceendswithastparse	TypeError
ValueErrorSyntaxErrorlinenor   msg)sourcer   argskwargseerrors         //usr/lib/python3/dist-packages/rope/base/ast.pyr   r      s    &#008/77uE??5!%yyDTD(DVDDz" !F	s   #A> >B<*B77B<c                 f     ||       }|s't        j                  |       D ]  }t        ||        yy)a  
    Pre-order depth-first traversal of AST nodes, calling `callback(node)` for
    each node visited.

    When each node is visited, `callback(node)` will be called with the visited
    `node`, then its children node will be visited.

    If `callback(node)` returns `True` for a node, then the descendants of that
    node will not be visited.

    See _ResultChecker._find_node for an example.
    N)r   iter_child_nodescall_for_nodes)nodecallbackresultchilds       r$   r'   r'   *   s9     d^F))$/ 	,E5(+	,     c                       e Zd Zd Zy)RopeNodeVisitorc                 r    d|j                   j                  z   }t        | || j                        } ||      S )zMModified from ast.NodeVisitor to match rope's existing Visitor implementation_)	__class____name__getattrgeneric_visit)selfr(   methodvisitors       r$   visitzRopeNodeVisitor.visit>   s4    t~~...$(:(:;t}r,   N)r2   
__module____qualname__r8    r,   r$   r.   r.   =   s    r,   r.   c                     t         j                  dk\  sJ d       t        | t        j                        sJ t
        t        | j                           S )zGet pre-3.8 ast node namer   z2This should only be called in Python 3.8 and above)sysversion_infor   r   Constantr   typevaluer(   s    r$   get_const_subtype_namerC   E   sF     v%['[[%dCLL)))!$tzz"233r,   c                 x    t        | t        j                        rt        |       S | j                  j
                  S )N)r   r   r?   rC   r1   r2   rB   s    r$   get_node_type_namerE   N   s5     dCLL) 	t$ ^^$$r,   )z<string>)r   r=   	rope.baser   r   ImportErrorr>   boolr@   intfloatcomplexr   bytesr   r'   NodeVisitorr.   rC   rE   r;   r,   r$   <module>rN      s    
 
   * ",&coo 4I  f$$$nT
NUuUwS	:	s   > 4A54A5