Hacked By AnonymousFox

Current Path : /opt/alt/python36/lib64/python3.6/lib2to3/fixes/__pycache__/
Upload File :
Current File : //opt/alt/python36/lib64/python3.6/lib2to3/fixes/__pycache__/fix_operator.cpython-36.pyc

3

� f�
�@sNdZddlZddlmZddlmZmZmZmZdd�Z	Gdd�dej
�ZdS)	a�Fixer for operator functions.

operator.isCallable(obj)       -> hasattr(obj, '__call__')
operator.sequenceIncludes(obj) -> operator.contains(obj)
operator.isSequenceType(obj)   -> isinstance(obj, collections.Sequence)
operator.isMappingType(obj)    -> isinstance(obj, collections.Mapping)
operator.isNumberType(obj)     -> isinstance(obj, numbers.Number)
operator.repeat(obj, n)        -> operator.mul(obj, n)
operator.irepeat(obj, n)       -> operator.imul(obj, n)
�N)�
fixer_base)�Call�Name�String�touch_importcs�fdd�}|S)Ncs
�|_|S)N)�
invocation)�f)�s��?/opt/alt/python36/lib64/python3.6/lib2to3/fixes/fix_operator.py�decszinvocation.<locals>.decr
)r	rr
)r	rrsrc@s�eZdZdZdZdZdZdeeed�Zdd�Z	e
d	�d
d��Ze
d�d
d��Ze
d�dd��Z
e
d�dd��Ze
d�dd��Ze
d�dd��Ze
d�dd��Zdd�Zd d!�Zd"d#�Zd$S)%�FixOperatorTZprez�
              method=('isCallable'|'sequenceIncludes'
                     |'isSequenceType'|'isMappingType'|'isNumberType'
                     |'repeat'|'irepeat')
              z'(' obj=any ')'z�
              power< module='operator'
                trailer< '.' %(methods)s > trailer< %(obj)s > >
              |
              power< %(methods)s trailer< %(obj)s > >
              )�methods�objcCs"|j||�}|dk	r|||�SdS)N)�
_check_method)�self�node�results�methodr
r
r�	transform+szFixOperator.transformzoperator.contains(%s)cCs|j||d�S)N�contains)�_handle_rename)rrrr
r
r�_sequenceIncludes0szFixOperator._sequenceIncludeszhasattr(%s, '__call__')cCs2|d}|j�td�td�g}ttd�||jd�S)Nrz, z
'__call__'�hasattr)�prefix)�clonerrrr)rrrr�argsr
r
r�_isCallable4szFixOperator._isCallablezoperator.mul(%s)cCs|j||d�S)N�mul)r)rrrr
r
r�_repeat:szFixOperator._repeatzoperator.imul(%s)cCs|j||d�S)N�imul)r)rrrr
r
r�_irepeat>szFixOperator._irepeatz$isinstance(%s, collections.Sequence)cCs|j||dd�S)N�collections�Sequence)�_handle_type2abc)rrrr
r
r�_isSequenceTypeBszFixOperator._isSequenceTypez#isinstance(%s, collections.Mapping)cCs|j||dd�S)Nr"�Mapping)r$)rrrr
r
r�_isMappingTypeFszFixOperator._isMappingTypezisinstance(%s, numbers.Number)cCs|j||dd�S)NZnumbers�Number)r$)rrrr
r
r�
_isNumberTypeJszFixOperator._isNumberTypecCs|dd}||_|j�dS)Nrr)�valueZchanged)rrr�namerr
r
rrNszFixOperator._handle_renamecCsFtd||�|d}|j�tddj||g��g}ttd�||jd�S)Nrz, �.�
isinstance)r)rrr�joinrrr)rrr�module�abcrrr
r
rr$SszFixOperator._handle_type2abccCs\t|d|ddj�}t|tj�rXd|kr0|St|d�f}|j|}|j|d|�dS)N�_rrr/rzYou should use '%s' here.)�getattrr*r-r"�Callable�strrZwarning)rrrr�subZinvocation_strr
r
rrYs
zFixOperator._check_methodN)�__name__�
__module__�__qualname__Z
BM_compatible�orderrr�dictZPATTERNrrrrrr!r%r'r)rr$rr
r
r
rr
s r
)�__doc__r"Zlib2to3rZlib2to3.fixer_utilrrrrrZBaseFixr
r
r
r
r�<module>
s


Hacked By AnonymousFox1.0, Coded By AnonymousFox