관리-도구
편집 파일: fix_isinstance.cpython-35.opt-1.pyc
��YfH � @ sC d Z d d l m Z d d l m Z Gd d � d e j � Z d S)a, Fixer that cleans up a tuple argument to isinstance after the tokens in it were fixed. This is mainly used to remove double occurrences of tokens as a leftover of the long -> int / unicode -> str conversion. eg. isinstance(x, (int, long)) -> isinstance(x, (int, int)) -> isinstance(x, int) � )� fixer_base)�tokenc @ s. e Z d Z d Z d Z d Z d d � Z d S)� FixIsinstanceTz� power< 'isinstance' trailer< '(' arglist< any ',' atom< '(' args=testlist_gexp< any+ > ')' > > ')' > > � c C sU t � } | d } | j } g } t | � } x� | D]� \ } } | j t j k r� | j | k r� | t | � d k r� | | d j t j k r� t | � q5 q5 | j | � | j t j k r5 | j | j � q5 W| r� | d j t j k r� | d =t | � d k r7| j } | j | d _ | j | d � n | | d d � <| j � d S)N�args� � ���r )�setZchildren� enumerate�typer �NAME�value�len�COMMA�next�append�add�parent�prefix�replaceZchanged)�selfZnodeZresultsZnames_insertedZtestlistr Znew_args�iterator�idx�argZatom� r �A/opt/alt/python35/lib64/python3.5/lib2to3/fixes/fix_isinstance.py� transform s* !0 zFixIsinstance.transformN)�__name__� __module__�__qualname__Z BM_compatibleZPATTERNZ run_orderr r r r r r s r N)�__doc__� r Z fixer_utilr ZBaseFixr r r r r �<module> s