관리-도구
편집 파일: fix_idioms.cpython-35.opt-2.pyc
���] � @ sg d d l m Z d d l m Z m Z m Z m Z m Z m Z d Z d Z Gd d � d e j � Z d S)� )� fixer_base)�Call�Comma�Name�Node� BlankLine�symsz0(n='!=' | '==' | 'is' | n=comp_op< 'is' 'not' >)z(power< 'type' trailer< '(' x=any ')' > >c sn e Z d Z d Z d e e e e f Z � f d d � Z d d � Z d d � Z d d � Z d d � Z � S) � FixIdiomsTa� isinstance=comparison< %s %s T=any > | isinstance=comparison< T=any %s %s > | while_stmt< 'while' while='1' ':' any+ > | sorted=any< any* simple_stmt< expr_stmt< id1=any '=' power< list='list' trailer< '(' (not arglist<any+>) any ')' > > > '\n' > sort= simple_stmt< power< id2=any trailer< '.' 'sort' > trailer< '(' ')' > > '\n' > next=any* > | sorted=any< any* simple_stmt< expr_stmt< id1=any '=' expr=any > '\n' > sort= simple_stmt< power< id2=any trailer< '.' 'sort' > trailer< '(' ')' > > '\n' > next=any* > c sJ t t | � j | � } | rF d | k rF | d | d k rB | Sd S| S)N�sortedZid1Zid2)�superr �match)�self�node�r)� __class__� �//opt/alt/python35/lib64/python3.5/fix_idioms.pyr O s zFixIdioms.matchc C sd d | k r | j | | � Sd | k r8 | j | | � Sd | k rT | j | | � St d � � d S)N� isinstance�whiler z Invalid match)�transform_isinstance�transform_while�transform_sort�RuntimeError)r r �resultsr r r � transformZ s zFixIdioms.transformc C s� | d j � } | d j � } d | _ d | _ t t d � | t � | g � } d | k r� d | _ t t j t d � | g � } | j | _ | S)N�x�T� � r �n�not)�clone�prefixr r r r r Znot_test)r r r r r Ztestr r r r d s ! zFixIdioms.transform_isinstancec C s* | d } | j t d d | j �� d S)Nr �Truer"