U ifb @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)fs?/opt/alt/python38/lib64/python3.8/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)% 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 > > )methodsobjcCs"|||}|dk r|||SdSr) _check_method)selfnoderesultsmethodr r r transform+s zFixOperator.transformzoperator.contains(%s)cCs|||dS)Ncontains_handle_renamerrrr r r _sequenceIncludes0szFixOperator._sequenceIncludesz callable(%s)cCs"|d}ttd|g|jdS)Nrcallableprefix)rrcloner)rrrrr r r _isCallable4szFixOperator._isCallablezoperator.mul(%s)cCs|||dS)Nmulrrr r r _repeat9szFixOperator._repeatzoperator.imul(%s)cCs|||dS)Nimulrrr r r _irepeat=szFixOperator._irepeatz(isinstance(%s, collections.abc.Sequence)cCs|||ddS)Ncollections.abcSequence_handle_type2abcrr r r _isSequenceTypeAszFixOperator._isSequenceTypez'isinstance(%s, collections.abc.Mapping)cCs|||ddS)Nr&Mappingr(rr r r _isMappingTypeEszFixOperator._isMappingTypezisinstance(%s, numbers.Number)cCs|||ddS)NZnumbersNumberr(rr r r _isNumberTypeIszFixOperator._isNumberTypecCs|dd}||_|dS)Nrr)valueZchanged)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|tjjrZd|kr2|St|df}|j|}||d|dS)N_rrr4rzYou should use '%s' here.) getattrr/r2 collectionsr5CallablestrrZwarning)rrrrsubZinvocation_strr r r rXs zFixOperator._check_methodN)__name__ __module__ __qualname__Z BM_compatibleorderrrdictZPATTERNrrrr!r#r%r*r,r.rr)rr r r r rs2        r) __doc__Zcollections.abcr9Zlib2to3rZlib2to3.fixer_utilrrrrrZBaseFixrr r r r s