Plan 9 from Bell Labs’s /usr/web/sources/contrib/jas/root/sys/lib/python2.7/lib2to3/fixes/fix_operator.pyc

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


��Qc@s^dZddlmZddlmZmZmZmZd�Zdej	fd��YZ
dS(s�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)
i�(t
fixer_base(tCalltNametStringttouch_importcs�fd�}|S(Ncs
�|_|S(N(t
invocation(tf(ts(s0/sys/lib/python2.7/lib2to3/fixes/fix_operator.pytdecs	((RR((Rs0/sys/lib/python2.7/lib2to3/fixes/fix_operator.pyRstFixOperatorcBs�eZeZdZdZdZdedede�Zd�Z	e
d�d��Ze
d	�d
��Ze
d�d��Z
e
d
�d��Ze
d�d��Ze
d�d��Ze
d�d��Zd�Zd�Zd�ZRS(tpres�
              method=('isCallable'|'sequenceIncludes'
                     |'isSequenceType'|'isMappingType'|'isNumberType'
                     |'repeat'|'irepeat')
              s'(' obj=any ')'s�
              power< module='operator'
                trailer< '.' %(methods)s > trailer< %(obj)s > >
              |
              power< %(methods)s trailer< %(obj)s > >
              tmethodstobjcCs/|j||�}|dk	r+|||�SdS(N(t
_check_methodtNone(tselftnodetresultstmethod((s0/sys/lib/python2.7/lib2to3/fixes/fix_operator.pyt	transform)ssoperator.contains(%s)cCs|j||d�S(Nucontains(t_handle_rename(RRR((s0/sys/lib/python2.7/lib2to3/fixes/fix_operator.pyt_sequenceIncludes.sshasattr(%s, '__call__')cCsG|d}|j�td�td�g}ttd�|d|j�S(NRu, u
'__call__'uhasattrtprefix(tcloneRRRR(RRRRtargs((s0/sys/lib/python2.7/lib2to3/fixes/fix_operator.pyt_isCallable2s
!soperator.mul(%s)cCs|j||d�S(Numul(R(RRR((s0/sys/lib/python2.7/lib2to3/fixes/fix_operator.pyt_repeat8ssoperator.imul(%s)cCs|j||d�S(Nuimul(R(RRR((s0/sys/lib/python2.7/lib2to3/fixes/fix_operator.pyt_irepeat<ss$isinstance(%s, collections.Sequence)cCs|j||dd�S(NucollectionsuSequence(t_handle_type2abc(RRR((s0/sys/lib/python2.7/lib2to3/fixes/fix_operator.pyt_isSequenceType@ss#isinstance(%s, collections.Mapping)cCs|j||dd�S(NucollectionsuMapping(R(RRR((s0/sys/lib/python2.7/lib2to3/fixes/fix_operator.pyt_isMappingTypeDssisinstance(%s, numbers.Number)cCs|j||dd�S(NunumbersuNumber(R(RRR((s0/sys/lib/python2.7/lib2to3/fixes/fix_operator.pyt
_isNumberTypeHscCs%|dd}||_|j�dS(NRi(tvaluetchanged(RRRtnameR((s0/sys/lib/python2.7/lib2to3/fixes/fix_operator.pyRLs	cCsatd||�|d}|j�tddj||g��g}ttd�|d|j�S(NRu, u.u
isinstanceR(RRRRtjoinRRR(RRRtmoduletabcRR((s0/sys/lib/python2.7/lib2to3/fixes/fix_operator.pyRQs
+cCs�t|d|ddjjd��}t|�r�d|krC|St|d�f}t|j�|}|j|d|�ndS(Nt_RitasciiR$RuYou should use '%s' here.(tgetattrR tencodetcallabletunicodeRtwarningR(RRRRtsubtinvocation_str((s0/sys/lib/python2.7/lib2to3/fixes/fix_operator.pyR
Ws'(t__name__t
__module__tTruet
BM_compatibletorderRRtdicttPATTERNRRRRRRRRRRRR
(((s0/sys/lib/python2.7/lib2to3/fixes/fix_operator.pyR	s 			N(t__doc__tlib2to3Rtlib2to3.fixer_utilRRRRRtBaseFixR	(((s0/sys/lib/python2.7/lib2to3/fixes/fix_operator.pyt<module>
s"	

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.