o bcb @sNdZddlZddlmZddlmZmZmZm Z ddZ Gdddej Z dS) aFixer for operator functions. operator.isCallable(obj) -> callable(obj) operator.sequenceIncludes(obj) -> operator.contains(obj) operator.isSequenceType(obj) -> isinstance(obj, collections.abc.Sequence) operator.isMappingType(obj) -> isinstance(obj, collections.abc.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)CallNameString touch_importcsfdd}|S)Ncs |_|SN) invocation)fs1/usr/lib/python3.10/lib2to3/fixes/fix_operator.pydecszinvocation..decr )r rr r r rs rc@seZdZdZdZdZdZdeeedZddZ e d d d Z e d d dZ e dddZ e dddZe dddZe dddZe dddZddZd d!Zd"d#Zd$S)% FixOperatorTprez 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 > > )methodsobjcCs"|||}|dur|||SdSr) _check_method)selfnoderesultsmethodr r r transform+s  zFixOperator.transformzoperator.contains(%s)cC|||dS)Ncontains_handle_renamerrrr r r _sequenceIncludes0zFixOperator._sequenceIncludesz callable(%s)cCs"|d}ttd|g|jdS)Nrcallableprefix)rrcloner")rrrrr r r _isCallable4szFixOperator._isCallablezoperator.mul(%s)cCr)Nmulrrr r r _repeat9rzFixOperator._repeatzoperator.imul(%s)cCr)Nimulrrr r r _irepeat=rzFixOperator._irepeatz(isinstance(%s, collections.abc.Sequence)cC|||ddS)Ncollections.abcSequence_handle_type2abcrr r r _isSequenceTypeAzFixOperator._isSequenceTypez'isinstance(%s, collections.abc.Mapping)cCr))Nr*Mappingr,rr r r _isMappingTypeEr/zFixOperator._isMappingTypezisinstance(%s, numbers.Number)cCr))NnumbersNumberr,rr r r _isNumberTypeIr/zFixOperator._isNumberTypecCs|dd}||_|dS)Nrr)valuechanged)rrrnamerr r r rMs  zFixOperator._handle_renamecCsFtd|||d}|tdd||gg}ttd||jdS)Nrz, . isinstancer!)rr#rjoinrrr")rrrmoduleabcrargsr r r r-Rs zFixOperator._handle_type2abccCs^t|d|ddj}t|tjjr-d|vr|St|df}|j|}||d|dS)N_rrr;rzYou should use '%s' here.) getattrr5r9 collectionsr<Callablestrrwarning)rrrrsubinvocation_strr r r rXs zFixOperator._check_methodN)__name__ __module__ __qualname__ BM_compatibleorderrrdictPATTERNrrrr$r&r(r.r1r4rr-rr r r r rs4         r) __doc__collections.abcr@lib2to3rlib2to3.fixer_utilrrrrrBaseFixrr r r r s