PKJŸC8‚< ½7½7protocols/advice.pyc;ò µÆBc @sqdklZdklZdklZlZlZdkZdddddd d d d d ddg Z d„Z ydk l Z Wne j o eZ nXee fZ ed„Zed„Zydkl Z lZlZWne j onXd„Zd„Zded„Zd„Zded„Zed„Zd„ZdklZdefd„ƒYZd„ZdS( (s generators(sinstancemethod(s ClassTypes FunctionTypes InstanceTypeNsaddClassAdvisorsisClassAdvisors metamethods supermetas minimalBasessdetermineMetaclasss getFrameInfosgetMROs classicMROsmkRefs StrongRefsadd_assignment_advisorcst‡d†ƒSdS(sEWrapper for metaclass method that might be confused w/instance methodcsˆi||iƒS(N(sfuncs__get__sobs __class__(sob(sfunc(s4build/bdist.darwin-8.0.1-x86/egg/protocols/advice.pyssN(sproperty(sfunc((sfuncs4build/bdist.darwin-8.0.1-x86/egg/protocols/advice.pys metamethod s(sExtensionClassccs…g}|i}|i}|d|ƒxF|o>|ƒ}|Vt|ƒ}x|iD]}|||ƒqRWq(W|o t Vt VndS(Ni( sstacksinsertspushspopsobsclsslensps __bases__sbsextendedClassics InstanceTypesobject(sobsextendedClassicsbspopspspushsstackscls((s4build/bdist.darwin-8.0.1-x86/egg/protocols/advice.pys classicMRO*s      cCsGt|tƒot||ƒSnt|tƒo |iSn|fSdS(N(s isinstancesobs ClassicTypess classicMROsextendedClassicstypes__mro__(sobsextendedClassic((s4build/bdist.darwin-8.0.1-x86/egg/protocols/advice.pysgetMRO9s  (s metamethodsgetMROs classicMROcsÖtˆƒ}|i‰ˆˆjoˆ}|i‰ntˆƒ‰x\ˆD]B}|ˆjo/gi}ˆD]}||i ƒqi~‰PqHqHWt d|ˆƒ‚tˆƒ‰dt f‡‡‡d†ƒY}|ƒSdS(NsNot sub/supertypes:stheSupercstZ‡‡‡d†ZRS(Ncstx]ˆD]U}||joB||}y |i}Wntj o |Sq\X|ˆˆƒSqqWti ||ƒSdS(N( smrosdsnamesdescrs__get__sAttributeErrorsobstypsobjects__getattribute__sself(sselfsnamesdescrsd(stypsobsmro(s4build/bdist.darwin-8.0.1-x86/egg/protocols/advice.pys__getattribute__is    (s__name__s __module__s__getattribute__((sobsmrostyp(s4build/bdist.darwin-8.0.1-x86/egg/protocols/advice.pystheSupergs(stypesobs starttypes__mro__smrostypsitersclssappends_[1]s__dict__s TypeErrorsobjectstheSuper(stypsobstheSupers_[1]smros starttypescls((stypsobsmros4build/bdist.darwin-8.0.1-x86/egg/protocols/advice.pys supermetaUs      *  c Cs!|i}|i}||j}d|j}d|j}|o|}|o|d|dj}|otii |dƒpt }|o |i |j}| o#d} |o| o d} q nK|o| o d} n2|o| o d} n| o d} nd} | |||fSdS( s„Return (kind,module,locals,globals) for a frame 'kind' is one of "exec", "module", "class", "function call", or "unknown". s __module__s__name__sexecsclasssmodules function callsunknownN(sframesf_localss f_globalss sameNamespaces hasModuleshasNamessameNamessyssmodulessgetsNonesmodules__dict__snamespaceIsModuleskind( sframes sameNamespacesnamespaceIsModules f_globalssmodulessameNames hasModulesf_localsshasNameskind((s4build/bdist.darwin-8.0.1-x86/egg/protocols/advice.pys getFrameInfo|s,      $   ic sž|p ti|ƒ}t|ƒ\}}}}|djot dƒ‚n|i dƒ‰|i dt ƒ‰‡‡‡d†} ˆ| _ ˆ| _| |d}|iidfƒ}||jo||d|ƒSq q WdS(Ns__protocols_provided__i(sgetMROsselfsclss__dict__sgetsconfsprotocol(sselfsprotocolsconfscls((s5build/bdist.darwin-8.0.1-x86/egg/protocols/classic.pys __conform__Js   ( s__name__s __module__s__doc__sadvises IOpenProvidersIImplicationListenersNO_ADAPTER_NEEDEDsdeclareProvidess metamethodsnewProtocolImplieds __conform__(((s5build/bdist.darwin-8.0.1-x86/egg/protocols/classic.pys ProviderMixin*s    sconformsRegistrycBsStZdZd„Zed„Zd„Zd„Zed„Z d„Z d„Z RS(sBHelper type for objects and classes that need registration supportcCsD||jo3|iƒ}|tj o||d|ƒSq@ndS(Ni(sprotocolsselfssubjectsNone(sselfsprotocolssubject((s5build/bdist.darwin-8.0.1-x86/egg/protocols/classic.pys__call__Ws   cCs‹x„t|ƒD]v}|iidƒ}|tjoq nt|tƒ ot d||ƒ‚n||jo||d|ƒSq q WdS(Ns __conform__s&Incompatible __conform__ in base classi( sgetMROssubjectsclss__dict__sgetsconfsNones isinstancesconformsRegistrys TypeErrorsprotocol(sselfssubjectsprotocols checkSelfsconfscls((s5build/bdist.darwin-8.0.1-x86/egg/protocols/classic.pysfindImplementationcs   cCsk|iƒ}|tjp ||jodSn||\}}t|||ƒ}t|||||ƒdS(N( sselfssubjectsNonessrcProtos baseAdaptersdscomposeAdapterssadaptersdeclareAdapterForObjects destProtosdepth(sselfssrcProtos destProtosadaptersdepthsds baseAdapterssubject((s5build/bdist.darwin-8.0.1-x86/egg/protocols/classic.pysnewProtocolImplied|s  cCst|ƒSdS(N(sidsself(sself((s5build/bdist.darwin-8.0.1-x86/egg/protocols/classic.pys__hash__‹scCs:|tj otdƒ‚nt|i|t|ƒƒSdS(Ns/__conform__ registry does not pass to instances(sobsNonesAttributeErrorsinstancemethodsselfsfindImplementationstypstype(sselfsobstyp((s5build/bdist.darwin-8.0.1-x86/egg/protocols/classic.pys__get__‘s cCs|iƒ|iƒfSdS(N(sselfssubjectsitems(sself((s5build/bdist.darwin-8.0.1-x86/egg/protocols/classic.pys __getstate__™scCs<|\}}|iƒ|it|ƒƒt|ƒ|_dS(N(ssubjectsitemssselfsclearsupdatesdictsmkRef(sselfs.2ssubjectsitems((s5build/bdist.darwin-8.0.1-x86/egg/protocols/classic.pys __setstate__œs  ( s__name__s __module__s__doc__s__call__sTruesfindImplementationsnewProtocolImplieds__hash__sNones__get__s __getstate__s __setstate__(((s5build/bdist.darwin-8.0.1-x86/egg/protocols/classic.pysconformsRegistrySs      sMiscObjectsAsOpenProviderc BsWtZdZedegdeeeee e gƒd„Z e dd„Z d„ZRS(sCSupply __conform__ registry for funcs, modules, & classic instancessinstancesProvidesasAdapterForTypescCstt|ƒƒ}x°|D]¨}yI|iidƒ}|tjo ||gjot |dtƒ}nWn"t j ot d|ƒ‚nX|tj ot |t ƒ ot d||ƒ‚qqW|iidƒ}|tjo|i|ƒ}|_n||_||_dS(Ns __conform__s3Only objects with dictionaries can use this adapters*Incompatible __conform__ on adapted object(slistsgetMROsobsobssitems__dict__sgetsregsNonesgetattrsAttributeErrors TypeErrors isinstancesconformsRegistrysselfs newRegistrys __conform__(sselfsobsregsitemsobs((s5build/bdist.darwin-8.0.1-x86/egg/protocols/classic.pys__init__±s"  icCs>t|i|||ƒo!t|tƒi|iƒt SndS(N( supdateWithSimplestAdaptersselfsregsprotocolsadaptersdepthsadapts IOpenProtocolsaddImplicationListenersTrue(sselfsprotocolsadaptersdepth((s5build/bdist.darwin-8.0.1-x86/egg/protocols/classic.pysdeclareProvidesÎscCs tƒ}t|ƒ|_|SdS(N(sconformsRegistrysregsmkRefssubject(sselfssubjectsreg((s5build/bdist.darwin-8.0.1-x86/egg/protocols/classic.pys newRegistryÓs (s__name__s __module__s__doc__sadvises IOpenProviders FunctionTypes ModuleTypes InstanceTypes ClassTypestypesobjects__init__sNO_ADAPTER_NEEDEDsdeclareProvidess newRegistry(((s5build/bdist.darwin-8.0.1-x86/egg/protocols/classic.pysMiscObjectsAsOpenProvider¥s   N(s__doc__s__all__stypess FunctionTypes ModuleTypes InstanceTypes ClassTypesadapterssapisdeclareImplementationsadvisesdeclareAdapterForObjectsadapts interfacessnewsinstancemethodsadvicesgetMROs metamethodsmkRefs ProviderMixinsdictsconformsRegistrysobjectsMiscObjectsAsOpenProvider(sdeclareAdapterForObjects__all__s ClassTypes metamethodsconformsRegistrysinstancemethodsgetMROsMiscObjectsAsOpenProviders ProviderMixinsadaptsmkRefsdeclareImplementations ModuleTypes FunctionTypes InstanceTypesadvise((s5build/bdist.darwin-8.0.1-x86/egg/protocols/classic.pys?s  )RPKIŸC8 gH-protocols/zope_support.pyc;ò µÆBc@s dZgZdklZdkTdklZlZlZdk l Z l Z dk l Z lZydkiZWnej ogZeZn`Xd„ZydklZWn"ej oeeii_nXeieƒeiigZ[d ee fd „ƒYZdS( s'Declaration support for Zope Interfaces(s ClassType(s*(sdeclareImplementationsadvisesadapt(s IOpenProtocolsProtocol(s metamethods supermetaNcCst|tƒi|ƒSdS(N(sadaptsselfs IOpenProtocols __adapt__sobj(sselfsobj((s:build/bdist.darwin-8.0.1-x86/egg/protocols/zope_support.pys __adapt__s(s adapter_hookssZopeInterfaceAsProtocolcBs“tZedegdeƒefZd„Zd„Zedd„Z e e ƒZ edd„Z e e ƒZ d„Z d „Z d „Zd „ZRS( NsinstancesProvidesasAdapterForTypescCs!ti||ƒti|ƒdS(N(s StickyAdapters__init__sselfsobsProtocol(sselfsob((s:build/bdist.darwin-8.0.1-x86/egg/protocols/zope_support.pys__init__6scCs5|ii|ƒo|Sntt|ƒi|ƒSdS(N(sselfssubjectsisImplementedBysobjs supermetasZopeInterfaceAsProtocols __adapt__(sselfsobj((s:build/bdist.darwin-8.0.1-x86/egg/protocols/zope_support.pys __adapt__;sicCs¨|tjoti||iƒne|tjoWtigi }ti |ƒD]}||i ƒqN~ƒ|i}ti||ƒntt|ƒi|||ƒSdS(N(sadaptersNO_ADAPTER_NEEDEDszisclassImplementssklasssselfssubjectsDOES_NOT_SUPPORTs Declarationsappends_[1]s implementedBysis__iro__sifacessclassImplementsOnlys supermetasZopeInterfaceAsProtocolsregisterImplementationsdepth(sselfsklasssadaptersdepthsifacessis_[1]((s:build/bdist.darwin-8.0.1-x86/egg/protocols/zope_support.pysregisterImplementationAs   CcCsu|tjoti||iƒn2|tjo$ti|ti|ƒ|iƒnt t |ƒi |||ƒSdS(N( sadaptersNO_ADAPTER_NEEDEDszisdirectlyProvidessobsselfssubjectsDOES_NOT_SUPPORTsdirectlyProvidedBys supermetasZopeInterfaceAsProtocolsregisterObjectsdepth(sselfsobsadaptersdepth((s:build/bdist.darwin-8.0.1-x86/egg/protocols/zope_support.pysregisterObjectSs   $cCsntt|ƒiƒ}t|ƒgi}|ii D]0}|t i j o||t dffƒq2q2~SdS(Ni(ssupersZopeInterfaceAsProtocolsselfsgetImpliedProtocolssprotosslistsappends_[1]ssubjects __bases__siszis InterfacesNO_ADAPTER_NEEDED(sselfsis_[1]sprotos((s:build/bdist.darwin-8.0.1-x86/egg/protocols/zope_support.pysgetImpliedProtocolsbscCs%|iiƒ}|d=|d=|SdS(Ns_Protocol__locks_Protocol__listeners(sselfs__dict__scopysstate(sselfsstate((s:build/bdist.darwin-8.0.1-x86/egg/protocols/zope_support.pys __getstate__jscCst|iƒSdS(N(shashsselfssubject(sself((s:build/bdist.darwin-8.0.1-x86/egg/protocols/zope_support.pys__hash__pscCst|i|ƒSdS(N(scmpsselfssubjectsother(sselfsother((s:build/bdist.darwin-8.0.1-x86/egg/protocols/zope_support.pys__cmp__ss(s__name__s __module__sadvises IOpenProtocolsZopeInterfaceTypessattachToProtocolss__init__s __adapt__sNO_ADAPTER_NEEDEDsregisterImplementations metamethodsregisterObjectsgetImpliedProtocolss __getstate__s__hash__s__cmp__(((s:build/bdist.darwin-8.0.1-x86/egg/protocols/zope_support.pysZopeInterfaceAsProtocol,s          (s__doc__s__all__stypess ClassTypesadapterssapisdeclareImplementationsadvisesadapts interfacess IOpenProtocolsProtocolsadvices metamethods supermetaszope.interfaces interfaceszis ImportErrorsZopeInterfaceTypessNones __adapt__s adapter_hookss Interfaces __class__sappends StickyAdaptersZopeInterfaceAsProtocol(sProtocolszis__all__s ClassTypes metamethodsZopeInterfaceTypess __adapt__sadapts adapter_hookssdeclareImplementationsadvises supermetas IOpenProtocolsZopeInterfaceAsProtocol((s:build/bdist.darwin-8.0.1-x86/egg/protocols/zope_support.pys?s(    PKKŸC80†ŸÓ::protocols/_speedups.pyo;ò .c¦Gc@sd„atƒdS(cCsGdk}dk}dk}|itdƒabb|ittƒdS(Ns _speedups.so( ssyss pkg_resourcessimpsresource_filenames__name__s__file__s __bootstrap__s __loader__s load_dynamic(s pkg_resourcesssyssimp((s7build/bdist.darwin-8.0.1-x86/egg/protocols/_speedups.pys __bootstrap__s N(s __bootstrap__(((s7build/bdist.darwin-8.0.1-x86/egg/protocols/_speedups.pys?s PKKŸC80†ŸÓ::protocols/_speedups.pyc;ò .c¦Gc@sd„atƒdS(cCsGdk}dk}dk}|itdƒabb|ittƒdS(Ns _speedups.so( ssyss pkg_resourcessimpsresource_filenames__name__s__file__s __bootstrap__s __loader__s load_dynamic(s pkg_resourcesssyssimp((s7build/bdist.darwin-8.0.1-x86/egg/protocols/_speedups.pys __bootstrap__s N(s __bootstrap__(((s7build/bdist.darwin-8.0.1-x86/egg/protocols/_speedups.pys?s PKKŸC8ºÜèÉO&O&protocols/generate.pyo;ò µÆBc @s\dZdklZlZlZdklZlZdkl Z l Z dkl Z l Z dk lZdddd d d d d dg Zd efd„ƒYZd efd„ƒYZd eefd„ƒYZdefd„ƒYZd efd„ƒYZe edegdeegƒd„ZeƒZhZd„Zfed„Zd„Zd„ZdS(sCAutogenerated protocols from type+method names, URI, sequence, etc.(sProtocols allocate_locks Interface(s metamethods supermeta(sdeclareAdapterForProtocolsdeclareAdapterForType(sdeclareAdaptersadapt(sNO_ADAPTER_NEEDEDsprotocolForTypesprotocolForURIs sequenceOfsIBasicSequences URIProtocols TypeSubsets WeakSubsetsADAPT_SEQUENCEsSequenceProtocolcBs)tZdZd„Zd„Zd„ZRS(sEProtocol representing a URI, UUID, or other unique textual identifiercCs||_ti|ƒdS(N(surisselfsURIsProtocols__init__(sselfsuri((s6build/bdist.darwin-8.0.1-x86/egg/protocols/generate.pys__init__s cCsd|iSdS(NsURIProtocol(%r)(sselfsURI(sself((s6build/bdist.darwin-8.0.1-x86/egg/protocols/generate.pys__repr__scCst|iffSdS(N(sprotocolForURIsselfsURI(sself((s6build/bdist.darwin-8.0.1-x86/egg/protocols/generate.pys __reduce__s(s__name__s __module__s__doc__s__init__s__repr__s __reduce__(((s6build/bdist.darwin-8.0.1-x86/egg/protocols/generate.pys URIProtocols   cBs)tZdZd„Zd„Zd„ZRS(s2Protocol representing some set of a type's methodscCs#||_||_ti|ƒdS(N(sbaseTypesselfsmethodssProtocols__init__(sselfsbaseTypesmethods((s6build/bdist.darwin-8.0.1-x86/egg/protocols/generate.pys__init__.s  cCsd|i|ifSdS(NsTypeSubset(%r,%r)(sselfsbaseTypesmethods(sself((s6build/bdist.darwin-8.0.1-x86/egg/protocols/generate.pys__repr__3scCst|i|itffSdS(N(sprotocolForTypesselfsbaseTypesmethodssFalse(sself((s6build/bdist.darwin-8.0.1-x86/egg/protocols/generate.pys __reduce__6s(s__name__s __module__s__doc__s__init__s__repr__s __reduce__(((s6build/bdist.darwin-8.0.1-x86/egg/protocols/generate.pys TypeSubset*s   cBs;tZdZeZd„ZeeƒZd„Zd„ZRS(s<TypeSubset that accepts any object with the right attributescCsbtt|ƒi|ƒ}|tj o|Snx.|iD]}t ||ƒ otSq7q7W|SdS(N( s supermetas TypeSubsetsselfs __adapt__sobsresultsNonesmethodssnameshasattr(sselfsobsnamesresult((s6build/bdist.darwin-8.0.1-x86/egg/protocols/generate.pys __adapt__Ys   cCsd|i|ifSdS(NsWeakSubset(%r,%r)(sselfsbaseTypesmethods(sself((s6build/bdist.darwin-8.0.1-x86/egg/protocols/generate.pys__repr__iscCst|i|itffSdS(N(sprotocolForTypesselfsbaseTypesmethodssTrue(sself((s6build/bdist.darwin-8.0.1-x86/egg/protocols/generate.pys __reduce__ls( s__name__s __module__s__doc__stypes __metaclass__s __adapt__s metamethods__repr__s __reduce__(((s6build/bdist.darwin-8.0.1-x86/egg/protocols/generate.pys WeakSubsetSs   cBs)tZdZd„Zd„Zd„ZRS(s8Protocol representing a "sequence of" some base protocolcCs||_ti|ƒdS(N(s baseProtocolsselfsProtocols__init__(sselfs baseProtocol((s6build/bdist.darwin-8.0.1-x86/egg/protocols/generate.pys__init__€s cCsd|iSdS(NssequenceOf(%r)(sselfs baseProtocol(sself((s6build/bdist.darwin-8.0.1-x86/egg/protocols/generate.pys__repr__„scCst|iffSdS(N(s sequenceOfsselfs baseProtocol(sself((s6build/bdist.darwin-8.0.1-x86/egg/protocols/generate.pys __reduce__‡s(s__name__s __module__s__doc__s__init__s__repr__s __reduce__(((s6build/bdist.darwin-8.0.1-x86/egg/protocols/generate.pysSequenceProtocol|s   cBstZdZd„ZRS(s$Non-string, iterable object sequencecCsdS(s$Return an iterator over the sequenceN((((s6build/bdist.darwin-8.0.1-x86/egg/protocols/generate.pys__iter__s(s__name__s __module__s__doc__s__iter__(((s6build/bdist.darwin-8.0.1-x86/egg/protocols/generate.pysIBasicSequence‹s sprovidessforTypescCsetƒ}g}|i}xB|D]:}t|||ƒ}||jotSn|i |ƒqW|SdS(s?Convert iterable 'ob' into list of objects implementing 'proto'N( sobjectsmarkersoutsprotos baseProtocolsobsitemsadaptsNonesappend(sobsprotositemsmarkersout((s6build/bdist.darwin-8.0.1-x86/egg/protocols/generate.pysADAPT_SEQUENCE¥s   cCsZtiƒz>y t|SWn+tj ot|ƒ}t|<|SnXWdtiƒXdS(sBReturn a unique protocol object representing the supplied URI/UUIDN(s__registryLocksacquiresregistrysurisKeyErrors URIProtocolsprotosrelease(surisproto((s6build/bdist.darwin-8.0.1-x86/egg/protocols/generate.pysprotocolForURIÓs   cCsntgi}|D]}|||fƒq~ƒiƒ}|iƒt|ƒ}||| f}t |ƒSdS(sEReturn a protocol representing a subset of methods of a specific typeN( sdictsappends_[1]smethodsskskeysssortstuplesbaseTypesimplicitskeys__protocolForType(sbaseTypesmethodssimplicitsks_[1]skey((s6build/bdist.darwin-8.0.1-x86/egg/protocols/generate.pysprotocolForTypeâs 9  cs|t|f}tiƒzTy t|SWnAtj o5t|ƒ‰t|sN( s sequenceOfs baseProtocolskeys__registryLocksacquiresregistrysKeyErrorsSequenceProtocolsprotosdeclareAdapterForProtocolsIBasicSequencesrelease(s baseProtocolsprotoskey((sprotos6build/bdist.darwin-8.0.1-x86/egg/protocols/generate.pys sequenceOf÷s    c CsStiƒzhy t|SWnUtj oI|\}}}|ot||ƒ}nt ||ƒ}|t|N( s__doc__s interfacessProtocols allocate_locks Interfacesadvices metamethods supermetasapisdeclareAdapterForProtocolsdeclareAdapterForTypesdeclareAdaptersadaptsadapterssNO_ADAPTER_NEEDEDs__all__s URIProtocols TypeSubsetsobjects WeakSubsetsSequenceProtocolsIBasicSequencesliststuplesADAPT_SEQUENCEs__registryLocksregistrysprotocolForURIsFalsesprotocolForTypes sequenceOfs__protocolForType(sdeclareAdapterForTypes__registryLocks sequenceOfs__all__s metamethodsdeclareAdapterForProtocolsprotocolForTypes TypeSubsetsadapts InterfacesADAPT_SEQUENCEsSequenceProtocolsIBasicSequences WeakSubsetsprotocolForURIsdeclareAdaptersregistrys__protocolForTypesProtocols allocate_locksNO_ADAPTER_NEEDEDs supermetas URIProtocol((s6build/bdist.darwin-8.0.1-x86/egg/protocols/generate.pys?s* !))  )   )PKÜ\â2d»)àyyprotocols/__init__.py"""Trivial Interfaces and Adaptation""" from api import * from adapters import NO_ADAPTER_NEEDED,DOES_NOT_SUPPORT,Adapter,StickyAdapter from adapters import AdaptationFailure from interfaces import * from advice import metamethod, supermeta from classic import ProviderMixin from generate import protocolForType, protocolForURI from generate import sequenceOf, IBasicSequence PKIŸC8dqK~~protocols/adapters.pyc;ò µÆBc @s,dZddddddddd g Zd klZlZlZyeWn)ej od efd „ƒYZnXde e fd „ƒYZ e d„Z e d„Zydkl Z lZWnej onXdefd„ƒYZdefd„ƒYZddd„Zd„Zd„Zd„ZdS(s%Basic Adapters and Adapter OperationssNO_ADAPTER_NEEDEDsDOES_NOT_SUPPORTsAdaptersminimumAdapterscomposeAdapterssupdateWithSimplestAdapters StickyAdaptersAdaptationFailures bindAdapter(s FunctionTypes ClassTypes MethodTypesPendingDeprecationWarningcBstZdZRS(sNBase class for warnings about features which will be deprecated in the future.(s__name__s __module__s__doc__(((s6build/bdist.darwin-8.0.1-x86/egg/protocols/adapters.pysPendingDeprecationWarnings cBstZdZRS(s4A suitable implementation/adapter could not be found(s__name__s __module__s__doc__(((s6build/bdist.darwin-8.0.1-x86/egg/protocols/adapters.pysAdaptationFailures cCs|SdS(s+Assume 'obj' implements 'protocol' directlyN(sobj(sobjsprotocol((s6build/bdist.darwin-8.0.1-x86/egg/protocols/adapters.pysNO_ADAPTER_NEEDEDscCstSdS(s(Prevent 'obj' from supporting 'protocol'N(sNone(sobjsprotocol((s6build/bdist.darwin-8.0.1-x86/egg/protocols/adapters.pysDOES_NOT_SUPPORTs(sNO_ADAPTER_NEEDEDsDOES_NOT_SUPPORTcBstZdZd„ZRS(s"Convenient base class for adapterscCs ||_dS(N(sobsselfssubject(sselfsob((s6build/bdist.darwin-8.0.1-x86/egg/protocols/adapters.pys__init__.s(s__name__s __module__s__doc__s__init__(((s6build/bdist.darwin-8.0.1-x86/egg/protocols/adapters.pysAdapter*s cBstZdZfZd„ZRS(s<Adapter that attaches itself to its subject for repeated usecsE|ˆ_tˆiƒ}dkl}|‡d†|d|gƒdS(N(sdeclareAdaptercsˆS(N(sself(ss(sself(s6build/bdist.darwin-8.0.1-x86/egg/protocols/adapters.pysBss forObjects(sobsselfssubjectslistsattachForProtocolssprovidess protocols.apisdeclareAdapter(sselfsobsdeclareAdaptersprovides((sselfs6build/bdist.darwin-8.0.1-x86/egg/protocols/adapters.pys__init__8s  (s__name__s __module__s__doc__sattachForProtocolss__init__(((s6build/bdist.darwin-8.0.1-x86/egg/protocols/adapters.pys StickyAdapter2s icCs||jo|Sn||jo|Snt|d|ƒt|d|ƒjo|Snt|ddƒ}t|ddƒ}||jo|Sn||jo|Sn|tjp |tjo|Sn|tjp |tjo|Snt d||||ƒ‚dS(spShortest route to implementation, 'a1' @ depth 'd1', or 'a2' @ 'd2'? Assuming both a1 and a2 are interchangeable adapters (i.e. have the same source and destination protocols), return the one which is preferable; that is, the one with the shortest implication depth, or, if the depths are equal, then the adapter that is composed of the fewest chained adapters. If both are the same, then prefer 'NO_ADAPTER_NEEDED', followed by anything but 'DOES_NOT_SUPPORT', with 'DOES_NOT_SUPPORT' being least preferable. If there is no unambiguous choice, and 'not a1 is a2', TypeError is raised. s__unbound_adapter__s__adapterCount__isAmbiguous adapter choiceN( sd1sd2sa1sa2sgetattrsa1ctsa2ctsNO_ADAPTER_NEEDEDsDOES_NOT_SUPPORTs TypeError(sa1sa2sd1sd2sa2ctsa1ct((s6build/bdist.darwin-8.0.1-x86/egg/protocols/adapters.pysminimumAdapterUs$   %  csˆˆtjp ˆtjotSnˆtjoˆSnˆtjoˆSn‡‡d†}tˆddƒtˆddƒ|_|SdS(s:Return the composition of 'baseAdapter'+'extendingAdapter'cs+ˆ|ƒ}|tj oˆ|ƒSndS(N(s baseAdaptersobsNonesextendingAdapter(sob(sextendingAdapters baseAdapter(s6build/bdist.darwin-8.0.1-x86/egg/protocols/adapters.pys newAdapterŠs  s__adapterCount__iN(s baseAdaptersDOES_NOT_SUPPORTsextendingAdaptersNO_ADAPTER_NEEDEDs newAdaptersgetattrs__adapterCount__(s baseAdapters baseProtocolsextendingAdapters newAdapter((s baseAdaptersextendingAdapters6build/bdist.darwin-8.0.1-x86/egg/protocols/adapters.pyscomposeAdapters|s  %c s~d} ˆ}d}xt|tƒ o|o„t|tƒo&| |itj 7} |i }d}qt|t t fƒo!| d7} |i }|d8}q|i }|d8}qWt|tƒo´dkl}||ƒ\}} }}|o|t|ƒ }nt|ƒ| jo\‡‡d†} tˆddƒ| _ˆ| _dkl}|dˆˆftd ƒ| SqvnˆSd S( sEBackward compatibility: wrap 'adapter' to support old 2-arg signatureii i(s getargspeccs ˆ|ˆƒS(N(sadaptersobsproto(sob(sadaptersproto(s6build/bdist.darwin-8.0.1-x86/egg/protocols/adapters.pysÀss__adapterCount__(swarns2Adapter %r to protocol %r needs multiple argumentsiN(smaxargssadaptersfstriess isinstances FunctionTypes MethodTypesim_selfsNonesim_funcs ClassTypestypes__init__s__call__sinspects getargspecsargssvarargssvarkwsdefaultsslens newAdaptersgetattrs__adapterCount__s__unbound_adapter__swarningsswarnsprotosPendingDeprecationWarning( sadaptersprotos getargspecsdefaultssargssfswarnstriessvarkws newAdaptersvarargssmaxargs((sadaptersprotos6build/bdist.darwin-8.0.1-x86/egg/protocols/adapters.pys bindAdapter¥s8          cCs|}|i|ƒ}|tj oG|\}}t||||ƒ}||jo ||jot Sqin||f||=maxargs: newAdapter = lambda ob: adapter(ob,proto) newAdapter.__adapterCount__ = getattr( adapter,'__adapterCount__',1 ) newAdapter.__unbound_adapter__ = adapter from warnings import warn warn("Adapter %r to protocol %r needs multiple arguments" % (adapter,proto), PendingDeprecationWarning, 6) return newAdapter return adapter def updateWithSimplestAdapter(mapping, key, adapter, depth): """Replace 'mapping[key]' w/'adapter' @ 'depth', return true if changed""" new = adapter old = mapping.get(key) if old is not None: old, oldDepth = old new = minimumAdapter(old,adapter,oldDepth,depth) if old is new and depth>=oldDepth: return False mapping[key] = new, depth return True PKÜ\â2)D·^ ^ protocols/zope_support.py"""Declaration support for Zope Interfaces""" __all__ = [] from types import ClassType from adapters import * from api import declareImplementation, advise, adapt from interfaces import IOpenProtocol, Protocol from advice import metamethod, supermeta # Monkeypatch Zope Interfaces try: import zope.interface as zi except ImportError: ZopeInterfaceTypes = [] zi = None else: def __adapt__(self, obj): return adapt(self,IOpenProtocol).__adapt__(obj) try: from zope.interface import adapter_hooks except ImportError: zi.Interface.__class__.__adapt__ = __adapt__ else: adapter_hooks.append(__adapt__) ZopeInterfaceTypes = [zi.Interface.__class__] del __adapt__ # Adapter for Zope X3 Interfaces class ZopeInterfaceAsProtocol(StickyAdapter, Protocol): advise( instancesProvide=[IOpenProtocol], asAdapterForTypes=ZopeInterfaceTypes, ) attachToProtocols = IOpenProtocol, def __init__(self, ob): StickyAdapter.__init__(self,ob) Protocol.__init__(self) def __adapt__(self, obj): if self.subject.isImplementedBy(obj): return obj return supermeta(ZopeInterfaceAsProtocol,self).__adapt__(obj) def registerImplementation(self,klass,adapter=NO_ADAPTER_NEEDED,depth=1): if adapter is NO_ADAPTER_NEEDED: zi.classImplements(klass, self.subject) elif adapter is DOES_NOT_SUPPORT: ifaces = zi.Declaration( [i.__iro__ for i in zi.implementedBy(klass)] ) - self.subject zi.classImplementsOnly(klass, ifaces) return supermeta(ZopeInterfaceAsProtocol,self).registerImplementation( klass,adapter,depth ) registerImplementation = metamethod(registerImplementation) def registerObject(self, ob, adapter=NO_ADAPTER_NEEDED, depth=1): if adapter is NO_ADAPTER_NEEDED: zi.directlyProvides(ob,self.subject) elif adapter is DOES_NOT_SUPPORT: zi.directlyProvides(ob, zi.directlyProvidedBy(ob)-self.subject) return supermeta(ZopeInterfaceAsProtocol,self).registerObject( ob, adapter, depth ) registerObject = metamethod(registerObject) def getImpliedProtocols(self): protos = super(ZopeInterfaceAsProtocol,self).getImpliedProtocols() return list(protos) + [ (i,(NO_ADAPTER_NEEDED,1)) for i in self.subject.__bases__ if i is not zi.Interface ] def __getstate__(self): state = self.__dict__.copy() del state['_Protocol__lock'] # locks can't be pickled del state['_Protocol__listeners'] # and neither can weakref dict return state def __hash__(self): return hash(self.subject) def __cmp__(self,other): return cmp(self.subject, other) PKÜ\â2 K¢ã§§protocols/classic.py"""Declaration support for Python built-in types""" __all__ = ['ProviderMixin'] from types import FunctionType, ModuleType, InstanceType, ClassType from adapters import * from api import declareImplementation, advise, declareAdapterForObject, adapt from interfaces import * from new import instancemethod from advice import getMRO, metamethod, mkRef class ProviderMixin: """Mixin to support per-instance declarations""" advise( instancesProvide=[IOpenProvider, IImplicationListener] ) def declareProvides(self,protocol,adapter=NO_ADAPTER_NEEDED,depth=1): registry = self.__dict__.get('__protocols_provided__') if registry is None: self.__protocols_provided__ = registry = {} if updateWithSimplestAdapter(registry,protocol,adapter,depth): adapt(protocol,IOpenProtocol).addImplicationListener(self) return True declareProvides = metamethod(declareProvides) def newProtocolImplied(self, srcProto, destProto, adapter, depth): registry = self.__dict__.get('__protocols_provided__',()) if srcProto not in registry: return baseAdapter, d = registry[srcProto] adapter = composeAdapters(baseAdapter,srcProto,adapter) declareAdapterForObject( destProto, adapter, self, depth+d ) newProtocolImplied = metamethod(newProtocolImplied) def __conform__(self,protocol): for cls in getMRO(self): conf = cls.__dict__.get('__protocols_provided__',()) if protocol in conf: return conf[protocol][0](self) __conform__ = metamethod(__conform__) class conformsRegistry(dict): """Helper type for objects and classes that need registration support""" def __call__(self, protocol): # This only gets called for non-class objects if protocol in self: subject = self.subject() if subject is not None: return self[protocol][0](subject) def findImplementation(self, subject, protocol, checkSelf=True): for cls in getMRO(subject): conf = cls.__dict__.get('__conform__') if conf is None: continue if not isinstance(conf,conformsRegistry): raise TypeError( "Incompatible __conform__ in base class", conf, cls ) if protocol in conf: return conf[protocol][0](subject) def newProtocolImplied(self, srcProto, destProto, adapter, depth): subject = self.subject() if subject is None or srcProto not in self: return baseAdapter, d = self[srcProto] adapter = composeAdapters(baseAdapter,srcProto,adapter) declareAdapterForObject( destProto, adapter, subject, depth+d ) def __hash__(self): # Need this because dictionaries aren't hashable, but we need to # be referenceable by a weak-key dictionary return id(self) def __get__(self,ob,typ=None): if ob is not None: raise AttributeError( "__conform__ registry does not pass to instances" ) # Return a bound method that adds the retrieved-from class to the return instancemethod(self.findImplementation, typ, type(typ)) def __getstate__(self): return self.subject(), self.items() def __setstate__(self,(subject,items)): self.clear() self.update(dict(items)) self.subject = mkRef(subject) class MiscObjectsAsOpenProvider(object): """Supply __conform__ registry for funcs, modules, & classic instances""" advise( instancesProvide=[IOpenProvider], asAdapterForTypes=[ FunctionType, ModuleType, InstanceType, ClassType, type, object ] ) def __init__(self,ob): obs = list(getMRO(ob)) for item in obs: try: reg = item.__dict__.get('__conform__') if reg is None and obs==[ob]: # Make sure we don't obscure a method from the class! reg = getattr(item,'__conform__',None) except AttributeError: raise TypeError( "Only objects with dictionaries can use this adapter", ob ) if reg is not None and not isinstance(reg,conformsRegistry): raise TypeError( "Incompatible __conform__ on adapted object", ob, reg ) reg = ob.__dict__.get('__conform__') if reg is None: reg = ob.__conform__ = self.newRegistry(ob) self.ob = ob self.reg = reg def declareProvides(self, protocol, adapter=NO_ADAPTER_NEEDED, depth=1): if updateWithSimplestAdapter(self.reg, protocol, adapter, depth): adapt(protocol,IOpenProtocol).addImplicationListener(self.reg) return True def newRegistry(self,subject): # Create a registry that's also set up for inheriting declarations reg = conformsRegistry() reg.subject = mkRef(subject) return reg PKKŸC8åïöŒLŒLprotocols/interfaces.pyo;ò µÆBc@s“dZdklZdddddddd d d d d ddgZdkZdklZlZlZdk l Z l Z dk l Z l Z dklZydklZWnPej oDydklZWqüej odefd„ƒYZqüXnXdfd„ƒYZydklZWnej on$XdklZeeeeƒe_deefd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZ defd„ƒYZ!defd „ƒYZ"de fd!„ƒYZ#de fd"„ƒYZ$d e$fd#„ƒYZ%d$e fd%„ƒYZ&d e fd&„ƒYZ'd e fd'„ƒYZ(d e%fd(„ƒYZ)d e fd)„ƒYZ*dS(*sBImplement Interfaces and define the interfaces used by the package(s generatorssProtocolsInterfaceClasss Interfaces AbstractBasesAbstractBaseMetasIAdapterFactorys IProtocolsIAdaptingProtocols IOpenProtocols IOpenProvidersIOpenImplementorsIImplicationListeners Attributes VariationN(s metamethods classicMROsmkRef(scomposeAdapterssupdateWithSimplestAdapter(sNO_ADAPTER_NEEDEDsDOES_NOT_SUPPORT(s InstanceType(s allocate_locks allocate_lockcBs tZfZd„Zd„ZRS(NcGsdS(N((sargs((s8build/bdist.darwin-8.0.1-x86/egg/protocols/interfaces.pysacquire!scGsdS(N((sargs((s8build/bdist.darwin-8.0.1-x86/egg/protocols/interfaces.pysrelease"s(s__name__s __module__s __slots__sacquiresrelease(((s8build/bdist.darwin-8.0.1-x86/egg/protocols/interfaces.pys allocate_locks cBsÑtZdZd„Zd„Zedd„ZeeƒZedd„ZeeƒZedd„Z ee ƒZ d„Z ydk l Z Wne j onXee ƒZ d „ZeeƒZeid „ZRS( s.Generic protocol w/type-based adapter registrycCs+h|_h|_t|_tƒ|_dS(N(sselfs_Protocol__adapterss_Protocol__impliessNones_Protocol__listenerss allocate_locks_Protocol__lock(sself((s8build/bdist.darwin-8.0.1-x86/egg/protocols/interfaces.pys__init__0s   cCsg}|i}|iiƒz\xQ|iiƒD]@\}}|ƒ}|t jo|i|=q/|||fƒq/W|SWd|ii ƒXdS(N( soutsappendsaddsselfs_Protocol__locksacquires_Protocol__impliessitemssksvsprotosNonesrelease(sselfsprotosksaddsvsout((s8build/bdist.darwin-8.0.1-x86/egg/protocols/interfaces.pysgetImpliedProtocols7s     ic Csí|iiƒz=t|ƒ}t|i|||ƒ o|i|dSnWd|ii ƒXxI|i i ƒD]8\}\}}ti|t|||ƒ|||ƒqkW|io4x1|iiƒD]}|i||||ƒqÁWn|SdS(Ni(sselfs_Protocol__locksacquiresmkRefsprotoskeysupdateWithSimplestAdapters_Protocol__impliessadaptersdepthsreleases_Protocol__adapterssitemssklasss baseAdaptersdsapisdeclareAdapterForTypescomposeAdapterss_Protocol__listenersskeysslistenersnewProtocolImplied( sselfsprotosadaptersdepthskeys baseAdapterslistenersklasssd((s8build/bdist.darwin-8.0.1-x86/egg/protocols/interfaces.pysaddImpliedProtocolSs  * cCsµ|iiƒz1t|i|||ƒ o|i|dSnWd|iiƒX|t jo|SnxF|i ƒD]8\}\}}ti|t|||ƒ|||ƒqqW|SdS(Ni(sselfs_Protocol__locksacquiresupdateWithSimplestAdapters_Protocol__adapterssklasssadaptersdepthsreleasesDOES_NOT_SUPPORTsgetImpliedProtocolssprotosextendersdsapisdeclareAdapterForTypescomposeAdapters(sselfsklasssadaptersdepthsdsprotosextender((s8build/bdist.darwin-8.0.1-x86/egg/protocols/interfaces.pysregisterImplementation|s   *cCsˆti|tƒi|||ƒob|tjodSnxJ|i ƒD]8\}\}}ti |t|||ƒ|||ƒqDWndS(N(sapisadaptsobs IOpenProvidersdeclareProvidessselfsadaptersdepthsDOES_NOT_SUPPORTsgetImpliedProtocolssprotosextendersdsdeclareAdapterForObjectscomposeAdapters(sselfsobsadaptersdepthsdsprotosextender((s8build/bdist.darwin-8.0.1-x86/egg/protocols/interfaces.pysregisterObject—s "  cCs°|ii}y |i}Wntj ot|ƒ}nXy |i}Wn%tj ot |dt ƒ}nXx9|D]1}||ƒ}|tj o|d|ƒSqwqwWdS(NsextendedClassici(sselfs_Protocol__adapterssgetsobjs __class__stypsAttributeErrorstypes__mro__smros classicMROsTruesklasssfactorysNone(sselfsobjsgetsfactorysmrosklassstyp((s8build/bdist.darwin-8.0.1-x86/egg/protocols/interfaces.pys __adapt__¥s     (sProtocol__adapt__cCs`|iiƒz>|itjodkl}|ƒ|_nd|i|1: for method in methods: subset = tuple([m for m in methods if m!=method]) implied = __protocolForType((baseType, subset, implicit)) declareAdapterForProtocol(implied, NO_ADAPTER_NEEDED, proto) # declare that explicit form implies implicit form if implicit: impliedBy = __protocolForType((baseType, methods, False)) declareAdapterForProtocol(proto, NO_ADAPTER_NEEDED, impliedBy) # declare that baseType implements this protocol declareAdapterForType(proto, NO_ADAPTER_NEEDED, baseType) return proto PKKŸC8lá“DDprotocols/__init__.pyo;ò µÆBc@sŠdZdkTdklZlZlZlZdklZdkTdk l Z l Z dk l Z dklZlZdklZlZdS( s!Trivial Interfaces and Adaptation(s*(sNO_ADAPTER_NEEDEDsDOES_NOT_SUPPORTsAdapters StickyAdapter(sAdaptationFailure(s metamethods supermeta(s ProviderMixin(sprotocolForTypesprotocolForURI(s sequenceOfsIBasicSequenceN(s__doc__sapisadapterssNO_ADAPTER_NEEDEDsDOES_NOT_SUPPORTsAdapters StickyAdaptersAdaptationFailures interfacessadvices metamethods supermetasclassics ProviderMixinsgeneratesprotocolForTypesprotocolForURIs sequenceOfsIBasicSequence( sIBasicSequencesAdaptationFailures sequenceOfsAdapters StickyAdaptersprotocolForTypesprotocolForURIsDOES_NOT_SUPPORTs ProviderMixins supermetas metamethodsNO_ADAPTER_NEEDED((s6build/bdist.darwin-8.0.1-x86/egg/protocols/__init__.pys?s  PKKŸC8 gH-protocols/zope_support.pyo;ò µÆBc@s dZgZdklZdkTdklZlZlZdk l Z l Z dk l Z lZydkiZWnej ogZeZn`Xd„ZydklZWn"ej oeeii_nXeieƒeiigZ[d ee fd „ƒYZdS( s'Declaration support for Zope Interfaces(s ClassType(s*(sdeclareImplementationsadvisesadapt(s IOpenProtocolsProtocol(s metamethods supermetaNcCst|tƒi|ƒSdS(N(sadaptsselfs IOpenProtocols __adapt__sobj(sselfsobj((s:build/bdist.darwin-8.0.1-x86/egg/protocols/zope_support.pys __adapt__s(s adapter_hookssZopeInterfaceAsProtocolcBs“tZedegdeƒefZd„Zd„Zedd„Z e e ƒZ edd„Z e e ƒZ d„Z d „Z d „Zd „ZRS( NsinstancesProvidesasAdapterForTypescCs!ti||ƒti|ƒdS(N(s StickyAdapters__init__sselfsobsProtocol(sselfsob((s:build/bdist.darwin-8.0.1-x86/egg/protocols/zope_support.pys__init__6scCs5|ii|ƒo|Sntt|ƒi|ƒSdS(N(sselfssubjectsisImplementedBysobjs supermetasZopeInterfaceAsProtocols __adapt__(sselfsobj((s:build/bdist.darwin-8.0.1-x86/egg/protocols/zope_support.pys __adapt__;sicCs¨|tjoti||iƒne|tjoWtigi }ti |ƒD]}||i ƒqN~ƒ|i}ti||ƒntt|ƒi|||ƒSdS(N(sadaptersNO_ADAPTER_NEEDEDszisclassImplementssklasssselfssubjectsDOES_NOT_SUPPORTs Declarationsappends_[1]s implementedBysis__iro__sifacessclassImplementsOnlys supermetasZopeInterfaceAsProtocolsregisterImplementationsdepth(sselfsklasssadaptersdepthsifacessis_[1]((s:build/bdist.darwin-8.0.1-x86/egg/protocols/zope_support.pysregisterImplementationAs   CcCsu|tjoti||iƒn2|tjo$ti|ti|ƒ|iƒnt t |ƒi |||ƒSdS(N( sadaptersNO_ADAPTER_NEEDEDszisdirectlyProvidessobsselfssubjectsDOES_NOT_SUPPORTsdirectlyProvidedBys supermetasZopeInterfaceAsProtocolsregisterObjectsdepth(sselfsobsadaptersdepth((s:build/bdist.darwin-8.0.1-x86/egg/protocols/zope_support.pysregisterObjectSs   $cCsntt|ƒiƒ}t|ƒgi}|ii D]0}|t i j o||t dffƒq2q2~SdS(Ni(ssupersZopeInterfaceAsProtocolsselfsgetImpliedProtocolssprotosslistsappends_[1]ssubjects __bases__siszis InterfacesNO_ADAPTER_NEEDED(sselfsis_[1]sprotos((s:build/bdist.darwin-8.0.1-x86/egg/protocols/zope_support.pysgetImpliedProtocolsbscCs%|iiƒ}|d=|d=|SdS(Ns_Protocol__locks_Protocol__listeners(sselfs__dict__scopysstate(sselfsstate((s:build/bdist.darwin-8.0.1-x86/egg/protocols/zope_support.pys __getstate__jscCst|iƒSdS(N(shashsselfssubject(sself((s:build/bdist.darwin-8.0.1-x86/egg/protocols/zope_support.pys__hash__pscCst|i|ƒSdS(N(scmpsselfssubjectsother(sselfsother((s:build/bdist.darwin-8.0.1-x86/egg/protocols/zope_support.pys__cmp__ss(s__name__s __module__sadvises IOpenProtocolsZopeInterfaceTypessattachToProtocolss__init__s __adapt__sNO_ADAPTER_NEEDEDsregisterImplementations metamethodsregisterObjectsgetImpliedProtocolss __getstate__s__hash__s__cmp__(((s:build/bdist.darwin-8.0.1-x86/egg/protocols/zope_support.pysZopeInterfaceAsProtocol,s          (s__doc__s__all__stypess ClassTypesadapterssapisdeclareImplementationsadvisesadapts interfacess IOpenProtocolsProtocolsadvices metamethods supermetaszope.interfaces interfaceszis ImportErrorsZopeInterfaceTypessNones __adapt__s adapter_hookss Interfaces __class__sappends StickyAdaptersZopeInterfaceAsProtocol(sProtocolszis__all__s ClassTypes metamethodsZopeInterfaceTypess __adapt__sadapts adapter_hookssdeclareImplementationsadvises supermetas IOpenProtocolsZopeInterfaceAsProtocol((s:build/bdist.darwin-8.0.1-x86/egg/protocols/zope_support.pys?s(    PKÜ\â2· )¹Á/Á/protocols/interfaces.py"""Implement Interfaces and define the interfaces used by the package""" from __future__ import generators __all__ = [ 'Protocol', 'InterfaceClass', 'Interface', 'AbstractBase', 'AbstractBaseMeta', 'IAdapterFactory', 'IProtocol', 'IAdaptingProtocol', 'IOpenProtocol', 'IOpenProvider', 'IOpenImplementor', 'IImplicationListener', 'Attribute', 'Variation' ] import api from advice import metamethod, classicMRO, mkRef from adapters import composeAdapters, updateWithSimplestAdapter from adapters import NO_ADAPTER_NEEDED, DOES_NOT_SUPPORT from types import InstanceType # Thread locking support try: from thread import allocate_lock except ImportError: try: from dummy_thread import allocate_lock except ImportError: class allocate_lock(object): __slots__ = () def acquire(*args): pass def release(*args): pass # Trivial interface implementation class Protocol: """Generic protocol w/type-based adapter registry""" def __init__(self): self.__adapters = {} self.__implies = {} self.__listeners = None self.__lock = allocate_lock() def getImpliedProtocols(self): # This is messy so it can clean out weakrefs, but this method is only # called for declaration activities and is thus not at all # speed-critical. It's more important that we support weak refs to # implied protocols, so that dynamically created subset protocols can # be garbage collected. out = [] add = out.append self.__lock.acquire() # we might clean out dead weakrefs try: for k,v in self.__implies.items(): proto = k() if proto is None: del self.__implies[k] else: add((proto,v)) return out finally: self.__lock.release() def addImpliedProtocol(self,proto,adapter=NO_ADAPTER_NEEDED,depth=1): self.__lock.acquire() try: key = mkRef(proto) if not updateWithSimplestAdapter( self.__implies, key, adapter, depth ): return self.__implies[key][0] finally: self.__lock.release() # Always register implied protocol with classes, because they should # know if we break the implication link between two protocols for klass,(baseAdapter,d) in self.__adapters.items(): api.declareAdapterForType( proto,composeAdapters(baseAdapter,self,adapter),klass,depth+d ) if self.__listeners: for listener in self.__listeners.keys(): # Must use keys()! listener.newProtocolImplied(self, proto, adapter, depth) return adapter addImpliedProtocol = metamethod(addImpliedProtocol) def registerImplementation(self,klass,adapter=NO_ADAPTER_NEEDED,depth=1): self.__lock.acquire() try: if not updateWithSimplestAdapter( self.__adapters,klass,adapter,depth ): return self.__adapters[klass][0] finally: self.__lock.release() if adapter is DOES_NOT_SUPPORT: # Don't register non-support with implied protocols, because # "X implies Y" and "not X" doesn't imply "not Y". In effect, # explicitly registering DOES_NOT_SUPPORT for a type is just a # way to "disinherit" a superclass' claim to support something. return adapter for proto, (extender,d) in self.getImpliedProtocols(): api.declareAdapterForType( proto, composeAdapters(adapter,self,extender), klass, depth+d ) return adapter registerImplementation = metamethod(registerImplementation) def registerObject(self, ob, adapter=NO_ADAPTER_NEEDED,depth=1): # Object needs to be able to handle registration if api.adapt(ob,IOpenProvider).declareProvides(self,adapter,depth): if adapter is DOES_NOT_SUPPORT: return # non-support doesn't imply non-support of implied # Handle implied protocols for proto, (extender,d) in self.getImpliedProtocols(): api.declareAdapterForObject( proto, composeAdapters(adapter,self,extender), ob, depth+d ) registerObject = metamethod(registerObject) def __adapt__(self, obj): get = self.__adapters.get try: typ = obj.__class__ except AttributeError: typ = type(obj) try: mro = typ.__mro__ except AttributeError: # Note: this adds 'InstanceType' and 'object' to end of MRO mro = classicMRO(typ,extendedClassic=True) for klass in mro: factory=get(klass) if factory is not None: return factory[0](obj) try: from _speedups import Protocol__adapt__ as __adapt__ except ImportError: pass __adapt__ = metamethod(__adapt__) def addImplicationListener(self, listener): self.__lock.acquire() try: if self.__listeners is None: from weakref import WeakKeyDictionary self.__listeners = WeakKeyDictionary() self.__listeners[listener] = 1 finally: self.__lock.release() addImplicationListener = metamethod(addImplicationListener) def __call__(self, ob, default=api._marker): """Adapt to this protocol""" return api.adapt(ob,self,default) # Use faster __call__ method, if possible # XXX it could be even faster if the __call__ were in the tp_call slot # XXX directly, but Pyrex doesn't have a way to do that AFAIK. try: from _speedups import Protocol__call__ except ImportError: pass else: from new import instancemethod Protocol.__call__ = instancemethod(Protocol__call__, None, Protocol) class AbstractBaseMeta(Protocol, type): """Metaclass for 'AbstractBase' - a protocol that's also a class (Note that this should not be used as an explicit metaclass - always subclass from 'AbstractBase' or 'Interface' instead.) """ def __init__(self, __name__, __bases__, __dict__): type.__init__(self, __name__, __bases__, __dict__) Protocol.__init__(self) for b in __bases__: if isinstance(b,AbstractBaseMeta) and b.__bases__<>(object,): self.addImpliedProtocol(b) def __setattr__(self,attr,val): # We could probably support changing __bases__, as long as we checked # that no bases are *removed*. But it'd be a pain, since we'd # have to do callbacks, remove entries from our __implies registry, # etc. So just punt for now. if attr=='__bases__': raise TypeError( "Can't change interface __bases__", self ) type.__setattr__(self,attr,val) __call__ = type.__call__ class AbstractBase(object): """Base class for a protocol that's a class""" __metaclass__ = AbstractBaseMeta class InterfaceClass(AbstractBaseMeta): """Metaclass for 'Interface' - a non-instantiable protocol (Note that this should not be used as an explicit metaclass - always subclass from 'AbstractBase' or 'Interface' instead.) """ def __call__(self, *__args, **__kw): if self.__init__ is Interface.__init__: return Protocol.__call__(self,*__args, **__kw) else: return type.__call__(self,*__args, **__kw) def getBases(self): return [ b for b in self.__bases__ if isinstance(b,AbstractBaseMeta) and b.__bases__<>(object,) ] class Interface(object): __metaclass__ = InterfaceClass class Variation(Protocol): """A variation of a base protocol - "inherits" the base's adapters See the 'LocalProtocol' example in the reference manual for more info. """ def __init__(self, baseProtocol, context = None): self.baseProtocol = baseProtocol self.context = context # Note: Protocol is a ``classic'' class, so we don't use super() Protocol.__init__(self) api.declareAdapterForProtocol(self,NO_ADAPTER_NEEDED,baseProtocol) def __repr__(self): if self.context is None: return "Variation(%r)" % self.baseProtocol return "Variation(%r,%r)" % (self.baseProtocol, self.context) # Semi-backward compatible 'interface.Attribute' class Attribute(object): """Attribute declaration; should we get rid of this?""" def __init__(self,doc,name=None,value=None): self.__doc__ = doc self.name = name self.value = value def __get__(self,ob,typ=None): if ob is None: return self if not self.name: raise NotImplementedError("Abstract attribute") try: return ob.__dict__[self.name] except KeyError: return self.value def __set__(self,ob,val): if not self.name: raise NotImplementedError("Abstract attribute") ob.__dict__[self.name] = val def __delete__(self,ob): if not self.name: raise NotImplementedError("Abstract attribute") del ob.__dict__[self.name] def __repr__(self): return "Attribute: %s" % self.__doc__ # Interfaces and adapters for declaring protocol/type/object relationships class IAdapterFactory(Interface): """Callable that can adapt an object to a protocol""" def __call__(ob): """Return an implementation of protocol for 'ob'""" class IProtocol(Interface): """Object usable as a protocol by 'adapt()'""" def __hash__(): """Protocols must be usable as dictionary keys""" def __eq__(other): """Protocols must be comparable with == and !=""" def __ne__(other): """Protocols must be comparable with == and !=""" class IAdaptingProtocol(IProtocol): """A protocol that potentially knows how to adapt some object to itself""" def __adapt__(ob): """Return 'ob' adapted to protocol, or 'None'""" class IConformingObject(Interface): """An object that potentially knows how to adapt to a protocol""" def __conform__(protocol): """Return an implementation of 'protocol' for self, or 'None'""" class IOpenProvider(Interface): """An object that can be told how to adapt to protocols""" def declareProvides(protocol, adapter=NO_ADAPTER_NEEDED, depth=1): """Register 'adapter' as providing 'protocol' for this object Return a true value if the provided adapter is the "shortest path" to 'protocol' for the object, or false if a shorter path already existed. """ class IOpenImplementor(Interface): """Object/type that can be told how its instances adapt to protocols""" def declareClassImplements(protocol, adapter=NO_ADAPTER_NEEDED, depth=1): """Register 'adapter' as implementing 'protocol' for instances""" class IOpenProtocol(IAdaptingProtocol): """A protocol that be told what it implies, and what supports it Note that these methods are for the use of the declaration APIs only, and you should NEVER call them directly.""" def addImpliedProtocol(proto, adapter=NO_ADAPTER_NEEDED, depth=1): """'adapter' provides conversion from this protocol to 'proto'""" def registerImplementation(klass, adapter=NO_ADAPTER_NEEDED, depth=1): """'adapter' provides protocol for instances of klass""" def registerObject(ob, adapter=NO_ADAPTER_NEEDED, depth=1): """'adapter' provides protocol for 'ob' directly""" def addImplicationListener(listener): """Notify 'listener' whenever protocol has new implied protocol""" class IImplicationListener(Interface): def newProtocolImplied(srcProto, destProto, adapter, depth): """'srcProto' now implies 'destProto' via 'adapter' at 'depth'""" PKKŸC86’­óÕÕprotocols/twisted_support.pyo;ò µÆBc@s¾dZgZdkTdklZdklZdklZde fd„ƒYZ ydk l Z lZlZWnej o gZnXed„ƒe_egZd e fd „ƒYZd S( s*Declaration support for Twisted Interfaces(s*(sadvise(s IOpenProtocol(sWeakKeyDictionarysTwistedAdaptMethodcBs/tZdZdZd„Zd„Zd„ZRS(s/__adapt__ implementation for Twisted interfacessifacecCs ||_dS(N(sifacesself(sselfsiface((s=build/bdist.darwin-8.0.1-x86/egg/protocols/twisted_support.pys__init__5scCs/t||iƒo|Sn|i|tƒSdS(N(sTwistedImplementssobjsselfsifacesNone(sselfsobj((s=build/bdist.darwin-8.0.1-x86/egg/protocols/twisted_support.pys__call__9scCs;|iiidƒ}|tjo|Sn|||ƒSdS(Ns __adapt__(sselfsifaces__dict__sgetsmethsNonesdefaultsob(sselfsobsdefaultsmeth((s=build/bdist.darwin-8.0.1-x86/egg/protocols/twisted_support.pysim_funcEs (s__name__s __module__s__doc__s __slots__s__init__s__call__sim_func(((s=build/bdist.darwin-8.0.1-x86/egg/protocols/twisted_support.pysTwistedAdaptMethod.s   (s implementss MetaInterfaces getInterfacescCs t|ƒS(N(sTwistedAdaptMethodss(ss((s=build/bdist.darwin-8.0.1-x86/egg/protocols/twisted_support.pys`ssTwistedInterfaceAsProtocolcBsltZdZedegdeƒd„Zd„Zedd„Z edd„Z edd „Z d „Z RS( NsifacesinstancesProvidesasAdapterForTypescCs ||_dS(N(sifacesself(sselfsiface((s=build/bdist.darwin-8.0.1-x86/egg/protocols/twisted_support.pys__init__†scCs|ii|ƒSdS(N(sselfsifaces __adapt__sobj(sselfsobj((s=build/bdist.darwin-8.0.1-x86/egg/protocols/twisted_support.pys __adapt__ŠsicCs•t|ƒ}|tjo|it|ƒf|_n]|t jo7|i|jo#|i |iƒt|ƒ|_q‘nt d|i||ƒ‚dS(Ns9Twisted interfaces can only declare support, not adapters( sTwistedGetInterfacessklasss oldImplementssadaptersNO_ADAPTER_NEEDEDsselfsifacestuples__implements__sDOES_NOT_SUPPORTsremoves TypeError(sselfsklasssadaptersdepths oldImplements((s=build/bdist.darwin-8.0.1-x86/egg/protocols/twisted_support.pysregisterImplementationŽs   csk|i‰|ii‡‡d†|ƒˆiidhƒ}x*|iƒD]}|i ||ˆ|ƒqGWdS(Ncs ˆ|ˆƒS(N(sadaptersosiface(so(sadaptersiface(s=build/bdist.darwin-8.0.1-x86/egg/protocols/twisted_support.pysªss_Protocol__listeners( sselfsifaces adaptWithsprotos__dict__sgets listenersskeysslistenersnewProtocolImpliedsadaptersdepth(sselfsprotosadaptersdepthsifaceslisteners listeners((sadaptersifaces=build/bdist.darwin-8.0.1-x86/egg/protocols/twisted_support.pysaddImpliedProtocol¥s   cCs•t|ƒ}|tjo|it|ƒf|_n]|t jo7|i|jo#|i |iƒt|ƒ|_q‘nt d|i||ƒ‚dS(Ns9Twisted interfaces can only declare support, not adapters( sTwistedGetInterfacessobs oldImplementssadaptersNO_ADAPTER_NEEDEDsselfsifacestuples__implements__sDOES_NOT_SUPPORTsremoves TypeError(sselfsobsadaptersdepths oldImplements((s=build/bdist.darwin-8.0.1-x86/egg/protocols/twisted_support.pysregisterObjectµs   cCs)|iiidtƒƒ}t||sN(sproperty(sfunc((sfuncs4build/bdist.darwin-8.0.1-x86/egg/protocols/advice.pys metamethod s(sExtensionClassccs…g}|i}|i}|d|ƒxF|o>|ƒ}|Vt|ƒ}x|iD]}|||ƒqRWq(W|o t Vt VndS(Ni( sstacksinsertspushspopsobsclsslensps __bases__sbsextendedClassics InstanceTypesobject(sobsextendedClassicsbspopspspushsstackscls((s4build/bdist.darwin-8.0.1-x86/egg/protocols/advice.pys classicMRO*s      cCsGt|tƒot||ƒSnt|tƒo |iSn|fSdS(N(s isinstancesobs ClassicTypess classicMROsextendedClassicstypes__mro__(sobsextendedClassic((s4build/bdist.darwin-8.0.1-x86/egg/protocols/advice.pysgetMRO9s  (s metamethodsgetMROs classicMROcsÖtˆƒ}|i‰ˆˆjoˆ}|i‰ntˆƒ‰x\ˆD]B}|ˆjo/gi}ˆD]}||i ƒqi~‰PqHqHWt d|ˆƒ‚tˆƒ‰dt f‡‡‡d†ƒY}|ƒSdS(NsNot sub/supertypes:stheSupercstZ‡‡‡d†ZRS(Ncstx]ˆD]U}||joB||}y |i}Wntj o |Sq\X|ˆˆƒSqqWti ||ƒSdS(N( smrosdsnamesdescrs__get__sAttributeErrorsobstypsobjects__getattribute__sself(sselfsnamesdescrsd(stypsobsmro(s4build/bdist.darwin-8.0.1-x86/egg/protocols/advice.pys__getattribute__is    (s__name__s __module__s__getattribute__((sobsmrostyp(s4build/bdist.darwin-8.0.1-x86/egg/protocols/advice.pystheSupergs(stypesobs starttypes__mro__smrostypsitersclssappends_[1]s__dict__s TypeErrorsobjectstheSuper(stypsobstheSupers_[1]smros starttypescls((stypsobsmros4build/bdist.darwin-8.0.1-x86/egg/protocols/advice.pys supermetaUs      *  c Cs!|i}|i}||j}d|j}d|j}|o|}|o|d|dj}|otii |dƒpt }|o |i |j}| o#d} |o| o d} q nK|o| o d} n2|o| o d} n| o d} nd} | |||fSdS( s„Return (kind,module,locals,globals) for a frame 'kind' is one of "exec", "module", "class", "function call", or "unknown". s __module__s__name__sexecsclasssmodules function callsunknownN(sframesf_localss f_globalss sameNamespaces hasModuleshasNamessameNamessyssmodulessgetsNonesmodules__dict__snamespaceIsModuleskind( sframes sameNamespacesnamespaceIsModules f_globalssmodulessameNames hasModulesf_localsshasNameskind((s4build/bdist.darwin-8.0.1-x86/egg/protocols/advice.pys getFrameInfo|s,      $   ic sž|p ti|ƒ}t|ƒ\}}}}|djot dƒ‚n|i dƒ‰|i dt ƒ‰‡‡‡d†} ˆ| _ ˆ| _| |dBss forObjects(sobsselfssubjectslistsattachForProtocolssprovidess protocols.apisdeclareAdapter(sselfsobsdeclareAdaptersprovides((sselfs6build/bdist.darwin-8.0.1-x86/egg/protocols/adapters.pys__init__8s  (s__name__s __module__s__doc__sattachForProtocolss__init__(((s6build/bdist.darwin-8.0.1-x86/egg/protocols/adapters.pys StickyAdapter2s icCs||jo|Sn||jo|Snt|d|ƒt|d|ƒjo|Snt|ddƒ}t|ddƒ}||jo|Sn||jo|Sn|tjp |tjo|Sn|tjp |tjo|Snt d||||ƒ‚dS(spShortest route to implementation, 'a1' @ depth 'd1', or 'a2' @ 'd2'? Assuming both a1 and a2 are interchangeable adapters (i.e. have the same source and destination protocols), return the one which is preferable; that is, the one with the shortest implication depth, or, if the depths are equal, then the adapter that is composed of the fewest chained adapters. If both are the same, then prefer 'NO_ADAPTER_NEEDED', followed by anything but 'DOES_NOT_SUPPORT', with 'DOES_NOT_SUPPORT' being least preferable. If there is no unambiguous choice, and 'not a1 is a2', TypeError is raised. s__unbound_adapter__s__adapterCount__isAmbiguous adapter choiceN( sd1sd2sa1sa2sgetattrsa1ctsa2ctsNO_ADAPTER_NEEDEDsDOES_NOT_SUPPORTs TypeError(sa1sa2sd1sd2sa2ctsa1ct((s6build/bdist.darwin-8.0.1-x86/egg/protocols/adapters.pysminimumAdapterUs$   %  csˆˆtjp ˆtjotSnˆtjoˆSnˆtjoˆSn‡‡d†}tˆddƒtˆddƒ|_|SdS(s:Return the composition of 'baseAdapter'+'extendingAdapter'cs+ˆ|ƒ}|tj oˆ|ƒSndS(N(s baseAdaptersobsNonesextendingAdapter(sob(sextendingAdapters baseAdapter(s6build/bdist.darwin-8.0.1-x86/egg/protocols/adapters.pys newAdapterŠs  s__adapterCount__iN(s baseAdaptersDOES_NOT_SUPPORTsextendingAdaptersNO_ADAPTER_NEEDEDs newAdaptersgetattrs__adapterCount__(s baseAdapters baseProtocolsextendingAdapters newAdapter((s baseAdaptersextendingAdapters6build/bdist.darwin-8.0.1-x86/egg/protocols/adapters.pyscomposeAdapters|s  %c s~d} ˆ}d}xt|tƒ o|o„t|tƒo&| |itj 7} |i }d}qt|t t fƒo!| d7} |i }|d8}q|i }|d8}qWt|tƒo´dkl}||ƒ\}} }}|o|t|ƒ }nt|ƒ| jo\‡‡d†} tˆddƒ| _ˆ| _dkl}|dˆˆftd ƒ| SqvnˆSd S( sEBackward compatibility: wrap 'adapter' to support old 2-arg signatureii i(s getargspeccs ˆ|ˆƒS(N(sadaptersobsproto(sob(sadaptersproto(s6build/bdist.darwin-8.0.1-x86/egg/protocols/adapters.pysÀss__adapterCount__(swarns2Adapter %r to protocol %r needs multiple argumentsiN(smaxargssadaptersfstriess isinstances FunctionTypes MethodTypesim_selfsNonesim_funcs ClassTypestypes__init__s__call__sinspects getargspecsargssvarargssvarkwsdefaultsslens newAdaptersgetattrs__adapterCount__s__unbound_adapter__swarningsswarnsprotosPendingDeprecationWarning( sadaptersprotos getargspecsdefaultssargssfswarnstriessvarkws newAdaptersvarargssmaxargs((sadaptersprotos6build/bdist.darwin-8.0.1-x86/egg/protocols/adapters.pys bindAdapter¥s8          cCs|}|i|ƒ}|tj oG|\}}t||||ƒ}||jo ||jot Sqin||f||Declare that 'adapter' adapts instances of 'typ' to 'protocol'N( s bindAdaptersadaptersprotocolsadapts IOpenProtocolsregisterImplementationstypsdepthsIOpenImplementorsNonesoisdeclareClassImplements(sprotocolsadapterstypsdepthsoi((s1build/bdist.darwin-8.0.1-x86/egg/protocols/api.pysdeclareAdapterForType[s  cCs6t|tƒt|tƒi|t||ƒ|ƒdS(s3Declare that 'adapter' adapts 'proto' to 'protocol'N(sadaptsprotocols IOpenProtocolsprotosaddImpliedProtocols bindAdaptersadaptersdepth(sprotocolsadaptersprotosdepth((s1build/bdist.darwin-8.0.1-x86/egg/protocols/api.pysdeclareAdapterForProtocolhs cCs)t|tƒi|t||ƒ|ƒdS(s0Declare that 'adapter' adapts 'ob' to 'protocol'N(sadaptsprotocols IOpenProtocolsregisterObjectsobs bindAdaptersadaptersdepth(sprotocolsadaptersobsdepth((s1build/bdist.darwin-8.0.1-x86/egg/protocols/api.pysdeclareAdapterForObjectnsc Csxxq|D]i}x|D]}t|||ƒqWx|D]}t|||ƒq5Wx|D]}t |||ƒqVWqWdS(s>'factory' is an IAdapterFactory providing 'provides' protocolsN( sprovidessprotocolsforTypesstypsdeclareAdapterForTypesfactorys forProtocolssprotosdeclareAdapterForProtocols forObjectssobsdeclareAdapterForObject( sfactorysprovidessforTypess forProtocolss forObjectssobsprotocolsprotostyp((s1build/bdist.darwin-8.0.1-x86/egg/protocols/api.pysdeclareAdapter~scCsFx|D]}t|t|ƒqWx|D]}t|t|ƒq(WdS(s>Declare information about a class, type, or 'IOpenImplementor'N(sinstancesProvidesprotosdeclareAdapterForTypesNO_ADAPTER_NEEDEDstypsinstancesDoNotProvidesDOES_NOT_SUPPORT(stypsinstancesProvidesinstancesDoNotProvidesproto((s1build/bdist.darwin-8.0.1-x86/egg/protocols/api.pysdeclareImplementation‘scCsFx|D]}t|t|ƒqWx|D]}t|t|ƒq(WdS(s.Tell an object what it does or doesn't provideN(sprovidessprotosdeclareAdapterForObjectsNO_ADAPTER_NEEDEDsobsdoesNotProvidesDOES_NOT_SUPPORT(sobsprovidessdoesNotProvidesproto((s1build/bdist.darwin-8.0.1-x86/egg/protocols/api.pys adviseObject›sc sÌ|iƒ}tdƒ}t|ƒ\} }}}| djoR|i dfƒ} |d=x|D]}t d|ƒ‚q]Wt |d| ƒdSn| djotdƒ‚n|i dfƒ‰|i d fƒ‰|i d fƒ‰|i d fƒ‰|i d fƒ‰|i d fƒ‰|i dfƒ‰|i dfƒ‰ |i dtƒ‰|i dfƒ‰t|idiƒƒx|D]}t d|ƒ‚q}W‡‡‡‡‡‡‡‡‡ ‡d†}t|ƒdS(NismodulesmoduleProvidess1Invalid keyword argument for advising modules: %ssprovidessclasss`protocols.advise() must be called directly in a class or module body, not in a function or exec.s classProvidessclassDoesNotProvidesinstancesProvidesinstancesDoNotProvidesasAdapterForTypessasAdapterForProtocolssprotocolExtendssprotocolIsSubsetOfs factoryMethodsequivalentProtocolssµclassProvides classDoesNotProvide instancesProvide instancesDoNotProvide asAdapterForTypes asAdapterForProtocols protocolExtends protocolIsSubsetOf factoryMethod equivalentProtocolss1Invalid keyword argument for advising classes: %scsKˆpˆ ot|dˆdˆ ƒnˆpˆot|dˆdˆƒnˆpˆoUˆ ot dƒ‚nˆot |ˆƒ}n|}t |ˆdˆdˆƒnˆot dƒ‚nˆot tˆd|gƒnˆot t|gdˆƒnˆo0t tˆd|gƒt t|gdˆƒn|SdS( NsprovidessdoesNotProvidesinstancesProvidesinstancesDoNotProvidesLWhen declaring an adapter, you must specify what its instances will provide.sforTypess forProtocolss;'factoryMethod' is only used when declaring an adapter type(s classProvidessclassDoesNotProvides adviseObjectsklasssinstancesProvidesinstancesDoNotProvidesdeclareImplementationsasAdapterForTypessasAdapterForProtocolss TypeErrors factoryMethodsgetattrsfactorysdeclareAdaptersprotocolExtendssNO_ADAPTER_NEEDEDsprotocolIsSubsetOfsequivalentProtocols(sklasssfactory( sasAdapterForTypessprotocolExtendssasAdapterForProtocolssequivalentProtocolssinstancesProvides factoryMethodsinstancesDoNotProvides classProvidessprotocolIsSubsetOfsclassDoesNotProvide(s1build/bdist.darwin-8.0.1-x86/egg/protocols/api.pyscallbackØs6   (skwscopys _getframesframes getFrameInfoskindsmodules caller_localsscaller_globalss setdefaultsmoduleProvidessks TypeErrors adviseObjects SyntaxErrors classProvidessclassDoesNotProvidesinstancesProvidesinstancesDoNotProvidesasAdapterForTypessasAdapterForProtocolssprotocolExtendssprotocolIsSubsetOfsNones factoryMethodsequivalentProtocolssmaps __delitem__ssplitscallbacksaddClassAdvisor(skwsframesmodules classProvidessclassDoesNotProvidesasAdapterForTypesscaller_globalss caller_localssinstancesDoNotProvidesasAdapterForProtocolssmoduleProvidessprotocolExtendsskindsequivalentProtocolssinstancesProvidesks factoryMethodscallbacksprotocolIsSubsetOf(( s classProvidessclassDoesNotProvidesasAdapterForTypessinstancesDoNotProvidesasAdapterForProtocolssprotocolExtendssequivalentProtocolssinstancesProvides factoryMethodsprotocolIsSubsetOfs1build/bdist.darwin-8.0.1-x86/egg/protocols/api.pysadvise§s<     '3N(%s__doc__s__all__sobjects_markerssyss _getframesexc_infosmodulesstypess ClassTypestypes ClassTypessadapterssNO_ADAPTER_NEEDEDsDOES_NOT_SUPPORTsAdaptationFailures bindAdaptersadvicesaddClassAdvisors getFrameInfos interfacess IOpenProtocols IOpenProvidersIOpenImplementorsProtocolsInterfaceClasssadapts _speedupss ImportErrorsdeclareAdapterForTypesdeclareAdapterForProtocolsdeclareAdapterForObjectsregisterImplementationsdeclareAdaptersdeclareImplementations adviseObjectsadvise(sdeclareAdapterForTypesdeclareAdapterForObjectsDOES_NOT_SUPPORTsdeclareImplementationsaddClassAdvisors IOpenProvidersAdaptationFailures__all__sdeclareAdapterForProtocolsadaptsdeclareAdaptersInterfaceClasssadvisesNO_ADAPTER_NEEDEDs_markers getFrameInfos bindAdapters ClassTypess adviseObjectsProtocolsIOpenImplementors ClassTypesmoduless _getframesexc_infos IOpenProtocol((s1build/bdist.darwin-8.0.1-x86/egg/protocols/api.pys?s0     )     PKÜ\â2Él)[[protocols/twisted_support.py"""Declaration support for Twisted Interfaces""" __all__ = [] from adapters import * from api import advise from interfaces import IOpenProtocol from weakref import WeakKeyDictionary # Twisted uses an approach to __adapt__ that is largely incompatible with # PEP 246, so we have to jump through some twisty hoops to convince it to work # for our purposes, without breaking Twisted's test suite. class TwistedAdaptMethod(object): """__adapt__ implementation for Twisted interfaces""" __slots__ = 'iface' def __init__(self,iface): self.iface = iface def __call__(self, obj): # This is the __adapt__ method that you get # for ISomething.__adapt__()... if TwistedImplements(obj, self.iface): return obj # Get Twisted to try and adapt return self.iface(obj, None) def im_func(self, ob, default): # And this is what MetaInterface.__call__ calls when # it goes after __adapt__.im_func! meth = self.iface.__dict__.get('__adapt__') if meth is None: return default return meth(ob,default) # Monkeypatch Twisted Interfaces try: from twisted.python.components import \ implements as TwistedImplements, \ MetaInterface as TwistedInterfaceClass, \ getInterfaces as TwistedGetInterfaces except ImportError: TwistedInterfaceTypes = [] else: # Force all Twisted interfaces to have an __adapt__ method TwistedInterfaceClass.__adapt__ = property(lambda s: TwistedAdaptMethod(s)) TwistedInterfaceTypes = [TwistedInterfaceClass] class TwistedInterfaceAsProtocol(object): __slots__ = 'iface' advise( instancesProvide=[IOpenProtocol], asAdapterForTypes=TwistedInterfaceTypes, ) def __init__(self, iface): self.iface = iface def __adapt__(self, obj): return self.iface.__adapt__(obj) def registerImplementation(self,klass,adapter=NO_ADAPTER_NEEDED,depth=1): oldImplements = TwistedGetInterfaces(klass) if adapter is NO_ADAPTER_NEEDED: klass.__implements__ = self.iface, tuple(oldImplements) elif adapter is DOES_NOT_SUPPORT: if self.iface in oldImplements: oldImplements.remove(self.iface) klass.__implements__ = tuple(oldImplements) else: raise TypeError( "Twisted interfaces can only declare support, not adapters", self.iface, klass, adapter ) def addImpliedProtocol(self, proto, adapter=NO_ADAPTER_NEEDED, depth=1): iface = self.iface # XXX need to ensure 'proto' is usable w/Twisted! self.iface.adaptWith(lambda o: adapter(o, iface), proto) # XXX is the above sufficient? # XXX What are Twisted's adapter override semantics? listeners = iface.__dict__.get('_Protocol__listeners',{}) for listener in listeners.keys(): # Must use keys()! listener.newProtocolImplied(self, proto, adapter, depth) def registerObject(self, ob, adapter=NO_ADAPTER_NEEDED, depth=1): oldImplements = TwistedGetInterfaces(ob) if adapter is NO_ADAPTER_NEEDED: ob.__implements__ = self.iface, tuple(oldImplements) elif adapter is DOES_NOT_SUPPORT: if self.iface in oldImplements: oldImplements.remove(self.iface) ob.__implements__ = tuple(oldImplements) else: raise TypeError( "Twisted interfaces can only declare support, not adapters", self.iface, ob, adapter ) def addImplicationListener(self, listener): listeners = self.iface.__dict__.setdefault( '_Protocol__listeners',WeakKeyDictionary() ) listeners[listener] = True PKIŸC8åïöŒLŒLprotocols/interfaces.pyc;ò µÆBc@s“dZdklZdddddddd d d d d ddgZdkZdklZlZlZdk l Z l Z dk l Z l Z dklZydklZWnPej oDydklZWqüej odefd„ƒYZqüXnXdfd„ƒYZydklZWnej on$XdklZeeeeƒe_deefd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZ defd„ƒYZ!defd „ƒYZ"de fd!„ƒYZ#de fd"„ƒYZ$d e$fd#„ƒYZ%d$e fd%„ƒYZ&d e fd&„ƒYZ'd e fd'„ƒYZ(d e%fd(„ƒYZ)d e fd)„ƒYZ*dS(*sBImplement Interfaces and define the interfaces used by the package(s generatorssProtocolsInterfaceClasss Interfaces AbstractBasesAbstractBaseMetasIAdapterFactorys IProtocolsIAdaptingProtocols IOpenProtocols IOpenProvidersIOpenImplementorsIImplicationListeners Attributes VariationN(s metamethods classicMROsmkRef(scomposeAdapterssupdateWithSimplestAdapter(sNO_ADAPTER_NEEDEDsDOES_NOT_SUPPORT(s InstanceType(s allocate_locks allocate_lockcBs tZfZd„Zd„ZRS(NcGsdS(N((sargs((s8build/bdist.darwin-8.0.1-x86/egg/protocols/interfaces.pysacquire!scGsdS(N((sargs((s8build/bdist.darwin-8.0.1-x86/egg/protocols/interfaces.pysrelease"s(s__name__s __module__s __slots__sacquiresrelease(((s8build/bdist.darwin-8.0.1-x86/egg/protocols/interfaces.pys allocate_locks cBsÑtZdZd„Zd„Zedd„ZeeƒZedd„ZeeƒZedd„Z ee ƒZ d„Z ydk l Z Wne j onXee ƒZ d „ZeeƒZeid „ZRS( s.Generic protocol w/type-based adapter registrycCs+h|_h|_t|_tƒ|_dS(N(sselfs_Protocol__adapterss_Protocol__impliessNones_Protocol__listenerss allocate_locks_Protocol__lock(sself((s8build/bdist.darwin-8.0.1-x86/egg/protocols/interfaces.pys__init__0s   cCsg}|i}|iiƒz\xQ|iiƒD]@\}}|ƒ}|t jo|i|=q/|||fƒq/W|SWd|ii ƒXdS(N( soutsappendsaddsselfs_Protocol__locksacquires_Protocol__impliessitemssksvsprotosNonesrelease(sselfsprotosksaddsvsout((s8build/bdist.darwin-8.0.1-x86/egg/protocols/interfaces.pysgetImpliedProtocols7s     ic Csí|iiƒz=t|ƒ}t|i|||ƒ o|i|dSnWd|ii ƒXxI|i i ƒD]8\}\}}ti|t|||ƒ|||ƒqkW|io4x1|iiƒD]}|i||||ƒqÁWn|SdS(Ni(sselfs_Protocol__locksacquiresmkRefsprotoskeysupdateWithSimplestAdapters_Protocol__impliessadaptersdepthsreleases_Protocol__adapterssitemssklasss baseAdaptersdsapisdeclareAdapterForTypescomposeAdapterss_Protocol__listenersskeysslistenersnewProtocolImplied( sselfsprotosadaptersdepthskeys baseAdapterslistenersklasssd((s8build/bdist.darwin-8.0.1-x86/egg/protocols/interfaces.pysaddImpliedProtocolSs  * cCsµ|iiƒz1t|i|||ƒ o|i|dSnWd|iiƒX|t jo|SnxF|i ƒD]8\}\}}ti|t|||ƒ|||ƒqqW|SdS(Ni(sselfs_Protocol__locksacquiresupdateWithSimplestAdapters_Protocol__adapterssklasssadaptersdepthsreleasesDOES_NOT_SUPPORTsgetImpliedProtocolssprotosextendersdsapisdeclareAdapterForTypescomposeAdapters(sselfsklasssadaptersdepthsdsprotosextender((s8build/bdist.darwin-8.0.1-x86/egg/protocols/interfaces.pysregisterImplementation|s   *cCsˆti|tƒi|||ƒob|tjodSnxJ|i ƒD]8\}\}}ti |t|||ƒ|||ƒqDWndS(N(sapisadaptsobs IOpenProvidersdeclareProvidessselfsadaptersdepthsDOES_NOT_SUPPORTsgetImpliedProtocolssprotosextendersdsdeclareAdapterForObjectscomposeAdapters(sselfsobsadaptersdepthsdsprotosextender((s8build/bdist.darwin-8.0.1-x86/egg/protocols/interfaces.pysregisterObject—s "  cCs°|ii}y |i}Wntj ot|ƒ}nXy |i}Wn%tj ot |dt ƒ}nXx9|D]1}||ƒ}|tj o|d|ƒSqwqwWdS(NsextendedClassici(sselfs_Protocol__adapterssgetsobjs __class__stypsAttributeErrorstypes__mro__smros classicMROsTruesklasssfactorysNone(sselfsobjsgetsfactorysmrosklassstyp((s8build/bdist.darwin-8.0.1-x86/egg/protocols/interfaces.pys __adapt__¥s     (sProtocol__adapt__cCs`|iiƒz>|itjodkl}|ƒ|_nd|i|Uä‰EÔ‰|$‰UЉT$‰4$è|>‹EЉ|$‰D$‰4$èP>èÂ?…À…•‹Eà…Àu ‹ƒóG‰Eàƒ‹EÔ‹P4…Òt‹ƒè…À‰„ü‹EÔ‹P8…Òt‹ƒè…À‰„Ï‹EÔ‹P<…Òt‹ƒè…À‰„¢‹EÜ‹MÔ‰A4‹Eà‰A8‹Eä‰A<‹Eà…À‰EØtƒÇEÜÇEàÇEä‹UÜ…Òt ‹ƒè…À‰tK‹Uà…Òt ‹ƒè…À‰t+‹Uä…Òt ‹ƒè…À‰t ‹E؃Ä<[^_]ËEä‹H‰$ÿQëç‹Eà‹x‰$ÿWëÇ‹EÜ‹p‰$ÿVë§‹}Ô‹G<‹p‰$ÿVéJÿÿÿ‹MÔ‹A8‹x‰$ÿWéÿÿÿ‹uÔ‹F4‹H‰$ÿQéðþÿÿU‰åWVSè@ƒì‹u…ötƒ‹E …Àt‹E ƒ‹E…Àt‹Eƒ‹E;ƒMF„ ‹E…Àt‹ƒ%F‹M9A…|‹E …À„`‹»5F9~t‰|$‹F‰$èB?…Àt*‰4$èH<…À~‰ò‹v ƒ‹ƒè…À‰uÉ‹B‰$ÿP뾋ƒF9FtL‰D$‹F‰$èú>…Àu9‹F;ƒEFt.;ƒAF…À‹} ;»MFu@‹U ‹ƒè…À‰t'‰u ‹vƒ‹E‰4$‰D$‹E ‰D$è‡;ƒÄ[^_]ËB‰$ÿPë΃y9‰D$‹ƒ!F‹‰$è¥;‹E …Àt‹U ‹ƒè…À‰t;…öt ‹ƒè…À‰t!‹E…À.t§‹U‹ƒè…À‰u™‹B‰$ÿP뎋F‰4$ÿPëÔ‹B‰$ÿP뺋@ “¹9‰D$‰T$‹ƒ!F‹‰$è÷:ë‚‹ƒMF‰E ƒéþÿÿƒù9éRÿÿÿ‰Â‹ƒè…À‰t ÇEé`þÿÿ‹B‰$ÿPëéU‰åƒìè$;‹H4‹P8‹@<…Étƒ…Òtƒ…Àtƒ‰D$‰T$‰ $è`:ÉÃU‰åVƒì‹u‹…Àu1ÀƒÄ^]ËF‰$èf;‹‰‹‹…Àt ƒÆ‹…ÀuàëÖ¸ÿÿÿÿëÑU‰åVƒì‹u‹…Àu1ÀƒÄ^]ËFƒè‰D$‹F‰$èÓ9‹‰‹‹…Àt ƒÆ ‹…ÀuÖë̸ÿÿÿÿëÇU‰åWVSèJ=ƒìlÇEàÇEÜ‹ƒ•DÇEØÇEÔ‰$èc9…À‰Æ„u‹E‰$èN9…À‰Ç„拃‰D‰$èb:…À‰Eä„ÍÇ$è£<…À‰Eà„¶“e5‰$è9…À‰EÜ„‰D$4‹ƒ‘D‰|$,‰D$0‹Eà‰t$(‰D$$‰D$ ‰D$‰D$‰D$‹E܉D$ÇD$ ÇD$ÇD$Ç$èŠ8…À‰EØt>è_9‹MäÇD$ ‰L$‹M؉$‰L$èG8…À‰EÔt‹MÔ‹ƒ‘D‰A@‰ $è8…öt‹ƒè…À‰„©…ÿt‹ƒè…À‰„ˆ‹Uà…Òt‹Uà‹ƒè…À‰th‹uÜ…öt‹UÜ‹ƒè…À‰tH‹}Ø…ÿt‹UØ‹ƒè…À‰t(‹EÔ…Àt‹UÔ‹ƒè…À‰tƒÄl[^_]ËB‰$ÿPëí‹B‰$ÿPëÍ‹B‰$ÿPë­‹B‰$ÿPë‹G‰<$ÿPéjÿÿÿ‹F‰4$ÿPéIÿÿÿU‰åVSèC;Mðƒì0“v@uô‹ƒ¦B‰T$ “~5‰Eô‹E‰T$‰D$‹E ÇEð‰t$‰L$‰$èå91Ò…Àt0‹Eðƒ‹Eôƒ‹Eðƒ‹uð‹ƒè…À‰t'‹Eô‹ƒé…ɉt ‰òƒÄ0‰Ð[^]ËEô‹H‰$ÿQëç‹Eð‹H‰$ÿQëËU‰åVSè—:Mðƒì0“Ö?uô‹ƒþA‰T$ “Ò4‰Eô‹E‰T$‰D$‹E ÇEð‰t$‰L$‰$è991Ò…Àt3‹Eð‹³Æ@ƒ‹Eôƒƒ‹Eð‹ƒé…ɉt'‹Eô‹ƒé…ɉt ‰òƒÄ0‰Ð[^]ËEô‹H‰$ÿQëç‹Eð‹H‰$ÿQëËU‰åVSèç9Môƒì0“2?ÇEô‹E‰T$ “B4‰D$‹E ‰T$‹u‰L$‰$è–8ºÿÿÿÿ…Àt;ƒ‹Eôƒ‹Eôƒ‹F‹ƒé…ɉtC‹‹Uôƒè‰V…À‰t$‹ƒè…À‰t 1ÒƒÄ0‰Ð[^]ËEô‹p‰$ÿVëç‹F‰4$ÿP‹Uôë΋F‹H‰$ÿQë¯U‰åVSè+9Uôƒì0Mìuð‹ƒ–@‰T$“B;‰Eô‹E‰T$ ‰D$“¦3‹E ‰T$ÇEìÇEð‰t$‰L$‰$è¿71Ò…Àt]‹E샋Eðƒ‹Eôƒ‹Eô‰D$‹Eð‰D$‹Eì‰$è<…À‰Æt_‹E싃é…ɉtC‹Eð‹ƒé…ɉt'‹Eô‹ƒé…ɉt ‰òƒÄ0‰Ð[^]ËEô‹H‰$ÿQëç‹Eð‹H‰$ÿQëË‹Eì‹H‰$ÿQ믋ƒZ>‹Æ31ö‹Çƒr@‰ $‰ƒv@èÃúÿÿétÿÿÿU‰åVSè8Uôƒì0Mìuð‹ƒv?‰T$“F:‰Eô‹E‰T$ ‰D$“‚2‹E ‰T$ÇEìÇEð‰t$‰L$‰$è›61Ò…Àt]‹E샋Eðƒ‹Eôƒ‹Eô‰D$‹Eì‰D$‹Eð‰$è…À‰Æt_‹E싃é…ɉtC‹Eð‹ƒé…ɉt'‹Eô‹ƒé…ɉt ‰òƒÄ0‰Ð[^]ËEô‹H‰$ÿQëç‹Eð‹H‰$ÿQëË‹Eì‹H‰$ÿQ믋ƒ6=‹Â21ö‹ÇƒN?Ɖ $‰ƒR?èŸùÿÿétÿÿÿU‰åWVMàuäSèÜ6ƒì<“?9ÇEà‹ƒO>‰T$ “1‰Eä‹E‰T$‰D$‹E ÇEÜÇE؉t$‰L$‰$èv51Ò…À„ ‹Eà‹» =ƒ‹E䃋ƒ=ƒ‹Mà9A…2Ç$è5…À‰Æ„‹ƒè…À‰„è‹Eà‰t$‰÷‰$èäÿÿ…À‰Æ„¶‹ƒè…À‰„™‹Eä‰$è 4…Àˆl…ÀtR‹³ÿ<ƒ‰t$‰<$è±4ƒøÿ„3‹ƒè…À‰„‹³÷<ƒ‰t$‰<$è„4ƒøÿtu‹ƒè…À‰t_ƒ‰þ‹ƒè…À‰tD‹Eà‹8ƒï…ÿ‰8t(‹Eä‹8ƒï…ÿ‰8t ‰òƒÄ<‰Ð[^_]ËEä‹H‰$ÿQëæ‹Eà‹H‰$ÿQëÊ‹G‰<$ÿP뱋F‰4$ÿPë–‹ƒ <‹Çƒ#>㉃'>…öt ‹ƒè…À‰tU‹EÜ…Àt‹UÜ‹ƒè…À‰t5‹EØ…Àt‹UØ‹ƒè…À‰t“·11ö‰$è„÷ÿÿé5ÿÿÿ‹B‰$ÿPëà‹B‰$ÿPëÀ‹F‰4$ÿPë ‹F‰4$ÿPéÜþÿÿ‹ƒ <‹Çƒ#>âéfÿÿÿ‹ƒ <‹Çƒ#>ቃ'>ë‹‹F‰4$ÿPéYþÿÿ‹ƒ <‹Çƒ#>àé'ÿÿÿ‹G‰<$ÿPé þÿÿ‹ƒ <‹Çƒ#>ßéÿÿÿ‹ƒ³>‰D$‹ƒ>‰$èéñÿÿ…À‰Æ„Ç$èÆ3…À‰EÜ„†‹ƒ¿>ƒ‹ƒ¿>‹M܉A ‹Eàƒ‹Eà‰A‰L$‰4$èu3…À‰EØtR‹ƒè…À‰tt‹UÜ1ö‹ƒè…À‰tY‹EØÇEÜÇD$‰$ÇD$èWóÿÿ‹UØ‹ƒè…À‰tÇEØ‹ƒ <‹Çƒ#>æé,þÿÿ‹B‰$ÿPë׋B‰$ÿP뜋F‰4$ÿPëU‰åWVMàuäSè 3ƒì<“5ÇEà‹ƒ—:‰T$ “[-‰Eä‹E‰T$‰D$‹E ‰t$‰L$‰$èÈ11Ò…À„û‹Eà‹»O9ƒ‹E䃃Ç$èk1…À‰Æ„‹ƒè…À‰„¥‹Eà‰t$‰÷‰$èIâÿÿ…À‰Æ„s‹ƒè…À‰„V‹Eä‰$è1…Àˆ)…ÀtR‹³C9ƒ‰t$‰<$è1ƒøÿ„ó‹ƒè…À‰„Ö‹³;9ƒ‰t$‰<$èè0ƒøÿtu‹ƒè…À‰t_ƒ‰þ‹ƒè…À‰tD‹Eà‹8ƒï…ÿ‰8t(‹Eä‹8ƒï…ÿ‰8t ‰òƒÄ<‰Ð[^_]ËEä‹H‰$ÿQëæ‹Eà‹H‰$ÿQëÊ‹G‰<$ÿP뱋F‰4$ÿPë–‹ƒO8‹Çƒg:‰ƒk:…öt ‹ƒè…À‰t“.1ö‰$èôÿÿé_ÿÿÿ‹F‰4$ÿPëà‹F‰4$ÿPéÿÿÿ‹ƒO8‹Çƒg:ë©‹ƒO8‹Çƒg:‰ƒk:뤋F‰4$ÿPéœþÿÿ‹ƒO8‹Çƒg:ÿéjÿÿÿ‹G‰<$ÿPéMþÿÿ‹ƒO8‹Çƒg:þéEÿÿÿU‰åWVMàuäSèÀ0ƒì<“;3ÇEà‹ƒ;8‰T$ “û*‰Eä‹E‰T$‰D$‹E ÇEÜÇE؉t$‰L$‰$èZ/1Ò…À„‚‹Eàƒ‹E䃋Uà‹J;‹ç6”À¶ð…ö…F‹ƒë69Át‰D$‹B‰$èÀ/…À„è‹Uà‹ƒ«8‰$‰D$èq/…À‰Æ‰ÇtD‹Eà‹ƒé…ɉt(‹E䋃é…ɉt ‰úƒÄ<‰Ð[^_]ËEä‹p‰$ÿVëæ‹Eà‹p‰$ÿVëÊ‹ƒï5‹Çƒ8 ‰ƒ 8…öt ‹ƒè…À‰tU‹EÜ…Àt‹UÜ‹ƒè…À‰t5‹EØ…Àt‹UØ‹ƒè…À‰t“Û+1ÿ‰$è òÿÿéVÿÿÿ‹B‰$ÿPëà‹B‰$ÿPëÀ‹F‰4$ÿPë ‹Uà‹ƒ89Bt‰D$‹B‰$è³.…Àt¾…ö„׋ƒg8‰D$‹ƒÿ7‰$èÉìÿÿ…À‰EÜ„—Ç$è¥.…À‰EØ„€‹Eàƒ‹Eà‹M؉A ‹E䃋Eä‰A‰L$‹E܉$èW.…À‰Æt9‹UÜ‹ƒè…À‰t ‹UØ‹ƒè…À‰t‰÷ézþÿÿ‹B‰$ÿPëî‹B‰$ÿPëÕ‹ƒï5‹Çƒ8é£þÿÿ‹ƒï5‹Çƒ8‰ƒ 8é›þÿÿÇ$èñ-…À‰EÜt‹Eàƒ‹uÜ‹Eà‰F ë‹‹ƒï5‹Çƒ8뽋ƒc8‰D$‹ƒÿ7‰$èºëÿÿ…À‰ÆtxÇ$è›-…À‰EÜte‹Eàƒ‹Eà‹}܉G ‹E䃋Eä‰G‰|$‰4$èT-…À‰EØt7‹ƒè…À‰t!‹UÜ‹ƒè…À‰t‹}Øéxýÿÿ‹B‰$ÿPëí‹F‰4$ÿPëÔ‹ƒï5‹Çƒ8 é¡ýÿÿU‰åWVMàuäSè<-ƒì\“Ã/ÇEà‹E‰T$ “w(‰D$‹E ‰T$ÇEäÇEÄÇEÀÇE¼‰t$‰L$‰$èÑ+1Ò…À„-‹Eàƒ‹E䃋ƒk3‰EÜ‹8‹uÜW‰uØO‰ƒÇ‹E؉EÔ‹UÔ‰UЉ ‹EЉẺ8‹ƒ_3‹Uä9B…Ÿ ‹zƒ‹UÌ‹ƒè…À‰„y ‰}Ü‹ƒg3‹MÜ1ö9At‰D$‹A‰$èì+…Àt ‹EÜ‹°¬…ö… ‹ƒc3‹uÜ9F…7 Ç$èØ*…À‰Ç„ ‹UÔ‹ƒè…À‰„ê ‹E܉}Ô‰|$‰$èZÚÿÿ…À‰Ç„· ‹ƒè…À‰„š ‹»_3ƒ‰|$‹EÔ‰$è’*ƒøÿ„b ‹ƒè…À‰„E ‹»W3ƒ‰|$‹MÔ‰ $èb*ƒøÿ„ ‹ƒè…À‰„ð‹ƒ+5‰D$‹Eà‰$èË*…À‰EÀ„¹‹ƒ/5‹uÀ‰D$‰4$è«*…À‰EÄ„‚‹UÀ‹ƒè…À‰„bÇEÀ‹MЋƒè…À‰„;‹EÄ‹UÔ‰EЋƒS39Bt‰D$‹B‰$è„*…À„„‹UÔ1ö‹B9EÀ‰EÈe‹EÔ‹|° ƒ‹UÜ‹ƒè…À‰„;‰}ÜÇ$èo*…À‰EÀ„‹}܃‹EÀ‰x ‰D$‹MЉ $è0*…À‰EĄʋMÀ‹ƒè…À‰„ªÇEÀ‹UÌ‹ƒè…À‰„ƒ‹UÄ‹ƒk3ÇEÄ9‰UÌ…ãƒÆ;uÈŒRÿÿÿ‰Æƒ‹MÜ‹ƒè…À‰„²‹UØ‹ƒè…À‰„’‹MÔ‹ƒè…À‰tv‹UЋƒè…À‰t]‹MÌ‹ƒè…À‰tD‹Eà‹8ƒï…ÿ‰8t(‹Eä‹8ƒï…ÿ‰8t ‰òƒÄ\‰Ð[^_]ËEä‹H‰$ÿQëæ‹Eà‹H‰$ÿQëÊ‹A‰ $ÿP뱋B‰$ÿP똋A‰ $ÿPé|ÿÿÿ‹B‰$ÿPé`ÿÿÿ‹A‰ $ÿPé@ÿÿÿÇ$ès(…À‰Ç„‰D$‹Ẻ$èA(…À‰EÀ„ƒ‹ƒè…À‰„8Ç$èÊ(…À‰EÄ„‹E䃋MÄ‹Eä‰A ‰L$‹uÀ‰4$èˆ(…À‰Çt9‹UÀ‹ƒè…À‰t ‹MÄ‹ƒè…À‰t‰þé‘þÿÿ‹A‰ $ÿPëî‹B‰$ÿPëÕ‹ƒk2‹Çƒƒ4z‰ƒ‡4…ÿt ‹ƒè…À‰tu‹uÄ…öt‹UÄ‹ƒè…À‰tU‹EÀ…Àt‹MÀ‹ƒè…À‰t5‹E¼…Àt‹U¼‹ƒè…À‰t‹—(1ö‰ $èÍêÿÿéþÿÿ‹B‰$ÿPëà‹A‰ $ÿPëÀ‹B‰$ÿPë ‹G‰<$ÿP뀋ƒk2‹Çƒƒ4z‰ƒ‡4écÿÿÿ‹G‰<$ÿPéºþÿÿ‹B‰$ÿPéoýÿÿ‹A‰ $ÿPéHýÿÿ‹ƒk2‹Çƒƒ4xë·‹ƒk2‹Çƒƒ4x‰ƒ‡4éÿÿÿ‹B‰$ÿPé·üÿÿ‹ƒk3é>ýÿÿ‹ƒO3‹UÔ9Bt‰D$‹B‰$èÛ&…À„‹}Ô1ö‹G9ƉEÈ.}À‹MÔ‹A ‹°‰EÀƒ‹MÜ‹ƒè…À‰„Ý‹EÀÇ$ÇEÀ‰EÜè»&…À‰EÄ„¢‹}܃‹Eĉx ‰D$‹EЉ$è|&…À‰Ç„f‹UÄ‹ƒè…À‰„F‹MÌ‹ƒè…À‰„&‹ƒk3‰}Ì9ÇuƒÆ;uÈŒYÿÿÿé]üÿÿÇ$è§%…À‰EÀ„Ú‰D$‹Ẻ$èt%…À‰EÄ„©‹UÀ‹ƒè…À‰„‰ÇEÀÇ$èó%…À‰ÇtY‹E䃋Eä‰G ‰|$‹Uĉ$è¹%…À‰EÀt7‹UÄ‹ƒè…À‰t‹ƒè…À‰t‹uÀéÃûÿÿ‹G‰<$ÿPëí‹B‰$ÿPë׋ƒk2‹Çƒƒ4‚é-ýÿÿ‹B‰$ÿPéiÿÿÿ‹ƒk2‹Çƒƒ4‚é¯ýÿÿ‹ƒk2‹Çƒƒ4‚éóýÿÿ‹A‰ $ÿPéÌþÿÿ‹B‰$ÿPé¬þÿÿ‹ƒk2‹Çƒƒ4€é¾üÿÿ‹ƒk2‹Çƒƒ4€éNýÿÿ‹A‰ $ÿPéþÿÿ‹uÔ‰4$è™#…À‰EÄ„‹Eĉ$èj#…À‰Ç„É‹UÜ‹ƒè…À‰„©‰}ÜÇ$è$…À‰EÀ„x‹}܃‹EÀ‰x ‰D$‹MЉ $è^$…À‰Ç„<‹MÀ‹ƒè…À‰„ÇEÀ‹UÌ‹ƒè…À‰„õ;»k3‰}Ì„`ÿÿÿÇ$è‘#…À‰EÀ„¸‰D$‹Ẻ$è^#…À‰Çt~‹UÀ‹ƒè…À‰„ƒÇ$èé#…À‰EÀtY‹E䃋UÀ‹Eä‰B ‰T$‰<$è®#…À‰E¼t7‹ƒè…À‰t!‹UÀ‹ƒè…À‰t‹u¼é¸ùÿÿ‹B‰$ÿPëí‹G‰<$ÿPëÔ‹ƒk2‹Çƒƒ4Šé"ûÿÿ‹B‰$ÿPéoÿÿÿ‹ƒk2‹Çƒƒ4Šé¤ûÿÿ‹B‰$ÿPéýþÿÿ‹A‰ $ÿPéÖþÿÿ‹ƒk2‹Çƒƒ4ˆéÊúÿÿ‹ƒk2‹Çƒƒ4ˆéZûÿÿ‹B‰$ÿPéIþÿÿèy!…Àu ‹MÄ‹ƒè…À‰…¥ûÿÿ‹A‰ $ÿPé—ûÿÿ‹ƒk2‹Çƒƒ4‡éeúÿÿ‹ƒk2‹Çƒƒ4‡éõúÿÿ‹A‰ $ÿPé·÷ÿÿ‹B‰$ÿPé÷ÿÿ‹ƒk2‹Çƒƒ4réÂúÿÿ‹ƒk2‹Çƒƒ4réûÿÿ‹G‰<$ÿPé÷ÿÿ‹ƒk2‹Çƒƒ4Qéßùÿÿ‹G‰<$ÿPé­öÿÿ‹ƒk2‹Çƒƒ4Péºùÿÿ‹G‰<$ÿPéXöÿÿ‹ƒk2‹Çƒƒ4Oé•ùÿÿ‹B‰$ÿPéöÿÿ‹ƒk2‹Çƒƒ4Népùÿÿ‹ƒ—4‹}܉D$‰<$èG!1Ò…À•Â…Ò‰UÈt>ƒ‰Ç‹UÔ‹ƒè…À‰t ‰}Ô‹ƒè…À‰…4öÿÿ‹uÔ‹F‰4$éÿÿÿ‹B‰$ÿPëÕ‹ƒ›4‹UÜ9Bt‰D$‹B‰$è!…ÀtÇEÈ‹EÈ…À„àè_ ‹ƒã4‰D$‹ƒ{4‰$èßÿÿ…À‰Ç„¢Ç$èc …À‰EÄ„‹Ç$èâ …À‰EÀtx‹U܃‹EÀ‰P ‹MĉH‰D$‰<$è¤ …À‰EÄtS‹ƒè…À‰t=‹MÀ‹ƒè…À‰t$‹UÔ‹ƒè…À‰t ‹}ĉ}Ôé@õÿÿ‹B‰$ÿPëê‹A‰ $ÿPëÑ‹G‰<$ÿP븋ƒk2‹Çƒƒ4^éü÷ÿÿè¨Þÿÿ…À‰Çt>‹UØ‹ƒè…À‰t%‰}Øè@âÿÿ‹ƒk2‹Çƒƒ4d‰ƒ‡4éøÿÿ‹B‰$ÿPëЋƒk2‹Çƒƒ4céœ÷ÿÿƒ‰÷‹UÔ‹ƒè…À‰…Iÿÿÿ‹B‰$ÿPé;ÿÿÿ‹B‰$ÿPéyóÿÿ‹ƒË4‰D$‹ƒ{4‰$è®Ýÿÿ…À‰Ç„ ‰D$‹Eä‰$è$‰Æ‹ƒè…À‰„Þ…ötAƒ‰÷‹MÌ‹ƒè…À‰t#‰}Ü‹ƒè…À‰…óÿÿ‹}Ü‹G‰<$ÿPéóÿÿ‹A‰ $ÿPëÒ‹ƒ[3‹‰$襅ÀuZèzÝÿÿ…À‰Çt8‹UÌ‹ƒè…À‰t‰}Øèáÿÿ‹ƒk2‹Çƒƒ47éÍþÿÿ‹B‰$ÿPëÖ‹ƒk2‹Çƒƒ46étöÿÿè÷‹Eä‹xƒ‹MÌ‹ƒè…À‰…dòÿÿ‹A‰ $éØþÿÿ‹G‰<$ÿPéÿÿÿ‹ƒk2‹Çƒƒ4)é$öÿÿU‰åSè ƒì‹EÇD$‰$ÿ˜‹‹Ï$‰HƒƒÄ[]ÃU‰åVƒì‹u‹V…Òt ‹ƒè…À‰t‹F‰4$ÿ ƒÄ^]ËF‹H‰$ÿQëàU‰åƒì‹E‹P…Òu1ÀÉËE‰$‰D$ÿU …ÀuíëéU‰åƒì‰]ø‰uü‹u‹Vèú…Òt ‹ƒè…À‰t‹ƒ)$‰Fƒ1À‹]ø‹uü‰ì]ËF‹H‰$ÿQëÚU‰åS較ì‹U ‹E‹‹ë#…ÒDÑ…ÀDÁ‰U ‰EƒÄ[]éò U‰åƒì‹E‹M‹U …ÀtÉé¯ ‰U ‰MÉé‡U‰åWVSè^ƒì<ÇEÜÇEØÇEÔ‹Eƒ‹} ƒ‹»#‹Eƒ‹‰}äpƒÀ‰7‹Mä‰Mà‰‹U ‹B‹“‰#9Ðt‰T$‰$è•…Àt&‹M‹A;E „> ‹U ‰$‰T$ès…À…' ‹ƒ…#‹U 9Bu‹ƒ#‹M9A„ó ‹ƒ±$‹u‰D$‰4$è…À„] ‰E܃‹ƒè…À‰„: ‹}Ü‹ƒè…À‰„ Ç$è-…À‰EÜ„õ‹U ƒ‹E܉P ‰D$‰<$èñ…À‰E؄ҋUÜ‹ƒè…À‰„²ÇEÜ‹M䋃è…À‰„‹‹EØÇEØ;ƒ#‰Eä…u‹ƒµ$‰D$‹E ‰$èB…À„»‰E؃‹ƒè…À‰„˜‹}Ø‹ƒè…À‰„xÇ$èk…À‰EÔ„A‹Mƒ‹uÔ‰N ‰t$‰<$è/…À‰EÜ„‹UÔ‹ƒè…À‰„þÇEÔ‹M䋃è…À‰„׋EÜ;ƒ#‰Eä…º‹M;‹­$…ž‹ƒå$‰D$‹ƒ$‰$èæØÿÿ…À‰EØ„UÇ$èÂ…À‰EÔ„‹ƒ=%ƒ‹ƒ=%‹uÔ‰F ‹Uƒ‰V‹E ƒ‰F‰t$‹E؉$èh…À‰EÜ„M‹UØ‹ƒè…À‰„-‹MÔ‹ƒè…À‰„ ‹EÜÇD$ÇD$‰$èDÚÿÿ‹UÜ‹ƒè…À‰„Ò‹ƒ"‹Çƒ¥$·‰ƒ©$³Ù‰uЋUÐ1ö‰$èØÜÿÿ‹ƒè…À‰„‡‹U䋃è…À‰tn‹Mà‹ƒè…À‰tU‹U‹ƒè…À‰t<‹M ‹ƒè…À‰t#‹U‹ƒè…À‰t ƒÄ<‰ð[^_]ËB‰$ÿPëë‹A‰ $ÿPëÒ‹B‰$ÿP빋A‰ $ÿPë ‹B‰$ÿP뇋G‰<$ÿPékÿÿÿ‹B‰$ÿPé ÿÿÿ‹A‰ $ÿPéåþÿÿ‹B‰$ÿPéÅþÿÿ‹ƒ"‹Çƒ¥$·‰ƒ©$ƒÙ‰EЋEÜ…Àt‹UÜ‹ƒè…À‰tL‹EØ…Àt‹MØ‹ƒè…À‰t,‹MÔ…É.„Îþÿÿ‹UÔ‹ƒè…À‰…¼þÿÿ‹B‰$ÿPé®þÿÿ‹A‰ $ÿPëÉ‹B‰$ÿPë©‹ƒ"‹Çƒ¥$·‰ƒ©$“Ù‰UÐ놋ƒ"³Ù‹Çƒ¥$·‰uЉƒ©$é`ÿÿÿ‹Eƒ‰ÆéOþÿÿƒ‹uäéDþÿÿ‹A‰ $ÿPéýÿÿ‹B‰$ÿPéôüÿÿ‹ƒ"‹Çƒ¥$ª‰ƒ©$‹EÔ…Àt‹UÔ‹ƒè…À‰„á‹EÜÇEÔ…Àt‹MÜ‹ƒè…À‰„³‹ƒ5%ÇE܉D$‹ƒ¡$‰$è¼Õÿÿ…À‰EØ„r‹E؉$è‹M؉Ƌƒè…À‰„EƒÙ…öÇE؉EЄeþÿÿ‰$èFÚÿÿèÁÕÿÿ…À‰EÔ„ø‹MÔ‹ƒè…À‰„Ø‹ƒá$ÇEÔ‰D$‹ƒ$‰$è1Õÿÿ…À‰EÜ„uÇ$è …À‰EØ„^‹EØ‹M܉D$‰ $è×…À‰EÔ„A‹MÜ‹ƒè…À‰„Z‹UØ‹ƒè…À‰„:ÇEØÇ$è…À‰EÜ„ÿ‹UÜ‹EÔ‰T$‰$èâ…À‰EØ„â‹UÔ‹ƒè…À‰„‹MÜ‹ƒè…À‰„¢‹ƒ9%‰D$‹E؉$èé…À‰EÔto‹UØ‹ƒè…À‰tV‹MÔ;‹#‹•ƒè…À¶ò‰t1…öÇEÔ„ûÿÿèØÿÿ‹ƒ"‹Çƒ¥$¯‰ƒ©$ééûÿÿ‹A‰ $ÿPëÄ‹B‰$ÿP럋ƒ"‹Çƒ¥$®ébýÿÿ‹A‰ $ÿPéPÿÿÿ‹B‰$ÿPé0ÿÿÿ‹ƒ"‹Çƒ¥$®‰ƒ©$éüÿÿ‹B‰$ÿPé¸þÿÿ‹A‰ $ÿPé˜þÿÿ‹A‰ $ÿPéþÿÿ‹ƒ"‹Çƒ¥$­‰ƒ©$ébüÿÿ‹A‰ $ÿPé­ýÿÿ‹ƒ"‹Çƒ¥$­é‘üÿÿ‹A‰ $ÿPé?ýÿÿ‹B‰$ÿPéýÿÿ‹G‰<$ÿPézùÿÿ‹G‰<$ÿPéZùÿÿ‹ƒ}#‹‰$èV…Àu|è+Óÿÿ…À‰EÜtJ‹Uà‹ƒè…À‰t1‹E܉Eàè¿Öÿÿ‹ƒ"‹“Ùǃ¥$´‰ƒ©$‰UÐé€úÿÿ‹B‰$ÿPëÄ‹ƒ"‹Çƒ¥$³‰ƒ©$³Ù‰uÐéKûÿÿè†éIùÿÿ‹A‰ $ÿPégøÿÿ‹B‰$ÿPé@øÿÿ‹ƒ"‹Çƒ¥$‘‰ƒ©$‹EÜ…Àt‹UÜ‹ƒè…À‰„Ï‹EØ…Àt‹MØ‹ƒè…À‰„¨‹ƒ5%ÇE؉D$‹ƒ¡$‰$èÑÑÿÿ…À‰EÜ„g‹E܉$è1‹M܉Ƌƒè…À‰„:ƒÙ…ö‰EЄ…ùÿÿ‰$èbÖÿÿèÝÑÿÿ…À‰EØ„ú‹MØ‹ƒè…À‰„Ú‹ƒá$ÇE؉D$‹ƒ$‰$èMÑÿÿ…À‰EÜ„}Ç$è)…À‰EØ„f‹EØ‹u܉D$‰4$èó…À‰EÔ„I‹MÜ‹ƒè…À‰„\‹UØ‹ƒè…À‰„<ÇEØÇ$è4…À‰EÜ„‹UÜ‹EÔ‰T$‰$èþ…À‰EØ„ê‹UÔ‹ƒè…À‰„Ê‹MÜ‹ƒè…À‰„ª‹ƒ9%ÇE܉D$‹E؉$èþ…À‰EÔtp‹UØ‹ƒè…À‰tW‹MÔÇEØ;‹#‹•ƒè…À¶ò‰t+…öÇEÔ„böÿÿè-Ôÿÿ‹ƒ"‹Çƒ¥$–é üÿÿ‹A‰ $ÿPëÊ‹B‰$ÿPëž‹ƒ"‹Çƒ¥$•évùÿÿ‹A‰ $ÿPéHÿÿÿ‹B‰$ÿPé(ÿÿÿ‹ƒ"‹Çƒ¥$•éüÿÿ‹B‰$ÿPé¶þÿÿ‹A‰ $ÿPé–þÿÿ‹A‰ $ÿPéþÿÿ‹ƒ"‹Çƒ¥$”éùÿÿ‹A‰ $ÿPé¸ýÿÿ‹ƒ"‹Çƒ¥$”éÔüÿÿ‹A‰ $ÿPéJýÿÿ‹B‰$ÿPé#ýÿÿ‹G‰<$ÿPéØôÿÿ‹G‰<$ÿPé¸ôÿÿ‹ƒ}#‹‰$èv…Àu[èKÏÿÿ…À‰EÜt8‹ƒè…À‰t"‹E܉EàèâÒÿÿ‹ƒ"‹Çƒ¥$›é£öÿÿ‹G‰<$ÿPëÓ‹ƒ"‹Çƒ¥$šé-üÿÿèÇéÏôÿÿ‰T$‰ $è3…À„ùóÿÿ‹EéøÿÿU‰åƒì8‰]ô‰uø‰}ü‹u‹} 臃ƒ‹Eƒ;»¶u[ƒ‰u䋃è…À‰t?‹ƒè…À‰t)‹U‹ƒè…À‰t‹Eä‹]ô‹uø‹}ü‰ì]ËB‰$ÿPëå‹G‰<$ÿPëÌ‹F‰4$ÿPë¶‹E‰|$‰D$‹F‰$èå…À‰EäuŽ‹ƒ¶“" ‹ÇƒÎi‰$‰ƒÒè€ÒÿÿÇEäé\ÿÿÿU‰åW1ÿVS較ì,ÇEä‹Eƒ‹E ƒ‹Eƒ‹ƒ‡‰D$‹ƒÿ‰$è_Íÿÿ…À‰Æ„Ç$è<…À‰Çt{‹ƒ‹ƒ‹ƒ‹‰G ‰|$‰4$èÿ…À‰EätV‹ƒè…À‰„C‹1öƒè…À‰„$‹EäÇD$ÇD$‰$èãÎÿÿ‹Uä‹1ÿƒè…À‰„çÇE䋃ë…ö‹Çƒl‰ƒt‹ƒè…À‰„§…ÿt‹ƒè…À‰„†‹Mä…Ét‹U䋃è…À‰tf“w ‰$è;Ñÿÿ‹U‹ƒè…À‰t?‹U ‹ƒè…À‰t&‹U‹ƒè…À‰t ƒÄ,¸ÿÿÿÿ[^_]ËB‰$ÿPëè‹B‰$ÿPëÏ‹B‰$ÿPë¶‹B‰$ÿPë‹G‰<$ÿPélÿÿÿ‹F‰4$ÿPéKÿÿÿ‹B‰$ÿPé ÿÿÿ‹G‰<$ÿPéÎþÿÿ‹F‰4$ÿPé¯þÿÿU‰åW1ÿVSèØ ƒì,ÇEä‹Eƒ‹E ƒ‹ƒ£‰D$‹ƒ‰$èËÿÿ…À‰Æ„Ç$è^ …À‰Çt{‹ƒ«ƒ‹ƒ«‰G ‰|$‰4$è! …À‰EätV‹ƒè…À‰„#‹1öƒè…À‰„‹EäÇD$ÇD$‰$èÍÿÿ‹Uä‹1ÿƒè…À‰„ÇÇE䋃…ö‹Çƒo‰ƒ#t‹ƒè…À‰„‡…ÿt ‹ƒè…À‰tm‹Eä…Àt‹U䋃è…À‰tM“³ ‰$èaÏÿÿ‹U‹ƒè…À‰t&‹U ‹ƒè…À‰t ƒÄ,¸ÿÿÿÿ[^_]ËB‰$ÿPëè‹B‰$ÿPëÏ‹B‰$ÿP먋G‰<$ÿP눋F‰4$ÿPékÿÿÿ‹B‰$ÿPé+ÿÿÿ‹G‰<$ÿPéîþÿÿ‹F‰4$ÿPéÏþÿÿobjprotocoldefaultselfob_speedups.buildClassicMROextendedClassic_speedups.buildECMROAdaptationFailureAttributeErrorDOES_NOT_SUPPORTExtensionClassFalseImportErrorNO_ADAPTER_NEEDEDProtocol__adapt__Protocol__call__TypeError_Protocol__adapters__all____bases____class__mro__adaptclassicMROexc_infoextClassMROgetgetMROmetamethodobjectsystb_next_speedups.metamethodWrapper for metaclass method that might be confused w/instance method_speedups__builtin____builtins___speedups.pyx__import__OOOOinstance exception may not have a separate valueexceptions must be strings, classes, or instances, not %sraise: arg 3 must be a traceback or NonefuncO|OOOO|O_speedups.adapt_speedups.Protocol__call___speedups.classicMRO_speedups.extClassMRO_speedups.getMROOO_speedups.Protocol__adapt___speedups._adapt_speedups.metamethod.__get___speedups.metamethod.__set___speedups.metamethod.__delete__èü‹[ ÿâ€[ Pé/²ÿÿèã‹F ÿâ€F Pé²ÿÿèÊ‹1 ÿâ€1 Péý±ÿÿ豋 ÿ†Péä±ÿÿ蘋 ÿ†Pé˱ÿÿè‹òÿâ€òPé²±ÿÿèf‹Ýÿâ€ÝPé™±ÿÿèM‹Èÿâ€ÈP週ÿÿè4‹³ÿ″Pég±ÿÿ苞ÿ„PéN±ÿÿ苉ÿ Pé5±ÿÿèé‹tÿâ€tPé±ÿÿèЋ_ÿâ€_Pé±ÿÿè·‹Jÿâ€JPéê°ÿÿèž‹5ÿâ€5PéѰÿÿè…‹ ÿ†P鸰ÿÿèl‹ ÿ†P韰ÿÿèS‹öÿâ€öP醰ÿÿè:‹áÿâ€áPém°ÿÿè!‹Ìÿâ€ÌPéT°ÿÿè‹·ÿ‷Pé;°ÿÿèï‹¢ÿ•Pé"°ÿÿèÖ‹ÿâ€Pé °ÿÿ轋xÿâ€xPéð¯ÿÿ褋cÿâ€cPéׯÿÿè‹‹Nÿâ€NP龯ÿÿèr‹9ÿâ€9P饯ÿÿèY‹$ÿâ€$P錯ÿÿè@‹ÿâ€Pés¯ÿÿè'‹úÿâ€úPéZ¯ÿÿè‹åÿâ€åPéA¯ÿÿèõ‹Ðÿâ€ÐPé(¯ÿÿèÜ‹»ÿ※Pé¯ÿÿè˦ÿ…Péö®ÿÿ誋‘ÿ‑PéÝ®ÿÿè‘‹|ÿâ€|PéÄ®ÿÿèx‹gÿâ€gPé«®ÿÿè_‹Rÿâ€RPé’®ÿÿèF‹=ÿâ€=Péy®ÿÿè-‹(ÿâ€(Pé`®ÿÿè‹ÿâ€PéG®ÿÿ‹$Ë$ÃC Speedups for commonly-used operationsprotocols.adapters__conform____adapt____class____mro__Assume 'obj' implements 'protocol' directlyPrevent 'obj' from supporting 'protocol'Read-only attributeRead-only attributeCan't adaptPEP 246-alike: Adapt 'obj' to 'protocol', return 'default' If 'default' is not supplied and no implementation is found, raise 'AdaptationFailure'. SÀSàSAdapt to this protocolT TàSNot a classic class T`T T`T T`TT SLg TgÀT\gàTPgUˆg U€g@UXg`Utg€Udg UœgÀU´gàUDgV¬g VTg@V°g`V`g€Vhg VHgÀVlgàV¸gWpg Wxg@W„g`W|g€W g WŒgH`”g a˜ga¤g1a ¨gbÀW PA fÀfèfôfûEXŒA´AfB4BÔ%A`Ux$ `àT$%à`€V&@a U´'ìa VØ(àV”, Wô.€Ux2ÀXðd SÀS SÀSàYààÍ[æ[ÿ[\1\J\c\|\•\®\Ç\à\ù\]+]D]]]v]]¨]Á]Ú]ó] ^%^>^W^p^‰^¢^»^Ô^í^__8_Q_j_ƒ_œ_µ_`eeeüdødôdðdÔdÐdÄdÀd´d°d¤d dœd”ddŒd„d€d|dtdpdlddd`d`$X?`bJ`(b\`„DH„DM’DN™DOœDN¢DO¥DR¨DUÀ{` ¬gDVßDWòDZýD[DZ D[ D_Dd!D`'Dd)De8DmfDnuDoŠDpDo’DršDs¥Du³D\÷DXDhDj%Dk.Ž`$H„³` HÆ` H Ü`@Ií`@Jü`@K a@La€Mäÿÿÿ(aÀ’)aà¶*a@I;a@JJa@KYa@Lha€MäÿÿÿvaÀ½waà[xa$Øya4b‹a@baLb¯a`bÁa LgÜa gôa \gb Pg&b ˆg5b €gJb Xgeb tg€b dgšb œg­b ´gÊb DgÛb Tgìb °gýb `g c hg c Hg2c lgGc ¸gTc pgdc xgxc „gˆc |g•c  g¦c@c¸c ŒgÄc ”gÐc ˜gÜc ¤gèc ¨gôc fd f8d ÀfYd èfyd ôf˜d cºdPAâdŒA e´A1eB[e4B…eÔ%¯eAÓe`dâex$f$%-f&Gf´'lfØ(‹f”,«fô.Æfx2Dd\Df`DdbDilDh‚Di‰Dj¨Diªìf gDj°Dk¶DlÄDkÆõf gDlÌDmÒDnöDo Dp"Du(Dp.þf gDq7g gDr@8g gDsITg gDtRng $gDu[DvaDudDvjDwwDx›D{¡D|·D}ÀD~ËDÔD€àDéD‚õDƒþD„ D…D†D‡(Dˆ4D‰=DŠID‹RDŒ^D‚D‘D‘§D’°D“»D”×D•æD–D—&D˜5D›DDœZDcDžnDŸŠD ™D¡µD¢ÙD£èD¢êD£ìD©ùDªD«D¬#D­?D®ND¯jD°ŽD±D´¬DËÎDÌãDÔãDÌéDÍïDÔñDÕ DÖ#D×:DØIDÙXDØ^DÙ`DÚoDÞrDÛxDÚDÞ…Dß—Dà¬Dä²DåÊDêßDæåDçëDêíDëDì'Dï9Dì?DïFDðXDñmDõsDö{‹g (gDú–g ,gDù‡DýŒDþ•¡g 0gD¡D¤¬g 4gD°DÒ·g 8gD ØDÞD àD ýD D Âg D?1D@@DBUD0D1D0D1’D3•Kh$#„_h #kh # |h@$Žh€%äÿÿÿŸh€&àÿÿÿ¬h€'Üÿÿÿ¾h€(ØÿÿÿÏh@)ÛhÀ’ÜhàUÝh@$ïh€%äÿÿÿi€&àÿÿÿ i€'Üÿÿÿi€(Øÿÿÿ0i@)i$?iœDDœDF¢DD¥DF¶DGÂDFÄDGÆDJÈDH×Ni$Dœci Doi D {i@D‡i@E•iÀ¶–iàÈ—i@E¥iÀצiàí§i$T¨iðDLðDPõDLûDMDNDO DP%DO(DP+DQ>DRQDT^DUeDVnDXqDYŠDZ£D[¼D\ÅD]ËD^ÑD_ÔD^ÖD_ÙD`ÞDaåDbìDdóDeDfDh)»i$LðÔi€MÜÿÿÿßi€Màÿÿÿëi€Mäÿÿÿôi€NØÿÿÿj€OÔÿÿÿ(j€R?j€žl€!ºl€¹m€)ÏmÀÐmà)Ñm€MÜÿÿÿÜm€Màÿÿÿèm€Mäÿÿÿñm€NØÿÿÿþm€OÔÿÿÿ nÀ4nàšn$¬nœDjœDk­Dl´DmÁDoÎDsÝDyöD~ D+ D€- D0 D‚3 D„I D†g Dˆr DŠ~ D‘‰ D’— D“š D” DŸ  D ¶ D¦¶ D‹É Dã D¢ã D£ø D¤!Dš>!D_!Dza!D{j!Dtr!Dp}!DqŠ!n$jœ1n j=n j Jn jTn@_nÀ+ `nàI an$bn¤!D¨¤!D©ª!Dª¯!D«²!D¬µ!D­¸!D®¿!D¯Æ!D°Í!D±Ý!qn$¨¤!‡n@©—n@ª£n@«°n@¬ºnÀª!»nàß!¼n$<½nà!D³à!D´ê!Dºð!D»ò!Dµø!D¶"D¸"D·"Òn$³à!ín ³*o€ Ho$DIo$"D½$"D¾."DÄ4"DÅ6"D¿<"DÀU"DÂ]"DÁh"\o$½$"uo ½Âo€ ào$Láop"DËp"DÏ~"DÐ…"DÔŒ"DÑ’"DÒ™"DÔ "DÕ¨"DÔª"DÕ¬"DÖ²"D×½"DÖ¿"D×Á"DØÇ"DÙÕ"DØ×"DÙÚ"DÚà"DÛì"DÚî"DÛñ"DÜ÷"DÝ#DÜ#DÝ #DÞ#Dîh#DÞj#Dîm#Dïo#Dõ’#Dï”#Dõ—#Dö™#D÷¥#Dù­#DúÀ#DûÓ#Düè#Dýý#Dþ$Dÿ'$õo$Ëp"p Ë p@Ì2p@ÍEp€ÎäÿÿÿVp€Ïàÿÿÿhp€ÐÜÿÿÿ{p€ÑØÿÿÿr€-r€ÒÔÿÿÿOr€,frÀ~"gràw$hr$irød{rereDbx$Dh‚$Db…$Dhˆ$Dg‘$Dh—$Dg¡$Dh¤$Dc²$Dh¹$DiÏ$DjÕ$DmÛ$Dná$Dwä$Dxï$Dyý$Dzÿ$Ÿr$bx$Ër bÝr b ïr bs@bs@b%s€cðÿÿÿ7s€dôÿÿÿNs@e]s&fød‰sÀˆ$Šsà%‹s€cðÿÿÿs€dôÿÿÿ´s@eÃs&fødÛsÀ%Üsà$%Ýs$¬D~$%D„.%D~1%D„4%Dƒ=%D„C%DƒM%D„P%D^%D„e%D…{%D‰~%D…„%D†‡%D‰%D“%D”ž%D•¬%D–®%Þs$~$% t ~t ~ -t ~?t@~Qt@~ct€ðÿÿÿut€€ôÿÿÿŒt&‚e¸tÀ4%¹tà±%ºt€ðÿÿÿÌt€€ôÿÿÿãt&‚eûtÀ·%ütàÓ%ýt$°D™Ô%DÞ%D™á%Dä%Dšê%Dñ%D™ &D &Dž!&DŸ$&D¢*&D£0&D¬>&D¤@&D¬C&D¤F&D¬I&D­O&D®Z&D¯\&þt$™Ô%.u ™Bu ™ Tu ™fu@™xu@™Šu€šôÿÿÿu&œeÉuÀä%Êuà_&Ëu€šôÿÿÿÞu&œeöuÀe&÷uà&øu$¼Ds&D{š&Ds&D{ &Dz¦&D{¬&Dz¶&D{¹&DtÑ&DuØ&D{ß&D|õ&D}û&D~'D'ùu\BD„ 'D"'D„$'D&'DŽ4'DB'DP'D‘R'D‡…'DŠ‹'D‹‘'D‡“'DŠŸ'D‡¢'DЍ'v$s&4v sFv s Xv sjv@s|v@sŽv€tìÿÿÿ v€uðÿÿÿ·v€vôÿÿÿÍv@wÜv@xëv&yÜawÀ¦&wàU'w€tìÿÿÿ+w€uðÿÿÿBw€vôÿÿÿXw@wgw@xvw&yÜaŽwÀ['wà²'w$$D•´'D¾'D•Á'DÄ'DœÊ'DÐ'DœÚ'DÝ'D–õ'D—ü'D(Dž(DŸ(D %(D£+(D¦D(D£F(D¦H(D¯J(D°X(D±f(D²t(D³v(D©©(D¬¯(D­µ(D©·(D¬Ã(D©Æ(D¬Ì(‘w$•´'¼w •Îw • àw •òw@•x@•x€–ìÿÿÿ)x€—ðÿÿÿ:x€˜ôÿÿÿPx@™_x@šnx&›bšxÀÊ'›xày(œx€–ìÿÿÿ¯x€—ðÿÿÿÀx€˜ôÿÿÿÖx@™åx@šôx&›b yÀ( yàÖ(y$$DðØ(DûÝ(Dðã(Dûì(Dñò(Dúù(Dûÿ(Dú )Dû )D÷)Dø!)Dû()DüB)DþE)DüK)DýN)DT)DþZ)D])Di)D)D Ž)D•)D —)D ©)D¸)DË)DÏ)DÕ)DØ)Dí)Dü)D*D*D*D"!*D#$*D$&*D@&*DA1*DB?*DCM*DDO*D:£*D;²*D<Ç*D=Ü*D>â*D=ä*D*›+D+½+D,Ô+D-Ý+D.é+D/ï+D0õ+D1,D2,D1,D2,D3#,D2&,D3-,D4E,D5Z,y$ðØ(4y ðFy ð Xy ðjy@ð|y@ðŽy€ñàÿÿÿŸy€òäÿÿÿ½y@óÐy@ôßy@õîy@öýy€÷Üÿÿÿ z€øØÿÿÿz&ù(bEzÀì(FzàR*Gz€ñàÿÿÿXz€òäÿÿÿvz@ó‰z@ô˜z@õ§z@ö¶z€÷ÜÿÿÿÄz€øØÿÿÿÒz&ù(bêzÀY*ëzà’,ìz$¼Dx”,D™,DxŸ,D¨,Dy®,D€µ,D»,D€Å,DÈ,D‚ð,D„ó,D‚ù,Dƒü,D„-D‡-Dˆ-D*-D‰1-D3-DŽE-D‘T-D’g-D•k-D–q-D—t-D˜‰-D›˜-Dœž-D¡-Dž²-D¤½-D¥À-D¦Â-D¯Â-D°Í-D±Û-D²é-D³ë-D©9.D«?.D¬N.D­T.D¬V.íz$x”,{ x%{ x 7{ xI{@x[{@xm{€yàÿÿÿ~{€zäÿÿÿœ{@{¯{@|¾{@}Í{@~Ü{&4b|À¨, |àî- |€yàÿÿÿ|€zäÿÿÿ9|@{L|@|[|@}j|@~y|&4b‘|Àõ-’|àô.“|$`D¸ô.DÂù.D¸ÿ.DÂ/D¹/DÁ/DÂ/DÁ%/DÂ(/D¾6/D¿=/DÂD/DÃ^/DÄd/DÇj/DÈ|/DÙ„/Dݨ/Dàº/Dݼ/DÞ¾/DàÀ/DÂ/D Ð/D Þ/D à/D0D0D-0DB0DW0D]0D_0Dá0Dã0Dä³0Dç»0DèÞ0Déõ0Dêû0Dë1Dì 1Dí1Dî%1Dï31DûA1DýC1Dø’1Dù¥1Dú«1DËÊ1DÌè1DÍû1DÎ2DÏ 2DÐ2DÑ2DÒ)2DÓ42DÔB2DÖE2”|$¸ô.µ| ¸Ç| ¸ Ù| ¸ë|@¸ý|@¸}€¹àÿÿÿ }€ºäÿÿÿ>}@»M}@¼\}@½k}€¾Üÿÿÿy}€¿Øÿÿÿ‡}&À@b³}À/´}àã/µ}€¹àÿÿÿÆ}€ºäÿÿÿä}@»ó}@¼~@½~€¾Üÿÿÿ~€¿Øÿÿÿ-~&À@bE~Àê/F~àw2G~$„Dx2D#}2Dƒ2D#Œ2D’2D#™2D±2D¸2D¿2D!Æ2D#Í2D$ç2D%í2D&ó2D'3D)3D' 3D* 3D(3D)3D*3D.%3D-+3D..3D173D2:3D3=3DXO3DZR3DpR3Dm[3Dp]3Dtu3D{~3D††3D‰˜3DŠ®3DÀ3D‹Ã3DÆ3DÜ3D“ë3D”ñ3D•ô3D– 4D™4Dš!4D›$4Dœ<4DÚK4DÛk4DÜ‹4Dݤ4DÞ¶4Dâ¹4DÞ¼4Dâ¿4Dæá4Dçä4Dææ4Dçé4Dæì4Dçï4Dêõ4Dëü4Dìÿ4Dí5Dñ5Dò+5Dó15Dô75DõQ5Döj5D÷|5Dû5Dø…5DüŒ5D÷Ž5Dü‘5Dç—5Dw£5Dx¨5D¨5D‚º5DƒÌ5D„Ú5D…è5D†ö5D‡6Dˆ6D‰6Dÿz6D6Dª6D¹6DÐ6DÖ6Dß6Dô6D7D7D 7DzE7D{T7D|i7D}~7D~“7D™7D~›7De8DŠ8D8D8D’8D”8D—8Dš8D¦8D©8D»8D"¾8DÅ8DÌ8D"Ï8D#ß8D$å8D%ë8D&9D'9D,(9D(.9D-19D59D0F9D1]9D2w9D39D4¢9D5¨9D6®9D7Ä9D8Ò9D9Ý9D;à9DG¦:DJ¼:DKÇ:DJÉ:DKË:DOÑ:DPã:DTæ:DUý:DV;DW ;DX";DY;;D_M;DZS;D_V;Db\;Dcs;Ddˆ;Deš;Df­;Dg³;Dh¼;DiÏ;DjÚ;Dkè;Dmë;DLš<DH£<Ds£<D±D=D¢Ï=D¥ä=D¦ë=D¥í=D¦ð=Dªò=D©õ=D«÷=D¬>D°>D³0>D´X>D·c>Dºh>D»Š>D¼¡>D½´>D¾º>D¿À>DÁÆ>DÂÙ>DÃä>DÄò>DÅ?DÇ?DÌC?DÍN?DÎ\?DÒ_?DÓd?D£?D~¦?D€¨?D;Ö?D<ø?D= @DA@DE@DD@DF!@DG/@DK2@DLM@DN]@DOm@D_q@D`|@DaŠ@De@Df’@DRË@DUÐ@DVÖ@DWÙ@H~$x2t~ †~  ˜~ ª~@¼~@Î~€àÿÿÿá~€äÿÿÿó~@@€Üÿÿÿ+€Øÿÿÿ=€ÔÿÿÿO€Ðÿÿÿa€Ìÿÿÿw@†€Èÿÿÿ”@£€Äÿÿÿ±€Àÿÿÿ¿€!¼ÿÿÿÍ&"LbùÀŒ2úà6û€àÿÿÿ€€äÿÿÿ €@5€@F€€ÜÿÿÿX€€Øÿÿÿj€€Ôÿÿÿ|€€ÐÿÿÿŽ€€Ìÿÿÿ¤€@³€€ÈÿÿÿÁ€@Ѐ€ÄÿÿÿÞ€€Àÿÿÿ쀀!¼ÿÿÿú€&"LbÀ6àA$¤D±AD²+AD´‘BD?—BD@™BDAŸBD@¢BDA¤BDD¬BDHÌBDXòBD\CDqCDu'CDx/CDy2CDz5CD{DCDGCD…VCD†mCD‡sCDˆyCD‰CDŠ©CD‹»CDŒ¾CDÅCD‹ËCDÎCDÚÔCDÞéCDáñCDâôCDã÷CDäDDè DDîDDï/DDð5DDñ;DDòRDDókDDô}DDù€DDô†DDù‰DDEDDHžDDIÁDDJØDDKáDDLíDDMóDDNöDDOüDDPÿDDQEDR+EDS=EDTXEDUjEDe‹EDfŽEDeEDh˜EDi§EDjµEDkÃEDlÑEDmßEDoíEDb‡FDcœFDd±FD[àJD?åJD2OD·AOD¸DOD¼JOD¿RODÀUODÁXODÓXODÔcODÕnOD×|ODÇ­ODÊÃODÇÅODÊÈODÍÊODÐÐODÍÖODÐâODÍåODÐëODÑðOÆ…$²$Oõ… ² † ² † ².†@²@†€³äÿÿÿN†@µ]†À>O^†à|O_†€³äÿÿÿm†@µ|†ÀŒO}†àüO~†$ØDàüODãPDàPDä PDåPDæPDçPDê%PDëGPDìYPDíbPDîkPDï~PDðPDïPDð‘PDñžPDò¹PDð¾PDòÀPDóÔPDøÚPDóÜPDøîPDùÿPDúQDû'QDþ5QDÿCQDQQD_Q†$àüO®† à† à Ô† àé†@âø†@㇀ääÿÿÿ‡ÀP‡àbQ‡@â&‡@ã5‡€ääÿÿÿC‡ÀlQD‡àÞQE‡$äD àQD äQD æQD ðQD÷QDýQDRD%RD7RD@RDIRD\RDkRDmRDoRD|RD—RDœRDžRD²RD ¸RDºRD ÌRD!ÝRD"ìRD#SD&SD'SD)+SF‡$ àQx‡  Œ‡   ž‡@ ­‡@ ¼‡€ äÿÿÿʇÀäQˇà.Ṡ@ Û‡@ ꇀ äÿÿÿø‡À8Sù‡àœSú‡$¼û‡( !g ˆ( "gˆ( # g-ˆ( $gCˆ&ôd[ˆ&' `„ˆ&& c®ˆ& 2fÙˆ( 3gûˆ( 4g‰( 5gA‰( 6 ga‰( 7$g„‰( 8(g•‰( 9,g¦‰( :0g·‰( ;4gȉ( <8gÙ‰( =@gû‰&EH`#Š&F[`KŠ&Gg`rŠ&Hq`™Š&I{`ÀŠ( KDg׊( LHgïŠ( MLg‹( NPg.‹( OTgE‹( PXgf‹( Q\g†‹( R`g›‹( Sdg»‹( ThgÕ‹( Ulgð‹( VpgŒ( Wtg'Œ( XxgAŒ( Y|gTŒ( Z€goŒ( [„g…Œ( \ˆgšŒ( ^Œg¬Œ&a `ñŒ&}à`5( ÙgS( Û”ge&Ý a( ˜gŸ&aÇ( +œgà( , g÷( .¤g Ž&01a1Ž&r@akŽ&”ìa¯Ž( ë¨gÁŽ&íbéŽ( F¬g( µ°g( ´g<( ¸gO&‹`b€&¨@c°& ßfò& ã f& Àf@& èfg& ôf&W`d¹&ðdædœSC€Á_[€Å_0s\‚ÿŸÿ²ÿÀÿÌÿØÿåÿýÿ ÿÿ2ÿBÿQÿbÿsÿ‰ÿšÿ«ÿ¸ÿÌÿÝÿíÿúÿ ÿÿ"ÿ0ÿBÿYÿnÿÿ‘ÿ©ÿ»ÿÍÿâÿóÿÿÿ,ÿAÿ]ÿxÿ‡ÿšÿ¬ÿ¾ÿËÿÙÿçÿùÿÿÿ$ÿ±–ˆ¬­´’ŽŒ°‘ ‰Ÿ¤®«©·ª—¹š¦¨œ›…Š¥™‹£§¶¡³ž±–ˆ¬­´’ŽŒ°‘ ‰Ÿ¤®«©·ª—¹š¦¨œ›…Š¥™‹£§¶¡³ž¯•²”¢µ†“˜‡¸º__dyld_func_lookupdyld_stub_binding_helper__mh_bundle_header___i686.get_pc_thunk.ax___i686.get_pc_thunk.bx_init_speedups_PyArg_ParseTupleAndKeywords_PyBaseObject_Type_PyClass_Type_PyCode_New_PyDict_New_PyErr_Clear_PyErr_ExceptionMatches_PyErr_Fetch_PyErr_Format_PyErr_NormalizeException_PyErr_Occurred_PyErr_Restore_PyErr_SetObject_PyErr_SetString_PyExc_AttributeError_PyExc_NameError_PyExc_TypeError_PyFrame_New_PyImport_AddModule_PyInstance_Type_PyInt_FromLong_PyIter_Next_PyList_Append_PyList_New_PyList_Type_PyMethod_New_PyModule_GetDict_PyObject_CallFunction_PyObject_CallObject_PyObject_GC_Del_PyObject_GetAttr_PyObject_GetAttrString_PyObject_GetItem_PyObject_GetIter_PyObject_IsInstance_PyObject_IsTrue_PyObject_SetAttr_PyObject_SetAttrString_PyObject_Type_PyString_FromString_PyString_FromStringAndSize_PyString_InternFromString_PyString_Type_PyThreadState_Get_PyTraceBack_Here_PyTraceBack_Type_PyTuple_New_PyTuple_Size_PyTuple_Type_PyType_IsSubtype_PyType_Ready_PyType_Type_Py_InitModule4__Py_NoneStruct_NXArgc_NXArgv_PyArg_Parse_PyArg_ParseTuple_PyArg_UnpackTuple_PyArg_VaParse_PyBaseString_Type_PyBool_FromLong_PyBool_Type_PyBuffer_FromMemory_PyBuffer_FromObject_PyBuffer_FromReadWriteMemory_PyBuffer_FromReadWriteObject_PyBuffer_New_PyBuffer_Type_PyCFunction_Call_PyCFunction_Fini_PyCFunction_GetFlags_PyCFunction_GetFunction_PyCFunction_GetSelf_PyCFunction_New_PyCFunction_NewEx_PyCFunction_Type_PyCObject_AsVoidPtr_PyCObject_FromVoidPtr_PyCObject_FromVoidPtrAndDesc_PyCObject_GetDesc_PyCObject_Import_PyCObject_Type_PyCallIter_New_PyCallIter_Type_PyCallable_Check_PyCell_Get_PyCell_New_PyCell_Set_PyCell_Type_PyClassMethod_New_PyClassMethod_Type_PyClass_IsSubclass_PyClass_New_PyCode_Addr2Line_PyCode_Type_PyCodec_BackslashReplaceErrors_PyCodec_Decode_PyCodec_Decoder_PyCodec_Encode_PyCodec_Encoder_PyCodec_IgnoreErrors_PyCodec_LookupError_PyCodec_Register_PyCodec_RegisterError_PyCodec_ReplaceErrors_PyCodec_StreamReader_PyCodec_StreamWriter_PyCodec_StrictErrors_PyCodec_XMLCharRefReplaceErrors_PyComplex_AsCComplex_PyComplex_FromCComplex_PyComplex_FromDoubles_PyComplex_ImagAsDouble_PyComplex_RealAsDouble_PyComplex_Type_PyDescr_NewClassMethod_PyDescr_NewGetSet_PyDescr_NewMember_PyDescr_NewMethod_PyDescr_NewWrapper_PyDictIter_Type_PyDictProxy_New_PyDict_Clear_PyDict_Copy_PyDict_DelItem_PyDict_DelItemString_PyDict_GetItem_PyDict_GetItemString_PyDict_Items_PyDict_Keys_PyDict_Merge_PyDict_MergeFromSeq2_PyDict_Next_PyDict_SetItem_PyDict_SetItemString_PyDict_Size_PyDict_Type_PyDict_Update_PyDict_Values_PyEnum_Type_PyErr_BadArgument_PyErr_BadInternalCall_PyErr_CheckSignals_PyErr_Display_PyErr_GivenExceptionMatches_PyErr_NewException_PyErr_NoMemory_PyErr_Print_PyErr_PrintEx_PyErr_ProgramText_PyErr_SetFromErrno_PyErr_SetFromErrnoWithFilename_PyErr_SetFromErrnoWithFilenameObject_PyErr_SetInterrupt_PyErr_SetNone_PyErr_SyntaxLocation_PyErr_Warn_PyErr_WarnExplicit_PyErr_WriteUnraisable_PyEval_AcquireLock_PyEval_AcquireThread_PyEval_CallFunction_PyEval_CallMethod_PyEval_CallObject_PyEval_CallObjectWithKeywords_PyEval_EvalCode_PyEval_EvalCodeEx_PyEval_GetBuiltins_PyEval_GetCallStats_PyEval_GetFrame_PyEval_GetFuncDesc_PyEval_GetFuncName_PyEval_GetGlobals_PyEval_GetLocals_PyEval_GetRestricted_PyEval_InitThreads_PyEval_MergeCompilerFlags_PyEval_ReInitThreads_PyEval_ReleaseLock_PyEval_ReleaseThread_PyEval_RestoreThread_PyEval_SaveThread_PyEval_SetProfile_PyEval_SetTrace_PyExc_ArithmeticError_PyExc_AssertionError_PyExc_DeprecationWarning_PyExc_EOFError_PyExc_EnvironmentError_PyExc_Exception_PyExc_FloatingPointError_PyExc_FutureWarning_PyExc_IOError_PyExc_ImportError_PyExc_IndentationError_PyExc_IndexError_PyExc_KeyError_PyExc_KeyboardInterrupt_PyExc_LookupError_PyExc_MemoryError_PyExc_MemoryErrorInst_PyExc_NotImplementedError_PyExc_OSError_PyExc_OverflowError_PyExc_OverflowWarning_PyExc_PendingDeprecationWarning_PyExc_ReferenceError_PyExc_RuntimeError_PyExc_RuntimeWarning_PyExc_StandardError_PyExc_StopIteration_PyExc_SyntaxError_PyExc_SyntaxWarning_PyExc_SystemError_PyExc_SystemExit_PyExc_TabError_PyExc_UnboundLocalError_PyExc_UnicodeDecodeError_PyExc_UnicodeEncodeError_PyExc_UnicodeError_PyExc_UnicodeTranslateError_PyExc_UserWarning_PyExc_ValueError_PyExc_Warning_PyExc_ZeroDivisionError_PyFPE_counter_PyFPE_dummy_PyFPE_jbuf_PyFile_AsFile_PyFile_FromFile_PyFile_FromString_PyFile_GetLine_PyFile_Name_PyFile_SetBufSize_PyFile_SetEncoding_PyFile_SoftSpace_PyFile_Type_PyFile_WriteObject_PyFile_WriteString_PyFloat_AsDouble_PyFloat_AsReprString_PyFloat_AsString_PyFloat_AsStringEx_PyFloat_Fini_PyFloat_FromDouble_PyFloat_FromString_PyFloat_Type_PyFrame_BlockPop_PyFrame_BlockSetup_PyFrame_FastToLocals_PyFrame_Fini_PyFrame_LocalsToFast_PyFrame_Type_PyFunction_GetClosure_PyFunction_GetCode_PyFunction_GetDefaults_PyFunction_GetGlobals_PyFunction_GetModule_PyFunction_New_PyFunction_SetClosure_PyFunction_SetDefaults_PyFunction_Type_PyGC_Collect_PyGILState_Ensure_PyGILState_GetThisThreadState_PyGILState_Release_PyGrammar_AddAccelerators_PyGrammar_FindDFA_PyGrammar_LabelRepr_PyGrammar_RemoveAccelerators_PyImport_AppendInittab_PyImport_Cleanup_PyImport_ExecCodeModule_PyImport_ExecCodeModuleEx_PyImport_ExtendInittab_PyImport_FrozenModules_PyImport_GetMagicNumber_PyImport_GetModuleDict_PyImport_Import_PyImport_ImportFrozenModule_PyImport_ImportModule_PyImport_ImportModuleEx_PyImport_Inittab_PyImport_ReloadModule_PyInstance_New_PyInstance_NewRaw_PyInt_AsLong_PyInt_AsUnsignedLongLongMask_PyInt_AsUnsignedLongMask_PyInt_Fini_PyInt_FromString_PyInt_FromUnicode_PyInt_GetMax_PyInt_Type_PyInterpreterState_Clear_PyInterpreterState_Delete_PyInterpreterState_Head_PyInterpreterState_New_PyInterpreterState_Next_PyInterpreterState_ThreadHead_PyListIter_Type_PyList_AsTuple_PyList_GetItem_PyList_GetSlice_PyList_Insert_PyList_Reverse_PyList_SetItem_PyList_SetSlice_PyList_Size_PyList_Sort_PyLong_AsDouble_PyLong_AsLong_PyLong_AsLongLong_PyLong_AsUnsignedLong_PyLong_AsUnsignedLongLong_PyLong_AsUnsignedLongLongMask_PyLong_AsUnsignedLongMask_PyLong_AsVoidPtr_PyLong_FromDouble_PyLong_FromLong_PyLong_FromLongLong_PyLong_FromString_PyLong_FromUnicode_PyLong_FromUnsignedLong_PyLong_FromUnsignedLongLong_PyLong_FromVoidPtr_PyLong_Type_PyMapping_Check_PyMapping_GetItemString_PyMapping_HasKey_PyMapping_HasKeyString_PyMapping_Length_PyMapping_SetItemString_PyMapping_Size_PyMarshal_Init_PyMarshal_ReadLastObjectFromFile_PyMarshal_ReadLongFromFile_PyMarshal_ReadObjectFromFile_PyMarshal_ReadObjectFromString_PyMarshal_ReadShortFromFile_PyMarshal_WriteLongToFile_PyMarshal_WriteObjectToFile_PyMarshal_WriteObjectToString_PyMem_Free_PyMem_Malloc_PyMem_Realloc_PyMember_Get_PyMember_GetOne_PyMember_Set_PyMember_SetOne_PyMethod_Class_PyMethod_Fini_PyMethod_Function_PyMethod_Self_PyMethod_Type_PyModule_AddIntConstant_PyModule_AddObject_PyModule_AddStringConstant_PyModule_GetFilename_PyModule_GetName_PyModule_GetWarningsModule_PyModule_New_PyModule_Type_PyNode_AddChild_PyNode_Compile_PyNode_CompileFlags_PyNode_CompileSymtable_PyNode_Free_PyNode_Future_PyNode_New_PyNumber_Absolute_PyNumber_Add_PyNumber_And_PyNumber_Check_PyNumber_Coerce_PyNumber_CoerceEx_PyNumber_Divide_PyNumber_Divmod_PyNumber_Float_PyNumber_FloorDivide_PyNumber_InPlaceAdd_PyNumber_InPlaceAnd_PyNumber_InPlaceDivide_PyNumber_InPlaceFloorDivide_PyNumber_InPlaceLshift_PyNumber_InPlaceMultiply_PyNumber_InPlaceOr_PyNumber_InPlacePower_PyNumber_InPlaceRemainder_PyNumber_InPlaceRshift_PyNumber_InPlaceSubtract_PyNumber_InPlaceTrueDivide_PyNumber_InPlaceXor_PyNumber_Int_PyNumber_Invert_PyNumber_Long_PyNumber_Lshift_PyNumber_Multiply_PyNumber_Negative_PyNumber_Or_PyNumber_Positive_PyNumber_Power_PyNumber_Remainder_PyNumber_Rshift_PyNumber_Subtract_PyNumber_TrueDivide_PyNumber_Xor_PyOS_AfterFork_PyOS_FiniInterrupts_PyOS_GetLastModificationTime_PyOS_InitInterrupts_PyOS_getsig_PyOS_InputHook_PyOS_InterruptOccurred_PyOS_Readline_PyOS_ReadlineFunctionPointer_PyOS_StdioReadline_PyOS_setsig_PyOS_snprintf_PyOS_strtol_PyOS_strtoul_PyOS_vsnprintf_PyObject_AsCharBuffer_PyObject_AsFileDescriptor_PyObject_AsReadBuffer_PyObject_AsWriteBuffer_PyObject_Call_PyObject_CallFunctionObjArgs_PyObject_CallMethod_PyObject_CallMethodObjArgs_PyObject_CheckReadBuffer_PyObject_ClearWeakRefs_PyObject_Cmp_PyObject_Compare_PyObject_DelItem_PyObject_DelItemString_PyObject_Dir_PyObject_Free_PyObject_GC_Track_PyObject_GC_UnTrack_PyObject_GenericGetAttr_PyObject_GenericSetAttr_PyObject_HasAttr_PyObject_HasAttrString_PyObject_Hash_PyObject_Init_PyObject_InitVar_PyObject_IsSubclass_PyObject_Length_PyObject_Malloc_PyObject_Not_PyObject_Print_PyObject_Realloc_PyObject_Repr_PyObject_RichCompare_PyObject_RichCompareBool_PyObject_SelfIter_PyObject_SetItem_PyObject_Size_PyObject_Str_PyObject_Unicode_PyParser_AddToken_PyParser_Delete_PyParser_New_PyParser_ParseFile_PyParser_ParseFileFlags_PyParser_ParseString_PyParser_ParseStringFlags_PyParser_ParseStringFlagsFilename_PyParser_SetError_PyParser_SimpleParseFile_PyParser_SimpleParseFileFlags_PyParser_SimpleParseString_PyParser_SimpleParseStringFilename_PyParser_SimpleParseStringFlags_PyParser_SimpleParseStringFlagsFilename_PyProperty_Type_PyRange_New_PyRange_Type_PyRun_AnyFile_PyRun_AnyFileEx_PyRun_AnyFileExFlags_PyRun_AnyFileFlags_PyRun_File_PyRun_FileEx_PyRun_FileExFlags_PyRun_FileFlags_PyRun_InteractiveLoop_PyRun_InteractiveLoopFlags_PyRun_InteractiveOne_PyRun_InteractiveOneFlags_PyRun_SimpleFile_PyRun_SimpleFileEx_PyRun_SimpleFileExFlags_PyRun_SimpleString_PyRun_SimpleStringFlags_PyRun_String_PyRun_StringFlags_PySeqIter_New_PySeqIter_Type_PySequence_Check_PySequence_Concat_PySequence_Contains_PySequence_Count_PySequence_DelItem_PySequence_DelSlice_PySequence_Fast_PySequence_GetItem_PySequence_GetSlice_PySequence_In_PySequence_InPlaceConcat_PySequence_InPlaceRepeat_PySequence_Index_PySequence_Length_PySequence_List_PySequence_Repeat_PySequence_SetItem_PySequence_SetSlice_PySequence_Size_PySequence_Tuple_PySlice_GetIndices_PySlice_GetIndicesEx_PySlice_New_PySlice_Type_PyStaticMethod_New_PyStaticMethod_Type_PyString_AsDecodedObject_PyString_AsDecodedString_PyString_AsEncodedObject_PyString_AsEncodedString_PyString_AsString_PyString_AsStringAndSize_PyString_Concat_PyString_ConcatAndDel_PyString_Decode_PyString_DecodeEscape_PyString_Encode_PyString_Fini_PyString_Format_PyString_FromFormat_PyString_FromFormatV_PyString_InternImmortal_PyString_InternInPlace_PyString_Repr_PyString_Size_PyStructSequence_InitType_PyStructSequence_New_PyStructSequence_UnnamedField_PySuper_Type_PySymtableEntry_New_PySymtableEntry_Type_PySymtable_Free_PySys_AddWarnOption_PySys_GetFile_PySys_GetObject_PySys_ResetWarnOptions_PySys_SetArgv_PySys_SetObject_PySys_SetPath_PySys_WriteStderr_PySys_WriteStdout_PyThreadState_Clear_PyThreadState_Delete_PyThreadState_DeleteCurrent_PyThreadState_GetDict_PyThreadState_New_PyThreadState_Next_PyThreadState_SetAsyncExc_PyThreadState_Swap_PyThread__exit_thread_PyThread_acquire_lock_PyThread_allocate_lock_PyThread_create_key_PyThread_delete_key_PyThread_delete_key_value_PyThread_exit_thread_PyThread_free_lock_PyThread_get_key_value_PyThread_get_thread_ident_PyThread_init_thread_PyThread_release_lock_PyThread_set_key_value_PyThread_start_new_thread_PyToken_OneChar_PyToken_ThreeChars_PyToken_TwoChars_PyTokenizer_Free_PyTokenizer_FromFile_PyTokenizer_FromString_PyTokenizer_Get_PyTraceBack_Print_PyTupleIter_Type_PyTuple_Fini_PyTuple_GetItem_PyTuple_GetSlice_PyTuple_SetItem_PyType_GenericAlloc_PyType_GenericNew_PyUnicodeDecodeError_Create_PyUnicodeDecodeError_GetEncoding_PyUnicodeDecodeError_GetEnd_PyUnicodeDecodeError_GetObject_PyUnicodeDecodeError_GetReason_PyUnicodeDecodeError_GetStart_PyUnicodeDecodeError_SetEnd_PyUnicodeDecodeError_SetReason_PyUnicodeDecodeError_SetStart_PyUnicodeEncodeError_Create_PyUnicodeEncodeError_GetEncoding_PyUnicodeEncodeError_GetEnd_PyUnicodeEncodeError_GetObject_PyUnicodeEncodeError_GetReason_PyUnicodeEncodeError_GetStart_PyUnicodeEncodeError_SetEnd_PyUnicodeEncodeError_SetReason_PyUnicodeEncodeError_SetStart_PyUnicodeTranslateError_Create_PyUnicodeTranslateError_GetEnd_PyUnicodeTranslateError_GetObject_PyUnicodeTranslateError_GetReason_PyUnicodeTranslateError_GetStart_PyUnicodeTranslateError_SetEnd_PyUnicodeTranslateError_SetReason_PyUnicodeTranslateError_SetStart_PyUnicodeUCS4_AsASCIIString_PyUnicodeUCS4_AsCharmapString_PyUnicodeUCS4_AsEncodedString_PyUnicodeUCS4_AsLatin1String_PyUnicodeUCS4_AsRawUnicodeEscapeString_PyUnicodeUCS4_AsUTF16String_PyUnicodeUCS4_AsUTF8String_PyUnicodeUCS4_AsUnicode_PyUnicodeUCS4_AsUnicodeEscapeString_PyUnicodeUCS4_AsWideChar_PyUnicodeUCS4_Compare_PyUnicodeUCS4_Concat_PyUnicodeUCS4_Contains_PyUnicodeUCS4_Count_PyUnicodeUCS4_Decode_PyUnicodeUCS4_DecodeASCII_PyUnicodeUCS4_DecodeCharmap_PyUnicodeUCS4_DecodeLatin1_PyUnicodeUCS4_DecodeRawUnicodeEscape_PyUnicodeUCS4_DecodeUTF16_PyUnicodeUCS4_DecodeUTF8_PyUnicodeUCS4_DecodeUnicodeEscape_PyUnicodeUCS4_Encode_PyUnicodeUCS4_EncodeASCII_PyUnicodeUCS4_EncodeCharmap_PyUnicodeUCS4_EncodeDecimal_PyUnicodeUCS4_EncodeLatin1_PyUnicodeUCS4_EncodeRawUnicodeEscape_PyUnicodeUCS4_EncodeUTF16_PyUnicodeUCS4_EncodeUTF8_PyUnicodeUCS4_EncodeUnicodeEscape_PyUnicodeUCS4_Find_PyUnicodeUCS4_Format_PyUnicodeUCS4_FromEncodedObject_PyUnicodeUCS4_FromObject_PyUnicodeUCS4_FromOrdinal_PyUnicodeUCS4_FromUnicode_PyUnicodeUCS4_FromWideChar_PyUnicodeUCS4_GetDefaultEncoding_PyUnicodeUCS4_GetMax_PyUnicodeUCS4_GetSize_PyUnicodeUCS4_Join_PyUnicodeUCS4_Replace_PyUnicodeUCS4_Resize_PyUnicodeUCS4_SetDefaultEncoding_PyUnicodeUCS4_Split_PyUnicodeUCS4_Splitlines_PyUnicodeUCS4_Tailmatch_PyUnicodeUCS4_Translate_PyUnicodeUCS4_TranslateCharmap_PyUnicode_DecodeUTF7_PyUnicode_EncodeUTF7_PyUnicode_Type_PyWeakref_GetObject_PyWeakref_NewProxy_PyWeakref_NewRef_PyWrapperDescr_Type_PyWrapper_New_Py_AddPendingCall_Py_AtExit_Py_BuildValue_Py_CompileString_Py_CompileStringFlags_Py_DebugFlag_Py_DivisionWarningFlag_Py_EndInterpreter_Py_Exit_Py_FatalError_Py_FdIsInteractive_Py_FileSystemDefaultEncoding_Py_Finalize_Py_FindMethod_Py_FindMethodInChain_Py_FlushLine_Py_FrozenFlag_Py_GetArgcArgv_Py_GetBuildInfo_Py_GetCompiler_Py_GetCopyright_Py_GetExecPrefix_Py_GetPath_Py_GetPlatform_Py_GetPrefix_Py_GetProgramFullPath_Py_GetProgramName_Py_GetPythonHome_Py_GetRecursionLimit_Py_GetVersion_Py_IgnoreEnvironmentFlag_Py_Initialize_Py_InteractiveFlag_Py_IsInitialized_Py_Main_Py_MakePendingCalls_Py_NewInterpreter_Py_NoSiteFlag_Py_OptimizeFlag_Py_ReprEnter_Py_ReprLeave_Py_SetProgramName_Py_SetPythonHome_Py_SetRecursionLimit_Py_SymtableString_Py_TabcheckFlag_Py_UnicodeFlag_Py_UniversalNewlineFgets_Py_UniversalNewlineFread_Py_UseClassExceptionsFlag_Py_VaBuildValue_Py_VerboseFlag__PyBuiltin_Init__PyCodec_Lookup__PyErr_BadInternalCall__PyEval_CallTracing__PyEval_SliceIndex__PyExc_Fini__PyExc_Init__PyFloat_Pack4__PyFloat_Pack8__PyFloat_Unpack4__PyFloat_Unpack8__PyFrame_Init__PyGC_Dump__PyGC_generation0__PyGILState_Fini__PyGILState_Init__PyImportHooks_Init__PyImport_DynLoadFiletab__PyImport_Filetab__PyImport_FindExtension__PyImport_Fini__PyImport_FixupExtension__PyImport_GetDynLoadFunc__PyImport_Init__PyImport_Inittab__PyImport_LoadDynamicModule__PyInstance_Lookup__PyInt_Init__PyLong_AsByteArray__PyLong_AsScaledDouble__PyLong_Copy__PyLong_FromByteArray__PyLong_New__PyLong_NumBits__PyLong_Sign__PyModule_Clear__PyOS_GetOpt__PyOS_optarg__PyOS_opterr__PyOS_optind__PyObject_Del__PyObject_Dump__PyObject_GC_Del__PyObject_GC_Malloc__PyObject_GC_New__PyObject_GC_NewVar__PyObject_GC_Resize__PyObject_GC_Track__PyObject_GC_UnTrack__PyObject_GetDictPtr__PyObject_New__PyObject_NewVar__PyObject_SlotCompare__PyParser_Grammar__PyParser_TokenNames__PySequence_IterSearch__PyString_Eq__PyString_FormatLong__PyString_Join__PyString_Resize__PySys_Init__PyThreadState_Current__PyThreadState_GetFrame__PyThread_Started__PyTrash_delete_later__PyTrash_delete_nesting__PyTrash_deposit_object__PyTrash_destroy_chain__PyTuple_Resize__PyType_Lookup__PyUnicodeUCS4_AsDefaultEncodedString__PyUnicodeUCS4_Fini__PyUnicodeUCS4_Init__PyUnicodeUCS4_IsAlpha__PyUnicodeUCS4_IsDecimalDigit__PyUnicodeUCS4_IsDigit__PyUnicodeUCS4_IsLinebreak__PyUnicodeUCS4_IsLowercase__PyUnicodeUCS4_IsNumeric__PyUnicodeUCS4_IsTitlecase__PyUnicodeUCS4_IsUppercase__PyUnicodeUCS4_IsWhitespace__PyUnicodeUCS4_ToDecimalDigit__PyUnicodeUCS4_ToDigit__PyUnicodeUCS4_ToLowercase__PyUnicodeUCS4_ToNumeric__PyUnicodeUCS4_ToTitlecase__PyUnicodeUCS4_ToUppercase__PyUnicode_TypeRecords__PyUnicode_XStrip__PyWeakref_CallableProxyType__PyWeakref_ClearRef__PyWeakref_GetWeakrefCount__PyWeakref_ProxyType__PyWeakref_RefType__Py_CheckInterval__Py_EllipsisObject__Py_HashDouble__Py_HashPointer__Py_Mangle__Py_NotImplementedStruct__Py_PackageContext__Py_QnewFlag__Py_ReadyTypes__Py_ReleaseInternedStrings__Py_Ticker__Py_TrueStruct__Py_ZeroStruct__Py_abstract_hack__Py_c_diff__Py_c_neg__Py_c_pow__Py_c_prod__Py_c_quot__Py_c_sum__Py_cobject_hack___darwin_gcc3_preregister_frame_info___progname__cplus_init__mh_execute_header__objcInit_catch_exception_raise_catch_exception_raise_state_catch_exception_raise_state_identity_clock_alarm_reply_do_mach_notify_dead_name_do_mach_notify_no_senders_do_mach_notify_port_deleted_do_mach_notify_send_once_do_seqnos_mach_notify_dead_name_do_seqnos_mach_notify_no_senders_do_seqnos_mach_notify_port_deleted_do_seqnos_mach_notify_send_once_environ_init_codecs_init_sre_init_symtable_initerrno_initgc_initimp_initposix_initsignal_initthread_initxxsubtype_initzipimport_main_receive_samplesstartdyld__mh_bundle_headerdyld_lazy_symbol_binding_entry_pointdyld_func_lookup_pointer/mnt/gmirror/ports/devel/py-protocols-devel/work/PyProtocols-1.0a0dev_r2082/src/protocols/_speedups.cgcc2_compiled.___pyx_mdoc___pyx_ptype_9_speedups_metamethod___pyx_k11___pyx_k15___pyx_k16___pyx_k17___pyx_k18___pyx_doc_9_speedups_NO_ADAPTER_NEEDED___pyx_doc_9_speedups_DOES_NOT_SUPPORT___pyx_k26___pyx_k27___pyx_k28___pyx_doc_9_speedups_adapt___pyx_argnames.0___pyx_doc_9_speedups_Protocol__call_____pyx_argnames.1___pyx_f_9_speedups_buildClassicMRO___pyx_f___pyx_lineno___pyx_filename__pyx_f_9_speedups_buildClassicMRO:f(0,1)=*(0,2)=(0,3)=xs_object:PyObject:t(0,2)_object:T(0,3)=s8ob_refcnt:(0,4)=r(0,4);-2147483648;2147483647;,0,32;ob_type:(0,5)=*(0,6)=xs_typeobject:,32,32;;int:t(0,4)_typeobject:T(0,6)=s192ob_refcnt:(0,4),0,32;ob_type:(0,5),32,32;ob_size:(0,4),64,32;tp_name:(0,7)=*(0,8)=r(0,8);0;127;,96,32;tp_basicsize:(0,4),128,32;tp_itemsize:(0,4),160,32;tp_dealloc:(0,9)=(0,10)=*(0,11)=f(0,12)=(0,12),192,32;tp_print:(0,13)=(0,14)=*(0,15)=f(0,4),224,32;tp_getattr:(0,16)=(0,17)=*(0,18)=f(0,1),256,32;tp_setattr:(0,19)=(0,20)=*(0,21)=f(0,4),288,32;tp_compare:(0,22)=(0,23)=*(0,24)=f(0,4),320,32;tp_repr:(0,25)=(0,26)=*(0,27)=f(0,1),352,32;tp_as_number:(0,28)=*(0,29)=(0,30)=s152nb_add:(0,31)=(0,32)=*(0,33)=f(0,1),0,32;nb_subtract:(0,31),32,32;nb_multiply:(0,31),64,32;nb_divide:(0,31),96,32;nb_remainder:(0,31),128,32;nb_divmod:(0,31),160,32;nb_power:(0,34)=(0,35)=*(0,36)=f(0,1),192,32;nb_negative:(0,37)=(0,26),224,32;nb_positive:(0,37),256,32;nb_absolute:(0,37),288,32;nb_nonzero:(0,38)=(0,39)=*(0,40)=f(0,4),320,32;nb_invert:(0,37),352,32;nb_lshift:(0,31),384,32;nb_rshift:(0,31),416,32;nb_and:(0,31),448,32;nb_xor:(0,31),480,32;nb_or:(0,31),512,32;nb_coerce:(0,41)=(0,42)=*(0,43)=f(0,4),544,32;nb_int:(0,37),576,32;nb_long:(0,37),608,32;nb_float:(0,37),640,32;nb_oct:(0,37),672,32;nb_hex:(0,37),704,32;nb_inplace_add:(0,31),736,32;nb_inplace_subtract:(0,31),768,32;nb_inplace_multiply:(0,31),800,32;nb_inplace_divide:(0,31),832,32;nb_inplace_remainder:(0,31),864,32;nb_inplace_power:(0,34),896,32;nb_inplace_lshift:(0,31),928,32;nb_inplace_rshift:(0,31),960,32;nb_inplace_and:(0,31),992,32;nb_inplace_xor:(0,31),1024,32;nb_inplace_or:(0,31),1056,32;nb_floor_divide:(0,31),1088,32;nb_true_divide:(0,31),1120,32;nb_inplace_floor_divide:(0,31),1152,32;nb_inplace_true_divide:(0,31),1184,32;;,384,32;tp_as_sequence:(0,44)=*(0,45)=(0,46)=s40sq_length:(0,38),0,32;sq_concat:(0,31),32,32;sq_repeat:(0,47)=(0,48)=*(0,49)=f(0,1),64,32;sq_item:(0,47),96,32;sq_slice:(0,50)=(0,51)=*(0,52)=f(0,1),128,32;sq_ass_item:(0,53)=(0,54)=*(0,55)=f(0,4),160,32;sq_ass_slice:(0,56)=(0,57)=*(0,58)=f(0,4),192,32;sq_contains:(0,59)=(0,23),224,32;sq_inplace_concat:(0,31),256,32;sq_inplace_repeat:(0,47),288,32;;,416,32;tp_as_mapping:(0,60)=*(0,61)=(0,62)=s12mp_length:(0,38),0,32;mp_subscript:(0,31),32,32;mp_ass_subscript:(0,63)=(0,64)=*(0,65)=f(0,4),64,32;;,448,32;tp_hash:(0,66)=(0,67)=*(0,68)=f(0,69)=r(0,69);-2147483648;2147483647;,480,32;tp_call:(0,34),512,32;tp_str:(0,25),544,32;tp_getattro:(0,70)=(0,32),576,32;tp_setattro:(0,71)=(0,64),608,32;tp_as_buffer:(0,72)=*(0,73)=(0,74)=s16bf_getreadbuffer:(0,75)=(0,76)=*(0,77)=f(0,4),0,32;bf_getwritebuffer:(0,78)=(0,76),32,32;bf_getsegcount:(0,79)=(0,80)=*(0,81)=f(0,4),64,32;bf_getcharbuffer:(0,82)=(0,83)=*(0,84)=f(0,4),96,32;;,640,32;tp_flags:(0,69),672,32;tp_doc:(0,7),704,32;tp_traverse:(0,85)=(0,86)=*(0,87)=f(0,4),736,32;tp_clear:(0,38),768,32;tp_richcompare:(0,88)=(0,89)=*(0,90)=f(0,1),800,32;tp_weaklistoffset:(0,69),832,32;tp_iter:(0,91)=(0,26),864,32;tp_iternext:(0,92)=(0,26),896,32;tp_methods:(0,93)=*(0,94)=xsPyMethodDef:,928,32;tp_members:(0,95)=*(0,96)=xsPyMemberDef:,960,32;tp_getset:(0,97)=*(0,98)=xsPyGetSetDef:,992,32;tp_base:(0,5),1024,32;tp_dict:(0,1),1056,32;tp_descr_get:(0,99)=(0,35),1088,32;tp_descr_set:(0,100)=(0,64),1120,32;tp_dictoffset:(0,69),1152,32;tp_init:(0,101)=(0,64),1184,32;tp_alloc:(0,102)=(0,103)=*(0,104)=f(0,1),1216,32;tp_new:(0,105)=(0,106)=*(0,107)=f(0,1),1248,32;tp_free:(0,108)=(0,109)=*(0,110)=f(0,12),1280,32;tp_is_gc:(0,38),1312,32;tp_bases:(0,1),1344,32;tp_mro:(0,1),1376,32;tp_cache:(0,1),1408,32;tp_subclasses:(0,1),1440,32;tp_weaklist:(0,1),1472,32;tp_del:(0,9),1504,32;;char:t(0,8)destructor:t(0,9)void:t(0,12)printfunc:t(0,13)getattrfunc:t(0,16)setattrfunc:t(0,19)cmpfunc:t(0,22)reprfunc:t(0,25)PyNumberMethods:t(0,29)binaryfunc:t(0,31)ternaryfunc:t(0,34)unaryfunc:t(0,37)inquiry:t(0,38)coercion:t(0,41)PySequenceMethods:t(0,45)intargfunc:t(0,47)intintargfunc:t(0,50)intobjargproc:t(0,53)intintobjargproc:t(0,56)objobjproc:t(0,59)PyMappingMethods:t(0,61)objobjargproc:t(0,63)hashfunc:t(0,66)long int:t(0,69)getattrofunc:t(0,70)setattrofunc:t(0,71)PyBufferProcs:t(0,73)getreadbufferproc:t(0,75)getwritebufferproc:t(0,78)getsegcountproc:t(0,79)getcharbufferproc:t(0,82)traverseproc:t(0,85)richcmpfunc:t(0,88)getiterfunc:t(0,91)iternextfunc:t(0,92)PyMethodDef:T(0,94)=s16ml_name:(0,7),0,32;ml_meth:(0,111)=(0,32),32,32;ml_flags:(0,4),64,32;ml_doc:(0,7),96,32;;PyMemberDef:T(0,96)=s20name:(0,7),0,32;type:(0,4),32,32;offset:(0,4),64,32;flags:(0,4),96,32;doc:(0,7),128,32;;PyGetSetDef:T(0,98)=s20name:(0,7),0,32;get:(0,112)=(0,113)=*(0,114)=f(0,1),32,32;set:(0,115)=(0,116)=*(0,117)=f(0,4),64,32;doc:(0,7),96,32;closure:(0,118)=*(0,12),128,32;;descrgetfunc:t(0,99)descrsetfunc:t(0,100)initproc:t(0,101)allocfunc:t(0,102)newfunc:t(0,105)freefunc:t(0,108)PyCFunction:t(0,111)getter:t(0,112)setter:t(0,115)__pyx_v_cls:p(0,119)=*(0,120)=(0,121)=s32ob_refcnt:(0,4),0,32;ob_type:(0,5),32,32;cl_bases:(0,1),64,32;cl_dict:(0,1),96,32;cl_name:(0,1),128,32;cl_getattr:(0,1),160,32;cl_setattr:(0,1),192,32;cl_delattr:(0,1),224,32;;__pyx_v_list:p(0,122)=*(0,123)=(0,124)=s16ob_refcnt:(0,4),0,32;ob_type:(0,5),32,32;ob_size:(0,4),64,32;ob_item:(0,125)=*(0,1),96,32;;PyClassObject:t(0,120)PyListObject:t(0,123)__pyx_v_bases:(0,126)=*(0,127)=(0,128)=s16ob_refcnt:(0,4),0,32;ob_type:(0,5),32,32;ob_size:(0,4),64,32;ob_item:(0,129)=ar(0,130)=r(0,130);0000000000000;0037777777777;;0;0;(0,1),96,32;;PyTupleObject:t(0,127)long unsigned int:t(0,131)=r(0,131);0000000000000;0037777777777;__pyx_v_i:(0,4)__pyx_v_tmp:r(0,1)__pyx_r:r(0,1)__pyx_1:r(0,1)__pyx_2:(0,4)__pyx_v_bases:(0,126)__pyx_v_i:(0,4)__pyx_v_tmp:r(0,1)__pyx_r:r(0,1)__pyx_1:r(0,1)__pyx_2:(0,4)___pyx_k29___pyx_argnames.2___pyx_f_9_speedups_buildECMRO___pyx_n___bases____pyx_f_9_speedups_buildECMRO:f(0,1)__pyx_v_cls:p(0,1)__pyx_v_list:p(0,122)__pyx_v_i:r(0,1)__pyx_r:r(0,1)__pyx_1:r(0,4)__pyx_2:r(0,1)__pyx_3:(0,1)__pyx_v_i:r(0,1)__pyx_r:r(0,1)__pyx_1:r(0,4)__pyx_2:r(0,1)__pyx_3:(0,1)___pyx_argnames.3___pyx_argnames.4___pyx_argnames.5___pyx_intern_tab___pyx_n_AdaptationFailure___pyx_n_AttributeError___pyx_n_DOES_NOT_SUPPORT___pyx_n_ExtensionClass___pyx_n_False___pyx_n_ImportError___pyx_n_NO_ADAPTER_NEEDED___pyx_n_Protocol__adapt_____pyx_n_Protocol__call_____pyx_n_TypeError___pyx_n__Protocol__adapters___pyx_n___all_____pyx_n___class___pyx_n___mro_____pyx_n_adapt___pyx_n_classicMRO___pyx_n_exc_info___pyx_n_extClassMRO___pyx_n_get___pyx_n_getMRO___pyx_n_metamethod___pyx_n_object___pyx_n_sys___pyx_n_tb_next___pyx_string_tab___pyx_k11p___pyx_k26p___pyx_k27p___pyx_k28p___pyx_k29p___pyx_methods_9_speedups_metamethod___pyx_tp_as_number_metamethod___pyx_tp_as_sequence_metamethod___pyx_tp_as_mapping_metamethod___pyx_tp_as_buffer_metamethod___pyx_type_9_speedups_metamethod___pyx_tp_dealloc_9_speedups_metamethod___pyx_tp_traverse_9_speedups_metamethod___pyx_tp_clear_9_speedups_metamethod___pyx_tp_descr_get_9_speedups_metamethod___pyx_tp_descr_set_9_speedups_metamethod___pyx_f_9_speedups_10metamethod___init_____pyx_tp_new_9_speedups_metamethod___pyx_methods___pyx_f_9_speedups_NO_ADAPTER_NEEDED___pyx_f_9_speedups_DOES_NOT_SUPPORT___pyx_f_9_speedups_adapt___pyx_f_9_speedups_Protocol__call_____pyx_f_9_speedups_classicMRO___pyx_f_9_speedups_extClassMRO___pyx_f_9_speedups_getMRO___pyx_f_9_speedups_Protocol__adapt_____pyx_m___pyx_b___pyx_v_9_speedups__marker___pyx_v_9_speedups___conform___pyx_v_9_speedups___adapt___pyx_v_9_speedups___mro___pyx_v_9_speedups___ECType___pyx_k19___pyx_k20___pyx_k21___pyx_k22___pyx_k23___pyx_k24___pyx_k25init_speedups:F(0,12)__pyx_1:r(0,1)__pyx_2:r(0,1)__pyx_3:r(0,4)__pyx_4:(0,1)___pyx_filenames___Pyx_Import__Pyx_Import:f(0,1)name:p(0,1)from_list:p(0,1)__import__:r(0,1)empty_list:(0,1)module:(0,1)global_dict:(0,1)empty_dict:(0,1)list:r(0,1)__import__:r(0,1)empty_list:(0,1)module:(0,1)global_dict:(0,1)empty_dict:(0,1)list:r(0,1)___Pyx_GetName__Pyx_GetName:f(0,1)dict:p(0,1)name:p(0,1)name:r(0,1)result:r(0,1)result:r(0,1)___Pyx_GetExcValue__Pyx_GetExcValue:f(0,1)type:(0,1)value:(0,1)tb:(0,1)result:(0,1)tstate:(0,132)=*(0,133)=(0,134)=xs_ts:PyThreadState:t(0,133)_ts:T(0,134)=s84next:(0,135)=*(0,134),0,32;interp:(0,136)=*(0,137)=(0,138)=xs_is:,32,32;frame:(0,139)=*(0,140)=xs_frame:,64,32;recursion_depth:(0,4),96,32;tracing:(0,4),128,32;use_tracing:(0,4),160,32;c_profilefunc:(0,141)=(0,142)=*(0,143)=f(0,4),192,32;c_tracefunc:(0,141),224,32;c_profileobj:(0,1),256,32;c_traceobj:(0,1),288,32;curexc_type:(0,1),320,32;curexc_value:(0,1),352,32;curexc_traceback:(0,1),384,32;exc_type:(0,1),416,32;exc_value:(0,1),448,32;exc_traceback:(0,1),480,32;dict:(0,1),512,32;tick_counter:(0,4),544,32;gilstate_counter:(0,4),576,32;async_exc:(0,1),608,32;thread_id:(0,69),640,32;;PyInterpreterState:t(0,137)_is:T(0,138)=s36next:(0,144)=*(0,138),0,32;tstate_head:(0,135),32,32;modules:(0,1),64,32;sysdict:(0,1),96,32;builtins:(0,1),128,32;codec_search_path:(0,1),160,32;codec_search_cache:(0,1),192,32;codec_error_registry:(0,1),224,32;dlopenflags:(0,4),256,32;;Py_tracefunc:t(0,141)type:(0,1)value:(0,1)tb:(0,1)result:(0,1)tstate:(0,132)___Pyx_Raise__Pyx_Raise:f(0,12)type:p(0,1)value:p(0,1)tb:p(0,1)tmp:r(0,1)___Pyx_ReRaise__Pyx_ReRaise:f(0,12)tstate:r(0,132)type:r(0,1)value:r(0,1)tb:r(0,1)___Pyx_InternStrings__Pyx_InternStrings:f(0,4)t:p(0,145)=*(0,146)=(0,147)=s8p:(0,125),0,32;s:(0,7),32,32;;__Pyx_InternTabEntry:t(0,146)___Pyx_InitStrings__Pyx_InitStrings:f(0,4)t:p(0,148)=*(0,149)=(0,150)=s12p:(0,125),0,32;s:(0,7),32,32;n:(0,69),64,32;;__Pyx_StringTabEntry:t(0,149)___Pyx_AddTraceback__Pyx_AddTraceback:f(0,12)funcname:p(0,7)py_srcfile:r(0,1)py_funcname:r(0,1)py_globals:(0,1)empty_tuple:(0,1)empty_string:(0,1)py_code:(0,151)=*(0,152)=(0,153)=s64ob_refcnt:(0,4),0,32;ob_type:(0,5),32,32;co_argcount:(0,4),64,32;co_nlocals:(0,4),96,32;co_stacksize:(0,4),128,32;co_flags:(0,4),160,32;co_code:(0,1),192,32;co_consts:(0,1),224,32;co_names:(0,1),256,32;co_varnames:(0,1),288,32;co_freevars:(0,1),320,32;co_cellvars:(0,1),352,32;co_filename:(0,1),384,32;co_name:(0,1),416,32;co_firstlineno:(0,4),448,32;co_lnotab:(0,1),480,32;;PyCodeObject:t(0,152)py_frame:(0,154)=*(0,155)=(0,140)PyFrameObject:t(0,155)___pyx_argnames.6___pyx_argnames.7___pyx_argnames.8__pyx_f_9_speedups_NO_ADAPTER_NEEDED:f(0,1)__pyx_self:p(0,1)__pyx_args:p(0,1)__pyx_kwds:p(0,1)__pyx_args:r(0,1)__pyx_kwds:r(0,1)__pyx_v_obj:(0,1)__pyx_v_protocol:(0,1)__pyx_r:r(0,1)__pyx_argnames:V(0,156)=ar(0,130);0;2;(0,7)__pyx_v_obj:(0,1)__pyx_v_protocol:(0,1)__pyx_r:r(0,1)__pyx_argnames:V(0,156)__pyx_f_9_speedups_DOES_NOT_SUPPORT:f(0,1)__pyx_self:p(0,1)__pyx_args:p(0,1)__pyx_kwds:p(0,1)__pyx_args:r(0,1)__pyx_kwds:r(0,1)__pyx_v_obj:(0,1)__pyx_v_protocol:(0,1)__pyx_argnames:V(0,157)=ar(0,130);0;2;(0,7)__pyx_v_obj:(0,1)__pyx_v_protocol:(0,1)__pyx_argnames:V(0,157)__pyx_f_9_speedups_10metamethod___init__:f(0,4)__pyx_v_self:p(0,1)__pyx_args:p(0,1)__pyx_kwds:p(0,1)__pyx_args:r(0,1)__pyx_kwds:r(0,1)__pyx_v_func:(0,1)__pyx_argnames:V(0,158)=ar(0,130);0;1;(0,7)__pyx_v_func:(0,1)__pyx_argnames:V(0,158)___pyx_f_9_speedups__adapt__pyx_f_9_speedups_adapt:f(0,1)__pyx_self:p(0,1)__pyx_args:p(0,1)__pyx_kwds:p(0,1)__pyx_args:r(0,1)__pyx_kwds:r(0,1)__pyx_v_obj:(0,1)__pyx_v_protocol:(0,1)__pyx_v_default:(0,1)__pyx_r:r(0,1)__pyx_1:r(0,1)__pyx_argnames:V(0,159)=ar(0,130);0;3;(0,7)__pyx_v_obj:(0,1)__pyx_v_protocol:(0,1)__pyx_v_default:(0,1)__pyx_r:r(0,1)__pyx_1:r(0,1)__pyx_argnames:V(0,159)__pyx_f_9_speedups_Protocol__call__:f(0,1)__pyx_self:p(0,1)__pyx_args:p(0,1)__pyx_kwds:p(0,1)__pyx_args:r(0,1)__pyx_kwds:r(0,1)__pyx_v_self:(0,1)__pyx_v_ob:(0,1)__pyx_v_default:(0,1)__pyx_r:r(0,1)__pyx_1:r(0,1)__pyx_argnames:V(0,160)=ar(0,130);0;3;(0,7)__pyx_v_self:(0,1)__pyx_v_ob:(0,1)__pyx_v_default:(0,1)__pyx_r:r(0,1)__pyx_1:r(0,1)__pyx_argnames:V(0,160)__pyx_f_9_speedups_classicMRO:f(0,1)__pyx_self:p(0,1)__pyx_args:p(0,1)__pyx_kwds:p(0,1)__pyx_args:r(0,1)__pyx_kwds:r(0,1)__pyx_v_ob:(0,1)__pyx_v_extendedClassic:(0,1)__pyx_v_mro:r(0,1)__pyx_r:r(0,1)__pyx_1:r(0,4)__pyx_2:r(0,1)__pyx_3:(0,1)__pyx_4:(0,1)__pyx_argnames:V(0,161)=ar(0,130);0;2;(0,7)__pyx_v_ob:(0,1)__pyx_v_extendedClassic:(0,1)__pyx_v_mro:r(0,1)__pyx_r:r(0,1)__pyx_1:r(0,4)__pyx_2:r(0,1)__pyx_3:(0,1)__pyx_4:(0,1)__pyx_argnames:V(0,161)__pyx_f_9_speedups_extClassMRO:f(0,1)__pyx_self:p(0,1)__pyx_args:p(0,1)__pyx_kwds:p(0,1)__pyx_args:r(0,1)__pyx_kwds:r(0,1)__pyx_v_ob:(0,1)__pyx_v_extendedClassic:(0,1)__pyx_v_mro:r(0,1)__pyx_r:r(0,1)__pyx_1:r(0,1)__pyx_2:r(0,4)__pyx_argnames:V(0,162)=ar(0,130);0;2;(0,7)__pyx_v_ob:(0,1)__pyx_v_extendedClassic:(0,1)__pyx_v_mro:r(0,1)__pyx_r:r(0,1)__pyx_1:r(0,1)__pyx_2:r(0,4)__pyx_argnames:V(0,162)__pyx_f_9_speedups_getMRO:f(0,1)__pyx_self:p(0,1)__pyx_args:p(0,1)__pyx_kwds:p(0,1)__pyx_args:r(0,1)__pyx_kwds:r(0,1)__pyx_v_ob:(0,1)__pyx_v_extendedClassic:(0,1)__pyx_r:r(0,1)__pyx_1:r(0,4)__pyx_2:r(0,1)__pyx_3:(0,1)__pyx_4:(0,1)__pyx_argnames:V(0,163)=ar(0,130);0;2;(0,7)__pyx_v_ob:(0,1)__pyx_v_extendedClassic:(0,1)__pyx_r:r(0,1)__pyx_1:r(0,4)__pyx_2:r(0,1)__pyx_3:(0,1)__pyx_4:(0,1)__pyx_argnames:V(0,163)__pyx_f_9_speedups_Protocol__adapt__:f(0,1)__pyx_self:p(0,1)__pyx_args:p(0,1)__pyx_kwds:p(0,1)__pyx_args:r(0,1)__pyx_kwds:r(0,1)__pyx_v_self:(0,1)__pyx_v_obj:(0,1)__pyx_v_tmp:r(0,118)__pyx_v_i:r(0,4)__pyx_v_cls:(0,1)__pyx_v_err:(0,1)__pyx_v_mro:(0,1)__pyx_v_get:(0,1)__pyx_v_factory:(0,1)__pyx_r:r(0,1)__pyx_1:(0,4)__pyx_2:r(0,1)__pyx_3:(0,1)__pyx_4:(0,1)__pyx_6:(0,1)__pyx_argnames:V(0,164)=ar(0,130);0;2;(0,7)__pyx_v_self:(0,1)__pyx_v_obj:(0,1)__pyx_v_tmp:r(0,118)__pyx_v_i:r(0,4)__pyx_v_cls:(0,1)__pyx_v_err:(0,1)__pyx_v_mro:(0,1)__pyx_v_get:(0,1)__pyx_v_factory:(0,1)__pyx_r:r(0,1)__pyx_1:(0,4)__pyx_2:r(0,1)__pyx_3:(0,1)__pyx_4:(0,1)__pyx_6:(0,1)__pyx_argnames:V(0,164)__pyx_tp_new_9_speedups_metamethod:f(0,1)t:p(0,165)=*(0,166)=(0,6)a:p(0,1)k:p(0,1)PyTypeObject:t(0,166)o:r(0,1)__pyx_obj_9_speedups_metamethod:T(0,167)=s12ob_refcnt:(0,4),0,32;ob_type:(0,5),32,32;func:(0,1),64,32;;__pyx_tp_dealloc_9_speedups_metamethod:f(0,12)o:p(0,1)__pyx_tp_traverse_9_speedups_metamethod:f(0,4)o:p(0,1)v:p(0,168)=(0,169)=*(0,170)=f(0,4)a:p(0,118)visitproc:t(0,168)a:r(0,118)e:r(0,4)__pyx_tp_clear_9_speedups_metamethod:f(0,4)o:p(0,1)___pyx_f_9_speedups_10metamethod___get____pyx_tp_descr_get_9_speedups_metamethod:f(0,1)o:p(0,1)i:p(0,1)c:p(0,1)i:r(0,1)c:r(0,1)___pyx_f_9_speedups_10metamethod___set_____pyx_f_9_speedups_10metamethod___delete____pyx_tp_descr_set_9_speedups_metamethod:f(0,4)o:p(0,1)i:p(0,1)v:p(0,1)i:r(0,1)v:r(0,1)__pyx_f_9_speedups__adapt:f(0,1)__pyx_v_obj:p(0,1)__pyx_v_protocol:p(0,1)__pyx_v_default:p(0,1)__pyx_v_tmp:r(0,118)__pyx_v_meth:r(0,1)__pyx_v_result:(0,1)__pyx_v_err:(0,1)__pyx_r:r(0,1)__pyx_1:r(0,4)__pyx_2:(0,1)__pyx_3:(0,1)__pyx_4:(0,1)__pyx_v_tmp:r(0,118)__pyx_v_meth:r(0,1)__pyx_v_result:(0,1)__pyx_v_err:(0,1)__pyx_r:r(0,1)__pyx_1:r(0,4)__pyx_2:(0,1)__pyx_3:(0,1)__pyx_4:(0,1)__pyx_f_9_speedups_10metamethod___get__:f(0,1)__pyx_v_self:p(0,1)__pyx_v_ob:p(0,1)__pyx_v_typ:p(0,1)__pyx_v_ob:r(0,1)__pyx_r:(0,1)__pyx_2:r(0,1)__pyx_r:(0,1)__pyx_2:r(0,1)__pyx_f_9_speedups_10metamethod___set__:f(0,4)__pyx_v_self:p(0,1)__pyx_v_ob:p(0,1)__pyx_v_value:p(0,1)__pyx_1:r(0,1)__pyx_2:r(0,1)__pyx_3:(0,1)__pyx_1:r(0,1)__pyx_2:r(0,1)__pyx_3:(0,1)__pyx_f_9_speedups_10metamethod___delete__:f(0,4)__pyx_v_self:p(0,1)__pyx_v_ob:p(0,1)__pyx_1:r(0,1)__pyx_2:r(0,1)__pyx_3:(0,1)__pyx_1:r(0,1)__pyx_2:r(0,1)__pyx_3:(0,1)__pyx_m:S(0,1)__pyx_b:S(0,1)__pyx_lineno:S(0,4)__pyx_filename:S(0,7)__pyx_f:S(0,171)=*(0,7)__pyx_mdoc:S(0,172)=ar(0,130);0;39;(0,8)__pyx_type_9_speedups_metamethod:S(0,166)__pyx_ptype_9_speedups_metamethod:S(0,165)__pyx_v_9_speedups__marker:S(0,1)__pyx_v_9_speedups___conform:S(0,1)__pyx_v_9_speedups___adapt:S(0,1)__pyx_v_9_speedups___mro:S(0,1)__pyx_v_9_speedups___ECType:S(0,1)__pyx_k19:S(0,1)__pyx_k20:S(0,1)__pyx_k21:S(0,1)__pyx_k22:S(0,1)__pyx_k23:S(0,1)__pyx_k24:S(0,1)__pyx_k25:S(0,1)__pyx_k11:S(0,173)=ar(0,130);0;18;(0,8)__pyx_k15:S(0,174)=ar(0,130);0;11;(0,8)__pyx_k16:S(0,175)=ar(0,130);0;9;(0,8)__pyx_k17:S(0,176)=ar(0,130);0;9;(0,8)__pyx_k18:S(0,177)=ar(0,130);0;7;(0,8)__pyx_n___all__:S(0,1)__pyx_n_exc_info:S(0,1)__pyx_n_AdaptationFailure:S(0,1)__pyx_n_ExtensionClass:S(0,1)__pyx_n___class:S(0,1)__pyx_n_NO_ADAPTER_NEEDED:S(0,1)__pyx_n_DOES_NOT_SUPPORT:S(0,1)__pyx_n_adapt:S(0,1)__pyx_n_Protocol__call__:S(0,1)__pyx_n_classicMRO:S(0,1)__pyx_n_extClassMRO:S(0,1)__pyx_n_getMRO:S(0,1)__pyx_n_Protocol__adapt__:S(0,1)__pyx_n_metamethod:S(0,1)__pyx_n_sys:S(0,1)__pyx_n_ImportError:S(0,1)__pyx_n_object:S(0,1)__pyx_n_False:S(0,1)__pyx_k11p:S(0,1)__pyx_doc_9_speedups_NO_ADAPTER_NEEDED:S(0,178)=ar(0,130);0;43;(0,8)__pyx_doc_9_speedups_DOES_NOT_SUPPORT:S(0,179)=ar(0,130);0;40;(0,8)__pyx_n_AttributeError:S(0,1)__pyx_k26p:S(0,1)__pyx_k26:S(0,180)=ar(0,130);0;19;(0,8)__pyx_k27p:S(0,1)__pyx_k27:S(0,181)=ar(0,130);0;19;(0,8)__pyx_n_TypeError:S(0,1)__pyx_n_tb_next:S(0,1)__pyx_k28p:S(0,1)__pyx_k28:S(0,182)=ar(0,130);0;11;(0,8)__pyx_doc_9_speedups_adapt:S(0,183)=ar(0,130);0;155;(0,8)__pyx_doc_9_speedups_Protocol__call__:S(0,184)=ar(0,130);0;22;(0,8)__pyx_k29p:S(0,1)__pyx_k29:S(0,185)=ar(0,130);0;19;(0,8)__pyx_n___bases__:S(0,1)__pyx_n___mro__:S(0,1)__pyx_n__Protocol__adapters:S(0,1)__pyx_n_get:S(0,1)__pyx_intern_tab:S(0,186)=ar(0,130);0;25;(0,146)__pyx_string_tab:S(0,187)=ar(0,130);0;5;(0,149)__pyx_methods_9_speedups_metamethod:S(0,188)=ar(0,130);0;0;(0,94)__pyx_tp_as_number_metamethod:S(0,29)__pyx_tp_as_sequence_metamethod:S(0,45)__pyx_tp_as_mapping_metamethod:S(0,61)__pyx_tp_as_buffer_metamethod:S(0,73)__pyx_methods:S(0,189)=ar(0,130);0;8;(0,94)__pyx_filenames:S(0,190)=ar(0,130);0;0;(0,7)PKIŸC8lá“DDprotocols/__init__.pyc;ò µÆBc@sŠdZdkTdklZlZlZlZdklZdkTdk l Z l Z dk l Z dklZlZdklZlZdS( s!Trivial Interfaces and Adaptation(s*(sNO_ADAPTER_NEEDEDsDOES_NOT_SUPPORTsAdapters StickyAdapter(sAdaptationFailure(s metamethods supermeta(s ProviderMixin(sprotocolForTypesprotocolForURI(s sequenceOfsIBasicSequenceN(s__doc__sapisadapterssNO_ADAPTER_NEEDEDsDOES_NOT_SUPPORTsAdapters StickyAdaptersAdaptationFailures interfacessadvices metamethods supermetasclassics ProviderMixinsgeneratesprotocolForTypesprotocolForURIs sequenceOfsIBasicSequence( sIBasicSequencesAdaptationFailures sequenceOfsAdapters StickyAdaptersprotocolForTypesprotocolForURIsDOES_NOT_SUPPORTs ProviderMixins supermetas metamethodsNO_ADAPTER_NEEDED((s6build/bdist.darwin-8.0.1-x86/egg/protocols/__init__.pys?s  PKIŸC8ÉV¯…&…&protocols/api.pyc;ò µÆBc@srdZddddddddgZeƒZd klZlZlZd kl Z e e fZ d k l Z lZlZd k lZd klZlZdklZlZlZdklZlZed„ZydklZWnej onXdd„Zdd„Zdd„Zei eƒei eƒfffd„Z!ffd„Z"ffd„Z#d„Z$dS(sAdapter and Declaration APIsadaptsdeclareAdapterForTypesdeclareAdapterForProtocolsdeclareAdapterForObjectsadvisesdeclareImplementationsdeclareAdapters adviseObject(s _getframesexc_infosmodules(s ClassType(sNO_ADAPTER_NEEDEDsDOES_NOT_SUPPORTsAdaptationFailure(s bindAdapter(saddClassAdvisors getFrameInfo(s IOpenProtocols IOpenProvidersIOpenImplementor(sProtocolsInterfaceClasscCsKt|tƒo t||ƒo|Sny |i}Wntj on[Xy%||ƒ}|tj o|SnWn1t j o%t ƒdi tj o‚q¤nXy |i }Wntj on[Xy%||ƒ}|tj o|SnWn1t j o%t ƒdi tj o‚q nX|tjotd||ƒ‚n|SdS(sPEP 246-alike: Adapt 'obj' to 'protocol', return 'default' If 'default' is not supplied and no implementation is found, the result of 'factory(obj,protocol)' is returned. If 'factory' is also not supplied, 'NotImplementedError' is then raised.is Can't adaptN(s isinstancesprotocols ClassTypessobjs __conform__s_conformsAttributeErrorsresultsNones TypeErrorsexc_infostb_nexts __adapt__s_adaptsdefaults_markersAdaptationFailure(sobjsprotocolsdefaults_conformsresults_adapt((s1build/bdist.darwin-8.0.1-x86/egg/protocols/api.pysadapt*s8            (sadapticCsgt||ƒ}t|tƒi|||ƒ}t|tt ƒ}|t j o|i |||ƒndS(s>Declare that 'adapter' adapts instances of 'typ' to 'protocol'N( s bindAdaptersadaptersprotocolsadapts IOpenProtocolsregisterImplementationstypsdepthsIOpenImplementorsNonesoisdeclareClassImplements(sprotocolsadapterstypsdepthsoi((s1build/bdist.darwin-8.0.1-x86/egg/protocols/api.pysdeclareAdapterForType[s  cCs6t|tƒt|tƒi|t||ƒ|ƒdS(s3Declare that 'adapter' adapts 'proto' to 'protocol'N(sadaptsprotocols IOpenProtocolsprotosaddImpliedProtocols bindAdaptersadaptersdepth(sprotocolsadaptersprotosdepth((s1build/bdist.darwin-8.0.1-x86/egg/protocols/api.pysdeclareAdapterForProtocolhs cCs)t|tƒi|t||ƒ|ƒdS(s0Declare that 'adapter' adapts 'ob' to 'protocol'N(sadaptsprotocols IOpenProtocolsregisterObjectsobs bindAdaptersadaptersdepth(sprotocolsadaptersobsdepth((s1build/bdist.darwin-8.0.1-x86/egg/protocols/api.pysdeclareAdapterForObjectnsc Csxxq|D]i}x|D]}t|||ƒqWx|D]}t|||ƒq5Wx|D]}t |||ƒqVWqWdS(s>'factory' is an IAdapterFactory providing 'provides' protocolsN( sprovidessprotocolsforTypesstypsdeclareAdapterForTypesfactorys forProtocolssprotosdeclareAdapterForProtocols forObjectssobsdeclareAdapterForObject( sfactorysprovidessforTypess forProtocolss forObjectssobsprotocolsprotostyp((s1build/bdist.darwin-8.0.1-x86/egg/protocols/api.pysdeclareAdapter~scCsFx|D]}t|t|ƒqWx|D]}t|t|ƒq(WdS(s>Declare information about a class, type, or 'IOpenImplementor'N(sinstancesProvidesprotosdeclareAdapterForTypesNO_ADAPTER_NEEDEDstypsinstancesDoNotProvidesDOES_NOT_SUPPORT(stypsinstancesProvidesinstancesDoNotProvidesproto((s1build/bdist.darwin-8.0.1-x86/egg/protocols/api.pysdeclareImplementation‘scCsFx|D]}t|t|ƒqWx|D]}t|t|ƒq(WdS(s.Tell an object what it does or doesn't provideN(sprovidessprotosdeclareAdapterForObjectsNO_ADAPTER_NEEDEDsobsdoesNotProvidesDOES_NOT_SUPPORT(sobsprovidessdoesNotProvidesproto((s1build/bdist.darwin-8.0.1-x86/egg/protocols/api.pys adviseObject›sc sÌ|iƒ}tdƒ}t|ƒ\} }}}| djoR|i dfƒ} |d=x|D]}t d|ƒ‚q]Wt |d| ƒdSn| djotdƒ‚n|i dfƒ‰|i d fƒ‰|i d fƒ‰|i d fƒ‰|i d fƒ‰|i d fƒ‰|i dfƒ‰|i dfƒ‰ |i dtƒ‰|i dfƒ‰t|idiƒƒx|D]}t d|ƒ‚q}W‡‡‡‡‡‡‡‡‡ ‡d†}t|ƒdS(NismodulesmoduleProvidess1Invalid keyword argument for advising modules: %ssprovidessclasss`protocols.advise() must be called directly in a class or module body, not in a function or exec.s classProvidessclassDoesNotProvidesinstancesProvidesinstancesDoNotProvidesasAdapterForTypessasAdapterForProtocolssprotocolExtendssprotocolIsSubsetOfs factoryMethodsequivalentProtocolssµclassProvides classDoesNotProvide instancesProvide instancesDoNotProvide asAdapterForTypes asAdapterForProtocols protocolExtends protocolIsSubsetOf factoryMethod equivalentProtocolss1Invalid keyword argument for advising classes: %scsKˆpˆ ot|dˆdˆ ƒnˆpˆot|dˆdˆƒnˆpˆoUˆ ot dƒ‚nˆot |ˆƒ}n|}t |ˆdˆdˆƒnˆot dƒ‚nˆot tˆd|gƒnˆot t|gdˆƒnˆo0t tˆd|gƒt t|gdˆƒn|SdS( NsprovidessdoesNotProvidesinstancesProvidesinstancesDoNotProvidesLWhen declaring an adapter, you must specify what its instances will provide.sforTypess forProtocolss;'factoryMethod' is only used when declaring an adapter type(s classProvidessclassDoesNotProvides adviseObjectsklasssinstancesProvidesinstancesDoNotProvidesdeclareImplementationsasAdapterForTypessasAdapterForProtocolss TypeErrors factoryMethodsgetattrsfactorysdeclareAdaptersprotocolExtendssNO_ADAPTER_NEEDEDsprotocolIsSubsetOfsequivalentProtocols(sklasssfactory( sasAdapterForTypessprotocolExtendssasAdapterForProtocolssequivalentProtocolssinstancesProvides factoryMethodsinstancesDoNotProvides classProvidessprotocolIsSubsetOfsclassDoesNotProvide(s1build/bdist.darwin-8.0.1-x86/egg/protocols/api.pyscallbackØs6   (skwscopys _getframesframes getFrameInfoskindsmodules caller_localsscaller_globalss setdefaultsmoduleProvidessks TypeErrors adviseObjects SyntaxErrors classProvidessclassDoesNotProvidesinstancesProvidesinstancesDoNotProvidesasAdapterForTypessasAdapterForProtocolssprotocolExtendssprotocolIsSubsetOfsNones factoryMethodsequivalentProtocolssmaps __delitem__ssplitscallbacksaddClassAdvisor(skwsframesmodules classProvidessclassDoesNotProvidesasAdapterForTypesscaller_globalss caller_localssinstancesDoNotProvidesasAdapterForProtocolssmoduleProvidessprotocolExtendsskindsequivalentProtocolssinstancesProvidesks factoryMethodscallbacksprotocolIsSubsetOf(( s classProvidessclassDoesNotProvidesasAdapterForTypessinstancesDoNotProvidesasAdapterForProtocolssprotocolExtendssequivalentProtocolssinstancesProvides factoryMethodsprotocolIsSubsetOfs1build/bdist.darwin-8.0.1-x86/egg/protocols/api.pysadvise§s<     '3N(%s__doc__s__all__sobjects_markerssyss _getframesexc_infosmodulesstypess ClassTypestypes ClassTypessadapterssNO_ADAPTER_NEEDEDsDOES_NOT_SUPPORTsAdaptationFailures bindAdaptersadvicesaddClassAdvisors getFrameInfos interfacess IOpenProtocols IOpenProvidersIOpenImplementorsProtocolsInterfaceClasssadapts _speedupss ImportErrorsdeclareAdapterForTypesdeclareAdapterForProtocolsdeclareAdapterForObjectsregisterImplementationsdeclareAdaptersdeclareImplementations adviseObjectsadvise(sdeclareAdapterForTypesdeclareAdapterForObjectsDOES_NOT_SUPPORTsdeclareImplementationsaddClassAdvisors IOpenProvidersAdaptationFailures__all__sdeclareAdapterForProtocolsadaptsdeclareAdaptersInterfaceClasssadvisesNO_ADAPTER_NEEDEDs_markers getFrameInfos bindAdapters ClassTypess adviseObjectsProtocolsIOpenImplementors ClassTypesmoduless _getframesexc_infos IOpenProtocol((s1build/bdist.darwin-8.0.1-x86/egg/protocols/api.pys?s0     )     PKÜ\â2£Þ—*(,(,protocols/advice.pyfrom __future__ import generators from new import instancemethod from types import ClassType, FunctionType, InstanceType import sys __all__ = [ 'addClassAdvisor', 'isClassAdvisor', 'metamethod', 'supermeta', 'minimalBases', 'determineMetaclass', 'getFrameInfo', 'getMRO', 'classicMRO', 'mkRef', 'StrongRef', 'add_assignment_advisor', ] def metamethod(func): """Wrapper for metaclass method that might be confused w/instance method""" return property(lambda ob: func.__get__(ob,ob.__class__)) try: from ExtensionClass import ExtensionClass except ImportError: ClassicTypes = ClassType else: ClassicTypes = ClassType, ExtensionClass def classicMRO(ob, extendedClassic=False): stack = [] push = stack.insert pop = stack.pop push(0,ob) while stack: cls = pop() yield cls p = len(stack) for b in cls.__bases__: push(p,b) if extendedClassic: yield InstanceType yield object def getMRO(ob, extendedClassic=False): if isinstance(ob,ClassicTypes): return classicMRO(ob,extendedClassic) elif isinstance(ob,type): return ob.__mro__ return ob, try: from _speedups import metamethod, getMRO, classicMRO except ImportError: pass # property-safe 'super()' for Python 2.2; 2.3 can use super() instead def supermeta(typ,ob): starttype = type(ob) mro = starttype.__mro__ if typ not in mro: starttype = ob mro = starttype.__mro__ mro = iter(mro) for cls in mro: if cls is typ: mro = [cls.__dict__ for cls in mro] break else: raise TypeError("Not sub/supertypes:", starttype, typ) typ = type(ob) class theSuper(object): def __getattribute__(self,name): for d in mro: if name in d: descr = d[name] try: descr = descr.__get__ except AttributeError: return descr else: return descr(ob,typ) return object.__getattribute__(self,name) return theSuper() def getFrameInfo(frame): """Return (kind,module,locals,globals) for a frame 'kind' is one of "exec", "module", "class", "function call", or "unknown". """ f_locals = frame.f_locals f_globals = frame.f_globals sameNamespace = f_locals is f_globals hasModule = '__module__' in f_locals hasName = '__name__' in f_globals sameName = hasModule and hasName sameName = sameName and f_globals['__name__']==f_locals['__module__'] module = hasName and sys.modules.get(f_globals['__name__']) or None namespaceIsModule = module and module.__dict__ is f_globals if not namespaceIsModule: # some kind of funky exec kind = "exec" if hasModule and not sameNamespace: kind="class" elif sameNamespace and not hasModule: kind = "module" elif sameName and not sameNamespace: kind = "class" elif not sameNamespace: kind = "function call" else: # How can you have f_locals is f_globals, and have '__module__' set? # This is probably module-level code, but with a '__module__' variable. kind = "unknown" return kind,module,f_locals,f_globals def addClassAdvisor(callback, depth=2,frame=None): """Set up 'callback' to be passed the containing class upon creation This function is designed to be called by an "advising" function executed in a class suite. The "advising" function supplies a callback that it wishes to have executed when the containing class is created. The callback will be given one argument: the newly created containing class. The return value of the callback will be used in place of the class, so the callback should return the input if it does not wish to replace the class. The optional 'depth' argument to this function determines the number of frames between this function and the targeted class suite. 'depth' defaults to 2, since this skips this function's frame and one calling function frame. If you use this function from a function called directly in the class suite, the default will be correct, otherwise you will need to determine the correct depth yourself. This function works by installing a special class factory function in place of the '__metaclass__' of the containing class. Therefore, only callbacks *after* the last '__metaclass__' assignment in the containing class will be executed. Be sure that classes using "advising" functions declare any '__metaclass__' *first*, to ensure all callbacks are run.""" frame = frame or sys._getframe(depth) kind, module, caller_locals, caller_globals = getFrameInfo(frame) if kind != "class": raise SyntaxError( "Advice must be in the body of a class statement" ) previousMetaclass = caller_locals.get('__metaclass__') defaultMetaclass = caller_globals.get('__metaclass__', ClassType) def advise(name,bases,cdict): if '__metaclass__' in cdict: del cdict['__metaclass__'] if previousMetaclass is None: if bases: # find best metaclass or use global __metaclass__ if no bases meta = determineMetaclass(bases) else: meta = defaultMetaclass elif isClassAdvisor(previousMetaclass): # special case: we can't compute the "true" metaclass here, # so we need to invoke the previous metaclass and let it # figure it out for us (and apply its own advice in the process) meta = previousMetaclass else: meta = determineMetaclass(bases, previousMetaclass) newClass = meta(name,bases,cdict) # this lets the callback replace the class completely, if it wants to return callback(newClass) # introspection data only, not used by inner function advise.previousMetaclass = previousMetaclass advise.callback = callback # install the advisor caller_locals['__metaclass__'] = advise def isClassAdvisor(ob): """True if 'ob' is a class advisor function""" return isinstance(ob,FunctionType) and hasattr(ob,'previousMetaclass') def add_assignment_advisor(callback,depth=2,frame=None): """Invoke 'callback(frame,name,value,old_locals)' on next assign in 'frame' The frame monitored is determined by the 'depth' argument, which gets passed to 'sys._getframe()'. When 'callback' is invoked, 'old_locals' contains a copy of the frame's local variables as they were before the assignment took place, allowing the callback to access the previous value of the assigned variable, if any. The callback's return value will become the new value of the variable. 'name' is the name of the variable being created or modified, and 'value' is its value (the same as 'frame.f_locals[name]'). This function also returns a decorator function for forward-compatibility with Python 2.4 '@' syntax. Note, however, that if the returned decorator is used with Python 2.4 '@' syntax, the callback 'name' argument may be 'None' or incorrect, if the 'value' is not the original function (e.g. when multiple decorators are used). """ frame = frame or sys._getframe(depth) oldtrace = [frame.f_trace] old_locals = frame.f_locals.copy() def tracer(frm,event,arg): if event=='call': # We don't want to trace into any calls if oldtrace[0]: # ...but give the previous tracer a chance to, if it wants return oldtrace[0](frm,event,arg) else: return None try: if frm is frame and event !='exception': # Aha, time to check for an assignment... for k,v in frm.f_locals.items(): if k not in old_locals or old_locals[k] is not v: break else: # No luck, keep tracing return tracer # Got it, fire the callback, then get the heck outta here... frm.f_locals[k] = callback(frm,k,v,old_locals) finally: # Give the previous tracer a chance to run before we return if oldtrace[0]: # And allow it to replace our idea of the "previous" tracer oldtrace[0] = oldtrace[0](frm,event,arg) uninstall() return oldtrace[0] def uninstall(): # Unlink ourselves from the trace chain. frame.f_trace = oldtrace[0] sys.settrace(oldtrace[0]) # Install the trace function frame.f_trace = tracer sys.settrace(tracer) def do_decorate(f): # Python 2.4 '@' compatibility; call the callback uninstall() frame = sys._getframe(1) return callback( frame, getattr(f,'__name__',None), f, frame.f_locals ) return do_decorate def determineMetaclass(bases, explicit_mc=None): """Determine metaclass from 1+ bases and optional explicit __metaclass__""" meta = [getattr(b,'__class__',type(b)) for b in bases] if explicit_mc is not None: # The explicit metaclass needs to be verified for compatibility # as well, and allowed to resolve the incompatible bases, if any meta.append(explicit_mc) if len(meta)==1: # easy case return meta[0] candidates = minimalBases(meta) # minimal set of metaclasses if not candidates: # they're all "classic" classes return ClassType elif len(candidates)>1: # We could auto-combine, but for now we won't... raise TypeError("Incompatible metatypes",bases) # Just one, return it return candidates[0] def minimalBases(classes): """Reduce a list of base classes to its ordered minimum equivalent""" classes = [c for c in classes if c is not ClassType] candidates = [] for m in classes: for n in classes: if issubclass(n,m) and m is not n: break else: # m has no subclasses in 'classes' if m in candidates: candidates.remove(m) # ensure that we're later in the list candidates.append(m) return candidates from weakref import ref class StrongRef(object): """Like a weakref, but for non-weakrefable objects""" __slots__ = 'referent' def __init__(self,referent): self.referent = referent def __call__(self): return self.referent def __hash__(self): return hash(self.referent) def __eq__(self,other): return self.referent==other def __repr__(self): return 'StrongRef(%r)' % self.referent def mkRef(ob,*args): """Return either a weakref or a StrongRef for 'ob' Note that extra args are forwarded to weakref.ref() if applicable.""" try: return ref(ob,*args) except TypeError: return StrongRef(ob) PKIŸC8ê%,Áüüprotocols/classic.pyc;ò µÆBc@sÄdZdgZdklZlZlZlZdkTdkl Z l Z l Z l Z dk TdklZdklZlZlZdfd„ƒYZdefd „ƒYZd efd „ƒYZd S( s-Declaration support for Python built-in typess ProviderMixin(s FunctionTypes ModuleTypes InstanceTypes ClassType(s*(sdeclareImplementationsadvisesdeclareAdapterForObjectsadapt(sinstancemethod(sgetMROs metamethodsmkRefcBsftZdZedeegƒedd„ZeeƒZd„Z ee ƒZ d„Z ee ƒZ RS(s*Mixin to support per-instance declarationssinstancesProvideicCsh|iidƒ}|tjoh|_}nt||||ƒot |t ƒi |ƒt SndS(Ns__protocols_provided__(sselfs__dict__sgetsregistrysNones__protocols_provided__supdateWithSimplestAdaptersprotocolsadaptersdepthsadapts IOpenProtocolsaddImplicationListenersTrue(sselfsprotocolsadaptersdepthsregistry((s5build/bdist.darwin-8.0.1-x86/egg/protocols/classic.pysdeclareProvides2s  cCsg|iidfƒ}||jodSn||\}}t|||ƒ}t |||||ƒdS(Ns__protocols_provided__( sselfs__dict__sgetsregistryssrcProtos baseAdaptersdscomposeAdapterssadaptersdeclareAdapterForObjects destProtosdepth(sselfssrcProtos destProtosadaptersdepthsds baseAdaptersregistry((s5build/bdist.darwin-8.0.1-x86/egg/protocols/classic.pysnewProtocolImplied<s  cCsSxLt|ƒD]>}|iidfƒ}||jo||d|ƒSq q WdS(Ns__protocols_provided__i(sgetMROsselfsclss__dict__sgetsconfsprotocol(sselfsprotocolsconfscls((s5build/bdist.darwin-8.0.1-x86/egg/protocols/classic.pys __conform__Js   ( s__name__s __module__s__doc__sadvises IOpenProvidersIImplicationListenersNO_ADAPTER_NEEDEDsdeclareProvidess metamethodsnewProtocolImplieds __conform__(((s5build/bdist.darwin-8.0.1-x86/egg/protocols/classic.pys ProviderMixin*s    sconformsRegistrycBsStZdZd„Zed„Zd„Zd„Zed„Z d„Z d„Z RS(sBHelper type for objects and classes that need registration supportcCsD||jo3|iƒ}|tj o||d|ƒSq@ndS(Ni(sprotocolsselfssubjectsNone(sselfsprotocolssubject((s5build/bdist.darwin-8.0.1-x86/egg/protocols/classic.pys__call__Ws   cCs‹x„t|ƒD]v}|iidƒ}|tjoq nt|tƒ ot d||ƒ‚n||jo||d|ƒSq q WdS(Ns __conform__s&Incompatible __conform__ in base classi( sgetMROssubjectsclss__dict__sgetsconfsNones isinstancesconformsRegistrys TypeErrorsprotocol(sselfssubjectsprotocols checkSelfsconfscls((s5build/bdist.darwin-8.0.1-x86/egg/protocols/classic.pysfindImplementationcs   cCsk|iƒ}|tjp ||jodSn||\}}t|||ƒ}t|||||ƒdS(N( sselfssubjectsNonessrcProtos baseAdaptersdscomposeAdapterssadaptersdeclareAdapterForObjects destProtosdepth(sselfssrcProtos destProtosadaptersdepthsds baseAdapterssubject((s5build/bdist.darwin-8.0.1-x86/egg/protocols/classic.pysnewProtocolImplied|s  cCst|ƒSdS(N(sidsself(sself((s5build/bdist.darwin-8.0.1-x86/egg/protocols/classic.pys__hash__‹scCs:|tj otdƒ‚nt|i|t|ƒƒSdS(Ns/__conform__ registry does not pass to instances(sobsNonesAttributeErrorsinstancemethodsselfsfindImplementationstypstype(sselfsobstyp((s5build/bdist.darwin-8.0.1-x86/egg/protocols/classic.pys__get__‘s cCs|iƒ|iƒfSdS(N(sselfssubjectsitems(sself((s5build/bdist.darwin-8.0.1-x86/egg/protocols/classic.pys __getstate__™scCs<|\}}|iƒ|it|ƒƒt|ƒ|_dS(N(ssubjectsitemssselfsclearsupdatesdictsmkRef(sselfs.2ssubjectsitems((s5build/bdist.darwin-8.0.1-x86/egg/protocols/classic.pys __setstate__œs  ( s__name__s __module__s__doc__s__call__sTruesfindImplementationsnewProtocolImplieds__hash__sNones__get__s __getstate__s __setstate__(((s5build/bdist.darwin-8.0.1-x86/egg/protocols/classic.pysconformsRegistrySs      sMiscObjectsAsOpenProviderc BsWtZdZedegdeeeee e gƒd„Z e dd„Z d„ZRS(sCSupply __conform__ registry for funcs, modules, & classic instancessinstancesProvidesasAdapterForTypescCstt|ƒƒ}x°|D]¨}yI|iidƒ}|tjo ||gjot |dtƒ}nWn"t j ot d|ƒ‚nX|tj ot |t ƒ ot d||ƒ‚qqW|iidƒ}|tjo|i|ƒ}|_n||_||_dS(Ns __conform__s3Only objects with dictionaries can use this adapters*Incompatible __conform__ on adapted object(slistsgetMROsobsobssitems__dict__sgetsregsNonesgetattrsAttributeErrors TypeErrors isinstancesconformsRegistrysselfs newRegistrys __conform__(sselfsobsregsitemsobs((s5build/bdist.darwin-8.0.1-x86/egg/protocols/classic.pys__init__±s"  icCs>t|i|||ƒo!t|tƒi|iƒt SndS(N( supdateWithSimplestAdaptersselfsregsprotocolsadaptersdepthsadapts IOpenProtocolsaddImplicationListenersTrue(sselfsprotocolsadaptersdepth((s5build/bdist.darwin-8.0.1-x86/egg/protocols/classic.pysdeclareProvidesÎscCs tƒ}t|ƒ|_|SdS(N(sconformsRegistrysregsmkRefssubject(sselfssubjectsreg((s5build/bdist.darwin-8.0.1-x86/egg/protocols/classic.pys newRegistryÓs (s__name__s __module__s__doc__sadvises IOpenProviders FunctionTypes ModuleTypes InstanceTypes ClassTypestypesobjects__init__sNO_ADAPTER_NEEDEDsdeclareProvidess newRegistry(((s5build/bdist.darwin-8.0.1-x86/egg/protocols/classic.pysMiscObjectsAsOpenProvider¥s   N(s__doc__s__all__stypess FunctionTypes ModuleTypes InstanceTypes ClassTypesadapterssapisdeclareImplementationsadvisesdeclareAdapterForObjectsadapts interfacessnewsinstancemethodsadvicesgetMROs metamethodsmkRefs ProviderMixinsdictsconformsRegistrysobjectsMiscObjectsAsOpenProvider(sdeclareAdapterForObjects__all__s ClassTypes metamethodsconformsRegistrysinstancemethodsgetMROsMiscObjectsAsOpenProviders ProviderMixinsadaptsmkRefsdeclareImplementations ModuleTypes FunctionTypes InstanceTypesadvise((s5build/bdist.darwin-8.0.1-x86/egg/protocols/classic.pys?s  )RPKIŸC8ºÜèÉO&O&protocols/generate.pyc;ò µÆBc @s\dZdklZlZlZdklZlZdkl Z l Z dkl Z l Z dk lZdddd d d d d dg Zd efd„ƒYZd efd„ƒYZd eefd„ƒYZdefd„ƒYZd efd„ƒYZe edegdeegƒd„ZeƒZhZd„Zfed„Zd„Zd„ZdS(sCAutogenerated protocols from type+method names, URI, sequence, etc.(sProtocols allocate_locks Interface(s metamethods supermeta(sdeclareAdapterForProtocolsdeclareAdapterForType(sdeclareAdaptersadapt(sNO_ADAPTER_NEEDEDsprotocolForTypesprotocolForURIs sequenceOfsIBasicSequences URIProtocols TypeSubsets WeakSubsetsADAPT_SEQUENCEsSequenceProtocolcBs)tZdZd„Zd„Zd„ZRS(sEProtocol representing a URI, UUID, or other unique textual identifiercCs||_ti|ƒdS(N(surisselfsURIsProtocols__init__(sselfsuri((s6build/bdist.darwin-8.0.1-x86/egg/protocols/generate.pys__init__s cCsd|iSdS(NsURIProtocol(%r)(sselfsURI(sself((s6build/bdist.darwin-8.0.1-x86/egg/protocols/generate.pys__repr__scCst|iffSdS(N(sprotocolForURIsselfsURI(sself((s6build/bdist.darwin-8.0.1-x86/egg/protocols/generate.pys __reduce__s(s__name__s __module__s__doc__s__init__s__repr__s __reduce__(((s6build/bdist.darwin-8.0.1-x86/egg/protocols/generate.pys URIProtocols   cBs)tZdZd„Zd„Zd„ZRS(s2Protocol representing some set of a type's methodscCs#||_||_ti|ƒdS(N(sbaseTypesselfsmethodssProtocols__init__(sselfsbaseTypesmethods((s6build/bdist.darwin-8.0.1-x86/egg/protocols/generate.pys__init__.s  cCsd|i|ifSdS(NsTypeSubset(%r,%r)(sselfsbaseTypesmethods(sself((s6build/bdist.darwin-8.0.1-x86/egg/protocols/generate.pys__repr__3scCst|i|itffSdS(N(sprotocolForTypesselfsbaseTypesmethodssFalse(sself((s6build/bdist.darwin-8.0.1-x86/egg/protocols/generate.pys __reduce__6s(s__name__s __module__s__doc__s__init__s__repr__s __reduce__(((s6build/bdist.darwin-8.0.1-x86/egg/protocols/generate.pys TypeSubset*s   cBs;tZdZeZd„ZeeƒZd„Zd„ZRS(s<TypeSubset that accepts any object with the right attributescCsbtt|ƒi|ƒ}|tj o|Snx.|iD]}t ||ƒ otSq7q7W|SdS(N( s supermetas TypeSubsetsselfs __adapt__sobsresultsNonesmethodssnameshasattr(sselfsobsnamesresult((s6build/bdist.darwin-8.0.1-x86/egg/protocols/generate.pys __adapt__Ys   cCsd|i|ifSdS(NsWeakSubset(%r,%r)(sselfsbaseTypesmethods(sself((s6build/bdist.darwin-8.0.1-x86/egg/protocols/generate.pys__repr__iscCst|i|itffSdS(N(sprotocolForTypesselfsbaseTypesmethodssTrue(sself((s6build/bdist.darwin-8.0.1-x86/egg/protocols/generate.pys __reduce__ls( s__name__s __module__s__doc__stypes __metaclass__s __adapt__s metamethods__repr__s __reduce__(((s6build/bdist.darwin-8.0.1-x86/egg/protocols/generate.pys WeakSubsetSs   cBs)tZdZd„Zd„Zd„ZRS(s8Protocol representing a "sequence of" some base protocolcCs||_ti|ƒdS(N(s baseProtocolsselfsProtocols__init__(sselfs baseProtocol((s6build/bdist.darwin-8.0.1-x86/egg/protocols/generate.pys__init__€s cCsd|iSdS(NssequenceOf(%r)(sselfs baseProtocol(sself((s6build/bdist.darwin-8.0.1-x86/egg/protocols/generate.pys__repr__„scCst|iffSdS(N(s sequenceOfsselfs baseProtocol(sself((s6build/bdist.darwin-8.0.1-x86/egg/protocols/generate.pys __reduce__‡s(s__name__s __module__s__doc__s__init__s__repr__s __reduce__(((s6build/bdist.darwin-8.0.1-x86/egg/protocols/generate.pysSequenceProtocol|s   cBstZdZd„ZRS(s$Non-string, iterable object sequencecCsdS(s$Return an iterator over the sequenceN((((s6build/bdist.darwin-8.0.1-x86/egg/protocols/generate.pys__iter__s(s__name__s __module__s__doc__s__iter__(((s6build/bdist.darwin-8.0.1-x86/egg/protocols/generate.pysIBasicSequence‹s sprovidessforTypescCsetƒ}g}|i}xB|D]:}t|||ƒ}||jotSn|i |ƒqW|SdS(s?Convert iterable 'ob' into list of objects implementing 'proto'N( sobjectsmarkersoutsprotos baseProtocolsobsitemsadaptsNonesappend(sobsprotositemsmarkersout((s6build/bdist.darwin-8.0.1-x86/egg/protocols/generate.pysADAPT_SEQUENCE¥s   cCsZtiƒz>y t|SWn+tj ot|ƒ}t|<|SnXWdtiƒXdS(sBReturn a unique protocol object representing the supplied URI/UUIDN(s__registryLocksacquiresregistrysurisKeyErrors URIProtocolsprotosrelease(surisproto((s6build/bdist.darwin-8.0.1-x86/egg/protocols/generate.pysprotocolForURIÓs   cCsntgi}|D]}|||fƒq~ƒiƒ}|iƒt|ƒ}||| f}t |ƒSdS(sEReturn a protocol representing a subset of methods of a specific typeN( sdictsappends_[1]smethodsskskeysssortstuplesbaseTypesimplicitskeys__protocolForType(sbaseTypesmethodssimplicitsks_[1]skey((s6build/bdist.darwin-8.0.1-x86/egg/protocols/generate.pysprotocolForTypeâs 9  cs|t|f}tiƒzTy t|SWnAtj o5t|ƒ‰t|sN( s sequenceOfs baseProtocolskeys__registryLocksacquiresregistrysKeyErrorsSequenceProtocolsprotosdeclareAdapterForProtocolsIBasicSequencesrelease(s baseProtocolsprotoskey((sprotos6build/bdist.darwin-8.0.1-x86/egg/protocols/generate.pys sequenceOf÷s    c CsStiƒzhy t|SWnUtj oI|\}}}|ot||ƒ}nt ||ƒ}|t|N( s__doc__s interfacessProtocols allocate_locks Interfacesadvices metamethods supermetasapisdeclareAdapterForProtocolsdeclareAdapterForTypesdeclareAdaptersadaptsadapterssNO_ADAPTER_NEEDEDs__all__s URIProtocols TypeSubsetsobjects WeakSubsetsSequenceProtocolsIBasicSequencesliststuplesADAPT_SEQUENCEs__registryLocksregistrysprotocolForURIsFalsesprotocolForTypes sequenceOfs__protocolForType(sdeclareAdapterForTypes__registryLocks sequenceOfs__all__s metamethodsdeclareAdapterForProtocolsprotocolForTypes TypeSubsetsadapts InterfacesADAPT_SEQUENCEsSequenceProtocolsIBasicSequences WeakSubsetsprotocolForURIsdeclareAdaptersregistrys__protocolForTypesProtocols allocate_locksNO_ADAPTER_NEEDEDs supermetas URIProtocol((s6build/bdist.darwin-8.0.1-x86/egg/protocols/generate.pys?s* !))  )   )PKJŸC86’­óÕÕprotocols/twisted_support.pyc;ò µÆBc@s¾dZgZdkTdklZdklZdklZde fd„ƒYZ ydk l Z lZlZWnej o gZnXed„ƒe_egZd e fd „ƒYZd S( s*Declaration support for Twisted Interfaces(s*(sadvise(s IOpenProtocol(sWeakKeyDictionarysTwistedAdaptMethodcBs/tZdZdZd„Zd„Zd„ZRS(s/__adapt__ implementation for Twisted interfacessifacecCs ||_dS(N(sifacesself(sselfsiface((s=build/bdist.darwin-8.0.1-x86/egg/protocols/twisted_support.pys__init__5scCs/t||iƒo|Sn|i|tƒSdS(N(sTwistedImplementssobjsselfsifacesNone(sselfsobj((s=build/bdist.darwin-8.0.1-x86/egg/protocols/twisted_support.pys__call__9scCs;|iiidƒ}|tjo|Sn|||ƒSdS(Ns __adapt__(sselfsifaces__dict__sgetsmethsNonesdefaultsob(sselfsobsdefaultsmeth((s=build/bdist.darwin-8.0.1-x86/egg/protocols/twisted_support.pysim_funcEs (s__name__s __module__s__doc__s __slots__s__init__s__call__sim_func(((s=build/bdist.darwin-8.0.1-x86/egg/protocols/twisted_support.pysTwistedAdaptMethod.s   (s implementss MetaInterfaces getInterfacescCs t|ƒS(N(sTwistedAdaptMethodss(ss((s=build/bdist.darwin-8.0.1-x86/egg/protocols/twisted_support.pys`ssTwistedInterfaceAsProtocolcBsltZdZedegdeƒd„Zd„Zedd„Z edd„Z edd „Z d „Z RS( NsifacesinstancesProvidesasAdapterForTypescCs ||_dS(N(sifacesself(sselfsiface((s=build/bdist.darwin-8.0.1-x86/egg/protocols/twisted_support.pys__init__†scCs|ii|ƒSdS(N(sselfsifaces __adapt__sobj(sselfsobj((s=build/bdist.darwin-8.0.1-x86/egg/protocols/twisted_support.pys __adapt__ŠsicCs•t|ƒ}|tjo|it|ƒf|_n]|t jo7|i|jo#|i |iƒt|ƒ|_q‘nt d|i||ƒ‚dS(Ns9Twisted interfaces can only declare support, not adapters( sTwistedGetInterfacessklasss oldImplementssadaptersNO_ADAPTER_NEEDEDsselfsifacestuples__implements__sDOES_NOT_SUPPORTsremoves TypeError(sselfsklasssadaptersdepths oldImplements((s=build/bdist.darwin-8.0.1-x86/egg/protocols/twisted_support.pysregisterImplementationŽs   csk|i‰|ii‡‡d†|ƒˆiidhƒ}x*|iƒD]}|i ||ˆ|ƒqGWdS(Ncs ˆ|ˆƒS(N(sadaptersosiface(so(sadaptersiface(s=build/bdist.darwin-8.0.1-x86/egg/protocols/twisted_support.pysªss_Protocol__listeners( sselfsifaces adaptWithsprotos__dict__sgets listenersskeysslistenersnewProtocolImpliedsadaptersdepth(sselfsprotosadaptersdepthsifaceslisteners listeners((sadaptersifaces=build/bdist.darwin-8.0.1-x86/egg/protocols/twisted_support.pysaddImpliedProtocol¥s   cCs•t|ƒ}|tjo|it|ƒf|_n]|t jo7|i|jo#|i |iƒt|ƒ|_q‘nt d|i||ƒ‚dS(Ns9Twisted interfaces can only declare support, not adapters( sTwistedGetInterfacessobs oldImplementssadaptersNO_ADAPTER_NEEDEDsselfsifacestuples__implements__sDOES_NOT_SUPPORTsremoves TypeError(sselfsobsadaptersdepths oldImplements((s=build/bdist.darwin-8.0.1-x86/egg/protocols/twisted_support.pysregisterObjectµs   cCs)|iiidtƒƒ}t||1: decorators = list(decorators) decorators.reverse() def callback(frame,k,v,old_locals): for d in decorators: v = d(v) return v from protocols.advice import add_assignment_advisor return add_assignment_advisor(callback) class SuperTest(TestCase): def checkMetaSuper(self): class Meta(type): def foo(self,arg): return arg foo = metamethod(foo) class Class(object): __metaclass__ = Meta def foo(self,arg): return arg*2 # Verify that ob.foo() and ob.__class__.foo() are different assert Class.foo(1)==1 assert Class().foo(1)==2 # Verify that supermeta() works for such methods class SubMeta(Meta): def foo(self,arg): return -supermeta(SubMeta,self).foo(arg) foo = metamethod(foo) class ClassOfSubMeta(Class): __metaclass__ = SubMeta assert ClassOfSubMeta.foo(1)==-1 assert ClassOfSubMeta().foo(1)==2 def checkPropSuper(self): class Base(object): __slots__ = 'foo' class Sub(Base): def getFoo(self): return supermeta(Sub,self).foo * 2 def setFoo(self,val): Base.foo.__set__(self,val) foo = property(getFoo, setFoo) ob = Sub() ob.foo = 1 assert ob.foo == 2 def checkSuperNotFound(self): class Base(object): pass b = Base() try: supermeta(Base,b).foo except AttributeError: pass else: raise AssertionError("Shouldn't have returned a value") class DecoratorTests(TestCase): def checkAssignAdvice(self): log = [] def track(f,k,v,d): log.append((f,k,v)) if k in f.f_locals: del f.f_locals[k] # simulate old-style advisor add_assignment_advisor(track,frame=sys._getframe()) test_var = 1 self.assertEqual(log, [(sys._getframe(),'test_var',1)]) log = [] add_assignment_advisor(track,1) test2 = 42 self.assertEqual(log, [(sys._getframe(),'test2',42)]) # Try doing double duty, redefining an existing variable... log = [] add_assignment_advisor(track,1) add_assignment_advisor(track,1) test2 = 42 self.assertEqual(log, [(sys._getframe(),'test2',42)]*2) def checkAs(self): def f(): pass [as_(lambda x: [x])] f1 = f self.assertEqual(f1, [f]) [as_(list, lambda x: (x,))] f1 = f self.assertEqual(f1, [f]) def check24DecoratorMode(self): log = [] def track(f,k,v,d): log.append((f,k,v)) return v def foo(x): pass add_assignment_advisor(track,1)(foo) x = 1 self.assertEqual(log, [(sys._getframe(),'foo',foo)]) moduleLevelFrameInfo = getFrameInfo(sys._getframe()) class FrameInfoTest(TestCase): classLevelFrameInfo = getFrameInfo(sys._getframe()) def checkModuleInfo(self): kind,module,f_locals,f_globals = moduleLevelFrameInfo assert kind=="module" for d in module.__dict__, f_locals, f_globals: assert d is globals() def checkClassInfo(self): kind,module,f_locals,f_globals = self.classLevelFrameInfo assert kind=="class" assert f_locals['classLevelFrameInfo'] is self.classLevelFrameInfo for d in module.__dict__, f_globals: assert d is globals() def checkCallInfo(self): kind,module,f_locals,f_globals = getFrameInfo(sys._getframe()) assert kind=="function call" assert f_locals is locals() # ??? for d in module.__dict__, f_globals: assert d is globals() def checkClassExec(self): d = {'sys':sys, 'getFrameInfo':getFrameInfo} exec "class Foo: info=getFrameInfo(sys._getframe())" in d kind,module,f_locals,f_globals = d['Foo'].info assert kind=="class", kind class MROTests(TestCase): def checkStdMRO(self): class foo(object): pass class bar(foo): pass class baz(foo): pass class spam(bar,baz): pass assert getMRO(spam) is spam.__mro__ def checkClassicMRO(self): class foo: pass class bar(foo): pass class baz(foo): pass class spam(bar,baz): pass basicMRO = [spam,bar,foo,baz,foo] assert list(getMRO(spam)) == basicMRO assert list(getMRO(spam,True)) == basicMRO+[InstanceType,object] class AdviceTests(TestCase): def checkOrder(self): log = [] class Foo: ping(log, 1) ping(log, 2) ping(log, 3) # Strip the list nesting for i in 1,2,3: assert isinstance(Foo,list) Foo, = Foo assert log == [ (1, Foo), (2, [Foo]), (3, [[Foo]]), ] def checkOutside(self): try: ping([], 1) except SyntaxError: pass else: raise AssertionError( "Should have detected advice outside class body" ) def checkDoubleType(self): if sys.hexversion >= 0x02030000: return # you can't duplicate bases in 2.3 class aType(type,type): ping([],1) aType, = aType assert aType.__class__ is type def checkSingleExplicitMeta(self): class M(type): pass class C(M): __metaclass__ = M ping([],1) C, = C assert C.__class__ is M def checkMixedMetas(self): class M1(type): pass class M2(type): pass class B1: __metaclass__ = M1 class B2: __metaclass__ = M2 try: class C(B1,B2): ping([],1) except TypeError: pass else: raise AssertionError("Should have gotten incompatibility error") class M3(M1,M2): pass class C(B1,B2): __metaclass__ = M3 ping([],1) assert isinstance(C,list) C, = C assert isinstance(C,M3) def checkMetaOfClass(self): class metameta(type): pass class meta(type): __metaclass__ = metameta assert determineMetaclass((meta,type))==metameta TestClasses = ( SuperTest, DecoratorTests, AdviceTests, FrameInfoTest, MROTests, ) def test_suite(): return TestSuite([makeSuite(t,'check') for t in TestClasses]) PKIŸC8m¥hÊ#Ê#protocols/tests/test_direct.pyc;ò µÆBc@sÒdZdklZlZlZdkTdklZlZl Z dkl Z l Z dkl Z de fd„ƒYZdefd „ƒYZd e fd „ƒYZd eefd „ƒYZde efd„ƒYZdfd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZdeefd„ƒYZdeefd„ƒYZdfd„ƒYZdefd„ƒYZeefZee eƒ7Zee eƒ7Zee eeeƒ7Zd „Zd!S("scTests for default IOpenProvider (etc.) adapters TODO: - Test Zope interface registrations (sTestCases makeSuites TestSuite(s*(sProviderCheckssAdaptiveCheckssClassProvidesChecks(smakeClassProvidesTestssmakeInstanceTests(smakeMetaClassProvidesTestssIAcBstZRS(N(s__name__s __module__(((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_direct.pysIAssIBcBstZRS(N(s__name__s __module__(((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_direct.pysIBssIPurecBstZRS(N(s__name__s __module__(((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_direct.pysIPuress BasicCheckscBs/tZdZeZeZeZeZd„ZRS(s!Checks to be done on every objectcCs^tƒ}tƒ}ttd|gd|gƒttd|gd|gƒ|i|gƒdS(Nsprovidess forProtocols(sProtocolsP1sP2sdeclareAdaptersNO_ADAPTER_NEEDEDsselfsdeclareObImplements(sselfsP2sP1((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_direct.pyscheckCircularRegister s   (s__name__s __module__s__doc__sIAsIBs InterfacesIPurescheckCircularRegister(((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_direct.pys BasicCheckss s ClassCheckscBstZdZRS(s&Checks to be done on classes and types(s__name__s __module__s__doc__(((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_direct.pys ClassChecks's sInstanceConformCheckscBs tZdZd„Zd„ZRS(s$Things to check on adapted instancescCs5d„}||i_|i|i|ig|ƒdS(NcCsdS(N((sproto((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_direct.pys __conform__.s(s __conform__sselfsobsassertBadConformsIA(sselfs __conform__((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_direct.pyscheckBadConform-s  cCsbyt|d|ƒWn;tj o/}|id||fjp t|i‚nXtdƒ‚dS(Nsprovidess*Incompatible __conform__ on adapted objects&Should've detected invalid __conform__(s adviseObjectsobs protocolss TypeErrorsvsargssconformsAssertionError(sselfsobs protocolssconformsv((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_direct.pysassertBadConform4s +(s__name__s __module__s__doc__scheckBadConformsassertBadConform(((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_direct.pysInstanceConformChecks*s  sClassConformCheckscBs tZdZd„Zd„ZRS(s"Things to check on adapted classescCsRd|ifd„ƒY}d|fd„ƒY}|i||ig|iiƒdS(NsBasecBstZd„ZRS(NcCsdS(N((sselfsprotocol((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_direct.pys __conform__Ds(s__name__s __module__s __conform__(((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_direct.pysBaseCssSubcBstZRS(N(s__name__s __module__(((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_direct.pysSubFs(sselfsobsBasesSubsassertBadConformsIAs __conform__sim_func(sselfsBasesSub((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_direct.pyscheckInheritedConformBscCsBd|ifd„ƒY}|ƒ}|i||ig|iƒdS(NsBasecBstZd„ZRS(NcCsdS(N((sselfsprotocol((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_direct.pys __conform__Ms(s__name__s __module__s __conform__(((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_direct.pysBaseLs(sselfsobsBasesbsassertBadConformsIAs __conform__(sselfsBasesb((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_direct.pyscheckInstanceConformJs (s__name__s __module__s__doc__scheckInheritedConformscheckInstanceConform(((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_direct.pysClassConformChecks?s  sAdviseMixinInstancecBstZd„ZRS(NcCstƒ|_dS(N(s ProviderMixinsselfsob(sself((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_direct.pyssetUpUs(s__name__s __module__ssetUp(((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_direct.pysAdviseMixinInstanceSssAdviseMixinMultiMeta1cBstZd„ZRS(NcsEdttfd„ƒY‰dttf‡d†ƒY}|ƒ|_dS(NsMetacBstZRS(N(s__name__s __module__(((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_direct.pysMetaassTestcstZˆZRS(N(s__name__s __module__sMetas __metaclass__((sMeta(s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_direct.pysTestbs(s ProviderMixinstypesMetasobjectsTestsselfsob(sselfsMetasTest((sMetas?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_direct.pyssetUp`s(s__name__s __module__ssetUp(((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_direct.pysAdviseMixinMultiMeta1^ssInstanceTestsBasecBstZRS(N(s__name__s __module__(((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_direct.pysInstanceTestsBasefssClassTestsBasecBstZRS(N(s__name__s __module__(((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_direct.pysClassTestsBaseiss PicklablecBstZRS(N(s__name__s __module__(((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_direct.pys PicklablelssNewStylecBstZRS(N(s__name__s __module__(((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_direct.pysNewStylepscCs8tgi}tD]}|t|dƒƒq~ƒSdS(Nscheck(s TestSuitesappends_[1]s TestClassessts makeSuite(s_[1]st((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_direct.pys test_suite|sN(s__doc__sunittestsTestCases makeSuites TestSuites protocolsscheckssProviderCheckssAdaptiveCheckssClassProvidesCheckssmakeClassProvidesTestssmakeInstanceTestssmakeMetaClassProvidesTestss InterfacesIAsIBsIPures BasicCheckss ClassCheckssInstanceConformCheckssClassConformCheckssAdviseMixinInstancesAdviseMixinMultiMeta1sInstanceTestsBasesClassTestsBases PicklablesobjectsNewStyles TestClassess test_suite(s TestClassessAdviseMixinInstancesmakeInstanceTestssClassConformCheckssInstanceConformCheckss TestSuitesClassTestsBasesTestCasesmakeClassProvidesTestssInstanceTestsBasesAdaptiveCheckss BasicCheckss makeSuitesIPuresAdviseMixinMultiMeta1sClassProvidesCheckssIAsIBsmakeMetaClassProvidesTestss PicklablesProviderCheckss test_suites ClassCheckssNewStyle((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_direct.pys?s.   PKKŸC8©/XØyJyJprotocols/tests/test_advice.pyo;ò þÕBc@sðdZdklZlZlZdkTdkZdklZd„Z d„Z defd„ƒYZ d efd „ƒYZ e eiƒƒZd efd „ƒYZd efd„ƒYZdefd„ƒYZe e eeefZd„ZdS(sTests for advice(sTestCases makeSuites TestSuite(s*N(s InstanceTypecs‡‡d†}t|ƒdS(Ncsˆiˆ|fƒ|gSdS(N(slogsappendsvaluesklass(sklass(svalueslog(s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pyspong s(spongsaddClassAdvisor(slogsvaluespong((slogsvalues?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pyspingscsTtˆƒdjotˆƒ‰ˆiƒn‡d†}dkl}||ƒSdS(sçUse Python 2.4 decorators w/Python 2.2+ Example:: import dispatch class Foo(object): [dispatch.as(classmethod)] def something(cls,etc): """This is a classmethod""" ics%xˆD]}||ƒ}qW|SdS(N(s decoratorssdsv(sframesksvs old_localssd(s decorators(s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pyscallback!s(sadd_assignment_advisorN(slens decoratorsslistsreversescallbacksprotocols.advicesadd_assignment_advisor(s decoratorssadd_assignment_advisorscallback((s decoratorss?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pysas_s    s SuperTestcBs#tZd„Zd„Zd„ZRS(Ncsedtfd„ƒY‰dtf‡d†ƒY}dˆf‡d†ƒY‰d|f‡d†ƒY}dS( NsMetacBstZd„ZeeƒZRS(NcCs|SdS(N(sarg(sselfsarg((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pysfoo/s(s__name__s __module__sfoos metamethod(((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pysMeta.s sClasscstZˆZd„ZRS(NcCs |dSdS(Ni(sarg(sselfsarg((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pysfoo6s(s__name__s __module__sMetas __metaclass__sfoo((sMeta(s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pysClass3ssSubMetacs tZ‡d†ZeeƒZRS(Ncstˆ|ƒi|ƒ SdS(N(s supermetasSubMetasselfsfoosarg(sselfsarg(sSubMeta(s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pysfooAs(s__name__s __module__sfoos metamethod((sSubMeta(s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pysSubMeta@s sClassOfSubMetacstZˆZRS(N(s__name__s __module__sSubMetas __metaclass__((sSubMeta(s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pysClassOfSubMetaEs(stypesMetasobjectsClasssSubMetasClassOfSubMeta(sselfsClassOfSubMetasSubMetasMetasClass((sSubMetasMetas?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pyscheckMetaSuper,scsHdtfd„ƒY‰dˆf‡‡d†ƒY‰ˆƒ}d|_dS(NsBasecBstZdZRS(Nsfoo(s__name__s __module__s __slots__(((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pysBaseUssSubcs/tZ‡d†Z‡d†ZeeeƒZRS(Ncstˆ|ƒidSdS(Ni(s supermetasSubsselfsfoo(sself(sSub(s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pysgetFooZscsˆii||ƒdS(N(sBasesfoos__set__sselfsval(sselfsval(sBase(s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pyssetFoo]s(s__name__s __module__sgetFoossetFoospropertysfoo((sSubsBase(s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pysSubXs  i(sobjectsBasesSubsobsfoo(sselfsBasesSubsob((sBasesSubs?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pyscheckPropSuperSs   cCsYdtfd„ƒY}|ƒ}yt||ƒiWntj onXtdƒ‚dS(NsBasecBstZRS(N(s__name__s __module__(((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pysBasehssShouldn't have returned a value(sobjectsBasesbs supermetasfoosAttributeErrorsAssertionError(sselfsbsBase((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pyscheckSuperNotFoundgs (s__name__s __module__scheckMetaSuperscheckPropSuperscheckSuperNotFound(((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pys SuperTest*s ' sDecoratorTestscBs#tZd„Zd„Zd„ZRS(NcsÛg‰‡d†}t|dtiƒƒd}|iˆtiƒddfgƒg‰t|dƒd}|iˆtiƒddfgƒg‰t|dƒt|dƒd}|iˆtiƒddfgdƒdS(Ncs8ˆi|||fƒ||ijo|i|=ndS(N(slogsappendsfsksvsf_locals(sfsksvsd(slog(s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pystrackssframeistest_vari*stest2i( slogstracksadd_assignment_advisorssyss _getframestest_varsselfs assertEqualstest2(sselfstest2slogstrackstest_var((slogs?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pyscheckAssignAdvice~s " "  cCsbd„}td„ƒg|}|i||gƒttd„ƒg|}|i||gƒdS(NcCsdS(N((((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pysf™scCs|gS(N(sx(sx((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pys›scCs|fS(N(sx(sx((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pys s(sfsas_sf1sselfs assertEqualslist(sselfsf1sf((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pyscheckAs—s csZg‰‡d†}d„}t|dƒ|ƒd}|iˆtiƒd|fgƒdS(Ncsˆi|||fƒ|SdS(N(slogsappendsfsksv(sfsksvsd(slog(s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pystrack¨scCsdS(N((sx((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pysfoo¬sisfoo( slogstracksfoosadd_assignment_advisorsxsselfs assertEqualssyss _getframe(sselfslogstracksxsfoo((slogs?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pyscheck24DecoratorMode¥s   (s__name__s __module__scheckAssignAdvicescheckAsscheck24DecoratorMode(((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pysDecoratorTests|s  s FrameInfoTestcBs>tZeeiƒƒZd„Zd„Zd„Zd„Z RS(NcCs3t\}}}}x|i||fD]}q%WdS(N(smoduleLevelFrameInfoskindsmodulesf_localss f_globalss__dict__sd(sselfskindsds f_globalssmodulesf_locals((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pyscheckModuleInfoÔs cCs3|i\}}}}x|i|fD]}q%WdS(N(sselfsclassLevelFrameInfoskindsmodulesf_localss f_globalss__dict__sd(sselfskindsds f_globalssmodulesf_locals((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pyscheckClassInfoÚs cCs<ttiƒƒ\}}}}x|i|fD]}q.WdS(N( s getFrameInfossyss _getframeskindsmodulesf_localss f_globalss__dict__sd(sselfskindsds f_globalssmodulesf_locals((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pys checkCallInfoâs cBs=hde<de<}d|U|di\}}}}dS(Nssyss getFrameInfos-class Foo: info=getFrameInfo(sys._getframe())sFoo(ssyss getFrameInfosdsinfoskindsmodulesf_localss f_globals(sselfskindsds f_globalssmodulesf_locals((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pyscheckClassExecês( s__name__s __module__s getFrameInfossyss _getframesclassLevelFrameInfoscheckModuleInfoscheckClassInfos checkCallInfoscheckClassExec(((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pys FrameInfoTestÐs    sMROTestscBstZd„Zd„ZRS(NcCs_dtfd„ƒY}d|fd„ƒY}d|fd„ƒY}d||fd„ƒY}dS( NsfoocBstZRS(N(s__name__s __module__(((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pysfooússbarcBstZRS(N(s__name__s __module__(((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pysbarûssbazcBstZRS(N(s__name__s __module__(((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pysbazüssspamcBstZRS(N(s__name__s __module__(((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pysspamýs(sobjectsfoosbarsbazsspam(sselfsbarsspamsbazsfoo((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pys checkStdMROùs cCsqdfd„ƒY}d|fd„ƒY}d|fd„ƒY}d||fd„ƒY}|||||g}dS( NsfoocBstZRS(N(s__name__s __module__(((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pysfoossbarcBstZRS(N(s__name__s __module__(((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pysbarssbazcBstZRS(N(s__name__s __module__(((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pysbazssspamcBstZRS(N(s__name__s __module__(((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pysspams(sfoosbarsbazsspamsbasicMRO(sselfsbarsspamsbazsbasicMROsfoo((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pyscheckClassicMROs(s__name__s __module__s checkStdMROscheckClassicMRO(((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pysMROTests÷s s AdviceTestscBs>tZd„Zd„Zd„Zd„Zd„Zd„ZRS(NcsCg‰df‡d†ƒY}x dddfD]}|\}q,WdS(NsFoocs/tZeˆdƒeˆdƒeˆdƒRS(Niii(s__name__s __module__spingslog((slog(s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pysFoo$s  iii(slogsFoosi(sselfsisFooslog((slogs?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pys checkOrder"s cCs7ytgdƒWntj onXtdƒ‚dS(Nis.Should have detected advice outside class body(spings SyntaxErrorsAssertionError(sself((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pys checkOutside4s cCs>tidjodSndttfd„ƒY}|\}dS(NisaTypecBstZegdƒRS(Ni(s__name__s __module__sping(((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pysaTypeAs(ssyss hexversionstypesaType(sselfsaType((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pyscheckDoubleType>s  cs<dtfd„ƒY‰dˆf‡d†ƒY}|\}dS(NsMcBstZRS(N(s__name__s __module__(((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pysMKssCcstZˆZegdƒRS(Ni(s__name__s __module__sMs __metaclass__sping((sM(s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pysCMs(stypesMsC(sselfsMsC((sMs?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pyscheckSingleExplicitMetaIs csÙdtfd„ƒY‰dtfd„ƒY‰df‡d†ƒY}df‡d†ƒY}yd ||fd „ƒY}Wntj onXtd ƒ‚d ˆˆfd „ƒY‰d ||f‡d†ƒY}|\}dS(NsM1cBstZRS(N(s__name__s __module__(((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pysM1WssM2cBstZRS(N(s__name__s __module__(((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pysM2XssB1cstZˆZRS(N(s__name__s __module__sM1s __metaclass__((sM1(s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pysB1ZssB2cstZˆZRS(N(s__name__s __module__sM2s __metaclass__((sM2(s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pysB2[ssCcBstZegdƒRS(Ni(s__name__s __module__sping(((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pysC^ss(Should have gotten incompatibility errorsM3cBstZRS(N(s__name__s __module__(((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pysM3escstZˆZegdƒRS(Ni(s__name__s __module__sM3s __metaclass__sping((sM3(s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pysCgs( stypesM1sM2sB1sB2sCs TypeErrorsAssertionErrorsM3(sselfsCsM3sM1sB1sB2sM2((sM3sM1sM2s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pyscheckMixedMetasUs  cs3dtfd„ƒY‰dtf‡d†ƒY}dS(NsmetametacBstZRS(N(s__name__s __module__(((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pysmetametatssmetacstZˆZRS(N(s__name__s __module__smetametas __metaclass__((smetameta(s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pysmetaws(stypesmetametasmeta(sselfsmetametasmeta((smetametas?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pyscheckMetaOfClassrs(s__name__s __module__s checkOrders checkOutsidescheckDoubleTypescheckSingleExplicitMetascheckMixedMetasscheckMetaOfClass(((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pys AdviceTests s   cCs8tgi}tD]}|t|dƒƒq~ƒSdS(Nscheck(s TestSuitesappends_[1]s TestClassessts makeSuite(s_[1]st((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pys test_suite„s(s__doc__sunittestsTestCases makeSuites TestSuitesprotocols.advicessysstypess InstanceTypespingsas_s SuperTestsDecoratorTestss getFrameInfos _getframesmoduleLevelFrameInfos FrameInfoTestsMROTestss AdviceTestss TestClassess test_suite(s TestSuites TestClassessDecoratorTestssas_s makeSuitespingsmoduleLevelFrameInfosTestCases AdviceTestss FrameInfoTests test_suitessyss SuperTests InstanceTypesMROTests((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pys?s    RR')`PKIí2Àµ‹6VVprotocols/tests/__init__.pyfrom unittest import TestSuite, TestCase, makeSuite from protocols import adapt, advise, Interface, Attribute, declareAdapter from protocols import AbstractBase, AdaptationFailure class APITests(TestCase): def checkAdaptTrapsTypeErrorsOnConform(self): class Conformer: def __conform__(self,ob): return [] assert adapt(Conformer,list,None) is None assert adapt(Conformer(),list,None) == [] def checkAdaptHandlesIsInstance(self): assert adapt([1,2,3],list,None) == [1,2,3] assert adapt('foo',str,None) == 'foo' assert adapt('foo',list,None) is None def checkAdviseFailsInCallContext(self): try: advise() except SyntaxError: pass else: raise AssertionError( "Should've got SyntaxError for advise() in function" ) def checkAdviseClassKeywordsValidated(self): try: class X: advise(moduleProvides=list) except TypeError,v: assert v.args==( "Invalid keyword argument for advising classes: moduleProvides", ) else: raise AssertionError("Should've caught invalid keyword") def checkAdviseClassKeywordsValidated(self): try: class X: advise(moduleProvides=list) except TypeError,v: assert v.args==( "Invalid keyword argument for advising classes: moduleProvides", ) else: raise AssertionError("Should've caught invalid keyword") def checkAdviseModuleKeywordsValidated(self): try: exec "advise(instancesProvide=[IProtocol1])" in globals(),globals() except TypeError,v: assert v.args==( "Invalid keyword argument for advising modules: instancesProvide", ) else: raise AssertionError("Should've caught invalid keyword") def checkAdviseInClassExec(self): d = {'advise':advise,'IProtocol1':IProtocol1} exec "class Foo: advise(instancesProvide=[IProtocol1])" in d def checkSimpleAdaptation(self): class Conformer: def __conform__(self,protocol): if protocol==42: return "hitchhiker",self class AdaptingProtocol: def __adapt__(klass,ob): return "adapted", ob __adapt__ = classmethod(__adapt__) c = Conformer() assert adapt(c,42,None) == ("hitchhiker",c) assert adapt(c,AdaptingProtocol,None) == ("adapted",c) assert adapt(42,AdaptingProtocol,None) == ("adapted",42) assert adapt(42,42,None) is None def checkAdaptFiltersTypeErrors(self): class Nonconformist: def __conform__(self,ob): raise TypeError("You got me!") class Unadaptive: def __adapt__(self,ob): raise TypeError("You got me!") # These will get a type errors calling __conform__/__adapt__ # but should be ignored since the error is at calling level assert adapt(None, Unadaptive, None) is None assert adapt(Nonconformist, None, None) is None # These will get type errors internally, and the error should # bleed through to the caller self.assertTypeErrorPassed(None, Unadaptive(), None) self.assertTypeErrorPassed(Nonconformist(), None, None) self.assertRaises(AdaptationFailure, adapt, None, None) def assertTypeErrorPassed(self, *args): try: # This should raise TypeError internally, and be caught adapt(*args) except TypeError,v: assert v.args==("You got me!",) else: raise AssertionError("Should've passed TypeError through") def checkImplicationBug(self): class I1(Interface): pass class I2(I1): pass declareAdapter(lambda o: o, provides=[I1],forProtocols=[I2]) def checkAttribute(self): for i in range(10)+[None]: class Abstract(AbstractBase): value = Attribute("testing", "value", i) ob = Abstract() assert ob.value == i for j in range(10): ob.value = j assert ob.value==j def checkStickyAdapter(self): class T: pass t = T() class I(Interface): pass from protocols.adapters import StickyAdapter class A(StickyAdapter): attachForProtocols = I, advise(instancesProvide=[I], asAdapterForTypes=[T]) a = I(t) assert adapt(t, I) is a assert a.subject is t n = T() a2 = I(n) assert a2 is not a assert a2.subject is n assert adapt(n, I) is a2 from protocols import protocolForType, protocolForURI, sequenceOf, advise from protocols import declareImplementation, Variation from UserDict import UserDict IGetSetMapping = protocolForType(dict,['__getitem__','__setitem__']) IGetMapping = protocolForType(dict,['__getitem__']) ISimpleReadFile = protocolForType(file,['read']) IImplicitRead = protocolForType(file,['read'], implicit=True) IProtocol1 = protocolForURI("http://peak.telecommunity.com/PyProtocols") multimap = sequenceOf(IGetMapping) declareImplementation(UserDict,[IGetSetMapping]) IMyUnusualMapping = Variation(IGetSetMapping) class MyUserMapping(object): pass declareImplementation(MyUserMapping,[IMyUnusualMapping]) class GenerationTests(TestCase): def checkTypeSubset(self): d = {} assert IGetSetMapping(d,None) is d assert IGetMapping(d,None) is d def checkImplications(self): d = UserDict() assert IGetMapping(d,None) is d assert IImplicitRead(d,None) is None def checkWeak(self): from cStringIO import StringIO s = StringIO("foo") assert ISimpleReadFile(s,None) is None assert IImplicitRead(s,None) is s def checkURI(self): p = protocolForURI("http://www.python.org/") assert p is not IProtocol1 p = protocolForURI("http://peak.telecommunity.com/PyProtocols") assert p is IProtocol1 def checkSequence(self): d1,d2 = {},{} seq = multimap([d1,d2]) assert seq == [d1,d2] assert seq[0] is d1 and seq[1] is d2 class ISequenceLike(Interface): advise(protocolIsSubsetOf=[multimap]) ISequenceLike([d1,d2]) def checkVariation(self): d = {} assert IMyUnusualMapping(d,None) is d # GetSet implies variation d = MyUserMapping(); assert IMyUnusualMapping(d,None) is d assert IGetSetMapping(d,None) is None # but not the other way self.assertEqual(repr(IMyUnusualMapping), "Variation(TypeSubset(,('__getitem__', '__setitem__')))") self.assertEqual(repr(Variation(Interface,42)), "Variation(,42)") def test_suite(): from protocols.tests import test_advice, test_direct, test_classes tests = [ test_advice.test_suite(), test_classes.test_suite(), test_direct.test_suite(), makeSuite(APITests,'check'), makeSuite(GenerationTests,'check'), ] try: import zope.interface except ImportError: pass else: from protocols.tests import test_zope tests.append( test_zope.test_suite() ) try: import twisted.python.components except ImportError: pass else: from protocols.tests import test_twisted tests.append( test_twisted.test_suite() ) return TestSuite( tests ) PKJŸC8‡ ô†‡ ‡ protocols/tests/test_classes.pyc;ò µÆBc@s³dZdklZlZlZdkTdklZlZl Z de fd„ƒYZ de fd„ƒYZ de fd „ƒYZ d eefd „ƒYZe eƒZd „Zd S(s;Tests for implementor declarations (i.e. instancesProvides)(sTestCases makeSuites TestSuite(s*(sImplementationCheckssAdaptiveCheckssmakeClassTestssIAcBstZRS(N(s__name__s __module__(((s@build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_classes.pysIAssIBcBstZRS(N(s__name__s __module__(((s@build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_classes.pysIBssIPurecBstZRS(N(s__name__s __module__(((s@build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_classes.pysIPure ss BasicCheckscBs/tZdZeZeZeZeZd„ZRS(s/PyProtocols-only class-instances-provide checkscCsŒ|i|iƒ\}}|i|ƒ}|i|ƒ}t|d|i gƒt|d|i gƒ|i ||ƒ|i ||||ƒdS(NsinstancesProvide( sselfs setupBasessklasssM1sM2smakesm1sm2sdeclareImplementationsIAsIBs#assertM1ProvidesOnlyAandM2ProvidesBs#assertChangingBasesChangesInterface(sselfsM2sm1sm2sM1((s@build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_classes.pyscheckChangingBasess(s__name__s __module__s__doc__sIAsIBs InterfacesIPurescheckChangingBases(((s@build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_classes.pys BasicCheckss cCs8tgi}tD]}|t|dƒƒq~ƒSdS(Nscheck(s TestSuitesappends_[1]s TestClassessts makeSuite(s_[1]st((s@build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_classes.pys test_suite'sN(s__doc__sunittestsTestCases makeSuites TestSuites protocolsscheckssImplementationCheckssAdaptiveCheckssmakeClassTestss InterfacesIAsIBsIPures BasicCheckss TestClassess test_suite( s TestSuitesIBsImplementationCheckssmakeClassTestssIPures makeSuitesTestCases TestClassess test_suitesIAsAdaptiveCheckss BasicChecks((s@build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_classes.pys?s PKKŸC8|’Áa¼¼protocols/tests/test_zope.pyo;ò µÆBc@s dZdklZlZlZdkTdkZdklZdefd„ƒYZ de fd„ƒYZ d efd „ƒYZ d fd „ƒYZ d e fd„ƒYZdklZlZlZdklZlZdklZlZdeefd„ƒYZdeefd„ƒYZdeefd„ƒYZeeƒZeeeƒ7Zeeee eƒ7Zdeifd„ƒYZ deefd„ƒYZdeefd„ƒYZdeeefd„ƒYZeeeƒ7Zeeeƒ7Zeeee eƒ7Zd„ZdS(sZope Interface tests(sTestCases makeSuites TestSuite(s*N(s InterfacesIAcBstZRS(N(s__name__s __module__(((s=build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_zope.pysIA ssIBcBstZRS(N(s__name__s __module__(((s=build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_zope.pysIB ssIPurecBstZRS(N(s__name__s __module__(((s=build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_zope.pysIPure ss PicklablecBstZRS(N(s__name__s __module__(((s=build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_zope.pys PicklablessNewStylecBstZRS(N(s__name__s __module__(((s=build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_zope.pysNewStyles(sImplementationCheckssmakeClassTestssmakeInstanceTests(sProviderCheckssBasicClassProvidesChecks(smakeMetaClassProvidesTestssAdaptiveCheckss BasicCheckscBs tZeZeZeZeZRS(N(s__name__s __module__sIAsIBs InterfacesIPure(((s=build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_zope.pys BasicChecksssInstanceCheckscBs tZeZeZeZeZRS(N(s__name__s __module__sIAsIBs InterfacesIPure(((s=build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_zope.pysInstanceChecks$ss ClassCheckscBs tZeZeZeZeZRS(N(s__name__s __module__sIAsIBs InterfacesIPure(((s=build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_zope.pys ClassChecks*scBstZedegƒRS(NsprotocolExtends(s__name__s __module__sadvisesIA(((s=build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_zope.pysIB4scCs8tgi}tD]}|t|dƒƒq~ƒSdS(Nscheck(s TestSuitesappends_[1]s TestClassessts makeSuite(s_[1]st((s=build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_zope.pys test_suiteMs(s__doc__sunittestsTestCases makeSuites TestSuites protocolssprotocols.zope_supportszope.interfaces InterfacesIAsIBsIPures PicklablesobjectsNewStylescheckssImplementationCheckssmakeClassTestssmakeInstanceTestssProviderCheckssBasicClassProvidesCheckssmakeMetaClassProvidesTestssAdaptiveCheckss BasicCheckssInstanceCheckss ClassCheckss TestClassess test_suite(s TestClassessmakeInstanceTestss TestSuitesTestCases protocolss InterfacesAdaptiveCheckss BasicCheckssInstanceCheckss makeSuitesmakeClassTestssIPuresIAsIBsmakeMetaClassProvidesTestss PicklablesBasicClassProvidesCheckssImplementationCheckssProviderCheckss test_suites ClassCheckssNewStyle((s=build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_zope.pys?s4   PKKŸC8¥°_66protocols/tests/__init__.pyo;ò jÕBc@stdklZlZlZdklZlZlZlZl Z dkl Z l Z defd„ƒYZ dkl Z lZlZlZdklZlZdklZe edd gƒZe edgƒZe ed gƒZe ed gd eƒZed ƒZeeƒZeeegƒeeƒZd efd„ƒYZeeegƒdefd„ƒYZd„Z dS((s TestSuitesTestCases makeSuite(sadaptsadvises Interfaces AttributesdeclareAdapter(s AbstractBasesAdaptationFailuresAPITestscBs}tZd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Z d „Z d „Z d „Z d „Z RS( NcCsdfd„ƒY}dS(Ns ConformercBstZd„ZRS(NcCsgSdS(N((sselfsob((s<build/bdist.darwin-8.0.1-x86/egg/protocols/tests/__init__.pys __conform__ s(s__name__s __module__s __conform__(((s<build/bdist.darwin-8.0.1-x86/egg/protocols/tests/__init__.pys Conformers(s Conformer(sselfs Conformer((s<build/bdist.darwin-8.0.1-x86/egg/protocols/tests/__init__.pys"checkAdaptTrapsTypeErrorsOnConformscCsdS(N((sself((s<build/bdist.darwin-8.0.1-x86/egg/protocols/tests/__init__.pyscheckAdaptHandlesIsInstancescCs1y tƒWntj onXtdƒ‚dS(Ns2Should've got SyntaxError for advise() in function(sadvises SyntaxErrorsAssertionError(sself((s<build/bdist.darwin-8.0.1-x86/egg/protocols/tests/__init__.pyscheckAdviseFailsInCallContexts  cCs?ydfd„ƒY}Wntj o }nXtdƒ‚dS(NsXcBstZedeƒRS(NsmoduleProvides(s__name__s __module__sadviseslist(((s<build/bdist.darwin-8.0.1-x86/egg/protocols/tests/__init__.pysX!ss Should've caught invalid keyword(sXs TypeErrorsvsAssertionError(sselfsXsv((s<build/bdist.darwin-8.0.1-x86/egg/protocols/tests/__init__.pys!checkAdviseClassKeywordsValidateds cBs<ydeƒeƒUWnej o }nXedƒ‚dS(Ns%advise(instancesProvide=[IProtocol1])s Should've caught invalid keyword(sglobalss TypeErrorsvsAssertionError(sselfsv((s<build/bdist.darwin-8.0.1-x86/egg/protocols/tests/__init__.pys"checkAdviseModuleKeywordsValidated5s cBs$hde<de<}d|UdS(Nsadvises IProtocol1s0class Foo: advise(instancesProvide=[IProtocol1])(sadvises IProtocol1sd(sselfsd((s<build/bdist.darwin-8.0.1-x86/egg/protocols/tests/__init__.pyscheckAdviseInClassExec?scCs3dfd„ƒY}dfd„ƒY}|ƒ}dS(Ns ConformercBstZd„ZRS(NcCs|djod|fSndS(Ni*s hitchhiker(sprotocolsself(sselfsprotocol((s<build/bdist.darwin-8.0.1-x86/egg/protocols/tests/__init__.pys __conform__Es (s__name__s __module__s __conform__(((s<build/bdist.darwin-8.0.1-x86/egg/protocols/tests/__init__.pys ConformerDssAdaptingProtocolcBstZd„ZeeƒZRS(NcCsd|fSdS(Nsadapted(sob(sklasssob((s<build/bdist.darwin-8.0.1-x86/egg/protocols/tests/__init__.pys __adapt__Is(s__name__s __module__s __adapt__s classmethod(((s<build/bdist.darwin-8.0.1-x86/egg/protocols/tests/__init__.pysAdaptingProtocolHs (s ConformersAdaptingProtocolsc(sselfsAdaptingProtocolscs Conformer((s<build/bdist.darwin-8.0.1-x86/egg/protocols/tests/__init__.pyscheckSimpleAdaptationCs cCsldfd„ƒY}dfd„ƒY}|it|ƒtƒ|i|ƒttƒ|ittttƒdS(Ns NonconformistcBstZd„ZRS(NcCstdƒ‚dS(Ns You got me!(s TypeError(sselfsob((s<build/bdist.darwin-8.0.1-x86/egg/protocols/tests/__init__.pys __conform__Vs(s__name__s __module__s __conform__(((s<build/bdist.darwin-8.0.1-x86/egg/protocols/tests/__init__.pys NonconformistUss UnadaptivecBstZd„ZRS(NcCstdƒ‚dS(Ns You got me!(s TypeError(sselfsob((s<build/bdist.darwin-8.0.1-x86/egg/protocols/tests/__init__.pys __adapt__Zs(s__name__s __module__s __adapt__(((s<build/bdist.darwin-8.0.1-x86/egg/protocols/tests/__init__.pys UnadaptiveYs(s Nonconformists UnadaptivesselfsassertTypeErrorPassedsNones assertRaisessAdaptationFailuresadapt(sselfs Unadaptives Nonconformist((s<build/bdist.darwin-8.0.1-x86/egg/protocols/tests/__init__.pyscheckAdaptFiltersTypeErrorsSscGs6yt|ŒWntj o }nXtdƒ‚dS(Ns"Should've passed TypeError through(sadaptsargss TypeErrorsvsAssertionError(sselfsargssv((s<build/bdist.darwin-8.0.1-x86/egg/protocols/tests/__init__.pysassertTypeErrorPassedis cCsOdtfd„ƒY}d|fd„ƒY}td„d|gd|gƒdS(NsI1cBstZRS(N(s__name__s __module__(((s<build/bdist.darwin-8.0.1-x86/egg/protocols/tests/__init__.pysI1sssI2cBstZRS(N(s__name__s __module__(((s<build/bdist.darwin-8.0.1-x86/egg/protocols/tests/__init__.pysI2tscCs|S(N(so(so((s<build/bdist.darwin-8.0.1-x86/egg/protocols/tests/__init__.pysussprovidess forProtocols(s InterfacesI1sI2sdeclareAdapter(sselfsI1sI2((s<build/bdist.darwin-8.0.1-x86/egg/protocols/tests/__init__.pyscheckImplicationBugrscsdx]tdƒtgD]H‰dtf‡d†ƒY}|ƒ}xtdƒD]}||_qIWqWdS(Ni sAbstractcstZeddˆƒZRS(Nstestingsvalue(s__name__s __module__s Attributesisvalue((si(s<build/bdist.darwin-8.0.1-x86/egg/protocols/tests/__init__.pysAbstract€s(srangesNonesis AbstractBasesAbstractsobsjsvalue(sselfsisAbstractsjsob((sis<build/bdist.darwin-8.0.1-x86/egg/protocols/tests/__init__.pyscheckAttribute|s   c s€dfd„ƒY‰ˆƒ}dtfd„ƒY‰dkl}d|f‡‡d†ƒY}ˆ|ƒ}ˆƒ}ˆ|ƒ}dS(NsTcBstZRS(N(s__name__s __module__(((s<build/bdist.darwin-8.0.1-x86/egg/protocols/tests/__init__.pysTŒssIcBstZRS(N(s__name__s __module__(((s<build/bdist.darwin-8.0.1-x86/egg/protocols/tests/__init__.pysIŽs(s StickyAdaptersAcs*tZˆfZedˆgdˆgƒRS(NsinstancesProvidesasAdapterForTypes(s__name__s __module__sIsattachForProtocolssadvisesT((sIsT(s<build/bdist.darwin-8.0.1-x86/egg/protocols/tests/__init__.pysAs ( sTsts InterfacesIsprotocols.adapterss StickyAdaptersAsasnsa2( sselfsAsasIs StickyAdaptersnsa2sTst((sIsTs<build/bdist.darwin-8.0.1-x86/egg/protocols/tests/__init__.pyscheckStickyAdapter‹s     (s__name__s __module__s"checkAdaptTrapsTypeErrorsOnConformscheckAdaptHandlesIsInstancescheckAdviseFailsInCallContexts!checkAdviseClassKeywordsValidateds"checkAdviseModuleKeywordsValidatedscheckAdviseInClassExecscheckSimpleAdaptationscheckAdaptFiltersTypeErrorssassertTypeErrorPassedscheckImplicationBugscheckAttributescheckStickyAdapter(((s<build/bdist.darwin-8.0.1-x86/egg/protocols/tests/__init__.pysAPITestss      (sprotocolForTypesprotocolForURIs sequenceOfsadvise(sdeclareImplementations Variation(sUserDicts __getitem__s __setitem__sreadsimplicits)http://peak.telecommunity.com/PyProtocolss MyUserMappingcBstZRS(N(s__name__s __module__(((s<build/bdist.darwin-8.0.1-x86/egg/protocols/tests/__init__.pys MyUserMapping·ssGenerationTestscBs>tZd„Zd„Zd„Zd„Zd„Zd„ZRS(NcCs h}dS(N(sd(sselfsd((s<build/bdist.darwin-8.0.1-x86/egg/protocols/tests/__init__.pyscheckTypeSubsetÏscCs tƒ}dS(N(sUserDictsd(sselfsd((s<build/bdist.darwin-8.0.1-x86/egg/protocols/tests/__init__.pyscheckImplicationsÔs cCsdkl}|dƒ}dS(N(sStringIOsfoo(s cStringIOsStringIOss(sselfsssStringIO((s<build/bdist.darwin-8.0.1-x86/egg/protocols/tests/__init__.pys checkWeakÙs  cCstdƒ}tdƒ}dS(Nshttp://www.python.org/s)http://peak.telecommunity.com/PyProtocols(sprotocolForURIsp(sselfsp((s<build/bdist.darwin-8.0.1-x86/egg/protocols/tests/__init__.pyscheckURIßs  cCsNhhf\}}t||gƒ}dtfd„ƒY}|||gƒdS(Ns ISequenceLikecBstZedegƒRS(NsprotocolIsSubsetOf(s__name__s __module__sadvisesmultimap(((s<build/bdist.darwin-8.0.1-x86/egg/protocols/tests/__init__.pys ISequenceLikeês(sd1sd2smultimapsseqs Interfaces ISequenceLike(sselfsseqs ISequenceLikesd2sd1((s<build/bdist.darwin-8.0.1-x86/egg/protocols/tests/__init__.pys checkSequenceås cCsHh}tƒ}|ittƒdƒ|itttdƒƒdƒdS(NsCVariation(TypeSubset(,('__getitem__', '__setitem__')))i*s6Variation(,42)(sds MyUserMappingsselfs assertEqualsreprsIMyUnusualMappings Variations Interface(sselfsd((s<build/bdist.darwin-8.0.1-x86/egg/protocols/tests/__init__.pyscheckVariationís (s__name__s __module__scheckTypeSubsetscheckImplicationss checkWeakscheckURIs checkSequencescheckVariation(((s<build/bdist.darwin-8.0.1-x86/egg/protocols/tests/__init__.pysGenerationTestsÎs      cCsædkl}l}l}|iƒ|iƒ|iƒttdƒttdƒg}y dk }Wnt j on"Xdkl }|i |iƒƒy dk}Wnt j on"Xdkl}|i |iƒƒt|ƒSdS(N(s test_advices test_directs test_classesscheck(s test_zope(s test_twisted(sprotocols.testss test_advices test_directs test_classess test_suites makeSuitesAPITestssGenerationTestsstestsszope.interfaceszopes ImportErrors test_zopesappendstwisted.python.componentsstwisteds test_twisteds TestSuite(stestss test_twisteds test_advicestwisteds test_zopes test_classesszopes test_direct((s<build/bdist.darwin-8.0.1-x86/egg/protocols/tests/__init__.pys test_suite÷s9    N(!sunittests TestSuitesTestCases makeSuites protocolssadaptsadvises Interfaces AttributesdeclareAdapters AbstractBasesAdaptationFailuresAPITestssprotocolForTypesprotocolForURIs sequenceOfsdeclareImplementations VariationsUserDictsdictsIGetSetMappings IGetMappingsfilesISimpleReadFilesTrues IImplicitReads IProtocol1smultimapsIMyUnusualMappingsobjects MyUserMappingsGenerationTestss test_suite(s sequenceOfsIMyUnusualMappings Variations TestSuitesAdaptationFailuresISimpleReadFilesprotocolForTypesTestCasesadapts IImplicitReads InterfacesadvisesAPITestssmultimapsUserDicts makeSuitesGenerationTestssprotocolForURIsdeclareAdaptersIGetSetMappingsdeclareImplementations MyUserMappings Attributes IGetMappings test_suites IProtocol1s AbstractBase((s<build/bdist.darwin-8.0.1-x86/egg/protocols/tests/__init__.pys?s$%     )PKJŸC8|’Áa¼¼protocols/tests/test_zope.pyc;ò µÆBc@s dZdklZlZlZdkTdkZdklZdefd„ƒYZ de fd„ƒYZ d efd „ƒYZ d fd „ƒYZ d e fd„ƒYZdklZlZlZdklZlZdklZlZdeefd„ƒYZdeefd„ƒYZdeefd„ƒYZeeƒZeeeƒ7Zeeee eƒ7Zdeifd„ƒYZ deefd„ƒYZdeefd„ƒYZdeeefd„ƒYZeeeƒ7Zeeeƒ7Zeeee eƒ7Zd„ZdS(sZope Interface tests(sTestCases makeSuites TestSuite(s*N(s InterfacesIAcBstZRS(N(s__name__s __module__(((s=build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_zope.pysIA ssIBcBstZRS(N(s__name__s __module__(((s=build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_zope.pysIB ssIPurecBstZRS(N(s__name__s __module__(((s=build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_zope.pysIPure ss PicklablecBstZRS(N(s__name__s __module__(((s=build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_zope.pys PicklablessNewStylecBstZRS(N(s__name__s __module__(((s=build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_zope.pysNewStyles(sImplementationCheckssmakeClassTestssmakeInstanceTests(sProviderCheckssBasicClassProvidesChecks(smakeMetaClassProvidesTestssAdaptiveCheckss BasicCheckscBs tZeZeZeZeZRS(N(s__name__s __module__sIAsIBs InterfacesIPure(((s=build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_zope.pys BasicChecksssInstanceCheckscBs tZeZeZeZeZRS(N(s__name__s __module__sIAsIBs InterfacesIPure(((s=build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_zope.pysInstanceChecks$ss ClassCheckscBs tZeZeZeZeZRS(N(s__name__s __module__sIAsIBs InterfacesIPure(((s=build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_zope.pys ClassChecks*scBstZedegƒRS(NsprotocolExtends(s__name__s __module__sadvisesIA(((s=build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_zope.pysIB4scCs8tgi}tD]}|t|dƒƒq~ƒSdS(Nscheck(s TestSuitesappends_[1]s TestClassessts makeSuite(s_[1]st((s=build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_zope.pys test_suiteMs(s__doc__sunittestsTestCases makeSuites TestSuites protocolssprotocols.zope_supportszope.interfaces InterfacesIAsIBsIPures PicklablesobjectsNewStylescheckssImplementationCheckssmakeClassTestssmakeInstanceTestssProviderCheckssBasicClassProvidesCheckssmakeMetaClassProvidesTestssAdaptiveCheckss BasicCheckssInstanceCheckss ClassCheckss TestClassess test_suite(s TestClassessmakeInstanceTestss TestSuitesTestCases protocolss InterfacesAdaptiveCheckss BasicCheckssInstanceCheckss makeSuitesmakeClassTestssIPuresIAsIBsmakeMetaClassProvidesTestss PicklablesBasicClassProvidesCheckssImplementationCheckssProviderCheckss test_suites ClassCheckssNewStyle((s=build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_zope.pys?s4   PKÛ\â2"†Î Î protocols/tests/test_direct.py"""Tests for default IOpenProvider (etc.) adapters TODO: - Test Zope interface registrations """ from unittest import TestCase, makeSuite, TestSuite from protocols import * from checks import ProviderChecks, AdaptiveChecks, ClassProvidesChecks from checks import makeClassProvidesTests, makeInstanceTests from checks import makeMetaClassProvidesTests class IA(Interface): pass class IB(IA): pass class IPure(Interface): # We use this for pickle/copy tests because the other protocols # imply various dynamically created interfaces, and so any object # registered with them won't be picklable pass class BasicChecks(AdaptiveChecks, ProviderChecks): """Checks to be done on every object""" IA = IA IB = IB Interface = Interface IPure = IPure def checkCircularRegister(self): P1 = Protocol() P2 = Protocol() declareAdapter(NO_ADAPTER_NEEDED,provides=[P2],forProtocols=[P1]) declareAdapter(NO_ADAPTER_NEEDED,provides=[P1],forProtocols=[P2]) self.declareObImplements([P1]) # implies P1->P2->P1 class ClassChecks(ClassProvidesChecks, BasicChecks): """Checks to be done on classes and types""" class InstanceConformChecks: """Things to check on adapted instances""" def checkBadConform(self): def __conform__(proto): pass self.ob.__conform__ = __conform__ self.assertBadConform(self.ob, [self.IA], __conform__) def assertBadConform(self, ob, protocols, conform): try: adviseObject(ob, provides=protocols) except TypeError,v: assert v.args==( "Incompatible __conform__ on adapted object", ob, conform ), v.args else: raise AssertionError("Should've detected invalid __conform__") class ClassConformChecks(InstanceConformChecks): """Things to check on adapted classes""" def checkInheritedConform(self): class Base(self.ob): def __conform__(self,protocol): pass class Sub(Base): pass self.assertBadConform(Sub, [self.IA], Base.__conform__.im_func) def checkInstanceConform(self): class Base(self.ob): def __conform__(self,protocol): pass b = Base() self.assertBadConform(b, [self.IA], b.__conform__) class AdviseMixinInstance(BasicChecks): def setUp(self): self.ob = ProviderMixin() # Notice that we don't test the *metaclass* of the next three configurations; # it would fail because the metaclass itself can't be adapted to an open # provider, because it has a __conform__ method (from ProviderMixin). For # that to work, there'd have to be *another* metalevel. class AdviseMixinMultiMeta1(BasicChecks): def setUp(self): class Meta(ProviderMixin, type): pass class Test(ProviderMixin,object): __metaclass__ = Meta self.ob = Test() class InstanceTestsBase(BasicChecks, InstanceConformChecks): pass class ClassTestsBase(ClassChecks, ClassConformChecks): pass class Picklable: # Pickling needs classes in top-level namespace pass class NewStyle(object): pass TestClasses = ( AdviseMixinInstance, AdviseMixinMultiMeta1, ) TestClasses += makeMetaClassProvidesTests(ClassChecks) TestClasses += makeClassProvidesTests(ClassTestsBase) TestClasses += makeInstanceTests(InstanceTestsBase,Picklable,NewStyle) def test_suite(): return TestSuite([makeSuite(t,'check') for t in TestClasses]) PKKŸC8‡ ô†‡ ‡ protocols/tests/test_classes.pyo;ò µÆBc@s³dZdklZlZlZdkTdklZlZl Z de fd„ƒYZ de fd„ƒYZ de fd „ƒYZ d eefd „ƒYZe eƒZd „Zd S(s;Tests for implementor declarations (i.e. instancesProvides)(sTestCases makeSuites TestSuite(s*(sImplementationCheckssAdaptiveCheckssmakeClassTestssIAcBstZRS(N(s__name__s __module__(((s@build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_classes.pysIAssIBcBstZRS(N(s__name__s __module__(((s@build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_classes.pysIBssIPurecBstZRS(N(s__name__s __module__(((s@build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_classes.pysIPure ss BasicCheckscBs/tZdZeZeZeZeZd„ZRS(s/PyProtocols-only class-instances-provide checkscCsŒ|i|iƒ\}}|i|ƒ}|i|ƒ}t|d|i gƒt|d|i gƒ|i ||ƒ|i ||||ƒdS(NsinstancesProvide( sselfs setupBasessklasssM1sM2smakesm1sm2sdeclareImplementationsIAsIBs#assertM1ProvidesOnlyAandM2ProvidesBs#assertChangingBasesChangesInterface(sselfsM2sm1sm2sM1((s@build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_classes.pyscheckChangingBasess(s__name__s __module__s__doc__sIAsIBs InterfacesIPurescheckChangingBases(((s@build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_classes.pys BasicCheckss cCs8tgi}tD]}|t|dƒƒq~ƒSdS(Nscheck(s TestSuitesappends_[1]s TestClassessts makeSuite(s_[1]st((s@build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_classes.pys test_suite'sN(s__doc__sunittestsTestCases makeSuites TestSuites protocolsscheckssImplementationCheckssAdaptiveCheckssmakeClassTestss InterfacesIAsIBsIPures BasicCheckss TestClassess test_suite( s TestSuitesIBsImplementationCheckssmakeClassTestssIPures makeSuitesTestCases TestClassess test_suitesIAsAdaptiveCheckss BasicChecks((s@build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_classes.pys?s PKJŸC8­CÇwEpEpprotocols/tests/checks.pyc;ò µÆBc @s.dZddddddddd d g Zd klZlZlZd kTd „Zd„Zdefd„ƒYZ de fd„ƒYZ dfd„ƒYZ de fd„ƒYZ de fd„ƒYZ de fd„ƒYZd fd„ƒYZdefd„ƒYZd„Zd„Zd„Zd„ZdS(sBasic test setupssTestBasesImplementationCheckssProviderCheckssInstanceImplementationCheckssmakeClassTestssClassProvidesCheckssAdaptiveCheckssSimpleAdaptiveCheckssmakeMetaClassProvidesTestssBasicClassProvidesChecks(sTestCases makeSuites TestSuite(s*cCsd|fSdS(Nsa1(sob(sob((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysa1scCsd|fSdS(Nsa2(sob(sob((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysa2scBs€tZdZeeƒZeeƒZd„Zd„Zd„Zd„Z d„Z d„Z d„Z d„Z d „Zd „ZRS( sNon-adapter instance testscCs³|i|itƒ|ijpt‚|i|itƒtjpt‚|ittƒtjpt‚t|ittƒtjpt‚t|ittƒtjpt‚dS(N(sselfsIAsobsNonesAssertionErrorsIBsadapt(sself((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysassertObProvidesOnlyA1s &# #cCs¹|i|itƒ|ijpt‚|i|itƒ|ijpt‚t|ittƒtjpt‚t|ittƒtjpt‚t|ittƒtjpt‚dS(N(sselfsIAsobsNonesAssertionErrorsIBsadapt(sself((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysassertObProvidesAandB8s &&##cCsVy|i||ƒWn;tj o/}|id||||fjpt ‚nXdS(NsAmbiguous adapter choice( sselfsdeclareObAdaptssa2sifacess TypeErrorsvsargssa1sd1sd2sAssertionError(sselfsa1sa2sd1sd2sifacessv((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysassertAmbiguous?scCs |ƒSdS(N(sklass(sselfsklass((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysmakeEscsCdˆif‡d†ƒY}|ˆitƒˆijpt‚dS(NsICcs9tZedˆigƒdeƒjoeƒd=nRS(NsprotocolIsSubsetOfsself(s__name__s __module__sadvisesselfsIAslocals((sself(s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysICLs(sselfs InterfacesICsobsNonesAssertionError(sselfsIC((sselfs:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysassertObProvidesSubsetOfAIscCs:d|fd„ƒY}d|fd„ƒY}||fSdS(NsM1cBstZRS(N(s__name__s __module__(((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysM1TssM2cBstZRS(N(s__name__s __module__(((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysM2Us(sbasesM1sM2(sselfsbasesM1sM2((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pys setupBasesSscCsd|i|tƒ|jpt‚|i|tƒtjpt‚|i|tƒ|jpt‚dS(N(sselfsIAsM1sNonesAssertionErrorsIBsM2(sselfsM1sM2((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pys#assertM1ProvidesOnlyAandM2ProvidesBYs  cCsjy|f|_Wntj onBX|i|tƒ|jpt‚|i |tƒ|jpt‚dS(N( sM2sM1s __bases__s TypeErrorsselfsIAsm1sNonesAssertionErrorsIB(sselfsM1sM2sm1sm2((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pys#assertChangingBasesChangesInterface_s  cCs–|i|itƒ|ijpt‚|i|itƒ|ijpt‚||itƒ|ijpt‚||itƒ|ijpt‚dS(N(sselfsIAsobsNonesAssertionErrorsIBsICsID(sselfsICsID((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysassertObProvidesABCDhs&&#cCs|i|itƒtjpt‚|i|itƒtjpt‚||itƒ|ijpt‚||itƒ|ijpt‚dS(N(sselfsIAsobsNonesAssertionErrorsIBsICsID(sselfsICsID((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysassertObProvidesCandDnotAorBns###(s__name__s __module__s__doc__s staticmethodsa1sa2sassertObProvidesOnlyAsassertObProvidesAandBsassertAmbiguoussmakesassertObProvidesSubsetOfAs setupBasess#assertM1ProvidesOnlyAandM2ProvidesBs#assertChangingBasesChangesInterfacesassertObProvidesABCDsassertObProvidesCandDnotAorB(((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysTestBase*s          cBs2tZdZd„Zd„Zd„Zd„ZRS(s+Non-adapter specific-object-provides checkscCst|id|ƒdS(Nsprovides(s adviseObjectsselfsobsifaces(sselfsifaces((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysdeclareObImplements€scCs t|d|d|igƒdS(Nsprovidess forObjects(sdeclareAdaptersfactorysifacessselfsob(sselfsfactorysifaces((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysdeclareObAdaptsƒscCs!|i|igƒ|iƒdS(N(sselfsdeclareObImplementssIAsassertObProvidesOnlyA(sself((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pyscheckSimpleRegister†scCs!|i|igƒ|iƒdS(N(sselfsdeclareObImplementssIBsassertObProvidesAandB(sself((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pyscheckImpliedRegisterŠs(s__name__s __module__s__doc__sdeclareObImplementssdeclareObAdaptsscheckSimpleRegisterscheckImpliedRegister(((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysProviderChecks|s    cBs tZdZd„Zd„ZRS(s}Simple adapter-oriented checks that Twisted can handle (Well, it handles them as long as all the interfaces are Twisted)cCs!|i|igƒ|iƒdS(N(sselfsdeclareObImplementssIAsassertObProvidesSubsetOfA(sself((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pyscheckDelayedImplication«scCs‚d|ifd„ƒY}d|fd„ƒY}|i|gƒ|i||ƒttd|igd|gƒ|i ||ƒdS(NsICcBstZRS(N(s__name__s __module__(((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysIC·ssIDcBstZRS(N(s__name__s __module__(((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysID¸ssprovidess forProtocols( sselfs InterfacesICsIDsdeclareObImplementssassertObProvidesCandDnotAorBsdeclareAdaptersNO_ADAPTER_NEEDEDsIBsassertObProvidesABCD(sselfsICsID((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pyscheckIndirectImplication°s (s__name__s __module__s__doc__scheckDelayedImplicationscheckIndirectImplication(((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysSimpleAdaptiveChecks¥s  cBs2tZdZd„Zd„Zd„Zd„ZRS(sLGeneral adapter/protocol implication checks Twisted can't handle these.cCsB|i|i|igƒ|i|i|idd|igƒdS(Ni(sselfsdeclareObAdaptssa1sIAsassertAmbiguoussa2(sself((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pyscheckAmbiguityÔscCsŽ|i|i|igƒ|i|itƒd|ifjpt‚|i|i|igƒ|i|itƒd|ifjpt‚dS(Nsa1sa2( sselfsdeclareObAdaptssa1sIBsIAsobsNonesAssertionErrorsa2(sself((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pyscheckOverrideDepthØs,cCs‡d|ifd„ƒY}t|id|gd|igƒ|i|i|igƒ||it ƒdd|iffjpt ‚dS(NsICcBstZRS(N(s__name__s __module__(((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysICássprovidess forProtocolssa2sa1( sselfs InterfacesICsdeclareAdaptersa2sIAsdeclareObAdaptssa1sobsNonesAssertionError(sselfsIC((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pys checkComposedàs"cCs²|it|igƒ|i|itƒtjpt‚|i|igƒ|i|itƒ|ijpt‚|it|igƒ|i|itƒ|ijpt‚dS(N(sselfsdeclareObAdaptssDOES_NOT_SUPPORTsIAsobsNonesAssertionErrorsdeclareObImplements(sself((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pyscheckLateDefinitionçs #&(s__name__s __module__s__doc__scheckAmbiguityscheckOverrideDepths checkComposedscheckLateDefinition(((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysAdaptiveChecksÎs    cBs2tZdZd„Zd„Zd„Zd„ZRS(s*Non-adapter class-instances-provide checkscCst|i|ƒdS(N(sdeclareImplementationsselfsklasssifaces(sselfsifaces((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysdeclareObImplementsýscCs t|d|d|igƒdS(NsprovidessforTypes(sdeclareAdaptersfactorysifacessselfsklass(sselfsfactorysifaces((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysdeclareObAdaptsscCs!|i|igƒ|iƒdS(N(sselfsdeclareObImplementssIAsassertObProvidesOnlyA(sself((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pyscheckSimpleRegisterscCs!|i|igƒ|iƒdS(N(sselfsdeclareObImplementssIBsassertObProvidesAandB(sself((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pyscheckImpliedRegisters(s__name__s __module__s__doc__sdeclareObImplementssdeclareObAdaptsscheckSimpleRegisterscheckImpliedRegister(((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysInstanceImplementationChecks÷s    cBs)tZdZd„Zd„Zd„ZRS(s4Non-adapter class-instances vs. class-provide checkscCs:|i|igƒ|i|itƒtjpt‚dS(N(sselfsdeclareObImplementssIAsklasssNonesAssertionError(sself((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pyscheckNoClassPassThruscCs¿|i|igƒd|ifd„ƒY}|i|ƒ}|i|tƒ|jpt‚|i |tƒ|jpt‚|i |tƒtjpt‚|i|tƒtjpt‚dS(NsSubcBstZRS(N(s__name__s __module__(((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysSubs( sselfsdeclareObImplementssIBsklasssSubsmakesinstsNonesAssertionErrorsIA(sselfsinstsSub((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pyscheckInheritedDeclarations   cs¸ˆiˆigƒdˆif‡d†ƒY}ˆi|ƒ}ˆi|tƒ|jpt ‚ˆi|tƒtjpt ‚t |dˆigƒˆi|tƒ|jpt ‚dS(NsSubcstZedˆigƒRS(NsinstancesDoNotProvide(s__name__s __module__sadvisesselfsIB((sself(s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysSub#ssinstancesProvide( sselfsdeclareObImplementssIBsklasssSubsmakesinstsIAsNonesAssertionErrorsdeclareImplementation(sselfsinstsSub((sselfs:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pys checkRejectInheritanceAndReplace s  (s__name__s __module__s__doc__scheckNoClassPassThruscheckInheritedDeclarations checkRejectInheritanceAndReplace(((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysImplementationChecks s   cBs tZdZd„Zd„ZRS(s,Object-provides checks for classes and typescCsI|iƒ}t|id|igƒ|i|tƒtjpt‚dS(Nsprovides(sselfsobsinsts adviseObjectsIAsNonesAssertionError(sselfsinst((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pyscheckNoInstancePassThruOs cCsn|i|iƒ\}}t|d|igƒt|d|igƒ|i||ƒ|i ||||ƒdS(Nsprovides( sselfs setupBasessobsM1sM2s adviseObjectsIAsIBs#assertM1ProvidesOnlyAandM2ProvidesBs#assertChangingBasesChangesInterface(sselfsM1sM2((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pyscheckChangingBasesTs (s__name__s __module__s__doc__scheckNoInstancePassThruscheckChangingBases(((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysBasicClassProvidesChecksIs  cBstZd„Zd„ZRS(NcCsvd|ifd„ƒY}t|id|igƒ|i|tƒ|jpt‚|i|tƒ|jpt‚dS(NsSubcBstZRS(N(s__name__s __module__(((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysSubassprovides(sselfsobsSubs adviseObjectsIBsNonesAssertionErrorsIA(sselfsSub((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pyscheckInheritedDeclaration`s cs¯tˆidˆigƒdˆif‡d†ƒY}ˆi|tƒ|jpt‚ˆi|tƒtjpt‚t|dˆigƒˆi|tƒ|jpt‚dS(NsprovidessSubcstZedˆigƒRS(NsclassDoesNotProvide(s__name__s __module__sadvisesselfsIB((sself(s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysSubjs(s adviseObjectsselfsobsIBsSubsIAsNonesAssertionError(sselfsSub((sselfs:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pys checkRejectInheritanceAndReplacegs   (s__name__s __module__scheckInheritedDeclarations checkRejectInheritanceAndReplace(((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysClassProvidesChecks\s csrd|fd„ƒY}d|fd„ƒY}d|f‡d†ƒY}d|f‡d†ƒY}||||fSd S( s=Generate a set of instance-oriented test classes using 'base'sAdviseFunctioncBstZd„ZRS(NcCsd„}||_dS(NcCsdS(N((sfoosbar((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysaFuncxs(saFuncsselfsob(sselfsaFunc((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pyssetUpws (s__name__s __module__ssetUp(((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysAdviseFunctionvss AdviseModulecBstZd„ZRS(NcCs dkl}|dƒ|_dS(N(s ModuleTypesx(stypess ModuleTypesselfsob(sselfs ModuleType((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pyssetUp}s (s__name__s __module__ssetUp(((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pys AdviseModule|ssAdviseInstancecstZ‡d†Zd„ZRS(Ncsˆƒ|_dS(N(s Picklablesselfsob(sself(s Picklable(s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pyssetUp‚scCsedkl}l}t|id|igƒ|||iƒƒ}|i|tƒ|jpt ‚dS(N(sloadssdumpssprovides( scPicklesloadssdumpss adviseObjectsselfsobsIPuresnewObsNonesAssertionError(sselfsnewObsdumpssloads((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pys checkPickling…s(s__name__s __module__ssetUps checkPickling((s Picklable(s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysAdviseInstances sAdviseNewInstancecstZ‡d†ZRS(Ncsˆƒ|_dS(N(sNewStylesselfsob(sself(sNewStyle(s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pyssetUpŒs(s__name__s __module__ssetUp((sNewStyle(s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysAdviseNewInstance‹sN(sbasesAdviseFunctions AdviseModulesAdviseInstancesAdviseNewInstance(sbases PicklablesNewStyles AdviseModulesAdviseFunctionsAdviseInstancesAdviseNewInstance((s PicklablesNewStyles:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysmakeInstanceTestsrs  cCs:d|fd„ƒY}d|fd„ƒY}||fSdS(sCGenerate a set of class-provides-oriented test classes using 'base's AdviseClasscBstZd„ZRS(NcCs dfd„ƒY}||_dS(NsClassiccBstZRS(N(s__name__s __module__(((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysClassic s(sClassicsselfsob(sselfsClassic((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pyssetUpŸs(s__name__s __module__ssetUp(((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pys AdviseClassžss AdviseTypecBstZd„ZRS(NcCs#dtfd„ƒY}||_dS(NsClasscBstZRS(N(s__name__s __module__(((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysClass¦s(sobjectsClasssselfsob(sselfsClass((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pyssetUp¥s(s__name__s __module__ssetUp(((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pys AdviseType¤sN(sbases AdviseClasss AdviseType(sbases AdviseTypes AdviseClass((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysmakeClassProvidesTests›scCs:d|fd„ƒY}d|fd„ƒY}||fSdS(sCGenerate a set of class-provides-oriented test classes using 'base'sAdviseMixinClasscBstZd„ZRS(Ncs?dttfd„ƒY‰dtf‡d†ƒY}||_dS(NsMetacBstZRS(N(s__name__s __module__(((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysMeta·ssTestcstZˆZRS(N(s__name__s __module__sMetas __metaclass__((sMeta(s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysTest¸s(s ProviderMixinstypesMetasobjectsTestsselfsob(sselfsMetasTest((sMetas:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pyssetUp¶s(s__name__s __module__ssetUp(((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysAdviseMixinClassµssAdviseMixinMultiMeta2cBstZd„ZRS(NcsBdttfd„ƒY‰dttf‡d†ƒY}||_dS(NsMetacBstZRS(N(s__name__s __module__(((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysMeta½ssTestcstZˆZRS(N(s__name__s __module__sMetas __metaclass__((sMeta(s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysTest¾s(s ProviderMixinstypesMetasobjectsTestsselfsob(sselfsMetasTest((sMetas:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pyssetUp¼s(s__name__s __module__ssetUp(((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysAdviseMixinMultiMeta2»sN(sbasesAdviseMixinClasssAdviseMixinMultiMeta2(sbasesAdviseMixinMultiMeta2sAdviseMixinClass((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysmakeMetaClassProvidesTests­scCsld|fd„ƒY}d|fd„ƒY}d|fd„ƒY}d|fd„ƒY}||||fSd S( s:Generate a set of class-oriented test classes using 'base's TestClassiccBstZd„ZRS(NcCs,dfd„ƒY}||_|ƒ|_dS(NsClassiccBstZRS(N(s__name__s __module__(((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysClassicËs(sClassicsselfsklasssob(sselfsClassic((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pyssetUpÊs (s__name__s __module__ssetUp(((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pys TestClassicÈss TestBuiltincBstZd„ZRS(NcCs/dtfd„ƒY}||_|ƒ|_dS(NsNewstylecBstZfZRS(N(s__name__s __module__s __slots__(((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysNewstyleÓs(slistsNewstylesselfsklasssob(sselfsNewstyle((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pyssetUpÑs (s__name__s __module__ssetUp(((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pys TestBuiltinÏss TestMetaclasscBstZd„Zd„ZRS(NcsEdtfd„ƒY‰ˆ|_dtf‡d†ƒY}||_dS(NsMetacBstZRS(N(s__name__s __module__(((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysMetaÚssBasecstZˆZRS(N(s__name__s __module__sMetas __metaclass__((sMeta(s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysBaseÜs(stypesMetasselfsklasssobjectsBasesob(sselfsBasesMeta((sMetas:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pyssetUpÙs cCs|dtfhƒSdS(NsDummy(sklasssobject(sselfsklass((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysmakeßs(s__name__s __module__ssetUpsmake(((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pys TestMetaclass×s sTestMetaInstancecBstZd„ZRS(NcsHdtfd„ƒY‰dtf‡d†ƒY}||_|ƒ|_dS(NsMetacBstZRS(N(s__name__s __module__(((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysMetaåssBasecstZˆZRS(N(s__name__s __module__sMetas __metaclass__((sMeta(s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysBaseæs(stypesMetasobjectsBasesselfsklasssob(sselfsBasesMeta((sMetas:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pyssetUpäs (s__name__s __module__ssetUp(((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysTestMetaInstanceâsN(sbases TestClassics TestBuiltins TestMetaclasssTestMetaInstance(sbases TestBuiltins TestMetaclasssTestMetaInstances TestClassic((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysmakeClassTestsÄs  N(s__doc__s__all__sunittestsTestCases makeSuites TestSuites protocolssa1sa2sTestBasesProviderCheckssSimpleAdaptiveCheckssAdaptiveCheckssInstanceImplementationCheckssImplementationCheckssBasicClassProvidesCheckssClassProvidesCheckssmakeInstanceTestssmakeClassProvidesTestssmakeMetaClassProvidesTestssmakeClassTests(s TestSuitesTestBasesa1sImplementationCheckss__all__smakeClassTestssmakeClassProvidesTestss makeSuitesClassProvidesCheckssTestCasesProviderCheckssa2sAdaptiveCheckssmakeInstanceTestssInstanceImplementationCheckssSimpleAdaptiveCheckssmakeMetaClassProvidesTestssBasicClassProvidesChecks((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pys?s"$  R)))= )  PKÛ\â2u²ü‰à„à„protocols/tests/doctest.py# Module doctest. # Released to the public domain 16-Jan-2001, by Tim Peters (tim@python.org). # Major enhancements and refactoring by: # Jim Fulton # Edward Loper # Provided as-is; use at your own risk; no warranty; no promises; enjoy! try: basestring except NameError: basestring = str,unicode try: enumerate except NameError: def enumerate(seq): return zip(range(len(seq)),seq) r"""Module doctest -- a framework for running examples in docstrings. In simplest use, end each module M to be tested with: def _test(): import doctest doctest.testmod() if __name__ == "__main__": _test() Then running the module as a script will cause the examples in the docstrings to get executed and verified: python M.py This won't display anything unless an example fails, in which case the failing example(s) and the cause(s) of the failure(s) are printed to stdout (why not stderr? because stderr is a lame hack <0.2 wink>), and the final line of output is "Test failed.". Run it with the -v switch instead: python M.py -v and a detailed report of all examples tried is printed to stdout, along with assorted summaries at the end. You can force verbose mode by passing "verbose=True" to testmod, or prohibit it by passing "verbose=False". In either of those cases, sys.argv is not examined by testmod. There are a variety of other ways to run doctests, including integration with the unittest framework, and support for running non-Python text files containing doctests. There are also many ways to override parts of doctest's default behaviors. See the Library Reference Manual for details. """ __docformat__ = 'reStructuredText en' __all__ = [ # 0, Option Flags 'register_optionflag', 'DONT_ACCEPT_TRUE_FOR_1', 'DONT_ACCEPT_BLANKLINE', 'NORMALIZE_WHITESPACE', 'ELLIPSIS', 'IGNORE_EXCEPTION_DETAIL', 'COMPARISON_FLAGS', 'REPORT_UDIFF', 'REPORT_CDIFF', 'REPORT_NDIFF', 'REPORT_ONLY_FIRST_FAILURE', 'REPORTING_FLAGS', # 1. Utility Functions 'is_private', # 2. Example & DocTest 'Example', 'DocTest', # 3. Doctest Parser 'DocTestParser', # 4. Doctest Finder 'DocTestFinder', # 5. Doctest Runner 'DocTestRunner', 'OutputChecker', 'DocTestFailure', 'UnexpectedException', 'DebugRunner', # 6. Test Functions 'testmod', 'testfile', 'run_docstring_examples', # 7. Tester 'Tester', # 8. Unittest Support 'DocTestSuite', 'DocFileSuite', 'set_unittest_reportflags', # 9. Debugging Support 'script_from_examples', 'testsource', 'debug_src', 'debug', ] import __future__ import sys, traceback, inspect, linecache, os, re, types import unittest, difflib, pdb, tempfile import warnings from StringIO import StringIO # Don't whine about the deprecated is_private function in this # module's tests. warnings.filterwarnings("ignore", "is_private", DeprecationWarning, __name__, 0) # There are 4 basic classes: # - Example: a pair, plus an intra-docstring line number. # - DocTest: a collection of examples, parsed from a docstring, plus # info about where the docstring came from (name, filename, lineno). # - DocTestFinder: extracts DocTests from a given object's docstring and # its contained objects' docstrings. # - DocTestRunner: runs DocTest cases, and accumulates statistics. # # So the basic picture is: # # list of: # +------+ +---------+ +-------+ # |object| --DocTestFinder-> | DocTest | --DocTestRunner-> |results| # +------+ +---------+ +-------+ # | Example | # | ... | # | Example | # +---------+ # Option constants. OPTIONFLAGS_BY_NAME = {} def register_optionflag(name): flag = 1 << len(OPTIONFLAGS_BY_NAME) OPTIONFLAGS_BY_NAME[name] = flag return flag DONT_ACCEPT_TRUE_FOR_1 = register_optionflag('DONT_ACCEPT_TRUE_FOR_1') DONT_ACCEPT_BLANKLINE = register_optionflag('DONT_ACCEPT_BLANKLINE') NORMALIZE_WHITESPACE = register_optionflag('NORMALIZE_WHITESPACE') ELLIPSIS = register_optionflag('ELLIPSIS') IGNORE_EXCEPTION_DETAIL = register_optionflag('IGNORE_EXCEPTION_DETAIL') COMPARISON_FLAGS = (DONT_ACCEPT_TRUE_FOR_1 | DONT_ACCEPT_BLANKLINE | NORMALIZE_WHITESPACE | ELLIPSIS | IGNORE_EXCEPTION_DETAIL) REPORT_UDIFF = register_optionflag('REPORT_UDIFF') REPORT_CDIFF = register_optionflag('REPORT_CDIFF') REPORT_NDIFF = register_optionflag('REPORT_NDIFF') REPORT_ONLY_FIRST_FAILURE = register_optionflag('REPORT_ONLY_FIRST_FAILURE') REPORTING_FLAGS = (REPORT_UDIFF | REPORT_CDIFF | REPORT_NDIFF | REPORT_ONLY_FIRST_FAILURE) # Special string markers for use in `want` strings: BLANKLINE_MARKER = '' ELLIPSIS_MARKER = '...' ###################################################################### ## Table of Contents ###################################################################### # 1. Utility Functions # 2. Example & DocTest -- store test cases # 3. DocTest Parser -- extracts examples from strings # 4. DocTest Finder -- extracts test cases from objects # 5. DocTest Runner -- runs test cases # 6. Test Functions -- convenient wrappers for testing # 7. Tester Class -- for backwards compatibility # 8. Unittest Support # 9. Debugging Support # 10. Example Usage ###################################################################### ## 1. Utility Functions ###################################################################### def is_private(prefix, base): """prefix, base -> true iff name prefix + "." + base is "private". Prefix may be an empty string, and base does not contain a period. Prefix is ignored (although functions you write conforming to this protocol may make use of it). Return true iff base begins with an (at least one) underscore, but does not both begin and end with (at least) two underscores. >>> is_private("a.b", "my_func") False >>> is_private("____", "_my_func") True >>> is_private("someclass", "__init__") False >>> is_private("sometypo", "__init_") True >>> is_private("x.y.z", "_") True >>> is_private("_x.y.z", "__") False >>> is_private("", "") # senseless but consistent False """ warnings.warn("is_private is deprecated; it wasn't useful; " "examine DocTestFinder.find() lists instead", DeprecationWarning, stacklevel=2) return base[:1] == "_" and not base[:2] == "__" == base[-2:] def _extract_future_flags(globs): """ Return the compiler-flags associated with the future features that have been imported into the given namespace (globs). """ flags = 0 for fname in __future__.all_feature_names: feature = globs.get(fname, None) if feature is getattr(__future__, fname): flags |= feature.compiler_flag return flags def _normalize_module(module, depth=2): """ Return the module specified by `module`. In particular: - If `module` is a module, then return module. - If `module` is a string, then import and return the module with that name. - If `module` is None, then return the calling module. The calling module is assumed to be the module of the stack frame at the given depth in the call stack. """ if inspect.ismodule(module): return module elif isinstance(module, (str, unicode)): return __import__(module, globals(), locals(), ["*"]) elif module is None: return sys.modules[sys._getframe(depth).f_globals['__name__']] else: raise TypeError("Expected a module, string, or None") def _indent(s, indent=4): """ Add the given number of space characters to the beginning every non-blank line in `s`, and return the result. """ # This regexp matches the start of non-blank lines: return re.sub('(?m)^(?!$)', indent*' ', s) def _exception_traceback(exc_info): """ Return a string containing a traceback message for the given exc_info tuple (as returned by sys.exc_info()). """ # Get a traceback message. excout = StringIO() exc_type, exc_val, exc_tb = exc_info traceback.print_exception(exc_type, exc_val, exc_tb, file=excout) return excout.getvalue() # Override some StringIO methods. class _SpoofOut(StringIO): def getvalue(self): result = StringIO.getvalue(self) # If anything at all was written, make sure there's a trailing # newline. There's no way for the expected output to indicate # that a trailing newline is missing. if result and not result.endswith("\n"): result += "\n" # Prevent softspace from screwing up the next test case, in # case they used print with a trailing comma in an example. if hasattr(self, "softspace"): del self.softspace return result def truncate(self, size=None): StringIO.truncate(self, size) if hasattr(self, "softspace"): del self.softspace # Worst-case linear-time ellipsis matching. def _ellipsis_match(want, got): """ Essentially the only subtle case: >>> _ellipsis_match('aa...aa', 'aaa') False """ if want.find(ELLIPSIS_MARKER)==-1: return want == got # Find "the real" strings. ws = want.split(ELLIPSIS_MARKER) assert len(ws) >= 2 # Deal with exact matches possibly needed at one or both ends. startpos, endpos = 0, len(got) w = ws[0] if w: # starts with exact match if got.startswith(w): startpos = len(w) del ws[0] else: return False w = ws[-1] if w: # ends with exact match if got.endswith(w): endpos -= len(w) del ws[-1] else: return False if startpos > endpos: # Exact end matches required more characters than we have, as in # _ellipsis_match('aa...aa', 'aaa') return False # For the rest, we only need to find the leftmost non-overlapping # match for each piece. If there's no overall match that way alone, # there's no overall match period. for w in ws: # w may be '' at times, if there are consecutive ellipses, or # due to an ellipsis at the start or end of `want`. That's OK. # Search for an empty string succeeds, and doesn't change startpos. startpos = got.find(w, startpos, endpos) if startpos < 0: return False startpos += len(w) return True def _comment_line(line): "Return a commented form of the given line" line = line.rstrip() if line: return '# '+line else: return '#' class _OutputRedirectingPdb(pdb.Pdb): """ A specialized version of the python debugger that redirects stdout to a given stream when interacting with the user. Stdout is *not* redirected when traced code is executed. """ def __init__(self, out): self.__out = out pdb.Pdb.__init__(self) def trace_dispatch(self, *args): # Redirect stdout to the given stream. save_stdout = sys.stdout sys.stdout = self.__out # Call Pdb's trace dispatch method. try: return pdb.Pdb.trace_dispatch(self, *args) finally: sys.stdout = save_stdout # [XX] Normalize with respect to os.path.pardir? def _module_relative_path(module, path): if not inspect.ismodule(module): raise TypeError, 'Expected a module: %r' % module if path.startswith('/'): raise ValueError, 'Module-relative files may not have absolute paths' # Find the base directory for the path. if hasattr(module, '__file__'): # A normal module/package basedir = os.path.split(module.__file__)[0] elif module.__name__ == '__main__': # An interactive session. if len(sys.argv)>0 and sys.argv[0] != '': basedir = os.path.split(sys.argv[0])[0] else: basedir = os.curdir else: # A module w/o __file__ (this includes builtins) raise ValueError("Can't resolve paths relative to the module " + module + " (it has no __file__)") # Combine the base directory and the path. return os.path.join(basedir, *(path.split('/'))) ###################################################################### ## 2. Example & DocTest ###################################################################### ## - An "example" is a pair, where "source" is a ## fragment of source code, and "want" is the expected output for ## "source." The Example class also includes information about ## where the example was extracted from. ## ## - A "doctest" is a collection of examples, typically extracted from ## a string (such as an object's docstring). The DocTest class also ## includes information about where the string was extracted from. class Example: """ A single doctest example, consisting of source code and expected output. `Example` defines the following attributes: - source: A single Python statement, always ending with a newline. The constructor adds a newline if needed. - want: The expected output from running the source code (either from stdout, or a traceback in case of exception). `want` ends with a newline unless it's empty, in which case it's an empty string. The constructor adds a newline if needed. - exc_msg: The exception message generated by the example, if the example is expected to generate an exception; or `None` if it is not expected to generate an exception. This exception message is compared against the return value of `traceback.format_exception_only()`. `exc_msg` ends with a newline unless it's `None`. The constructor adds a newline if needed. - lineno: The line number within the DocTest string containing this Example where the Example begins. This line number is zero-based, with respect to the beginning of the DocTest. - indent: The example's indentation in the DocTest string. I.e., the number of space characters that preceed the example's first prompt. - options: A dictionary mapping from option flags to True or False, which is used to override default options for this example. Any option flags not contained in this dictionary are left at their default value (as specified by the DocTestRunner's optionflags). By default, no options are set. """ def __init__(self, source, want, exc_msg=None, lineno=0, indent=0, options=None): # Normalize inputs. if not source.endswith('\n'): source += '\n' if want and not want.endswith('\n'): want += '\n' if exc_msg is not None and not exc_msg.endswith('\n'): exc_msg += '\n' # Store properties. self.source = source self.want = want self.lineno = lineno self.indent = indent if options is None: options = {} self.options = options self.exc_msg = exc_msg class DocTest: """ A collection of doctest examples that should be run in a single namespace. Each `DocTest` defines the following attributes: - examples: the list of examples. - globs: The namespace (aka globals) that the examples should be run in. - name: A name identifying the DocTest (typically, the name of the object whose docstring this DocTest was extracted from). - filename: The name of the file that this DocTest was extracted from, or `None` if the filename is unknown. - lineno: The line number within filename where this DocTest begins, or `None` if the line number is unavailable. This line number is zero-based, with respect to the beginning of the file. - docstring: The string that the examples were extracted from, or `None` if the string is unavailable. """ def __init__(self, examples, globs, name, filename, lineno, docstring): """ Create a new DocTest containing the given examples. The DocTest's globals are initialized with a copy of `globs`. """ assert not isinstance(examples, basestring), \ "DocTest no longer accepts str; use DocTestParser instead" self.examples = examples self.docstring = docstring self.globs = globs.copy() self.name = name self.filename = filename self.lineno = lineno def __repr__(self): if len(self.examples) == 0: examples = 'no examples' elif len(self.examples) == 1: examples = '1 example' else: examples = '%d examples' % len(self.examples) return ('' % (self.name, self.filename, self.lineno, examples)) # This lets us sort tests by name: def __cmp__(self, other): if not isinstance(other, DocTest): return -1 return cmp((self.name, self.filename, self.lineno, id(self)), (other.name, other.filename, other.lineno, id(other))) ###################################################################### ## 3. DocTestParser ###################################################################### class DocTestParser: """ A class used to parse strings containing doctest examples. """ # This regular expression is used to find doctest examples in a # string. It defines three groups: `source` is the source code # (including leading indentation and prompts); `indent` is the # indentation of the first (PS1) line of the source code; and # `want` is the expected output (including leading indentation). _EXAMPLE_RE = re.compile(r''' # Source consists of a PS1 line followed by zero or more PS2 lines. (?P (?:^(?P [ ]*) >>> .*) # PS1 line (?:\n [ ]* \.\.\. .*)*) # PS2 lines \n? # Want consists of any non-blank lines that do not start with PS1. (?P (?:(?![ ]*$) # Not a blank line (?![ ]*>>>) # Not a line starting with PS1 .*$\n? # But any other line )*) ''', re.MULTILINE | re.VERBOSE) # A regular expression for handling `want` strings that contain # expected exceptions. It divides `want` into three pieces: # - the traceback header line (`hdr`) # - the traceback stack (`stack`) # - the exception message (`msg`), as generated by # traceback.format_exception_only() # `msg` may have multiple lines. We assume/require that the # exception message is the first non-indented line starting with a word # character following the traceback header line. _EXCEPTION_RE = re.compile(r""" # Grab the traceback header. Different versions of Python have # said different things on the first traceback line. ^(?P Traceback\ \( (?: most\ recent\ call\ last | innermost\ last ) \) : ) \s* $ # toss trailing whitespace on the header. (?P .*?) # don't blink: absorb stuff until... ^ (?P \w+ .*) # a line *starts* with alphanum. """, re.VERBOSE | re.MULTILINE | re.DOTALL) # A callable returning a true value iff its argument is a blank line # or contains a single comment. _IS_BLANK_OR_COMMENT = re.compile(r'^[ ]*(#.*)?$').match def parse(self, string, name=''): """ Divide the given string into examples and intervening text, and return them as a list of alternating Examples and strings. Line numbers for the Examples are 0-based. The optional argument `name` is a name identifying this string, and is only used for error messages. """ string = string.expandtabs() # If all lines begin with the same indentation, then strip it. min_indent = self._min_indent(string) if min_indent > 0: string = '\n'.join([l[min_indent:] for l in string.split('\n')]) output = [] charno, lineno = 0, 0 # Find all doctest examples in the string: for m in self._EXAMPLE_RE.finditer(string): # Add the pre-example text to `output`. output.append(string[charno:m.start()]) # Update lineno (lines before this example) lineno += string.count('\n', charno, m.start()) # Extract info from the regexp match. (source, options, want, exc_msg) = \ self._parse_example(m, name, lineno) # Create an Example, and add it to the list. if not self._IS_BLANK_OR_COMMENT(source): output.append( Example(source, want, exc_msg, lineno=lineno, indent=min_indent+len(m.group('indent')), options=options) ) # Update lineno (lines inside this example) lineno += string.count('\n', m.start(), m.end()) # Update charno. charno = m.end() # Add any remaining post-example text to `output`. output.append(string[charno:]) return output def get_doctest(self, string, globs, name, filename, lineno): """ Extract all doctest examples from the given string, and collect them into a `DocTest` object. `globs`, `name`, `filename`, and `lineno` are attributes for the new `DocTest` object. See the documentation for `DocTest` for more information. """ return DocTest(self.get_examples(string, name), globs, name, filename, lineno, string) def get_examples(self, string, name=''): """ Extract all doctest examples from the given string, and return them as a list of `Example` objects. Line numbers are 0-based, because it's most common in doctests that nothing interesting appears on the same line as opening triple-quote, and so the first interesting line is called \"line 1\" then. The optional argument `name` is a name identifying this string, and is only used for error messages. """ return [x for x in self.parse(string, name) if isinstance(x, Example)] def _parse_example(self, m, name, lineno): """ Given a regular expression match from `_EXAMPLE_RE` (`m`), return a pair `(source, want)`, where `source` is the matched example's source code (with prompts and indentation stripped); and `want` is the example's expected output (with indentation stripped). `name` is the string's name, and `lineno` is the line number where the example starts; both are used for error messages. """ # Get the example's indentation level. indent = len(m.group('indent')) # Divide source into lines; check that they're properly # indented; and then strip their indentation & prompts. source_lines = m.group('source').split('\n') self._check_prompt_blank(source_lines, indent, name, lineno) self._check_prefix(source_lines[1:], ' '*indent + '.', name, lineno) source = '\n'.join([sl[indent+4:] for sl in source_lines]) # Divide want into lines; check that it's properly indented; and # then strip the indentation. Spaces before the last newline should # be preserved, so plain rstrip() isn't good enough. want = m.group('want') want_lines = want.split('\n') if len(want_lines) > 1 and re.match(r' *$', want_lines[-1]): del want_lines[-1] # forget final newline & spaces after it self._check_prefix(want_lines, ' '*indent, name, lineno + len(source_lines)) want = '\n'.join([wl[indent:] for wl in want_lines]) # If `want` contains a traceback message, then extract it. m = self._EXCEPTION_RE.match(want) if m: exc_msg = m.group('msg') else: exc_msg = None # Extract options from the source. options = self._find_options(source, name, lineno) return source, options, want, exc_msg # This regular expression looks for option directives in the # source code of an example. Option directives are comments # starting with "doctest:". Warning: this may give false # positives for string-literals that contain the string # "#doctest:". Eliminating these false positives would require # actually parsing the string; but we limit them by ignoring any # line containing "#doctest:" that is *followed* by a quote mark. _OPTION_DIRECTIVE_RE = re.compile(r'#\s*doctest:\s*([^\n\'"]*)$', re.MULTILINE) def _find_options(self, source, name, lineno): """ Return a dictionary containing option overrides extracted from option directives in the given source string. `name` is the string's name, and `lineno` is the line number where the example starts; both are used for error messages. """ options = {} # (note: with the current regexp, this will match at most once:) for m in self._OPTION_DIRECTIVE_RE.finditer(source): option_strings = m.group(1).replace(',', ' ').split() for option in option_strings: if (option[0] not in '+-' or option[1:] not in OPTIONFLAGS_BY_NAME): raise ValueError('line %r of the doctest for %s ' 'has an invalid option: %r' % (lineno+1, name, option)) flag = OPTIONFLAGS_BY_NAME[option[1:]] options[flag] = (option[0] == '+') if options and self._IS_BLANK_OR_COMMENT(source): raise ValueError('line %r of the doctest for %s has an option ' 'directive on a line with no example: %r' % (lineno, name, source)) return options # This regular expression finds the indentation of every non-blank # line in a string. _INDENT_RE = re.compile('^([ ]*)(?=\S)', re.MULTILINE) def _min_indent(self, s): "Return the minimum indentation of any non-blank line in `s`" indents = [len(indent) for indent in self._INDENT_RE.findall(s)] if len(indents) > 0: return min(indents) else: return 0 def _check_prompt_blank(self, lines, indent, name, lineno): """ Given the lines of a source string (including prompts and leading indentation), check to make sure that every prompt is followed by a space character. If any line is not followed by a space character, then raise ValueError. """ for i, line in enumerate(lines): if len(line) >= indent+4 and line[indent+3] != ' ': raise ValueError('line %r of the docstring for %s ' 'lacks blank after %s: %r' % (lineno+i+1, name, line[indent:indent+3], line)) def _check_prefix(self, lines, prefix, name, lineno): """ Check that every line in the given list starts with the given prefix; if any line does not, then raise a ValueError. """ for i, line in enumerate(lines): if line and not line.startswith(prefix): raise ValueError('line %r of the docstring for %s has ' 'inconsistent leading whitespace: %r' % (lineno+i+1, name, line)) ###################################################################### ## 4. DocTest Finder ###################################################################### class DocTestFinder: """ A class used to extract the DocTests that are relevant to a given object, from its docstring and the docstrings of its contained objects. Doctests can currently be extracted from the following object types: modules, functions, classes, methods, staticmethods, classmethods, and properties. """ def __init__(self, verbose=False, parser=DocTestParser(), recurse=True, _namefilter=None, exclude_empty=True): """ Create a new doctest finder. The optional argument `parser` specifies a class or function that should be used to create new DocTest objects (or objects that implement the same interface as DocTest). The signature for this factory function should match the signature of the DocTest constructor. If the optional argument `recurse` is false, then `find` will only examine the given object, and not any contained objects. If the optional argument `exclude_empty` is false, then `find` will include tests for objects with empty docstrings. """ self._parser = parser self._verbose = verbose self._recurse = recurse self._exclude_empty = exclude_empty # _namefilter is undocumented, and exists only for temporary backward- # compatibility support of testmod's deprecated isprivate mess. self._namefilter = _namefilter def find(self, obj, name=None, module=None, globs=None, extraglobs=None): """ Return a list of the DocTests that are defined by the given object's docstring, or by any of its contained objects' docstrings. The optional parameter `module` is the module that contains the given object. If the module is not specified or is None, then the test finder will attempt to automatically determine the correct module. The object's module is used: - As a default namespace, if `globs` is not specified. - To prevent the DocTestFinder from extracting DocTests from objects that are imported from other modules. - To find the name of the file containing the object. - To help find the line number of the object within its file. Contained objects whose module does not match `module` are ignored. If `module` is False, no attempt to find the module will be made. This is obscure, of use mostly in tests: if `module` is False, or is None but cannot be found automatically, then all objects are considered to belong to the (non-existent) module, so all contained objects will (recursively) be searched for doctests. The globals for each DocTest is formed by combining `globs` and `extraglobs` (bindings in `extraglobs` override bindings in `globs`). A new copy of the globals dictionary is created for each DocTest. If `globs` is not specified, then it defaults to the module's `__dict__`, if specified, or {} otherwise. If `extraglobs` is not specified, then it defaults to {}. """ # If name was not specified, then extract it from the object. if name is None: name = getattr(obj, '__name__', None) if name is None: raise ValueError("DocTestFinder.find: name must be given " "when obj.__name__ doesn't exist: %r" % (type(obj),)) # Find the module that contains the given object (if obj is # a module, then module=obj.). Note: this may fail, in which # case module will be None. if module is False: module = None elif module is None: module = inspect.getmodule(obj) # Read the module's source code. This is used by # DocTestFinder._find_lineno to find the line number for a # given object's docstring. try: file = inspect.getsourcefile(obj) or inspect.getfile(obj) source_lines = linecache.getlines(file) if not source_lines: source_lines = None except TypeError: source_lines = None # Initialize globals, and merge in extraglobs. if globs is None: if module is None: globs = {} else: globs = module.__dict__.copy() else: globs = globs.copy() if extraglobs is not None: globs.update(extraglobs) # Recursively expore `obj`, extracting DocTests. tests = [] self._find(tests, obj, name, module, source_lines, globs, {}) return tests def _filter(self, obj, prefix, base): """ Return true if the given object should not be examined. """ return (self._namefilter is not None and self._namefilter(prefix, base)) def _from_module(self, module, object): """ Return true if the given object is defined in the given module. """ if module is None: return True elif inspect.isfunction(object): return module.__dict__ is object.func_globals elif inspect.isclass(object): return module.__name__ == object.__module__ elif inspect.getmodule(object) is not None: return module is inspect.getmodule(object) elif hasattr(object, '__module__'): return module.__name__ == object.__module__ elif isinstance(object, property): return True # [XX] no way not be sure. else: raise ValueError("object must be a class or function") def _find(self, tests, obj, name, module, source_lines, globs, seen): """ Find tests for the given object and any contained objects, and add them to `tests`. """ if self._verbose: print 'Finding tests in %s' % name # If we've already processed this object, then ignore it. if id(obj) in seen: return seen[id(obj)] = 1 # Find a test for this object, and add it to the list of tests. test = self._get_test(obj, name, module, globs, source_lines) if test is not None: tests.append(test) # Look for tests in a module's contained objects. if inspect.ismodule(obj) and self._recurse: for valname, val in obj.__dict__.items(): # Check if this contained object should be ignored. if self._filter(val, name, valname): continue valname = '%s.%s' % (name, valname) # Recurse to functions & classes. if ((inspect.isfunction(val) or inspect.isclass(val)) and self._from_module(module, val)): self._find(tests, val, valname, module, source_lines, globs, seen) # Look for tests in a module's __test__ dictionary. if inspect.ismodule(obj) and self._recurse: for valname, val in getattr(obj, '__test__', {}).items(): if not isinstance(valname, basestring): raise ValueError("DocTestFinder.find: __test__ keys " "must be strings: %r" % (type(valname),)) if not (inspect.isfunction(val) or inspect.isclass(val) or inspect.ismethod(val) or inspect.ismodule(val) or isinstance(val, basestring)): raise ValueError("DocTestFinder.find: __test__ values " "must be strings, functions, methods, " "classes, or modules: %r" % (type(val),)) valname = '%s.__test__.%s' % (name, valname) self._find(tests, val, valname, module, source_lines, globs, seen) # Look for tests in a class's contained objects. if inspect.isclass(obj) and self._recurse: for valname, val in obj.__dict__.items(): # Check if this contained object should be ignored. if self._filter(val, name, valname): continue # Special handling for staticmethod/classmethod. if isinstance(val, staticmethod): val = getattr(obj, valname) if isinstance(val, classmethod): val = getattr(obj, valname).im_func # Recurse to methods, properties, and nested classes. if ((inspect.isfunction(val) or inspect.isclass(val) or isinstance(val, property)) and self._from_module(module, val)): valname = '%s.%s' % (name, valname) self._find(tests, val, valname, module, source_lines, globs, seen) def _get_test(self, obj, name, module, globs, source_lines): """ Return a DocTest for the given object, if it defines a docstring; otherwise, return None. """ # Extract the object's docstring. If it doesn't have one, # then return None (no test for this object). if isinstance(obj, basestring): docstring = obj else: try: if obj.__doc__ is None: docstring = '' else: docstring = obj.__doc__ if not isinstance(docstring, basestring): docstring = str(docstring) except (TypeError, AttributeError): docstring = '' # Find the docstring's location in the file. lineno = self._find_lineno(obj, source_lines) # Don't bother if the docstring is empty. if self._exclude_empty and not docstring: return None # Return a DocTest for this object. if module is None: filename = None else: filename = getattr(module, '__file__', module.__name__) if filename[-4:] in (".pyc", ".pyo"): filename = filename[:-1] return self._parser.get_doctest(docstring, globs, name, filename, lineno) def _find_lineno(self, obj, source_lines): """ Return a line number of the given object's docstring. Note: this method assumes that the object has a docstring. """ lineno = None # Find the line number for modules. if inspect.ismodule(obj): lineno = 0 # Find the line number for classes. # Note: this could be fooled if a class is defined multiple # times in a single file. if inspect.isclass(obj): if source_lines is None: return None pat = re.compile(r'^\s*class\s*%s\b' % getattr(obj, '__name__', '-')) for i, line in enumerate(source_lines): if pat.match(line): lineno = i break # Find the line number for functions & methods. if inspect.ismethod(obj): obj = obj.im_func if inspect.isfunction(obj): obj = obj.func_code if inspect.istraceback(obj): obj = obj.tb_frame if inspect.isframe(obj): obj = obj.f_code if inspect.iscode(obj): lineno = getattr(obj, 'co_firstlineno', None)-1 # Find the line number where the docstring starts. Assume # that it's the first line that begins with a quote mark. # Note: this could be fooled by a multiline function # signature, where a continuation line begins with a quote # mark. if lineno is not None: if source_lines is None: return lineno+1 pat = re.compile('(^|.*:)\s*\w*("|\')') for lineno in range(lineno, len(source_lines)): if pat.match(source_lines[lineno]): return lineno # We couldn't find the line number. return None ###################################################################### ## 5. DocTest Runner ###################################################################### class DocTestRunner: """ A class used to run DocTest test cases, and accumulate statistics. The `run` method is used to process a single DocTest case. It returns a tuple `(f, t)`, where `t` is the number of test cases tried, and `f` is the number of test cases that failed. >>> tests = DocTestFinder().find(_TestClass) >>> runner = DocTestRunner(verbose=False) >>> for test in tests: ... print runner.run(test) (0, 2) (0, 1) (0, 2) (0, 2) The `summarize` method prints a summary of all the test cases that have been run by the runner, and returns an aggregated `(f, t)` tuple: >>> runner.summarize(verbose=1) 4 items passed all tests: 2 tests in _TestClass 2 tests in _TestClass.__init__ 2 tests in _TestClass.get 1 tests in _TestClass.square 7 tests in 4 items. 7 passed and 0 failed. Test passed. (0, 7) The aggregated number of tried examples and failed examples is also available via the `tries` and `failures` attributes: >>> runner.tries 7 >>> runner.failures 0 The comparison between expected outputs and actual outputs is done by an `OutputChecker`. This comparison may be customized with a number of option flags; see the documentation for `testmod` for more information. If the option flags are insufficient, then the comparison may also be customized by passing a subclass of `OutputChecker` to the constructor. The test runner's display output can be controlled in two ways. First, an output function (`out) can be passed to `TestRunner.run`; this function will be called with strings that should be displayed. It defaults to `sys.stdout.write`. If capturing the output is not sufficient, then the display output can be also customized by subclassing DocTestRunner, and overriding the methods `report_start`, `report_success`, `report_unexpected_exception`, and `report_failure`. """ # This divider string is used to separate failure messages, and to # separate sections of the summary. DIVIDER = "*" * 70 def __init__(self, checker=None, verbose=None, optionflags=0): """ Create a new test runner. Optional keyword arg `checker` is the `OutputChecker` that should be used to compare the expected outputs and actual outputs of doctest examples. Optional keyword arg 'verbose' prints lots of stuff if true, only failures if false; by default, it's true iff '-v' is in sys.argv. Optional argument `optionflags` can be used to control how the test runner compares expected output to actual output, and how it displays failures. See the documentation for `testmod` for more information. """ self._checker = checker or OutputChecker() if verbose is None: verbose = '-v' in sys.argv self._verbose = verbose self.optionflags = optionflags self.original_optionflags = optionflags # Keep track of the examples we've run. self.tries = 0 self.failures = 0 self._name2ft = {} # Create a fake output target for capturing doctest output. self._fakeout = _SpoofOut() #///////////////////////////////////////////////////////////////// # Reporting methods #///////////////////////////////////////////////////////////////// def report_start(self, out, test, example): """ Report that the test runner is about to process the given example. (Only displays a message if verbose=True) """ if self._verbose: if example.want: out('Trying:\n' + _indent(example.source) + 'Expecting:\n' + _indent(example.want)) else: out('Trying:\n' + _indent(example.source) + 'Expecting nothing\n') def report_success(self, out, test, example, got): """ Report that the given example ran successfully. (Only displays a message if verbose=True) """ if self._verbose: out("ok\n") def report_failure(self, out, test, example, got): """ Report that the given example failed. """ out(self._failure_header(test, example) + self._checker.output_difference(example, got, self.optionflags)) def report_unexpected_exception(self, out, test, example, exc_info): """ Report that the given example raised an unexpected exception. """ out(self._failure_header(test, example) + 'Exception raised:\n' + _indent(_exception_traceback(exc_info))) def _failure_header(self, test, example): out = [self.DIVIDER] if test.filename: if test.lineno is not None and example.lineno is not None: lineno = test.lineno + example.lineno + 1 else: lineno = '?' out.append('File "%s", line %s, in %s' % (test.filename, lineno, test.name)) else: out.append('Line %s, in %s' % (example.lineno+1, test.name)) out.append('Failed example:') source = example.source out.append(_indent(source)) return '\n'.join(out) #///////////////////////////////////////////////////////////////// # DocTest Running #///////////////////////////////////////////////////////////////// def __run(self, test, compileflags, out): """ Run the examples in `test`. Write the outcome of each example with one of the `DocTestRunner.report_*` methods, using the writer function `out`. `compileflags` is the set of compiler flags that should be used to execute examples. Return a tuple `(f, t)`, where `t` is the number of examples tried, and `f` is the number of examples that failed. The examples are run in the namespace `test.globs`. """ # Keep track of the number of failures and tries. failures = tries = 0 # Save the option flags (since option directives can be used # to modify them). original_optionflags = self.optionflags SUCCESS, FAILURE, BOOM = range(3) # `outcome` state check = self._checker.check_output # Process each example. for examplenum, example in enumerate(test.examples): # If REPORT_ONLY_FIRST_FAILURE is set, then supress # reporting after the first failure. quiet = (self.optionflags & REPORT_ONLY_FIRST_FAILURE and failures > 0) # Merge in the example's options. self.optionflags = original_optionflags if example.options: for (optionflag, val) in example.options.items(): if val: self.optionflags |= optionflag else: self.optionflags &= ~optionflag # Record that we started this example. tries += 1 if not quiet: self.report_start(out, test, example) # Use a special filename for compile(), so we can retrieve # the source code during interactive debugging (see # __patched_linecache_getlines). filename = '' % (test.name, examplenum) # Run the example in the given context (globs), and record # any exception that gets raised. (But don't intercept # keyboard interrupts.) try: # Don't blink! This is where the user's code gets run. exec compile(example.source, filename, "single", compileflags, 1) in test.globs self.debugger.set_continue() # ==== Example Finished ==== exception = None except KeyboardInterrupt: raise except: exception = sys.exc_info() self.debugger.set_continue() # ==== Example Finished ==== got = self._fakeout.getvalue() # the actual output self._fakeout.truncate(0) outcome = FAILURE # guilty until proved innocent or insane # If the example executed without raising any exceptions, # verify its output. if exception is None: if check(example.want, got, self.optionflags): outcome = SUCCESS # The example raised an exception: check if it was expected. else: exc_info = sys.exc_info() exc_msg = traceback.format_exception_only(*exc_info[:2])[-1] if not quiet: got += _exception_traceback(exc_info) # If `example.exc_msg` is None, then we weren't expecting # an exception. if example.exc_msg is None: outcome = BOOM # We expected an exception: see whether it matches. elif check(example.exc_msg, exc_msg, self.optionflags): outcome = SUCCESS # Another chance if they didn't care about the detail. elif self.optionflags & IGNORE_EXCEPTION_DETAIL: m1 = re.match(r'[^:]*:', example.exc_msg) m2 = re.match(r'[^:]*:', exc_msg) if m1 and m2 and check(m1.group(0), m2.group(0), self.optionflags): outcome = SUCCESS # Report the outcome. if outcome is SUCCESS: if not quiet: self.report_success(out, test, example, got) elif outcome is FAILURE: if not quiet: self.report_failure(out, test, example, got) failures += 1 elif outcome is BOOM: if not quiet: self.report_unexpected_exception(out, test, example, exc_info) failures += 1 else: assert False, ("unknown outcome", outcome) # Restore the option flags (in case they were modified) self.optionflags = original_optionflags # Record and return the number of failures and tries. self.__record_outcome(test, failures, tries) return failures, tries def __record_outcome(self, test, f, t): """ Record the fact that the given DocTest (`test`) generated `f` failures out of `t` tried examples. """ f2, t2 = self._name2ft.get(test.name, (0,0)) self._name2ft[test.name] = (f+f2, t+t2) self.failures += f self.tries += t __LINECACHE_FILENAME_RE = re.compile(r'[\w\.]+)' r'\[(?P\d+)\]>$') def __patched_linecache_getlines(self, filename): m = self.__LINECACHE_FILENAME_RE.match(filename) if m and m.group('name') == self.test.name: example = self.test.examples[int(m.group('examplenum'))] return example.source.splitlines(True) else: return self.save_linecache_getlines(filename) def run(self, test, compileflags=None, out=None, clear_globs=True): """ Run the examples in `test`, and display the results using the writer function `out`. The examples are run in the namespace `test.globs`. If `clear_globs` is true (the default), then this namespace will be cleared after the test runs, to help with garbage collection. If you would like to examine the namespace after the test completes, then use `clear_globs=False`. `compileflags` gives the set of flags that should be used by the Python compiler when running the examples. If not specified, then it will default to the set of future-import flags that apply to `globs`. The output of each example is checked using `DocTestRunner.check_output`, and the results are formatted by the `DocTestRunner.report_*` methods. """ self.test = test if compileflags is None: compileflags = _extract_future_flags(test.globs) save_stdout = sys.stdout if out is None: out = save_stdout.write sys.stdout = self._fakeout # Patch pdb.set_trace to restore sys.stdout during interactive # debugging (so it's not still redirected to self._fakeout). # Note that the interactive output will go to *our* # save_stdout, even if that's not the real sys.stdout; this # allows us to write test cases for the set_trace behavior. save_set_trace = pdb.set_trace self.debugger = _OutputRedirectingPdb(save_stdout) self.debugger.reset() pdb.set_trace = self.debugger.set_trace # Patch linecache.getlines, so we can see the example's source # when we're inside the debugger. self.save_linecache_getlines = linecache.getlines linecache.getlines = self.__patched_linecache_getlines try: return self.__run(test, compileflags, out) finally: sys.stdout = save_stdout pdb.set_trace = save_set_trace linecache.getlines = self.save_linecache_getlines if clear_globs: test.globs.clear() #///////////////////////////////////////////////////////////////// # Summarization #///////////////////////////////////////////////////////////////// def summarize(self, verbose=None): """ Print a summary of all the test cases that have been run by this DocTestRunner, and return a tuple `(f, t)`, where `f` is the total number of failed examples, and `t` is the total number of tried examples. The optional `verbose` argument controls how detailed the summary is. If the verbosity is not specified, then the DocTestRunner's verbosity is used. """ if verbose is None: verbose = self._verbose notests = [] passed = [] failed = [] totalt = totalf = 0 for x in self._name2ft.items(): name, (f, t) = x assert f <= t totalt += t totalf += f if t == 0: notests.append(name) elif f == 0: passed.append( (name, t) ) else: failed.append(x) if verbose: if notests: print len(notests), "items had no tests:" notests.sort() for thing in notests: print " ", thing if passed: print len(passed), "items passed all tests:" passed.sort() for thing, count in passed: print " %3d tests in %s" % (count, thing) if failed: print self.DIVIDER print len(failed), "items had failures:" failed.sort() for thing, (f, t) in failed: print " %3d of %3d in %s" % (f, t, thing) if verbose: print totalt, "tests in", len(self._name2ft), "items." print totalt - totalf, "passed and", totalf, "failed." if totalf: print "***Test Failed***", totalf, "failures." elif verbose: print "Test passed." return totalf, totalt #///////////////////////////////////////////////////////////////// # Backward compatibility cruft to maintain doctest.master. #///////////////////////////////////////////////////////////////// def merge(self, other): d = self._name2ft for name, (f, t) in other._name2ft.items(): if name in d: print "*** DocTestRunner.merge: '" + name + "' in both" \ " testers; summing outcomes." f2, t2 = d[name] f = f + f2 t = t + t2 d[name] = f, t class OutputChecker: """ A class used to check the whether the actual output from a doctest example matches the expected output. `OutputChecker` defines two methods: `check_output`, which compares a given pair of outputs, and returns true if they match; and `output_difference`, which returns a string describing the differences between two outputs. """ def check_output(self, want, got, optionflags): """ Return True iff the actual output from an example (`got`) matches the expected output (`want`). These strings are always considered to match if they are identical; but depending on what option flags the test runner is using, several non-exact match types are also possible. See the documentation for `TestRunner` for more information about option flags. """ # Handle the common case first, for efficiency: # if they're string-identical, always return true. if got == want: return True # The values True and False replaced 1 and 0 as the return # value for boolean comparisons in Python 2.3. if not (optionflags & DONT_ACCEPT_TRUE_FOR_1): if (got,want) == ("True\n", "1\n"): return True if (got,want) == ("False\n", "0\n"): return True # can be used as a special sequence to signify a # blank line, unless the DONT_ACCEPT_BLANKLINE flag is used. if not (optionflags & DONT_ACCEPT_BLANKLINE): # Replace in want with a blank line. want = re.sub('(?m)^%s\s*?$' % re.escape(BLANKLINE_MARKER), '', want) # If a line in got contains only spaces, then remove the # spaces. got = re.sub('(?m)^\s*?$', '', got) if got == want: return True # This flag causes doctest to ignore any differences in the # contents of whitespace strings. Note that this can be used # in conjunction with the ELLIPSIS flag. if optionflags & NORMALIZE_WHITESPACE: got = ' '.join(got.split()) want = ' '.join(want.split()) if got == want: return True # The ELLIPSIS flag says to let the sequence "..." in `want` # match any substring in `got`. if optionflags & ELLIPSIS: if _ellipsis_match(want, got): return True # We didn't find any match; return false. return False # Should we do a fancy diff? def _do_a_fancy_diff(self, want, got, optionflags): # Not unless they asked for a fancy diff. if not optionflags & (REPORT_UDIFF | REPORT_CDIFF | REPORT_NDIFF): return False # If expected output uses ellipsis, a meaningful fancy diff is # too hard ... or maybe not. In two real-life failures Tim saw, # a diff was a major help anyway, so this is commented out. # [todo] _ellipsis_match() knows which pieces do and don't match, # and could be the basis for a kick-ass diff in this case. ##if optionflags & ELLIPSIS and ELLIPSIS_MARKER in want: ## return False # ndiff does intraline difference marking, so can be useful even # for 1-line differences. if optionflags & REPORT_NDIFF: return True # The other diff types need at least a few lines to be helpful. return want.count('\n') > 2 and got.count('\n') > 2 def output_difference(self, example, got, optionflags): """ Return a string describing the differences between the expected output for a given example (`example`) and the actual output (`got`). `optionflags` is the set of option flags used to compare `want` and `got`. """ want = example.want # If s are being used, then replace blank lines # with in the actual output string. if not (optionflags & DONT_ACCEPT_BLANKLINE): got = re.sub('(?m)^[ ]*(?=\n)', BLANKLINE_MARKER, got) # Check if we should use diff. if self._do_a_fancy_diff(want, got, optionflags): # Split want & got into lines. want_lines = want.splitlines(True) # True == keep line ends got_lines = got.splitlines(True) # Use difflib to find their differences. if optionflags & REPORT_UDIFF: diff = difflib.unified_diff(want_lines, got_lines, n=2) diff = list(diff)[2:] # strip the diff header kind = 'unified diff with -expected +actual' elif optionflags & REPORT_CDIFF: diff = difflib.context_diff(want_lines, got_lines, n=2) diff = list(diff)[2:] # strip the diff header kind = 'context diff with expected followed by actual' elif optionflags & REPORT_NDIFF: engine = difflib.Differ(charjunk=difflib.IS_CHARACTER_JUNK) diff = list(engine.compare(want_lines, got_lines)) kind = 'ndiff with -expected +actual' else: assert 0, 'Bad diff option' # Remove trailing whitespace on diff output. diff = [line.rstrip() + '\n' for line in diff] return 'Differences (%s):\n' % kind + _indent(''.join(diff)) # If we're not using diff, then simply list the expected # output followed by the actual output. if want and got: return 'Expected:\n%sGot:\n%s' % (_indent(want), _indent(got)) elif want: return 'Expected:\n%sGot nothing\n' % _indent(want) elif got: return 'Expected nothing\nGot:\n%s' % _indent(got) else: return 'Expected nothing\nGot nothing\n' class DocTestFailure(Exception): """A DocTest example has failed in debugging mode. The exception instance has variables: - test: the DocTest object being run - excample: the Example object that failed - got: the actual output """ def __init__(self, test, example, got): self.test = test self.example = example self.got = got def __str__(self): return str(self.test) class UnexpectedException(Exception): """A DocTest example has encountered an unexpected exception The exception instance has variables: - test: the DocTest object being run - excample: the Example object that failed - exc_info: the exception info """ def __init__(self, test, example, exc_info): self.test = test self.example = example self.exc_info = exc_info def __str__(self): return str(self.test) class DebugRunner(DocTestRunner): r"""Run doc tests but raise an exception as soon as there is a failure. If an unexpected exception occurs, an UnexpectedException is raised. It contains the test, the example, and the original exception: >>> runner = DebugRunner(verbose=False) >>> test = DocTestParser().get_doctest('>>> raise KeyError\n42', ... {}, 'foo', 'foo.py', 0) >>> try: ... runner.run(test) ... except UnexpectedException, failure: ... pass >>> failure.test is test True >>> failure.example.want '42\n' >>> exc_info = failure.exc_info >>> raise exc_info[0], exc_info[1], exc_info[2] Traceback (most recent call last): ... KeyError We wrap the original exception to give the calling application access to the test and example information. If the output doesn't match, then a DocTestFailure is raised: >>> test = DocTestParser().get_doctest(''' ... >>> x = 1 ... >>> x ... 2 ... ''', {}, 'foo', 'foo.py', 0) >>> try: ... runner.run(test) ... except DocTestFailure, failure: ... pass DocTestFailure objects provide access to the test: >>> failure.test is test True As well as to the example: >>> failure.example.want '2\n' and the actual output: >>> failure.got '1\n' If a failure or error occurs, the globals are left intact: >>> del test.globs['__builtins__'] >>> test.globs {'x': 1} >>> test = DocTestParser().get_doctest(''' ... >>> x = 2 ... >>> raise KeyError ... ''', {}, 'foo', 'foo.py', 0) >>> runner.run(test) Traceback (most recent call last): ... UnexpectedException: >>> del test.globs['__builtins__'] >>> test.globs {'x': 2} But the globals are cleared if there is no error: >>> test = DocTestParser().get_doctest(''' ... >>> x = 2 ... ''', {}, 'foo', 'foo.py', 0) >>> runner.run(test) (0, 1) >>> test.globs {} """ def run(self, test, compileflags=None, out=None, clear_globs=True): r = DocTestRunner.run(self, test, compileflags, out, False) if clear_globs: test.globs.clear() return r def report_unexpected_exception(self, out, test, example, exc_info): raise UnexpectedException(test, example, exc_info) def report_failure(self, out, test, example, got): raise DocTestFailure(test, example, got) ###################################################################### ## 6. Test Functions ###################################################################### # These should be backwards compatible. # For backward compatibility, a global instance of a DocTestRunner # class, updated by testmod. master = None def testmod(m=None, name=None, globs=None, verbose=None, isprivate=None, report=True, optionflags=0, extraglobs=None, raise_on_error=False, exclude_empty=False): """m=None, name=None, globs=None, verbose=None, isprivate=None, report=True, optionflags=0, extraglobs=None, raise_on_error=False, exclude_empty=False Test examples in docstrings in functions and classes reachable from module m (or the current module if m is not supplied), starting with m.__doc__. Unless isprivate is specified, private names are not skipped. Also test examples reachable from dict m.__test__ if it exists and is not None. m.__test__ maps names to functions, classes and strings; function and class docstrings are tested even if the name is private; strings are tested directly, as if they were docstrings. Return (#failures, #tests). See doctest.__doc__ for an overview. Optional keyword arg "name" gives the name of the module; by default use m.__name__. Optional keyword arg "globs" gives a dict to be used as the globals when executing examples; by default, use m.__dict__. A copy of this dict is actually used for each docstring, so that each docstring's examples start with a clean slate. Optional keyword arg "extraglobs" gives a dictionary that should be merged into the globals that are used to execute examples. By default, no extra globals are used. This is new in 2.4. Optional keyword arg "verbose" prints lots of stuff if true, prints only failures if false; by default, it's true iff "-v" is in sys.argv. Optional keyword arg "report" prints a summary at the end when true, else prints nothing at the end. In verbose mode, the summary is detailed, else very brief (in fact, empty if all tests passed). Optional keyword arg "optionflags" or's together module constants, and defaults to 0. This is new in 2.3. Possible values (see the docs for details): DONT_ACCEPT_TRUE_FOR_1 DONT_ACCEPT_BLANKLINE NORMALIZE_WHITESPACE ELLIPSIS IGNORE_EXCEPTION_DETAIL REPORT_UDIFF REPORT_CDIFF REPORT_NDIFF REPORT_ONLY_FIRST_FAILURE Optional keyword arg "raise_on_error" raises an exception on the first unexpected exception or failure. This allows failures to be post-mortem debugged. Deprecated in Python 2.4: Optional keyword arg "isprivate" specifies a function used to determine whether a name is private. The default function is treat all functions as public. Optionally, "isprivate" can be set to doctest.is_private to skip over functions marked as private using the underscore naming convention; see its docs for details. Advanced tomfoolery: testmod runs methods of a local instance of class doctest.Tester, then merges the results into (or creates) global Tester instance doctest.master. Methods of doctest.master can be called directly too, if you want to do something unusual. Passing report=0 to testmod is especially useful then, to delay displaying a summary. Invoke doctest.master.summarize(verbose) when you're done fiddling. """ global master if isprivate is not None: warnings.warn("the isprivate argument is deprecated; " "examine DocTestFinder.find() lists instead", DeprecationWarning) # If no module was given, then use __main__. if m is None: # DWA - m will still be None if this wasn't invoked from the command # line, in which case the following TypeError is about as good an error # as we should expect m = sys.modules.get('__main__') # Check that we were actually given a module. if not inspect.ismodule(m): raise TypeError("testmod: module required; %r" % (m,)) # If no name was given, then use the module's name. if name is None: name = m.__name__ # Find, parse, and run all tests in the given module. finder = DocTestFinder(_namefilter=isprivate, exclude_empty=exclude_empty) if raise_on_error: runner = DebugRunner(verbose=verbose, optionflags=optionflags) else: runner = DocTestRunner(verbose=verbose, optionflags=optionflags) for test in finder.find(m, name, globs=globs, extraglobs=extraglobs): runner.run(test) if report: runner.summarize() if master is None: master = runner else: master.merge(runner) return runner.failures, runner.tries def testfile(filename, module_relative=True, name=None, package=None, globs=None, verbose=None, report=True, optionflags=0, extraglobs=None, raise_on_error=False, parser=DocTestParser()): """ Test examples in the given file. Return (#failures, #tests). Optional keyword arg "module_relative" specifies how filenames should be interpreted: - If "module_relative" is True (the default), then "filename" specifies a module-relative path. By default, this path is relative to the calling module's directory; but if the "package" argument is specified, then it is relative to that package. To ensure os-independence, "filename" should use "/" characters to separate path segments, and should not be an absolute path (i.e., it may not begin with "/"). - If "module_relative" is False, then "filename" specifies an os-specific path. The path may be absolute or relative (to the current working directory). Optional keyword arg "name" gives the name of the test; by default use the file's basename. Optional keyword argument "package" is a Python package or the name of a Python package whose directory should be used as the base directory for a module relative filename. If no package is specified, then the calling module's directory is used as the base directory for module relative filenames. It is an error to specify "package" if "module_relative" is False. Optional keyword arg "globs" gives a dict to be used as the globals when executing examples; by default, use {}. A copy of this dict is actually used for each docstring, so that each docstring's examples start with a clean slate. Optional keyword arg "extraglobs" gives a dictionary that should be merged into the globals that are used to execute examples. By default, no extra globals are used. Optional keyword arg "verbose" prints lots of stuff if true, prints only failures if false; by default, it's true iff "-v" is in sys.argv. Optional keyword arg "report" prints a summary at the end when true, else prints nothing at the end. In verbose mode, the summary is detailed, else very brief (in fact, empty if all tests passed). Optional keyword arg "optionflags" or's together module constants, and defaults to 0. Possible values (see the docs for details): DONT_ACCEPT_TRUE_FOR_1 DONT_ACCEPT_BLANKLINE NORMALIZE_WHITESPACE ELLIPSIS IGNORE_EXCEPTION_DETAIL REPORT_UDIFF REPORT_CDIFF REPORT_NDIFF REPORT_ONLY_FIRST_FAILURE Optional keyword arg "raise_on_error" raises an exception on the first unexpected exception or failure. This allows failures to be post-mortem debugged. Optional keyword arg "parser" specifies a DocTestParser (or subclass) that should be used to extract tests from the files. Advanced tomfoolery: testmod runs methods of a local instance of class doctest.Tester, then merges the results into (or creates) global Tester instance doctest.master. Methods of doctest.master can be called directly too, if you want to do something unusual. Passing report=0 to testmod is especially useful then, to delay displaying a summary. Invoke doctest.master.summarize(verbose) when you're done fiddling. """ global master if package and not module_relative: raise ValueError("Package may only be specified for module-" "relative paths.") # Relativize the path if module_relative: package = _normalize_module(package) filename = _module_relative_path(package, filename) # If no name was given, then use the file's name. if name is None: name = os.path.basename(filename) # Assemble the globals. if globs is None: globs = {} else: globs = globs.copy() if extraglobs is not None: globs.update(extraglobs) if raise_on_error: runner = DebugRunner(verbose=verbose, optionflags=optionflags) else: runner = DocTestRunner(verbose=verbose, optionflags=optionflags) # Read the file, convert it to a test, and run it. s = open(filename).read() test = parser.get_doctest(s, globs, name, filename, 0) runner.run(test) if report: runner.summarize() if master is None: master = runner else: master.merge(runner) return runner.failures, runner.tries def run_docstring_examples(f, globs, verbose=False, name="NoName", compileflags=None, optionflags=0): """ Test examples in the given object's docstring (`f`), using `globs` as globals. Optional argument `name` is used in failure messages. If the optional argument `verbose` is true, then generate output even if there are no failures. `compileflags` gives the set of flags that should be used by the Python compiler when running the examples. If not specified, then it will default to the set of future-import flags that apply to `globs`. Optional keyword arg `optionflags` specifies options for the testing and output. See the documentation for `testmod` for more information. """ # Find, parse, and run all tests in the given module. finder = DocTestFinder(verbose=verbose, recurse=False) runner = DocTestRunner(verbose=verbose, optionflags=optionflags) for test in finder.find(f, name, globs=globs): runner.run(test, compileflags=compileflags) ###################################################################### ## 7. Tester ###################################################################### # This is provided only for backwards compatibility. It's not # actually used in any way. class Tester: def __init__(self, mod=None, globs=None, verbose=None, isprivate=None, optionflags=0): warnings.warn("class Tester is deprecated; " "use class doctest.DocTestRunner instead", DeprecationWarning, stacklevel=2) if mod is None and globs is None: raise TypeError("Tester.__init__: must specify mod or globs") if mod is not None and not inspect.ismodule(mod): raise TypeError("Tester.__init__: mod must be a module; %r" % (mod,)) if globs is None: globs = mod.__dict__ self.globs = globs self.verbose = verbose self.isprivate = isprivate self.optionflags = optionflags self.testfinder = DocTestFinder(_namefilter=isprivate) self.testrunner = DocTestRunner(verbose=verbose, optionflags=optionflags) def runstring(self, s, name): test = DocTestParser().get_doctest(s, self.globs, name, None, None) if self.verbose: print "Running string", name (f,t) = self.testrunner.run(test) if self.verbose: print f, "of", t, "examples failed in string", name return (f,t) def rundoc(self, object, name=None, module=None): f = t = 0 tests = self.testfinder.find(object, name, module=module, globs=self.globs) for test in tests: (f2, t2) = self.testrunner.run(test) (f,t) = (f+f2, t+t2) return (f,t) def rundict(self, d, name, module=None): import new m = new.module(name) m.__dict__.update(d) if module is None: module = False return self.rundoc(m, name, module) def run__test__(self, d, name): import new m = new.module(name) m.__test__ = d return self.rundoc(m, name) def summarize(self, verbose=None): return self.testrunner.summarize(verbose) def merge(self, other): self.testrunner.merge(other.testrunner) ###################################################################### ## 8. Unittest Support ###################################################################### _unittest_reportflags = 0 def set_unittest_reportflags(flags): """Sets the unittest option flags. The old flag is returned so that a runner could restore the old value if it wished to: >>> old = _unittest_reportflags >>> set_unittest_reportflags(REPORT_NDIFF | ... REPORT_ONLY_FIRST_FAILURE) == old True >>> import doctest >>> doctest._unittest_reportflags == (REPORT_NDIFF | ... REPORT_ONLY_FIRST_FAILURE) True Only reporting flags can be set: >>> set_unittest_reportflags(ELLIPSIS) Traceback (most recent call last): ... ValueError: ('Only reporting flags allowed', 8) >>> set_unittest_reportflags(old) == (REPORT_NDIFF | ... REPORT_ONLY_FIRST_FAILURE) True """ global _unittest_reportflags if (flags & REPORTING_FLAGS) != flags: raise ValueError("Only reporting flags allowed", flags) old = _unittest_reportflags _unittest_reportflags = flags return old class DocTestCase(unittest.TestCase): def __init__(self, test, optionflags=0, setUp=None, tearDown=None, checker=None): unittest.TestCase.__init__(self) self._dt_optionflags = optionflags self._dt_checker = checker self._dt_test = test self._dt_setUp = setUp self._dt_tearDown = tearDown def setUp(self): test = self._dt_test if self._dt_setUp is not None: self._dt_setUp(test) def tearDown(self): test = self._dt_test if self._dt_tearDown is not None: self._dt_tearDown(test) test.globs.clear() def runTest(self): test = self._dt_test old = sys.stdout new = StringIO() optionflags = self._dt_optionflags if not (optionflags & REPORTING_FLAGS): # The option flags don't include any reporting flags, # so add the default reporting flags optionflags |= _unittest_reportflags runner = DocTestRunner(optionflags=optionflags, checker=self._dt_checker, verbose=False) try: runner.DIVIDER = "-"*70 failures, tries = runner.run( test, out=new.write, clear_globs=False) finally: sys.stdout = old if failures: raise self.failureException(self.format_failure(new.getvalue())) def format_failure(self, err): test = self._dt_test if test.lineno is None: lineno = 'unknown line number' else: lineno = '%s' % test.lineno lname = '.'.join(test.name.split('.')[-1:]) return ('Failed doctest test for %s\n' ' File "%s", line %s, in %s\n\n%s' % (test.name, test.filename, lineno, lname, err) ) def debug(self): r"""Run the test case without results and without catching exceptions The unit test framework includes a debug method on test cases and test suites to support post-mortem debugging. The test code is run in such a way that errors are not caught. This way a caller can catch the errors and initiate post-mortem debugging. The DocTestCase provides a debug method that raises UnexpectedException errors if there is an unexepcted exception: >>> test = DocTestParser().get_doctest('>>> raise KeyError\n42', ... {}, 'foo', 'foo.py', 0) >>> case = DocTestCase(test) >>> try: ... case.debug() ... except UnexpectedException, failure: ... pass The UnexpectedException contains the test, the example, and the original exception: >>> failure.test is test True >>> failure.example.want '42\n' >>> exc_info = failure.exc_info >>> raise exc_info[0], exc_info[1], exc_info[2] Traceback (most recent call last): ... KeyError If the output doesn't match, then a DocTestFailure is raised: >>> test = DocTestParser().get_doctest(''' ... >>> x = 1 ... >>> x ... 2 ... ''', {}, 'foo', 'foo.py', 0) >>> case = DocTestCase(test) >>> try: ... case.debug() ... except DocTestFailure, failure: ... pass DocTestFailure objects provide access to the test: >>> failure.test is test True As well as to the example: >>> failure.example.want '2\n' and the actual output: >>> failure.got '1\n' """ self.setUp() runner = DebugRunner(optionflags=self._dt_optionflags, checker=self._dt_checker, verbose=False) runner.run(self._dt_test) self.tearDown() def id(self): return self._dt_test.name def __repr__(self): name = self._dt_test.name.split('.') return "%s (%s)" % (name[-1], '.'.join(name[:-1])) __str__ = __repr__ def shortDescription(self): return "Doctest: " + self._dt_test.name def DocTestSuite(module=None, globs=None, extraglobs=None, test_finder=None, **options): """ Convert doctest tests for a module to a unittest test suite. This converts each documentation string in a module that contains doctest tests to a unittest test case. If any of the tests in a doc string fail, then the test case fails. An exception is raised showing the name of the file containing the test and a (sometimes approximate) line number. The `module` argument provides the module to be tested. The argument can be either a module or a module name. If no argument is given, the calling module is used. A number of options may be provided as keyword arguments: setUp A set-up function. This is called before running the tests in each file. The setUp function will be passed a DocTest object. The setUp function can access the test globals as the globs attribute of the test passed. tearDown A tear-down function. This is called after running the tests in each file. The tearDown function will be passed a DocTest object. The tearDown function can access the test globals as the globs attribute of the test passed. globs A dictionary containing initial global variables for the tests. optionflags A set of doctest option flags expressed as an integer. """ if test_finder is None: test_finder = DocTestFinder() module = _normalize_module(module) tests = test_finder.find(module, globs=globs, extraglobs=extraglobs) if globs is None: globs = module.__dict__ if not tests: # Why do we want to do this? Because it reveals a bug that might # otherwise be hidden. raise ValueError(module, "has no tests") tests.sort() suite = unittest.TestSuite() for test in tests: if len(test.examples) == 0: continue if not test.filename: filename = module.__file__ if filename[-4:] in (".pyc", ".pyo"): filename = filename[:-1] test.filename = filename suite.addTest(DocTestCase(test, **options)) return suite class DocFileCase(DocTestCase): def id(self): return '_'.join(self._dt_test.name.split('.')) def __repr__(self): return self._dt_test.filename __str__ = __repr__ def format_failure(self, err): return ('Failed doctest test for %s\n File "%s", line 0\n\n%s' % (self._dt_test.name, self._dt_test.filename, err) ) def DocFileTest(path, module_relative=True, package=None, globs=None, parser=DocTestParser(), **options): if globs is None: globs = {} if package and not module_relative: raise ValueError("Package may only be specified for module-" "relative paths.") # Relativize the path. if module_relative: package = _normalize_module(package) path = _module_relative_path(package, path) # Find the file and read it. name = os.path.basename(path) doc = open(path).read() # Convert it to a test, and wrap it in a DocFileCase. test = parser.get_doctest(doc, globs, name, path, 0) return DocFileCase(test, **options) def DocFileSuite(*paths, **kw): """A unittest suite for one or more doctest files. The path to each doctest file is given as a string; the interpretation of that string depends on the keyword argument "module_relative". A number of options may be provided as keyword arguments: module_relative If "module_relative" is True, then the given file paths are interpreted as os-independent module-relative paths. By default, these paths are relative to the calling module's directory; but if the "package" argument is specified, then they are relative to that package. To ensure os-independence, "filename" should use "/" characters to separate path segments, and may not be an absolute path (i.e., it may not begin with "/"). If "module_relative" is False, then the given file paths are interpreted as os-specific paths. These paths may be absolute or relative (to the current working directory). package A Python package or the name of a Python package whose directory should be used as the base directory for module relative paths. If "package" is not specified, then the calling module's directory is used as the base directory for module relative filenames. It is an error to specify "package" if "module_relative" is False. setUp A set-up function. This is called before running the tests in each file. The setUp function will be passed a DocTest object. The setUp function can access the test globals as the globs attribute of the test passed. tearDown A tear-down function. This is called after running the tests in each file. The tearDown function will be passed a DocTest object. The tearDown function can access the test globals as the globs attribute of the test passed. globs A dictionary containing initial global variables for the tests. optionflags A set of doctest option flags expressed as an integer. parser A DocTestParser (or subclass) that should be used to extract tests from the files. """ suite = unittest.TestSuite() # We do this here so that _normalize_module is called at the right # level. If it were called in DocFileTest, then this function # would be the caller and we might guess the package incorrectly. if kw.get('module_relative', True): kw['package'] = _normalize_module(kw.get('package')) for path in paths: suite.addTest(DocFileTest(path, **kw)) return suite ###################################################################### ## 9. Debugging Support ###################################################################### def script_from_examples(s): r"""Extract script from text with examples. Converts text with examples to a Python script. Example input is converted to regular code. Example output and all other words are converted to comments: >>> text = ''' ... Here are examples of simple math. ... ... Python has super accurate integer addition ... ... >>> 2 + 2 ... 5 ... ... And very friendly error messages: ... ... >>> 1/0 ... To Infinity ... And ... Beyond ... ... You can use logic if you want: ... ... >>> if 0: ... ... blah ... ... blah ... ... ... ... Ho hum ... ''' >>> print script_from_examples(text) # Here are examples of simple math. # # Python has super accurate integer addition # 2 + 2 # Expected: ## 5 # # And very friendly error messages: # 1/0 # Expected: ## To Infinity ## And ## Beyond # # You can use logic if you want: # if 0: blah blah # # Ho hum """ output = [] for piece in DocTestParser().parse(s): if isinstance(piece, Example): # Add the example's source code (strip trailing NL) output.append(piece.source[:-1]) # Add the expected output: want = piece.want if want: output.append('# Expected:') output += ['## '+l for l in want.split('\n')[:-1]] else: # Add non-example text. output += [_comment_line(l) for l in piece.split('\n')[:-1]] # Trim junk on both ends. while output and output[-1] == '#': output.pop() while output and output[0] == '#': output.pop(0) # Combine the output, and return it. return '\n'.join(output) def testsource(module, name): """Extract the test sources from a doctest docstring as a script. Provide the module (or dotted name of the module) containing the test to be debugged and the name (within the module) of the object with the doc string with tests to be debugged. """ module = _normalize_module(module) tests = DocTestFinder().find(module) test = [t for t in tests if t.name == name] if not test: raise ValueError(name, "not found in tests") test = test[0] testsrc = script_from_examples(test.docstring) return testsrc def debug_src(src, pm=False, globs=None): """Debug a single doctest docstring, in argument `src`'""" testsrc = script_from_examples(src) debug_script(testsrc, pm, globs) def debug_script(src, pm=False, globs=None): "Debug a test script. `src` is the script, as a string." import pdb # Note that tempfile.NameTemporaryFile() cannot be used. As the # docs say, a file so created cannot be opened by name a second time # on modern Windows boxes, and execfile() needs to open it. srcfilename = tempfile.mktemp(".py", "doctestdebug") f = open(srcfilename, 'w') f.write(src) f.close() try: if globs: globs = globs.copy() else: globs = {} if pm: try: execfile(srcfilename, globs, globs) except: print sys.exc_info()[1] pdb.post_mortem(sys.exc_info()[2]) else: # Note that %r is vital here. '%s' instead can, e.g., cause # backslashes to get treated as metacharacters on Windows. pdb.run("execfile(%r)" % srcfilename, globs, globs) finally: os.remove(srcfilename) def debug(module, name, pm=False): """Debug a single doctest docstring. Provide the module (or dotted name of the module) containing the test to be debugged and the name (within the module) of the object with the docstring with tests to be debugged. """ module = _normalize_module(module) testsrc = testsource(module, name) debug_script(testsrc, pm, module.__dict__) ###################################################################### ## 10. Example Usage ###################################################################### class _TestClass: """ A pointless class, for sanity-checking of docstring testing. Methods: square() get() >>> _TestClass(13).get() + _TestClass(-12).get() 1 >>> hex(_TestClass(13).square().get()) '0xa9' """ def __init__(self, val): """val -> _TestClass object with associated value val. >>> t = _TestClass(123) >>> print t.get() 123 """ self.val = val def square(self): """square() -> square TestClass's associated value >>> _TestClass(13).square().get() 169 """ self.val = self.val ** 2 return self def get(self): """get() -> return TestClass's associated value. >>> x = _TestClass(-42) >>> print x.get() -42 """ return self.val __test__ = {"_TestClass": _TestClass, "string": r""" Example of a string object, searched as-is. >>> x = 1; y = 2 >>> x + y, x * y (3, 2) """, "bool-int equivalence": r""" In 2.2, boolean expressions displayed 0 or 1. By default, we still accept them. This can be disabled by passing DONT_ACCEPT_TRUE_FOR_1 to the new optionflags argument. >>> 4 == 4 1 >>> 4 == 4 True >>> 4 > 4 0 >>> 4 > 4 False """, "blank lines": r""" Blank lines can be marked with : >>> print 'foo\n\nbar\n' foo bar """, "ellipsis": r""" If the ellipsis flag is used, then '...' can be used to elide substrings in the desired output: >>> print range(1000) #doctest: +ELLIPSIS [0, 1, 2, ..., 999] """, "whitespace normalization": r""" If the whitespace normalization flag is used, then differences in whitespace are ignored. >>> print range(30) #doctest: +NORMALIZE_WHITESPACE [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29] """, } def _test(): r = unittest.TextTestRunner() r.run(DocTestSuite()) if __name__ == "__main__": _test() PKKŸC8ó÷GüŽfŽfprotocols/tests/checks.pyo;ò µÆBc @s.dZddddddddd d g Zd klZlZlZd kTd „Zd„Zdefd„ƒYZ de fd„ƒYZ dfd„ƒYZ de fd„ƒYZ de fd„ƒYZ de fd„ƒYZd fd„ƒYZdefd„ƒYZd„Zd„Zd„Zd„ZdS(sBasic test setupssTestBasesImplementationCheckssProviderCheckssInstanceImplementationCheckssmakeClassTestssClassProvidesCheckssAdaptiveCheckssSimpleAdaptiveCheckssmakeMetaClassProvidesTestssBasicClassProvidesChecks(sTestCases makeSuites TestSuite(s*cCsd|fSdS(Nsa1(sob(sob((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysa1scCsd|fSdS(Nsa2(sob(sob((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysa2scBs€tZdZeeƒZeeƒZd„Zd„Zd„Zd„Z d„Z d„Z d„Z d„Z d „Zd „ZRS( sNon-adapter instance testscCsdS(N((sself((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysassertObProvidesOnlyA1s cCsdS(N((sself((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysassertObProvidesAandB8s cCs0y|i||ƒWntj o }nXdS(N(sselfsdeclareObAdaptssa2sifacess TypeErrorsv(sselfsa1sa2sd1sd2sifacessv((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysassertAmbiguous?scCs |ƒSdS(N(sklass(sselfsklass((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysmakeEscs dˆif‡d†ƒY}dS(NsICcs9tZedˆigƒdeƒjoeƒd=nRS(NsprotocolIsSubsetOfsself(s__name__s __module__sadvisesselfsIAslocals((sself(s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysICLs(sselfs InterfacesIC(sselfsIC((sselfs:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysassertObProvidesSubsetOfAIscCs:d|fd„ƒY}d|fd„ƒY}||fSdS(NsM1cBstZRS(N(s__name__s __module__(((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysM1TssM2cBstZRS(N(s__name__s __module__(((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysM2Us(sbasesM1sM2(sselfsbasesM1sM2((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pys setupBasesSscCsdS(N((sselfsM1sM2((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pys#assertM1ProvidesOnlyAandM2ProvidesBYscCs*y|f|_Wntj onXdS(N(sM2sM1s __bases__s TypeError(sselfsM1sM2sm1sm2((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pys#assertChangingBasesChangesInterface_s cCsdS(N((sselfsICsID((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysassertObProvidesABCDhscCsdS(N((sselfsICsID((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysassertObProvidesCandDnotAorBns(s__name__s __module__s__doc__s staticmethodsa1sa2sassertObProvidesOnlyAsassertObProvidesAandBsassertAmbiguoussmakesassertObProvidesSubsetOfAs setupBasess#assertM1ProvidesOnlyAandM2ProvidesBs#assertChangingBasesChangesInterfacesassertObProvidesABCDsassertObProvidesCandDnotAorB(((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysTestBase*s          cBs2tZdZd„Zd„Zd„Zd„ZRS(s+Non-adapter specific-object-provides checkscCst|id|ƒdS(Nsprovides(s adviseObjectsselfsobsifaces(sselfsifaces((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysdeclareObImplements€scCs t|d|d|igƒdS(Nsprovidess forObjects(sdeclareAdaptersfactorysifacessselfsob(sselfsfactorysifaces((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysdeclareObAdaptsƒscCs!|i|igƒ|iƒdS(N(sselfsdeclareObImplementssIAsassertObProvidesOnlyA(sself((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pyscheckSimpleRegister†scCs!|i|igƒ|iƒdS(N(sselfsdeclareObImplementssIBsassertObProvidesAandB(sself((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pyscheckImpliedRegisterŠs(s__name__s __module__s__doc__sdeclareObImplementssdeclareObAdaptsscheckSimpleRegisterscheckImpliedRegister(((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysProviderChecks|s    cBs tZdZd„Zd„ZRS(s}Simple adapter-oriented checks that Twisted can handle (Well, it handles them as long as all the interfaces are Twisted)cCs!|i|igƒ|iƒdS(N(sselfsdeclareObImplementssIAsassertObProvidesSubsetOfA(sself((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pyscheckDelayedImplication«scCs‚d|ifd„ƒY}d|fd„ƒY}|i|gƒ|i||ƒttd|igd|gƒ|i ||ƒdS(NsICcBstZRS(N(s__name__s __module__(((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysIC·ssIDcBstZRS(N(s__name__s __module__(((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysID¸ssprovidess forProtocols( sselfs InterfacesICsIDsdeclareObImplementssassertObProvidesCandDnotAorBsdeclareAdaptersNO_ADAPTER_NEEDEDsIBsassertObProvidesABCD(sselfsICsID((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pyscheckIndirectImplication°s (s__name__s __module__s__doc__scheckDelayedImplicationscheckIndirectImplication(((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysSimpleAdaptiveChecks¥s  cBs2tZdZd„Zd„Zd„Zd„ZRS(sLGeneral adapter/protocol implication checks Twisted can't handle these.cCsB|i|i|igƒ|i|i|idd|igƒdS(Ni(sselfsdeclareObAdaptssa1sIAsassertAmbiguoussa2(sself((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pyscheckAmbiguityÔscCs6|i|i|igƒ|i|i|igƒdS(N(sselfsdeclareObAdaptssa1sIBsa2sIA(sself((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pyscheckOverrideDepthØscCsXd|ifd„ƒY}t|id|gd|igƒ|i|i|igƒdS(NsICcBstZRS(N(s__name__s __module__(((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysICássprovidess forProtocols(sselfs InterfacesICsdeclareAdaptersa2sIAsdeclareObAdaptssa1(sselfsIC((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pys checkComposedàs"cCsC|it|igƒ|i|igƒ|it|igƒdS(N(sselfsdeclareObAdaptssDOES_NOT_SUPPORTsIAsdeclareObImplements(sself((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pyscheckLateDefinitionçs (s__name__s __module__s__doc__scheckAmbiguityscheckOverrideDepths checkComposedscheckLateDefinition(((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysAdaptiveChecksÎs    cBs2tZdZd„Zd„Zd„Zd„ZRS(s*Non-adapter class-instances-provide checkscCst|i|ƒdS(N(sdeclareImplementationsselfsklasssifaces(sselfsifaces((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysdeclareObImplementsýscCs t|d|d|igƒdS(NsprovidessforTypes(sdeclareAdaptersfactorysifacessselfsklass(sselfsfactorysifaces((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysdeclareObAdaptsscCs!|i|igƒ|iƒdS(N(sselfsdeclareObImplementssIAsassertObProvidesOnlyA(sself((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pyscheckSimpleRegisterscCs!|i|igƒ|iƒdS(N(sselfsdeclareObImplementssIBsassertObProvidesAandB(sself((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pyscheckImpliedRegisters(s__name__s __module__s__doc__sdeclareObImplementssdeclareObAdaptsscheckSimpleRegisterscheckImpliedRegister(((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysInstanceImplementationChecks÷s    cBs)tZdZd„Zd„Zd„ZRS(s4Non-adapter class-instances vs. class-provide checkscCs|i|igƒdS(N(sselfsdeclareObImplementssIA(sself((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pyscheckNoClassPassThruscCs?|i|igƒd|ifd„ƒY}|i|ƒ}dS(NsSubcBstZRS(N(s__name__s __module__(((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysSubs(sselfsdeclareObImplementssIBsklasssSubsmakesinst(sselfsinstsSub((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pyscheckInheritedDeclarationscsXˆiˆigƒdˆif‡d†ƒY}ˆi|ƒ}t|dˆigƒdS(NsSubcstZedˆigƒRS(NsinstancesDoNotProvide(s__name__s __module__sadvisesselfsIB((sself(s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysSub#ssinstancesProvide(sselfsdeclareObImplementssIBsklasssSubsmakesinstsdeclareImplementation(sselfsinstsSub((sselfs:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pys checkRejectInheritanceAndReplace s(s__name__s __module__s__doc__scheckNoClassPassThruscheckInheritedDeclarations checkRejectInheritanceAndReplace(((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysImplementationChecks s   cBs tZdZd„Zd„ZRS(s,Object-provides checks for classes and typescCs)|iƒ}t|id|igƒdS(Nsprovides(sselfsobsinsts adviseObjectsIA(sselfsinst((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pyscheckNoInstancePassThruOs cCsn|i|iƒ\}}t|d|igƒt|d|igƒ|i||ƒ|i ||||ƒdS(Nsprovides( sselfs setupBasessobsM1sM2s adviseObjectsIAsIBs#assertM1ProvidesOnlyAandM2ProvidesBs#assertChangingBasesChangesInterface(sselfsM1sM2((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pyscheckChangingBasesTs (s__name__s __module__s__doc__scheckNoInstancePassThruscheckChangingBases(((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysBasicClassProvidesChecksIs  cBstZd„Zd„ZRS(NcCs6d|ifd„ƒY}t|id|igƒdS(NsSubcBstZRS(N(s__name__s __module__(((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysSubassprovides(sselfsobsSubs adviseObjectsIB(sselfsSub((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pyscheckInheritedDeclaration`scsOtˆidˆigƒdˆif‡d†ƒY}t|dˆigƒdS(NsprovidessSubcstZedˆigƒRS(NsclassDoesNotProvide(s__name__s __module__sadvisesselfsIB((sself(s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysSubjs(s adviseObjectsselfsobsIBsSub(sselfsSub((sselfs:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pys checkRejectInheritanceAndReplacegs (s__name__s __module__scheckInheritedDeclarations checkRejectInheritanceAndReplace(((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysClassProvidesChecks\s csrd|fd„ƒY}d|fd„ƒY}d|f‡d†ƒY}d|f‡d†ƒY}||||fSd S( s=Generate a set of instance-oriented test classes using 'base'sAdviseFunctioncBstZd„ZRS(NcCsd„}||_dS(NcCsdS(N((sfoosbar((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysaFuncxs(saFuncsselfsob(sselfsaFunc((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pyssetUpws (s__name__s __module__ssetUp(((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysAdviseFunctionvss AdviseModulecBstZd„ZRS(NcCs dkl}|dƒ|_dS(N(s ModuleTypesx(stypess ModuleTypesselfsob(sselfs ModuleType((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pyssetUp}s (s__name__s __module__ssetUp(((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pys AdviseModule|ssAdviseInstancecstZ‡d†Zd„ZRS(Ncsˆƒ|_dS(N(s Picklablesselfsob(sself(s Picklable(s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pyssetUp‚scCsEdkl}l}t|id|igƒ|||iƒƒ}dS(N(sloadssdumpssprovides(scPicklesloadssdumpss adviseObjectsselfsobsIPuresnewOb(sselfsdumpssnewObsloads((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pys checkPickling…s(s__name__s __module__ssetUps checkPickling((s Picklable(s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysAdviseInstances sAdviseNewInstancecstZ‡d†ZRS(Ncsˆƒ|_dS(N(sNewStylesselfsob(sself(sNewStyle(s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pyssetUpŒs(s__name__s __module__ssetUp((sNewStyle(s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysAdviseNewInstance‹sN(sbasesAdviseFunctions AdviseModulesAdviseInstancesAdviseNewInstance(sbases PicklablesNewStyles AdviseModulesAdviseFunctionsAdviseInstancesAdviseNewInstance((s PicklablesNewStyles:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysmakeInstanceTestsrs  cCs:d|fd„ƒY}d|fd„ƒY}||fSdS(sCGenerate a set of class-provides-oriented test classes using 'base's AdviseClasscBstZd„ZRS(NcCs dfd„ƒY}||_dS(NsClassiccBstZRS(N(s__name__s __module__(((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysClassic s(sClassicsselfsob(sselfsClassic((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pyssetUpŸs(s__name__s __module__ssetUp(((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pys AdviseClassžss AdviseTypecBstZd„ZRS(NcCs#dtfd„ƒY}||_dS(NsClasscBstZRS(N(s__name__s __module__(((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysClass¦s(sobjectsClasssselfsob(sselfsClass((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pyssetUp¥s(s__name__s __module__ssetUp(((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pys AdviseType¤sN(sbases AdviseClasss AdviseType(sbases AdviseTypes AdviseClass((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysmakeClassProvidesTests›scCs:d|fd„ƒY}d|fd„ƒY}||fSdS(sCGenerate a set of class-provides-oriented test classes using 'base'sAdviseMixinClasscBstZd„ZRS(Ncs?dttfd„ƒY‰dtf‡d†ƒY}||_dS(NsMetacBstZRS(N(s__name__s __module__(((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysMeta·ssTestcstZˆZRS(N(s__name__s __module__sMetas __metaclass__((sMeta(s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysTest¸s(s ProviderMixinstypesMetasobjectsTestsselfsob(sselfsMetasTest((sMetas:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pyssetUp¶s(s__name__s __module__ssetUp(((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysAdviseMixinClassµssAdviseMixinMultiMeta2cBstZd„ZRS(NcsBdttfd„ƒY‰dttf‡d†ƒY}||_dS(NsMetacBstZRS(N(s__name__s __module__(((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysMeta½ssTestcstZˆZRS(N(s__name__s __module__sMetas __metaclass__((sMeta(s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysTest¾s(s ProviderMixinstypesMetasobjectsTestsselfsob(sselfsMetasTest((sMetas:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pyssetUp¼s(s__name__s __module__ssetUp(((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysAdviseMixinMultiMeta2»sN(sbasesAdviseMixinClasssAdviseMixinMultiMeta2(sbasesAdviseMixinMultiMeta2sAdviseMixinClass((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysmakeMetaClassProvidesTests­scCsld|fd„ƒY}d|fd„ƒY}d|fd„ƒY}d|fd„ƒY}||||fSd S( s:Generate a set of class-oriented test classes using 'base's TestClassiccBstZd„ZRS(NcCs,dfd„ƒY}||_|ƒ|_dS(NsClassiccBstZRS(N(s__name__s __module__(((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysClassicËs(sClassicsselfsklasssob(sselfsClassic((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pyssetUpÊs (s__name__s __module__ssetUp(((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pys TestClassicÈss TestBuiltincBstZd„ZRS(NcCs/dtfd„ƒY}||_|ƒ|_dS(NsNewstylecBstZfZRS(N(s__name__s __module__s __slots__(((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysNewstyleÓs(slistsNewstylesselfsklasssob(sselfsNewstyle((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pyssetUpÑs (s__name__s __module__ssetUp(((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pys TestBuiltinÏss TestMetaclasscBstZd„Zd„ZRS(NcsEdtfd„ƒY‰ˆ|_dtf‡d†ƒY}||_dS(NsMetacBstZRS(N(s__name__s __module__(((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysMetaÚssBasecstZˆZRS(N(s__name__s __module__sMetas __metaclass__((sMeta(s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysBaseÜs(stypesMetasselfsklasssobjectsBasesob(sselfsBasesMeta((sMetas:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pyssetUpÙs cCs|dtfhƒSdS(NsDummy(sklasssobject(sselfsklass((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysmakeßs(s__name__s __module__ssetUpsmake(((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pys TestMetaclass×s sTestMetaInstancecBstZd„ZRS(NcsHdtfd„ƒY‰dtf‡d†ƒY}||_|ƒ|_dS(NsMetacBstZRS(N(s__name__s __module__(((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysMetaåssBasecstZˆZRS(N(s__name__s __module__sMetas __metaclass__((sMeta(s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysBaseæs(stypesMetasobjectsBasesselfsklasssob(sselfsBasesMeta((sMetas:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pyssetUpäs (s__name__s __module__ssetUp(((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysTestMetaInstanceâsN(sbases TestClassics TestBuiltins TestMetaclasssTestMetaInstance(sbases TestBuiltins TestMetaclasssTestMetaInstances TestClassic((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pysmakeClassTestsÄs  N(s__doc__s__all__sunittestsTestCases makeSuites TestSuites protocolssa1sa2sTestBasesProviderCheckssSimpleAdaptiveCheckssAdaptiveCheckssInstanceImplementationCheckssImplementationCheckssBasicClassProvidesCheckssClassProvidesCheckssmakeInstanceTestssmakeClassProvidesTestssmakeMetaClassProvidesTestssmakeClassTests(s TestSuitesTestBasesa1sImplementationCheckss__all__smakeClassTestssmakeClassProvidesTestss makeSuitesClassProvidesCheckssTestCasesProviderCheckssa2sAdaptiveCheckssmakeInstanceTestssInstanceImplementationCheckssSimpleAdaptiveCheckssmakeMetaClassProvidesTestssBasicClassProvidesChecks((s:build/bdist.darwin-8.0.1-x86/egg/protocols/tests/checks.pys?s"$  R)))= )  PKÛ\â2.¢~*  protocols/tests/test_zope.py"""Zope Interface tests""" from unittest import TestCase, makeSuite, TestSuite from protocols import * import protocols.zope_support from zope.interface import Interface # Dummy interfaces and adapters used in tests class IA(Interface): pass class IB(IA): pass class IPure(Interface): # We use this for pickle/copy tests because the other protocols # imply various dynamically created interfaces, and so any object # registered with them won't be picklable pass class Picklable: # Pickling needs classes in top-level namespace pass class NewStyle(object): pass from checks import ImplementationChecks, makeClassTests, makeInstanceTests from checks import ProviderChecks, BasicClassProvidesChecks from checks import makeMetaClassProvidesTests, AdaptiveChecks class BasicChecks(AdaptiveChecks, ImplementationChecks): IA = IA IB = IB Interface = Interface IPure = IPure class InstanceChecks(AdaptiveChecks, ProviderChecks): IA = IA IB = IB Interface = Interface IPure = IPure class ClassChecks(BasicClassProvidesChecks, ProviderChecks): IA = IA IB = IB Interface = Interface IPure = IPure TestClasses = makeClassTests(BasicChecks) TestClasses += makeMetaClassProvidesTests(ClassChecks) TestClasses += makeInstanceTests(InstanceChecks,Picklable,NewStyle) class IB(protocols.Interface): advise(protocolExtends = [IA]) class BasicChecks(AdaptiveChecks, ImplementationChecks): IA = IA IB = IB Interface = Interface IPure = IPure class InstanceChecks(AdaptiveChecks, ProviderChecks): IA = IA IB = IB Interface = Interface IPure = IPure class ClassChecks(AdaptiveChecks, BasicClassProvidesChecks, ProviderChecks): IA = IA IB = IB Interface = Interface IPure = IPure TestClasses += makeClassTests(BasicChecks) TestClasses += makeMetaClassProvidesTests(ClassChecks) TestClasses += makeInstanceTests(InstanceChecks,Picklable,NewStyle) def test_suite(): return TestSuite([makeSuite(t,'check') for t in TestClasses]) PKÛ\â2ãú‡½Q.Q.protocols/tests/checks.py"""Basic test setups""" __all__ = [ 'TestBase', 'ImplementationChecks', 'ProviderChecks', 'InstanceImplementationChecks', 'makeClassTests', 'ClassProvidesChecks', 'AdaptiveChecks', 'SimpleAdaptiveChecks', 'makeMetaClassProvidesTests', 'BasicClassProvidesChecks', ] from unittest import TestCase, makeSuite, TestSuite from protocols import * # Dummy interfaces and adapters used in tests def a1(ob): return 'a1',ob def a2(ob): return 'a2',ob class TestBase(TestCase): """Non-adapter instance tests""" a1 = staticmethod(a1) a2 = staticmethod(a2) def assertObProvidesOnlyA(self): assert self.IA(self.ob, None) is self.ob assert self.IB(self.ob, None) is None assert self.IA(None, None) is None assert adapt(self.IB, None, None) is None assert adapt(self.ob, None, None) is None def assertObProvidesAandB(self): assert self.IA(self.ob, None) is self.ob assert self.IB(self.ob, None) is self.ob assert adapt(self.IA, None, None) is None assert adapt(self.IB, None, None) is None assert adapt(self.ob, None, None) is None def assertAmbiguous(self, a1, a2, d1, d2, ifaces): try: self.declareObAdapts(a2,ifaces) except TypeError,v: assert v.args == ("Ambiguous adapter choice", a1, a2, d1, d2) def make(self,klass): # This is overridden by tests where 'klass' is a metaclass return klass() def assertObProvidesSubsetOfA(self): # Assert that self.ob provides a new subset of self.IA # (Caller must ensure that self.ob provides self.IA) class IC(self.Interface): advise(protocolIsSubsetOf=[self.IA]) if 'self' in locals(): del locals()['self'] # how the heck??? assert IC(self.ob, None) is self.ob def setupBases(self,base): class M1(base): pass class M2(base): pass return M1, M2 def assertM1ProvidesOnlyAandM2ProvidesB(self,M1,M2): assert self.IA(M1,None) is M1 assert self.IB(M1,None) is None assert self.IB(M2,None) is M2 def assertChangingBasesChangesInterface(self,M1,M2,m1,m2): try: M1.__bases__ = M2, except TypeError: # XXX 2.2 doesn't let newstyle __bases__ change pass else: assert self.IA(m1,None) is m1 assert self.IB(m1,None) is m1 def assertObProvidesABCD(self,IC,ID): assert self.IA(self.ob, None) is self.ob assert self.IB(self.ob, None) is self.ob assert IC(self.ob, None) is self.ob assert ID(self.ob, None) is self.ob def assertObProvidesCandDnotAorB(self,IC,ID): assert self.IA(self.ob, None) is None assert self.IB(self.ob, None) is None assert IC(self.ob, None) is self.ob assert ID(self.ob, None) is self.ob class ProviderChecks(TestBase): """Non-adapter specific-object-provides checks""" def declareObImplements(self,ifaces): adviseObject(self.ob, provides=ifaces) def declareObAdapts(self,factory,ifaces): declareAdapter(factory,provides=ifaces,forObjects=[self.ob]) def checkSimpleRegister(self): self.declareObImplements([self.IA]) self.assertObProvidesOnlyA() def checkImpliedRegister(self): self.declareObImplements([self.IB]) self.assertObProvidesAandB() class SimpleAdaptiveChecks: """Simple adapter-oriented checks that Twisted can handle (Well, it handles them as long as all the interfaces are Twisted)""" def checkDelayedImplication(self): self.declareObImplements([self.IA]) self.assertObProvidesSubsetOfA() def checkIndirectImplication(self): # Zope fails this because it does not support adding after-the-fact # implication. # IB->IA + ID->IC + IC->IB = ID->IA class IC(self.Interface): pass class ID(IC): pass self.declareObImplements([ID]) self.assertObProvidesCandDnotAorB(IC,ID) declareAdapter( NO_ADAPTER_NEEDED, provides=[self.IB], forProtocols=[IC] ) self.assertObProvidesABCD(IC,ID) class AdaptiveChecks(SimpleAdaptiveChecks): """General adapter/protocol implication checks Twisted can't handle these.""" def checkAmbiguity(self): self.declareObAdapts(self.a1,[self.IA]) self.assertAmbiguous(self.a1,self.a2,1,1,[self.IA]) def checkOverrideDepth(self): self.declareObAdapts(self.a1,[self.IB]) assert self.IA(self.ob,None) == ('a1',self.ob) self.declareObAdapts(self.a2,[self.IA]) assert self.IA(self.ob,None) == ('a2',self.ob) def checkComposed(self): class IC(self.Interface): pass declareAdapter(self.a2,provides=[IC],forProtocols=[self.IA]) self.declareObAdapts(self.a1,[self.IA]) assert IC(self.ob,None) == ('a2',('a1',self.ob)) def checkLateDefinition(self): # Zope fails this because it has different override semantics self.declareObAdapts(DOES_NOT_SUPPORT, [self.IA]) assert self.IA(self.ob,None) is None self.declareObImplements([self.IA]) assert self.IA(self.ob,None) is self.ob # NO_ADAPTER_NEEDED at same depth should override DOES_NOT_SUPPORT self.declareObAdapts(DOES_NOT_SUPPORT, [self.IA]) assert self.IA(self.ob,None) is self.ob class InstanceImplementationChecks(TestBase): """Non-adapter class-instances-provide checks""" # Everybody can handle these def declareObImplements(self,ifaces): declareImplementation(self.klass, ifaces) def declareObAdapts(self,factory,ifaces): declareAdapter(factory,provides=ifaces,forTypes=[self.klass]) def checkSimpleRegister(self): self.declareObImplements([self.IA]) self.assertObProvidesOnlyA() def checkImpliedRegister(self): self.declareObImplements([self.IB]) self.assertObProvidesAandB() class ImplementationChecks(InstanceImplementationChecks): """Non-adapter class-instances vs. class-provide checks""" # Twisted fails these tests because it has no way to distinguish the # interfaces an object provides from the interfaces its class provides def checkNoClassPassThru(self): self.declareObImplements([self.IA]) assert self.IA(self.klass, None) is None def checkInheritedDeclaration(self): self.declareObImplements([self.IB]) class Sub(self.klass): pass inst = self.make(Sub) assert self.IB(inst,None) is inst assert self.IA(inst,None) is inst assert self.IA(Sub,None) is None # check not passed up to class assert self.IB(Sub,None) is None def checkRejectInheritanceAndReplace(self): self.declareObImplements([self.IB]) class Sub(self.klass): advise(instancesDoNotProvide=[self.IB]) inst = self.make(Sub) assert self.IA(inst,None) is inst assert self.IB(inst,None) is None declareImplementation(Sub, instancesProvide=[self.IB]) assert self.IB(inst,None) is inst class BasicClassProvidesChecks: """Object-provides checks for classes and types""" # Twisted doesn't support these because it makes no object/type distinction def checkNoInstancePassThru(self): inst = self.ob() adviseObject(self.ob, provides=[self.IA]) assert self.IA(inst, None) is None def checkChangingBases(self): M1, M2 = self.setupBases(self.ob) adviseObject(M1, provides=[self.IA]) adviseObject(M2, provides=[self.IB]) self.assertM1ProvidesOnlyAandM2ProvidesB(M1,M2) self.assertChangingBasesChangesInterface(M1,M2,M1,M2) class ClassProvidesChecks(BasicClassProvidesChecks): # Twisted doesn't support these because it makes no object/type distinction def checkInheritedDeclaration(self): class Sub(self.ob): pass adviseObject(self.ob, provides=[self.IB]) assert self.IB(Sub, None) is Sub assert self.IA(Sub, None) is Sub def checkRejectInheritanceAndReplace(self): adviseObject(self.ob, provides=[self.IB]) class Sub(self.ob): advise(classDoesNotProvide=[self.IB]) assert self.IA(Sub,None) is Sub assert self.IB(Sub,None) is None adviseObject(Sub,provides=[self.IB]) assert self.IB(Sub,None) is Sub def makeInstanceTests(base,Picklable,NewStyle): """Generate a set of instance-oriented test classes using 'base'""" class AdviseFunction(base): def setUp(self): def aFunc(foo,bar): pass self.ob = aFunc class AdviseModule(base): def setUp(self): from types import ModuleType self.ob = ModuleType('x') class AdviseInstance(base): def setUp(self): self.ob = Picklable() def checkPickling(self): from cPickle import loads,dumps # pickle has a bug! adviseObject(self.ob, provides=[self.IPure]) newOb = loads(dumps(self.ob)) assert self.IPure(newOb,None) is newOb class AdviseNewInstance(AdviseInstance): def setUp(self): self.ob = NewStyle() return AdviseFunction, AdviseModule, AdviseInstance, AdviseNewInstance def makeClassProvidesTests(base): """Generate a set of class-provides-oriented test classes using 'base'""" class AdviseClass(base): def setUp(self): class Classic: pass self.ob = Classic class AdviseType(AdviseClass): def setUp(self): class Class(object): pass self.ob = Class return AdviseClass, AdviseType def makeMetaClassProvidesTests(base): """Generate a set of class-provides-oriented test classes using 'base'""" # Notice that we don't test the *metaclass* of the next two configurations; # it would fail because the metaclass itself can't be adapted to an open # provider, because it has a __conform__ method (from ProviderMixin). For # that to work, there'd have to be *another* metalevel. class AdviseMixinClass(base): def setUp(self): class Meta(ProviderMixin, type): pass class Test(object): __metaclass__ = Meta self.ob = Test class AdviseMixinMultiMeta2(base): def setUp(self): class Meta(ProviderMixin, type): pass class Test(ProviderMixin,object): __metaclass__ = Meta self.ob = Test return AdviseMixinClass, AdviseMixinMultiMeta2 def makeClassTests(base): """Generate a set of class-oriented test classes using 'base'""" class TestClassic(base): def setUp(self): class Classic: pass self.klass = Classic self.ob = Classic() class TestBuiltin(base): def setUp(self): # Note: We need a type with a no-arguments constructor class Newstyle(list): __slots__ = () self.klass = Newstyle self.ob = Newstyle() class TestMetaclass(base): def setUp(self): class Meta(type): pass self.klass = Meta class Base(object): __metaclass__ = Meta self.ob = Base def make(self,klass): return klass('Dummy',(object,),{}) class TestMetaInstance(base): def setUp(self): class Meta(type): pass class Base(object): __metaclass__ = Meta self.klass = Base self.ob = Base() return TestClassic, TestBuiltin, TestMetaclass, TestMetaInstance PKKŸC8›¨dó¿x¿xprotocols/tests/doctest.pyo;ò µÆBc!@sÞyeWnej oeefZnXyeWnej od„ZnXdZdddddddd d d d d ddddddddddddddddddd d!d"g!Zd#kZd#kZd#k Z d#k Z d#k Z d#k Z d#k Z d#kZd#kZd#kZd#kZd#kZd#kZd$klZeid%deed&ƒhZd'„ZedƒZedƒZedƒZedƒZedƒZeeBeBeBeBZed ƒZ ed ƒZ!ed ƒZ"ed ƒZ#e e!Be"Be#BZ$d(Z%d)Z&d*„Z'd+„Z(d,d-„Z)d.d/„Z*d0„Z+d1efd2„ƒYZ,d3„Z-d4„Z.d5ei/fd6„ƒYZ0d7„Z1dfd8„ƒYZ2dfd9„ƒYZ3dfd:„ƒYZ4dfd;„ƒYZ5dfd<„ƒYZ6dfd=„ƒYZ7de8fd>„ƒYZ9de8fd?„ƒYZ:de6fd@„ƒYZ;e<a=e<e<e<e<e<e>d&e<e?e?dA„ Z@e>e<e<e<e<e>d&e<e?e4ƒdB„ ZAe?dCe<d&dD„ZBdfdE„ƒYZCd&aDdF„ZEdGeiFfdH„ƒYZGe<e<e<e<dI„ZHdJeGfdK„ƒYZIe>e<e<e4ƒdL„ZJdM„ZKdN„ZLdO„ZMe?e<dP„ZNe?e<dQ„ZOe?dR„ZPdSfdT„ƒYZQhdSeQ<dUdV<dWdX<dYdZ<d[d\<d]d^}|t|<|SdS(Ni(slensOPTIONFLAGS_BY_NAMEsflagsname(snamesflag((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pysregister_optionflags s s...cCsOtidtddƒ|d djo$|d djo|djn SdS( sÞprefix, base -> true iff name prefix + "." + base is "private". Prefix may be an empty string, and base does not contain a period. Prefix is ignored (although functions you write conforming to this protocol may make use of it). Return true iff base begins with an (at least one) underscore, but does not both begin and end with (at least) two underscores. >>> is_private("a.b", "my_func") False >>> is_private("____", "_my_func") True >>> is_private("someclass", "__init__") False >>> is_private("sometypo", "__init_") True >>> is_private("x.y.z", "_") True >>> is_private("_x.y.z", "__") False >>> is_private("", "") # senseless but consistent False sVis_private is deprecated; it wasn't useful; examine DocTestFinder.find() lists insteads stackleveliis_s__iþÿÿÿN(swarningsswarnsDeprecationWarningsbase(sprefixsbase((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pys is_private¾s  cCs[d}xJtiD]?}|i|tƒ}|tt|ƒjo||i O}qqW|SdS(s… Return the compiler-flags associated with the future features that have been imported into the given namespace (globs). iN( sflagss __future__sall_feature_namessfnamesglobssgetsNonesfeaturesgetattrs compiler_flag(sglobssfeaturesflagssfname((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pys_extract_future_flagsÛs icCsŠti|ƒo|Snot|ttfƒo t|tƒtƒdgƒSn9|t jot i t i |ƒidSn tdƒ‚dS(s‡ Return the module specified by `module`. In particular: - If `module` is a module, then return module. - If `module` is a string, then import and return the module with that name. - If `module` is None, then return the calling module. The calling module is assumed to be the module of the stack frame at the given depth in the call stack. s*s__name__s"Expected a module, string, or NoneN(sinspectsismodulesmodules isinstancesstrsunicodes __import__sglobalsslocalssNonessyssmoduless _getframesdepths f_globalss TypeError(smodulesdepth((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pys_normalize_moduleçs   icCstid|d|ƒSdS(s{ Add the given number of space characters to the beginning every non-blank line in `s`, and return the result. s (?m)^(?!$)s N(sressubsindentss(sssindent((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pys_indentúscCs?tƒ}|\}}}ti|||d|ƒ|iƒSdS(sz Return a string containing a traceback message for the given exc_info tuple (as returned by sys.exc_info()). sfileN( sStringIOsexcoutsexc_infosexc_typesexc_valsexc_tbs tracebacksprint_exceptionsgetvalue(sexc_infosexc_valsexc_typesexcoutsexc_tb((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pys_exception_tracebacks  s _SpoofOutcBstZd„Zed„ZRS(NcCsWti|ƒ}|o|idƒ o|d7}nt|dƒo |`n|SdS(Ns s softspace(sStringIOsgetvaluesselfsresultsendswithshasattrs softspace(sselfsresult((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pysgetvalues  cCs.ti||ƒt|dƒo |`ndS(Ns softspace(sStringIOstruncatesselfssizeshasattrs softspace(sselfssize((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pystruncates(s__name__s __module__sgetvaluesNonestruncate(((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pys _SpoofOuts cCs7|itƒdjo||jSn|itƒ}dt|ƒf\}}|d}|o/|i |ƒot|ƒ}|d=q‹t Sn|d}|o3|i |ƒo|t|ƒ8}|d=qÏt Sn||jot SnxH|D]@}|i|||ƒ}|djot Sn|t|ƒ7}qëWt SdS(s_ Essentially the only subtle case: >>> _ellipsis_match('aa...aa', 'aaa') False iÿÿÿÿiN(swantsfindsELLIPSIS_MARKERsgotssplitswsslensstartpossendpossws startswithsFalsesendswithsTrue(swantsgotswswssstartpossendpos((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pys_ellipsis_match"s6       cCs'|iƒ}|o d|SndSdS(s)Return a commented form of the given lines# s#N(slinesrstrip(sline((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pys _comment_lineSs   s_OutputRedirectingPdbcBs tZdZd„Zd„ZRS(sÀ A specialized version of the python debugger that redirects stdout to a given stream when interacting with the user. Stdout is *not* redirected when traced code is executed. cCs||_tii|ƒdS(N(soutsselfs_OutputRedirectingPdb__outspdbsPdbs__init__(sselfsout((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pys__init__as cGs=ti}|it_ztii||ŒSWd|t_XdS(N( ssyssstdouts save_stdoutsselfs_OutputRedirectingPdb__outspdbsPdbstrace_dispatchsargs(sselfsargss save_stdout((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pystrace_dispatches   (s__name__s __module__s__doc__s__init__strace_dispatch(((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pys_OutputRedirectingPdb[s  cCsti|ƒ otd|‚n|idƒo td‚nt|dƒotii |i ƒd}n}|i djoXt tiƒdjotiddjo!tii tidƒd}qèti}ntd|d ƒ‚tii||i dƒŒSdS( NsExpected a module: %rs/s1Module-relative files may not have absolute pathss__file__is__main__ss+Can't resolve paths relative to the module s (it has no __file__)(sinspectsismodulesmodules TypeErrorspaths startswiths ValueErrorshasattrsosssplits__file__sbasedirs__name__slenssyssargvscurdirsjoin(smodulespathsbasedir((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pys_module_relative_pathps *! cBs#tZdZedded„ZRS(sn A single doctest example, consisting of source code and expected output. `Example` defines the following attributes: - source: A single Python statement, always ending with a newline. The constructor adds a newline if needed. - want: The expected output from running the source code (either from stdout, or a traceback in case of exception). `want` ends with a newline unless it's empty, in which case it's an empty string. The constructor adds a newline if needed. - exc_msg: The exception message generated by the example, if the example is expected to generate an exception; or `None` if it is not expected to generate an exception. This exception message is compared against the return value of `traceback.format_exception_only()`. `exc_msg` ends with a newline unless it's `None`. The constructor adds a newline if needed. - lineno: The line number within the DocTest string containing this Example where the Example begins. This line number is zero-based, with respect to the beginning of the DocTest. - indent: The example's indentation in the DocTest string. I.e., the number of space characters that preceed the example's first prompt. - options: A dictionary mapping from option flags to True or False, which is used to override default options for this example. Any option flags not contained in this dictionary are left at their default value (as specified by the DocTestRunner's optionflags). By default, no options are set. icCsÂ|idƒ o|d7}n|o|idƒ o|d7}n|tj o|idƒ o|d7}n||_||_||_||_|tjo h}n||_||_dS(Ns ( ssourcesendswithswantsexc_msgsNonesselfslinenosindentsoptions(sselfssourceswantsexc_msgslinenosindentsoptions((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pys__init__·s      (s__name__s __module__s__doc__sNones__init__(((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pysExample”s "cBs)tZdZd„Zd„Zd„ZRS(se A collection of doctest examples that should be run in a single namespace. Each `DocTest` defines the following attributes: - examples: the list of examples. - globs: The namespace (aka globals) that the examples should be run in. - name: A name identifying the DocTest (typically, the name of the object whose docstring this DocTest was extracted from). - filename: The name of the file that this DocTest was extracted from, or `None` if the filename is unknown. - lineno: The line number within filename where this DocTest begins, or `None` if the line number is unavailable. This line number is zero-based, with respect to the beginning of the file. - docstring: The string that the examples were extracted from, or `None` if the string is unavailable. cCs@||_||_|iƒ|_||_||_||_dS(sŒ Create a new DocTest containing the given examples. The DocTest's globals are initialized with a copy of `globs`. N(sexamplessselfs docstringsglobsscopysnamesfilenameslineno(sselfsexamplessglobssnamesfilenameslinenos docstring((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pys__init__ás    cCstt|iƒdjo d}n4t|iƒdjo d}ndt|iƒ}d|i|i|i|fSdS(Nis no examplesis 1 examples %d exampless(slensselfsexamplessnamesfilenameslineno(sselfsexamples((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pys__repr__ïs   cCs`t|tƒ odSnt|i|i|it|ƒf|i|i|it|ƒfƒSdS(Niÿÿÿÿ( s isinstancesothersDocTestscmpsselfsnamesfilenameslinenosid(sselfsother((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pys__cmp__ûs!(s__name__s __module__s__doc__s__init__s__repr__s__cmp__(((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pysDocTestÉs   cBs×tZdZeideieiBƒZeideieiBeiBƒZ eidƒi Z dd„Z d„Z dd„Zd„Zeid eiƒZd „Zeid eiƒZd „Zd „Zd„ZRS(sD A class used to parse strings containing doctest examples. sú # Source consists of a PS1 line followed by zero or more PS2 lines. (?P (?:^(?P [ ]*) >>> .*) # PS1 line (?:\n [ ]* \.\.\. .*)*) # PS2 lines \n? # Want consists of any non-blank lines that do not start with PS1. (?P (?:(?![ ]*$) # Not a blank line (?![ ]*>>>) # Not a line starting with PS1 .*$\n? # But any other line )*) sß # Grab the traceback header. Different versions of Python have # said different things on the first traceback line. ^(?P Traceback\ \( (?: most\ recent\ call\ last | innermost\ last ) \) : ) \s* $ # toss trailing whitespace on the header. (?P .*?) # don't blink: absorb stuff until... ^ (?P \w+ .*) # a line *starts* with alphanum. s ^[ ]*(#.*)?$sc Cs•|iƒ}|i|ƒ}|djoAdigi}|idƒD]}|||ƒqE~ƒ}ng} ddf\} } xø|i i|ƒD]ä}| i|| |iƒ!ƒ| |id| |iƒƒ7} |i||| ƒ\}} } }|i|ƒ oB| it|| |d| d|t|idƒƒd| ƒƒn| |id|iƒ|iƒƒ7} |iƒ} q”W| i|| ƒ| SdS(s= Divide the given string into examples and intervening text, and return them as a list of alternating Examples and strings. Line numbers for the Examples are 0-based. The optional argument `name` is a name identifying this string, and is only used for error messages. is slinenosindentsoptionsN(sstrings expandtabssselfs _min_indents min_indentsjoinsappends_[1]ssplitslsoutputscharnoslinenos _EXAMPLE_REsfinditersmsstartscounts_parse_examplesnamessourcesoptionsswantsexc_msgs_IS_BLANK_OR_COMMENTsExampleslensgroupsend(sselfsstringsnames min_indentsexc_msgsmsls_[1]ssourceslinenoswantsoutputscharnosoptions((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pysparse5s*  A!%cCs)t|i||ƒ|||||ƒSdS(s" Extract all doctest examples from the given string, and collect them into a `DocTest` object. `globs`, `name`, `filename`, and `lineno` are attributes for the new `DocTest` object. See the documentation for `DocTest` for more information. N(sDocTestsselfs get_examplessstringsnamesglobssfilenameslineno(sselfsstringsglobssnamesfilenameslineno((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pys get_doctest\scCsIgi}|i||ƒD]$}t|tƒo||ƒqq~SdS(sÑ Extract all doctest examples from the given string, and return them as a list of `Example` objects. Line numbers are 0-based, because it's most common in doctests that nothing interesting appears on the same line as opening triple-quote, and so the first interesting line is called "line 1" then. The optional argument `name` is a name identifying this string, and is only used for error messages. N( sappends_[1]sselfsparsesstringsnamesxs isinstancesExample(sselfsstringsnames_[1]sx((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pys get_exampleshs cCs£t|idƒƒ}|idƒidƒ} |i| |||ƒ|i | dd|d||ƒdi gi }| D]} || |dƒqy~ƒ} |idƒ} | idƒ}t|ƒdjotid |d ƒo |d =n|i |d|||t| ƒƒdi gi }|D]}|||ƒq(~ƒ} |ii| ƒ}|o|id ƒ}nt}|i| ||ƒ} | | | |fSd S( s¼ Given a regular expression match from `_EXAMPLE_RE` (`m`), return a pair `(source, want)`, where `source` is the matched example's source code (with prompts and indentation stripped); and `want` is the example's expected output (with indentation stripped). `name` is the string's name, and `lineno` is the line number where the example starts; both are used for error messages. sindentssources is s.iswants *$iÿÿÿÿsmsgN(slensmsgroupsindentssplits source_linessselfs_check_prompt_blanksnameslinenos _check_prefixsjoinsappends_[1]sslssourceswants want_linessresmatchswls _EXCEPTION_REsexc_msgsNones _find_optionssoptions(sselfsmsnameslinenosindents want_linessexc_msgswls_[1]ssourceswantssls source_linessoptions((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pys_parse_examplevs& "8* 4s#\s*doctest:\s*([^\n\'"]*)$c Csöh}x±|ii|ƒD]}|idƒiddƒiƒ}xs|D]k}|ddjp|dt jo!t d|d||fƒ‚nt |d}|ddj||>> tests = DocTestFinder().find(_TestClass) >>> runner = DocTestRunner(verbose=False) >>> for test in tests: ... print runner.run(test) (0, 2) (0, 1) (0, 2) (0, 2) The `summarize` method prints a summary of all the test cases that have been run by the runner, and returns an aggregated `(f, t)` tuple: >>> runner.summarize(verbose=1) 4 items passed all tests: 2 tests in _TestClass 2 tests in _TestClass.__init__ 2 tests in _TestClass.get 1 tests in _TestClass.square 7 tests in 4 items. 7 passed and 0 failed. Test passed. (0, 7) The aggregated number of tried examples and failed examples is also available via the `tries` and `failures` attributes: >>> runner.tries 7 >>> runner.failures 0 The comparison between expected outputs and actual outputs is done by an `OutputChecker`. This comparison may be customized with a number of option flags; see the documentation for `testmod` for more information. If the option flags are insufficient, then the comparison may also be customized by passing a subclass of `OutputChecker` to the constructor. The test runner's display output can be controlled in two ways. First, an output function (`out) can be passed to `TestRunner.run`; this function will be called with strings that should be displayed. It defaults to `sys.stdout.write`. If capturing the output is not sufficient, then the display output can be also customized by subclassing DocTestRunner, and overriding the methods `report_start`, `report_success`, `report_unexpected_exception`, and `report_failure`. s*iFicCsy|ptƒ|_|tjodtij}n||_||_ ||_ d|_ d|_ h|_ tƒ|_dS(sc Create a new test runner. Optional keyword arg `checker` is the `OutputChecker` that should be used to compare the expected outputs and actual outputs of doctest examples. Optional keyword arg 'verbose' prints lots of stuff if true, only failures if false; by default, it's true iff '-v' is in sys.argv. Optional argument `optionflags` can be used to control how the test runner compares expected output to actual output, and how it displays failures. See the documentation for `testmod` for more information. s-viN(scheckers OutputCheckersselfs_checkersverbosesNonessyssargvs_verboses optionflagssoriginal_optionflagsstriessfailuress_name2fts _SpoofOuts_fakeout(sselfscheckersverboses optionflags((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pys__init__Us       cCsc|ioU|io,|dt|iƒdt|iƒƒq_|dt|iƒdƒndS(s‡ Report that the test runner is about to process the given example. (Only displays a message if verbose=True) sTrying: s Expecting: sExpecting nothing N(sselfs_verbosesexampleswantsouts_indentssource(sselfsoutstestsexample((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pys report_startys   ,cCs|io|dƒndS(st Report that the given example ran successfully. (Only displays a message if verbose=True) sok N(sselfs_verbosesout(sselfsoutstestsexamplesgot((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pysreport_success†s cCs3||i||ƒ|ii|||iƒƒdS(s7 Report that the given example failed. N( soutsselfs_failure_headerstestsexamples_checkersoutput_differencesgots optionflags(sselfsoutstestsexamplesgot((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pysreport_failureŽscCs.||i||ƒdtt|ƒƒƒdS(sO Report that the given example raised an unexpected exception. sException raised: N(soutsselfs_failure_headerstestsexamples_indents_exception_tracebacksexc_info(sselfsoutstestsexamplesexc_info((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pysreport_unexpected_exception•scCsÓ|ig}|iob|itj o |itj o|i|id}nd}|id|i||i fƒn"|id|id|i fƒ|idƒ|i }|it |ƒƒdi |ƒSdS(Nis?sFile "%s", line %s, in %ssLine %s, in %ssFailed example:s ( sselfsDIVIDERsoutstestsfilenameslinenosNonesexamplesappendsnamessources_indentsjoin(sselfstestsexamplessourceslinenosout((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pys_failure_headerœs   $!  cBsŸd}} |i} edƒ\} }}|i i }x>e |iƒD]-\}}|ie@o |dj}| |_|ioNxK|iiƒD]6\}}|o|i|O_q|i|M_qWn| d7} | o|i|||ƒnd|i|f}y7e|i|d|dƒ|iU|ii ƒe!}Wn5e#j o ‚n!e$i%ƒ}|ii ƒnX|i&i'ƒ} |i&i)dƒ|}|e!jo'||i+| |iƒo | }qÄnöe$i%ƒ}e,i-|d Œd} | o| e/|ƒ7} n|i.e!jo |}n||i.| |iƒo | }nz|ie0@oke1i2d|i.ƒ}e1i2d| ƒ}|o,|o%||i5dƒ|i5dƒ|iƒo | }qÄn|| jo&| o|i6|||| ƒqqqD||jo0| o|i7|||| ƒn|d7}qD||jo0| o|i8||||ƒn|d7}qDqDW| |_|i9||| ƒ|| fSd S( sÒ Run the examples in `test`. Write the outcome of each example with one of the `DocTestRunner.report_*` methods, using the writer function `out`. `compileflags` is the set of compiler flags that should be used to execute examples. Return a tuple `(f, t)`, where `t` is the number of examples tried, and `f` is the number of examples that failed. The examples are run in the namespace `test.globs`. iiisssingleiiÿÿÿÿs[^:]*:N(:sfailuresstriessselfs optionflagssoriginal_optionflagssrangesSUCCESSsFAILUREsBOOMs_checkers check_outputschecks enumeratestestsexampless examplenumsexamplesREPORT_ONLY_FIRST_FAILUREsquietsoptionssitemss optionflagsvals report_startsoutsnamesfilenamescompilessources compileflagssglobssdebuggers set_continuesNones exceptionsKeyboardInterruptssyssexc_infos_fakeoutsgetvaluesgotstruncatesoutcomeswants tracebacksformat_exception_onlysexc_msgs_exception_tracebacksIGNORE_EXCEPTION_DETAILsresmatchsm1sm2sgroupsreport_successsreport_failuresreport_unexpected_exceptions_DocTestRunner__record_outcome(sselfstests compileflagssoutschecksvalsfilenamesm1sm2sgotsoriginal_optionflagssSUCCESSsexc_msgstriessexc_infos exceptions optionflagsquietsFAILUREsBOOMs examplenumsfailuressoutcomesexample((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pys__run°s‚                )      cCsd|ii|iddfƒ\}}||||f|i|i<|i |7_ |i |7_ dS(s{ Record the fact that the given DocTest (`test`) generated `f` failures out of `t` tried examples. iN( sselfs_name2ftsgetstestsnamesf2st2sfstsfailuresstries(sselfstestsfstsf2st2((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pys__record_outcome(s $s3[\w\.]+)\[(?P\d+)\]>$cCsy|ii|ƒ}|o|idƒ|iijo3|iit |idƒƒ}|i i t ƒSn|i|ƒSdS(Nsnames examplenum(sselfs%_DocTestRunner__LINECACHE_FILENAME_REsmatchsfilenamesmsgroupstestsnamesexamplessintsexamplessources splitlinessTruessave_linecache_getlines(sselfsfilenamesmsexample((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pys__patched_linecache_getlines5s #cCsù||_|tjot|iƒ}nti}|tjo |i }n|i t_t i }t|ƒ|_|iiƒ|ii t _ ti|_|it_z|i|||ƒSWd|t_|t _ |it_|o|iiƒnXdS(sJ Run the examples in `test`, and display the results using the writer function `out`. The examples are run in the namespace `test.globs`. If `clear_globs` is true (the default), then this namespace will be cleared after the test runs, to help with garbage collection. If you would like to examine the namespace after the test completes, then use `clear_globs=False`. `compileflags` gives the set of flags that should be used by the Python compiler when running the examples. If not specified, then it will default to the set of future-import flags that apply to `globs`. The output of each example is checked using `DocTestRunner.check_output`, and the results are formatted by the `DocTestRunner.report_*` methods. N(stestsselfs compileflagssNones_extract_future_flagssglobsssyssstdouts save_stdoutsoutswrites_fakeoutspdbs set_tracessave_set_traces_OutputRedirectingPdbsdebuggersresets linecachesgetlinesssave_linecache_getliness*_DocTestRunner__patched_linecache_getliness_DocTestRunner__runs clear_globssclear(sselfstests compileflagssouts clear_globss save_stdoutssave_set_trace((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pysrun=s,             c Cs#|tjo |i}ng} g}g}d}} xŒ|i i ƒD]{} | \}\}}||7}| |7} |djo| i|ƒqF|djo|i||fƒqF|i| ƒqFW|oŒ| o7t| ƒGdGH| iƒx| D]} dG| GHqóWn|oCt|ƒGdGH|iƒx'|D]\} }d|| fGHq1WqXn|oT|iGHt|ƒGdGH|iƒx0|D]$\} \}}d||| fGHq‡Wn|o3|GdGt|i ƒGd GH|| Gd G| Gd GHn| od G| Gd GHn|o dGHn| |fSdS(s¦ Print a summary of all the test cases that have been run by this DocTestRunner, and return a tuple `(f, t)`, where `f` is the total number of failed examples, and `t` is the total number of tried examples. The optional `verbose` argument controls how detailed the summary is. If the verbosity is not specified, then the DocTestRunner's verbosity is used. isitems had no tests:s sitems passed all tests:s %3d tests in %ssitems had failures:s %3d of %3d in %sstests insitems.s passed andsfailed.s***Test Failed***s failures.s Test passed.N(sverbosesNonesselfs_verbosesnotestsspassedsfailedstotaltstotalfs_name2ftsitemssxsnamesfstsappendslenssortsthingscountsDIVIDER( sselfsverbosescountsfstotaltsnamesfailedstspassedsxstotalfsthingsnotests((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pys summarizevs\             cCs…|i}xu|iiƒD]d\}\}}||jo5d|dGH||\}}||}||}n||f||>> runner = DebugRunner(verbose=False) >>> test = DocTestParser().get_doctest('>>> raise KeyError\n42', ... {}, 'foo', 'foo.py', 0) >>> try: ... runner.run(test) ... except UnexpectedException, failure: ... pass >>> failure.test is test True >>> failure.example.want '42\n' >>> exc_info = failure.exc_info >>> raise exc_info[0], exc_info[1], exc_info[2] Traceback (most recent call last): ... KeyError We wrap the original exception to give the calling application access to the test and example information. If the output doesn't match, then a DocTestFailure is raised: >>> test = DocTestParser().get_doctest(''' ... >>> x = 1 ... >>> x ... 2 ... ''', {}, 'foo', 'foo.py', 0) >>> try: ... runner.run(test) ... except DocTestFailure, failure: ... pass DocTestFailure objects provide access to the test: >>> failure.test is test True As well as to the example: >>> failure.example.want '2\n' and the actual output: >>> failure.got '1\n' If a failure or error occurs, the globals are left intact: >>> del test.globs['__builtins__'] >>> test.globs {'x': 1} >>> test = DocTestParser().get_doctest(''' ... >>> x = 2 ... >>> raise KeyError ... ''', {}, 'foo', 'foo.py', 0) >>> runner.run(test) Traceback (most recent call last): ... UnexpectedException: >>> del test.globs['__builtins__'] >>> test.globs {'x': 2} But the globals are cleared if there is no error: >>> test = DocTestParser().get_doctest(''' ... >>> x = 2 ... ''', {}, 'foo', 'foo.py', 0) >>> runner.run(test) (0, 1) >>> test.globs {} cCs;ti||||tƒ}|o|i i ƒn|SdS(N( s DocTestRunnersrunsselfstests compileflagssoutsFalsesrs clear_globssglobssclear(sselfstests compileflagssouts clear_globssr((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pysrunÀscCst|||ƒ‚dS(N(sUnexpectedExceptionstestsexamplesexc_info(sselfsoutstestsexamplesexc_info((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pysreport_unexpected_exceptionÆscCst|||ƒ‚dS(N(sDocTestFailurestestsexamplesgot(sselfsoutstestsexamplesgot((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pysreport_failureÉs(s__name__s __module__s__doc__sNonesTruesrunsreport_unexpected_exceptionsreport_failure(((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pys DebugRunneres Y c CsS|tj otidtƒn|tjotiidƒ}nt i |ƒ ot d|fƒ‚n|tjo |i }ntd|d| ƒ} |otd|d|ƒ} ntd|d|ƒ} x3| i||d|d |ƒD]} | i| ƒqïW|o| iƒnttjo | anti| ƒ| i | i!fSd S( så m=None, name=None, globs=None, verbose=None, isprivate=None, report=True, optionflags=0, extraglobs=None, raise_on_error=False, exclude_empty=False Test examples in docstrings in functions and classes reachable from module m (or the current module if m is not supplied), starting with m.__doc__. Unless isprivate is specified, private names are not skipped. Also test examples reachable from dict m.__test__ if it exists and is not None. m.__test__ maps names to functions, classes and strings; function and class docstrings are tested even if the name is private; strings are tested directly, as if they were docstrings. Return (#failures, #tests). See doctest.__doc__ for an overview. Optional keyword arg "name" gives the name of the module; by default use m.__name__. Optional keyword arg "globs" gives a dict to be used as the globals when executing examples; by default, use m.__dict__. A copy of this dict is actually used for each docstring, so that each docstring's examples start with a clean slate. Optional keyword arg "extraglobs" gives a dictionary that should be merged into the globals that are used to execute examples. By default, no extra globals are used. This is new in 2.4. Optional keyword arg "verbose" prints lots of stuff if true, prints only failures if false; by default, it's true iff "-v" is in sys.argv. Optional keyword arg "report" prints a summary at the end when true, else prints nothing at the end. In verbose mode, the summary is detailed, else very brief (in fact, empty if all tests passed). Optional keyword arg "optionflags" or's together module constants, and defaults to 0. This is new in 2.3. Possible values (see the docs for details): DONT_ACCEPT_TRUE_FOR_1 DONT_ACCEPT_BLANKLINE NORMALIZE_WHITESPACE ELLIPSIS IGNORE_EXCEPTION_DETAIL REPORT_UDIFF REPORT_CDIFF REPORT_NDIFF REPORT_ONLY_FIRST_FAILURE Optional keyword arg "raise_on_error" raises an exception on the first unexpected exception or failure. This allows failures to be post-mortem debugged. Deprecated in Python 2.4: Optional keyword arg "isprivate" specifies a function used to determine whether a name is private. The default function is treat all functions as public. Optionally, "isprivate" can be set to doctest.is_private to skip over functions marked as private using the underscore naming convention; see its docs for details. Advanced tomfoolery: testmod runs methods of a local instance of class doctest.Tester, then merges the results into (or creates) global Tester instance doctest.master. Methods of doctest.master can be called directly too, if you want to do something unusual. Passing report=0 to testmod is especially useful then, to delay displaying a summary. Invoke doctest.master.summarize(verbose) when you're done fiddling. sPthe isprivate argument is deprecated; examine DocTestFinder.find() lists insteads__main__stestmod: module required; %rs _namefilters exclude_emptysverboses optionflagssglobss extraglobsN("s isprivatesNoneswarningsswarnsDeprecationWarningsmssyssmodulessgetsinspectsismodules TypeErrorsnames__name__s DocTestFinders exclude_emptysfindersraise_on_errors DebugRunnersverboses optionflagssrunners DocTestRunnersfindsglobss extraglobsstestsrunsreports summarizesmastersmergesfailuresstries( smsnamesglobssverboses isprivatesreports optionflagss extraglobssraise_on_errors exclude_emptysrunnerstestsfinder((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pystestmodÕs0H         c Cse|o| otdƒ‚n|ot|ƒ}t||ƒ}n|tjoti i |ƒ}n|tjo h}n |i ƒ}|tj o|i|ƒn| otd|d|ƒ} ntd|d|ƒ} t|ƒiƒ} | i| |||dƒ} | i| ƒ|o| iƒnttjo | anti| ƒ| i | i!fSdS(s Test examples in the given file. Return (#failures, #tests). Optional keyword arg "module_relative" specifies how filenames should be interpreted: - If "module_relative" is True (the default), then "filename" specifies a module-relative path. By default, this path is relative to the calling module's directory; but if the "package" argument is specified, then it is relative to that package. To ensure os-independence, "filename" should use "/" characters to separate path segments, and should not be an absolute path (i.e., it may not begin with "/"). - If "module_relative" is False, then "filename" specifies an os-specific path. The path may be absolute or relative (to the current working directory). Optional keyword arg "name" gives the name of the test; by default use the file's basename. Optional keyword argument "package" is a Python package or the name of a Python package whose directory should be used as the base directory for a module relative filename. If no package is specified, then the calling module's directory is used as the base directory for module relative filenames. It is an error to specify "package" if "module_relative" is False. Optional keyword arg "globs" gives a dict to be used as the globals when executing examples; by default, use {}. A copy of this dict is actually used for each docstring, so that each docstring's examples start with a clean slate. Optional keyword arg "extraglobs" gives a dictionary that should be merged into the globals that are used to execute examples. By default, no extra globals are used. Optional keyword arg "verbose" prints lots of stuff if true, prints only failures if false; by default, it's true iff "-v" is in sys.argv. Optional keyword arg "report" prints a summary at the end when true, else prints nothing at the end. In verbose mode, the summary is detailed, else very brief (in fact, empty if all tests passed). Optional keyword arg "optionflags" or's together module constants, and defaults to 0. Possible values (see the docs for details): DONT_ACCEPT_TRUE_FOR_1 DONT_ACCEPT_BLANKLINE NORMALIZE_WHITESPACE ELLIPSIS IGNORE_EXCEPTION_DETAIL REPORT_UDIFF REPORT_CDIFF REPORT_NDIFF REPORT_ONLY_FIRST_FAILURE Optional keyword arg "raise_on_error" raises an exception on the first unexpected exception or failure. This allows failures to be post-mortem debugged. Optional keyword arg "parser" specifies a DocTestParser (or subclass) that should be used to extract tests from the files. Advanced tomfoolery: testmod runs methods of a local instance of class doctest.Tester, then merges the results into (or creates) global Tester instance doctest.master. Methods of doctest.master can be called directly too, if you want to do something unusual. Passing report=0 to testmod is especially useful then, to delay displaying a summary. Invoke doctest.master.summarize(verbose) when you're done fiddling. s8Package may only be specified for module-relative paths.sverboses optionflagsiN("spackagesmodule_relatives ValueErrors_normalize_modules_module_relative_pathsfilenamesnamesNonesosspathsbasenamesglobsscopys extraglobssupdatesraise_on_errors DebugRunnersverboses optionflagssrunners DocTestRunnersopensreadsssparsers get_docteststestsrunsreports summarizesmastersmergesfailuresstries(sfilenamesmodule_relativesnamespackagesglobssverbosesreports optionflagss extraglobssraise_on_errorsparsersrunnerstestss((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pystestfileIs4J          sNoNamec Csdtd|dtƒ}td|d|ƒ}x3|i||d|ƒD]}|i |d|ƒqCWdS(sr Test examples in the given object's docstring (`f`), using `globs` as globals. Optional argument `name` is used in failure messages. If the optional argument `verbose` is true, then generate output even if there are no failures. `compileflags` gives the set of flags that should be used by the Python compiler when running the examples. If not specified, then it will default to the set of future-import flags that apply to `globs`. Optional keyword arg `optionflags` specifies options for the testing and output. See the documentation for `testmod` for more information. sverbosesrecurses optionflagssglobss compileflagsN(s DocTestFindersverbosesFalsesfinders DocTestRunners optionflagssrunnersfindsfsnamesglobsstestsruns compileflags( sfsglobssverbosesnames compileflagss optionflagssrunnerstestsfinder((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pysrun_docstring_examples¿s cBsbtZeeeedd„Zd„Zeed„Zed„Zd„Zed„Zd„Z RS( NicCsátidtddƒ|tjo |tjotdƒ‚n|tj oti|ƒ otd|fƒ‚n|tjo |i }n||_||_ ||_ ||_ td|ƒ|_td|d|ƒ|_dS( NsCclass Tester is deprecated; use class doctest.DocTestRunner insteads stacklevelis*Tester.__init__: must specify mod or globss)Tester.__init__: mod must be a module; %rs _namefiltersverboses optionflags(swarningsswarnsDeprecationWarningsmodsNonesglobss TypeErrorsinspectsismodules__dict__sselfsverboses isprivates optionflagss DocTestFinders testfinders DocTestRunners testrunner(sselfsmodsglobssverboses isprivates optionflags((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pys__init__Ýs         cCstƒi||i|ttƒ}|io dG|GHn|i i |ƒ\}}|io|GdG|GdG|GHn||fSdS(NsRunning stringsofsexamples failed in string( s DocTestParsers get_doctestsssselfsglobssnamesNonestestsverboses testrunnersrunsfst(sselfsssnamesfststest((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pys runstringós!   c Csd}}|ii||d|d|iƒ}x@|D]8} |i i | ƒ\}}||||f\}}q5W||fSdS(Nismodulesglobs(sfstsselfs testfindersfindsobjectsnamesmodulesglobsstestsstests testrunnersrunsf2st2( sselfsobjectsnamesmodulestestssfst2sf2ststest((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pysrundocüs cCsVdk}|i|ƒ}|ii|ƒ|tjo t}n|i |||ƒSdS(N( snewsmodulesnamesms__dict__supdatesdsNonesFalsesselfsrundoc(sselfsdsnamesmodulesmsnew((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pysrundicts    cCs5dk}|i|ƒ}||_|i||ƒSdS(N(snewsmodulesnamesmsds__test__sselfsrundoc(sselfsdsnamesnewsm((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pys run__test__ s  cCs|ii|ƒSdS(N(sselfs testrunners summarizesverbose(sselfsverbose((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pys summarizescCs|ii|iƒdS(N(sselfs testrunnersmergesother(sselfsother((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pysmerges( s__name__s __module__sNones__init__s runstringsrundocsrundicts run__test__s summarizesmerge(((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pysTesterÜs    cCs8|t@|jotd|ƒ‚nt}|a|SdS(sSets the unittest option flags. The old flag is returned so that a runner could restore the old value if it wished to: >>> old = _unittest_reportflags >>> set_unittest_reportflags(REPORT_NDIFF | ... REPORT_ONLY_FIRST_FAILURE) == old True >>> import doctest >>> doctest._unittest_reportflags == (REPORT_NDIFF | ... REPORT_ONLY_FIRST_FAILURE) True Only reporting flags can be set: >>> set_unittest_reportflags(ELLIPSIS) Traceback (most recent call last): ... ValueError: ('Only reporting flags allowed', 8) >>> set_unittest_reportflags(old) == (REPORT_NDIFF | ... REPORT_ONLY_FIRST_FAILURE) True sOnly reporting flags allowedN(sflagssREPORTING_FLAGSs ValueErrors_unittest_reportflagssold(sflagssold((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pysset_unittest_reportflagsss DocTestCasecBsktZdeeed„Zd„Zd„Zd„Zd„Zd„Zd„Z d „Z e Z d „Z RS( NicCsAtii|ƒ||_||_||_ ||_ ||_ dS(N(sunittestsTestCases__init__sselfs optionflagss_dt_optionflagsscheckers _dt_checkerstests_dt_testssetUps _dt_setUpstearDowns _dt_tearDown(sselfstests optionflagsssetUpstearDownschecker((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pys__init__Es     cCs.|i}|itj o|i|ƒndS(N(sselfs_dt_teststests _dt_setUpsNone(sselfstest((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pyssetUpOs cCs;|i}|itj o|i|ƒn|iiƒdS(N(sselfs_dt_teststests _dt_tearDownsNonesglobssclear(sselfstest((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pystearDownUs cCsË|i}ti}tƒ}|i}|t @ o|t O}nt d|d|i dtƒ}z5dd|_|i|d|idtƒ\}}Wd|t_X|o"|i|i|iƒƒƒ‚ndS(Ns optionflagsscheckersverboses-iFsouts clear_globs(sselfs_dt_teststestssyssstdoutsoldsStringIOsnews_dt_optionflagss optionflagssREPORTING_FLAGSs_unittest_reportflagss DocTestRunners _dt_checkersFalsesrunnersDIVIDERsrunswritesfailuresstriessfailureExceptionsformat_failuresgetvalue(sselfsoldsrunnerstriessfailuresstestsnews optionflags((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pysrunTest]s       ( cCsp|i}|itjo d}nd|i}di|iidƒdƒ}d|i|i |||fSdS(Nsunknown line numbers%ss.iÿÿÿÿs:Failed doctest test for %s File "%s", line %s, in %s %s( sselfs_dt_teststestslinenosNonesjoinsnamessplitslnamesfilenameserr(sselfserrslnameslinenostest((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pysformat_failureus    cCsI|iƒtd|id|idtƒ}|i|iƒ|i ƒdS(sÊRun the test case without results and without catching exceptions The unit test framework includes a debug method on test cases and test suites to support post-mortem debugging. The test code is run in such a way that errors are not caught. This way a caller can catch the errors and initiate post-mortem debugging. The DocTestCase provides a debug method that raises UnexpectedException errors if there is an unexepcted exception: >>> test = DocTestParser().get_doctest('>>> raise KeyError\n42', ... {}, 'foo', 'foo.py', 0) >>> case = DocTestCase(test) >>> try: ... case.debug() ... except UnexpectedException, failure: ... pass The UnexpectedException contains the test, the example, and the original exception: >>> failure.test is test True >>> failure.example.want '42\n' >>> exc_info = failure.exc_info >>> raise exc_info[0], exc_info[1], exc_info[2] Traceback (most recent call last): ... KeyError If the output doesn't match, then a DocTestFailure is raised: >>> test = DocTestParser().get_doctest(''' ... >>> x = 1 ... >>> x ... 2 ... ''', {}, 'foo', 'foo.py', 0) >>> case = DocTestCase(test) >>> try: ... case.debug() ... except DocTestFailure, failure: ... pass DocTestFailure objects provide access to the test: >>> failure.test is test True As well as to the example: >>> failure.example.want '2\n' and the actual output: >>> failure.got '1\n' s optionflagsscheckersverboseN( sselfssetUps DebugRunners_dt_optionflagss _dt_checkersFalsesrunnersruns_dt_teststearDown(sselfsrunner((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pysdebugs @  cCs|iiSdS(N(sselfs_dt_testsname(sself((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pysidÉscCs8|iiidƒ}d|ddi|d ƒfSdS(Ns.s%s (%s)iÿÿÿÿ(sselfs_dt_testsnamessplitsjoin(sselfsname((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pys__repr__ÌscCsd|iiSdS(Ns Doctest: (sselfs_dt_testsname(sself((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pysshortDescriptionÒs( s__name__s __module__sNones__init__ssetUpstearDownsrunTestsformat_failuresdebugsids__repr__s__str__sshortDescription(((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pys DocTestCaseCs    H  c Ks|tjo tƒ}nt|ƒ}|i|d|d|ƒ}|tjo |i }n| ot |dƒ‚n|i ƒt i ƒ}x‡|D]}t|iƒdjoq“n|i o;|i}|dddfjo|d }n||_n|it||ƒq“W|Sd S( s Convert doctest tests for a module to a unittest test suite. This converts each documentation string in a module that contains doctest tests to a unittest test case. If any of the tests in a doc string fail, then the test case fails. An exception is raised showing the name of the file containing the test and a (sometimes approximate) line number. The `module` argument provides the module to be tested. The argument can be either a module or a module name. If no argument is given, the calling module is used. A number of options may be provided as keyword arguments: setUp A set-up function. This is called before running the tests in each file. The setUp function will be passed a DocTest object. The setUp function can access the test globals as the globs attribute of the test passed. tearDown A tear-down function. This is called after running the tests in each file. The tearDown function will be passed a DocTest object. The tearDown function can access the test globals as the globs attribute of the test passed. globs A dictionary containing initial global variables for the tests. optionflags A set of doctest option flags expressed as an integer. sglobss extraglobss has no testsiiüÿÿÿs.pycs.pyoiÿÿÿÿN(s test_findersNones DocTestFinders_normalize_modulesmodulesfindsglobss extraglobsstestss__dict__s ValueErrorssortsunittests TestSuitessuitestestslensexamplessfilenames__file__saddTests DocTestCasesoptions( smodulesglobss extraglobss test_findersoptionsstestsstestssuitesfilename((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pys DocTestSuiteÕs,#          s DocFileCasecBs)tZd„Zd„ZeZd„ZRS(NcCs di|iiidƒƒSdS(Ns_s.(sjoinsselfs_dt_testsnamessplit(sself((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pysid scCs|iiSdS(N(sselfs_dt_testsfilename(sself((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pys__repr__ scCs!d|ii|ii|fSdS(Ns2Failed doctest test for %s File "%s", line 0 %s(sselfs_dt_testsnamesfilenameserr(sselfserr((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pysformat_failure s(s__name__s __module__sids__repr__s__str__sformat_failure(((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pys DocFileCase s  c Ks¬|tjo h}n|o| otdƒ‚n|ot|ƒ}t||ƒ}ntii |ƒ}t |ƒi ƒ}|i||||dƒ}t||SdS(Ns8Package may only be specified for module-relative paths.i(sglobssNonespackagesmodule_relatives ValueErrors_normalize_modules_module_relative_pathspathsossbasenamesnamesopensreadsdocsparsers get_docteststests DocFileCasesoptions( spathsmodule_relativespackagesglobssparsersoptionssnamesdocstest((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pys DocFileTest" s   cOsktiƒ}|idtƒot|idƒƒ|dA unittest suite for one or more doctest files. The path to each doctest file is given as a string; the interpretation of that string depends on the keyword argument "module_relative". A number of options may be provided as keyword arguments: module_relative If "module_relative" is True, then the given file paths are interpreted as os-independent module-relative paths. By default, these paths are relative to the calling module's directory; but if the "package" argument is specified, then they are relative to that package. To ensure os-independence, "filename" should use "/" characters to separate path segments, and may not be an absolute path (i.e., it may not begin with "/"). If "module_relative" is False, then the given file paths are interpreted as os-specific paths. These paths may be absolute or relative (to the current working directory). package A Python package or the name of a Python package whose directory should be used as the base directory for module relative paths. If "package" is not specified, then the calling module's directory is used as the base directory for module relative filenames. It is an error to specify "package" if "module_relative" is False. setUp A set-up function. This is called before running the tests in each file. The setUp function will be passed a DocTest object. The setUp function can access the test globals as the globs attribute of the test passed. tearDown A tear-down function. This is called after running the tests in each file. The tearDown function will be passed a DocTest object. The tearDown function can access the test globals as the globs attribute of the test passed. globs A dictionary containing initial global variables for the tests. optionflags A set of doctest option flags expressed as an integer. parser A DocTestParser (or subclass) that should be used to extract tests from the files. smodule_relativespackageN( sunittests TestSuitessuiteskwsgetsTrues_normalize_modulespathsspathsaddTests DocFileTest(spathsskwspathssuite((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pys DocFileSuite8 s4 cCsNg}xÝtƒi|ƒD]É}t|tƒou|i|id ƒ|i }|oM|idƒ|gi}|i dƒd D]}|d|ƒq~~7}qâq|gi}|i dƒd D]}|t |ƒƒqÂ~7}qWx'|o|ddjo|iƒqéWx*|o|ddjo|idƒqWdi|ƒSdS(scExtract script from text with examples. Converts text with examples to a Python script. Example input is converted to regular code. Example output and all other words are converted to comments: >>> text = ''' ... Here are examples of simple math. ... ... Python has super accurate integer addition ... ... >>> 2 + 2 ... 5 ... ... And very friendly error messages: ... ... >>> 1/0 ... To Infinity ... And ... Beyond ... ... You can use logic if you want: ... ... >>> if 0: ... ... blah ... ... blah ... ... ... ... Ho hum ... ''' >>> print script_from_examples(text) # Here are examples of simple math. # # Python has super accurate integer addition # 2 + 2 # Expected: ## 5 # # And very friendly error messages: # 1/0 # Expected: ## To Infinity ## And ## Beyond # # You can use logic if you want: # if 0: blah blah # # Ho hum iÿÿÿÿs # Expected:s s## s#iN(soutputs DocTestParsersparsessspieces isinstancesExamplesappendssourceswants_[1]ssplitsls _comment_linespopsjoin(ssspiecesls_[1]swantsoutput((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pysscript_from_examples~ s$8  DBcCs•t|ƒ}tƒi|ƒ}gi}|D]$}|i|jo||ƒq,q,~}| ot |dƒ‚n|d}t |i ƒ}|SdS(sExtract the test sources from a doctest docstring as a script. Provide the module (or dotted name of the module) containing the test to be debugged and the name (within the module) of the object with the doc string with tests to be debugged. snot found in testsiN(s_normalize_modulesmodules DocTestFindersfindstestssappends_[1]stsnamestests ValueErrorsscript_from_exampless docstringstestsrc(smodulesnamestestss_[1]stestsrcststest((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pys testsourceÎ s ; cCs t|ƒ}t|||ƒdS(s4Debug a single doctest docstring, in argument `src`'N(sscript_from_examplesssrcstestsrcs debug_scriptspmsglobs(ssrcspmsglobsstestsrc((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pys debug_srcÞ s cCsÝdk}tiddƒ}t|dƒ}|i|ƒ|iƒz‡|o|i ƒ}nh}|oHyt |||ƒWqÇt iƒdGH|it iƒdƒqÇXn|id|||ƒWdti|ƒXdS(s7Debug a test script. `src` is the script, as a string.Ns.pys doctestdebugswiis execfile(%r)(spdbstempfilesmktemps srcfilenamesopensfswritessrcsclosesglobsscopyspmsexecfilessyssexc_infos post_mortemsrunsossremove(ssrcspmsglobssfs srcfilenamespdb((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pys debug_scriptã s&   cCs2t|ƒ}t||ƒ}t|||iƒdS(såDebug a single doctest docstring. Provide the module (or dotted name of the module) containing the test to be debugged and the name (within the module) of the object with the docstring with tests to be debugged. N(s_normalize_modulesmodules testsourcesnamestestsrcs debug_scriptspms__dict__(smodulesnamespmstestsrc((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pysdebug s s _TestClasscBs)tZdZd„Zd„Zd„ZRS(så A pointless class, for sanity-checking of docstring testing. Methods: square() get() >>> _TestClass(13).get() + _TestClass(-12).get() 1 >>> hex(_TestClass(13).square().get()) '0xa9' cCs ||_dS(sƒval -> _TestClass object with associated value val. >>> t = _TestClass(123) >>> print t.get() 123 N(svalsself(sselfsval((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pys__init__ scCs|id|_|SdS(sosquare() -> square TestClass's associated value >>> _TestClass(13).square().get() 169 iN(sselfsval(sself((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pyssquare) scCs |iSdS(s}get() -> return TestClass's associated value. >>> x = _TestClass(-42) >>> print x.get() -42 N(sselfsval(sself((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pysget3 s(s__name__s __module__s__doc__s__init__ssquaresget(((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pys _TestClass s  sstringsÄ Example of a string object, searched as-is. >>> x = 1; y = 2 >>> x + y, x * y (3, 2) sbool-int equivalencesÜ In 2.2, boolean expressions displayed 0 or 1. By default, we still accept them. This can be disabled by passing DONT_ACCEPT_TRUE_FOR_1 to the new optionflags argument. >>> 4 == 4 1 >>> 4 == 4 True >>> 4 > 4 0 >>> 4 > 4 False s blank linessæ Blank lines can be marked with : >>> print 'foo\n\nbar\n' foo bar sellipsissó If the ellipsis flag is used, then '...' can be used to elide substrings in the desired output: >>> print range(1000) #doctest: +ELLIPSIS [0, 1, 2, ..., 999] swhitespace normalizations| If the whitespace normalization flag is used, then differences in whitespace are ignored. >>> print range(30) #doctest: +NORMALIZE_WHITESPACE [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29] cCs tiƒ}|itƒƒdS(N(sunittestsTextTestRunnersrsruns DocTestSuite(sr((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pys_testo s s__main__(Ts basestrings NameErrorsstrsunicodes enumerates __docformat__s__all__s __future__ssyss tracebacksinspects linecachesossrestypessunittestsdifflibspdbstempfileswarningssStringIOsfilterwarningssDeprecationWarnings__name__sOPTIONFLAGS_BY_NAMEsregister_optionflagsDONT_ACCEPT_TRUE_FOR_1sDONT_ACCEPT_BLANKLINEsNORMALIZE_WHITESPACEsELLIPSISsIGNORE_EXCEPTION_DETAILsCOMPARISON_FLAGSs REPORT_UDIFFs REPORT_CDIFFs REPORT_NDIFFsREPORT_ONLY_FIRST_FAILUREsREPORTING_FLAGSsBLANKLINE_MARKERsELLIPSIS_MARKERs is_privates_extract_future_flagss_normalize_modules_indents_exception_tracebacks _SpoofOuts_ellipsis_matchs _comment_linesPdbs_OutputRedirectingPdbs_module_relative_pathsExamplesDocTests DocTestParsers DocTestFinders DocTestRunners OutputCheckers ExceptionsDocTestFailuresUnexpectedExceptions DebugRunnersNonesmastersTruesFalsestestmodstestfilesrun_docstring_examplessTesters_unittest_reportflagssset_unittest_reportflagssTestCases DocTestCases DocTestSuites DocFileCases DocFileTests DocFileSuitesscript_from_exampless testsources debug_srcs debug_scriptsdebugs _TestClasss__test__s_test(Fs_module_relative_paths __future__s OutputCheckersBLANKLINE_MARKERsunittestsNORMALIZE_WHITESPACEs __docformat__stestmods_normalize_modules REPORT_UDIFFsDONT_ACCEPT_TRUE_FOR_1s enumerates_OutputRedirectingPdbs_ellipsis_matchs basestringsIGNORE_EXCEPTION_DETAILs__all__sTesterstempfiles DocFileCases DocTestRunners DocFileTestsres is_privatesDocTestFailures DocTestCasesELLIPSISs_tests _comment_lines REPORT_CDIFFs testsourcesDocTestsDONT_ACCEPT_BLANKLINEs _SpoofOutswarningss DocFileSuitesrun_docstring_examplessREPORT_ONLY_FIRST_FAILUREsinspects _TestClasss debug_scriptssyssdebugsscript_from_exampless debug_srcs__test__s_extract_future_flagss_indentsExamplestypess DocTestSuitesregister_optionflagsOPTIONFLAGS_BY_NAMEs DocTestParsersStringIOsset_unittest_reportflagss REPORT_NDIFFs tracebacksdifflibs linecaches DocTestFinders DebugRunnersELLIPSIS_MARKERsREPORTING_FLAGSsCOMPARISON_FLAGSsUnexpectedExceptionsosspdbstestfiles_exception_traceback((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pys? s–(i. ?$                  1  $5<ëÿ+ÿ¡…n't*vA $’? F P  ,<2  PKÛ\â2Cä®SSprotocols/tests/test_twisted.py"""Twisted Interface tests""" from unittest import TestCase, makeSuite, TestSuite from protocols import * import protocols.twisted_support from twisted.python.components import Interface # Dummy interfaces and adapters used in tests class IA(Interface): pass class IB(IA): pass class IPure(Interface): # We use this for pickle/copy tests because the other protocols # imply various dynamically created interfaces, and so any object # registered with them won't be picklable pass from checks import InstanceImplementationChecks, makeClassTests, ProviderChecks from checks import makeInstanceTests, SimpleAdaptiveChecks class Picklable: # Pickling needs classes in top-level namespace pass class NewStyle(object): pass class BasicChecks(SimpleAdaptiveChecks, InstanceImplementationChecks): IA = IA IB = IB Interface = Interface IPure = IPure class InstanceChecks(ProviderChecks): IA = IA IB = IB Interface = Interface IPure = IPure TestClasses = makeClassTests(BasicChecks) TestClasses += makeInstanceTests(InstanceChecks,Picklable,NewStyle) class IB(protocols.Interface): advise(protocolExtends = [IA]) class BasicChecks(InstanceImplementationChecks): IA = IA IB = IB Interface = Interface IPure = IPure class InstanceChecks(ProviderChecks): IA = IA IB = IB Interface = Interface IPure = IPure TestClasses += makeClassTests(BasicChecks) TestClasses += makeInstanceTests(InstanceChecks,Picklable,NewStyle) def test_suite(): return TestSuite([makeSuite(t,'check') for t in TestClasses]) PKIŸC8vÃ&ó<ó<protocols/tests/__init__.pyc;ò jÕBc@stdklZlZlZdklZlZlZlZl Z dkl Z l Z defd„ƒYZ dkl Z lZlZlZdklZlZdklZe edd gƒZe edgƒZe ed gƒZe ed gd eƒZed ƒZeeƒZeeegƒeeƒZd efd„ƒYZeeegƒdefd„ƒYZd„Z dS((s TestSuitesTestCases makeSuite(sadaptsadvises Interfaces AttributesdeclareAdapter(s AbstractBasesAdaptationFailuresAPITestscBs}tZd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Z d „Z d „Z d „Z d „Z RS( NcCsZdfd„ƒY}t|ttƒtjpt‚t|ƒttƒgjpt‚dS(Ns ConformercBstZd„ZRS(NcCsgSdS(N((sselfsob((s<build/bdist.darwin-8.0.1-x86/egg/protocols/tests/__init__.pys __conform__ s(s__name__s __module__s __conform__(((s<build/bdist.darwin-8.0.1-x86/egg/protocols/tests/__init__.pys Conformers(s ConformersadaptslistsNonesAssertionError(sselfs Conformer((s<build/bdist.darwin-8.0.1-x86/egg/protocols/tests/__init__.pys"checkAdaptTrapsTypeErrorsOnConforms cCsvtdddgttƒdddgjpt‚tdttƒdjpt‚tdttƒtjpt‚dS(Niiisfoo(sadaptslistsNonesAssertionErrorsstr(sself((s<build/bdist.darwin-8.0.1-x86/egg/protocols/tests/__init__.pyscheckAdaptHandlesIsInstances2 cCs1y tƒWntj onXtdƒ‚dS(Ns2Should've got SyntaxError for advise() in function(sadvises SyntaxErrorsAssertionError(sself((s<build/bdist.darwin-8.0.1-x86/egg/protocols/tests/__init__.pyscheckAdviseFailsInCallContexts  cCsYydfd„ƒY}Wn/tj o#}|idfjpt‚nXtdƒ‚dS(NsXcBstZedeƒRS(NsmoduleProvides(s__name__s __module__sadviseslist(((s<build/bdist.darwin-8.0.1-x86/egg/protocols/tests/__init__.pysX!ss=Invalid keyword argument for advising classes: moduleProvidess Should've caught invalid keyword(sXs TypeErrorsvsargssAssertionError(sselfsXsv((s<build/bdist.darwin-8.0.1-x86/egg/protocols/tests/__init__.pys!checkAdviseClassKeywordsValidateds cBsVydeƒeƒUWn/ej o#}|idfjpt‚nXedƒ‚dS(Ns%advise(instancesProvide=[IProtocol1])s?Invalid keyword argument for advising modules: instancesProvides Should've caught invalid keyword(sglobalss TypeErrorsvsargssAssertionError(sselfsv((s<build/bdist.darwin-8.0.1-x86/egg/protocols/tests/__init__.pys"checkAdviseModuleKeywordsValidated5s cBs$hde<de<}d|UdS(Nsadvises IProtocol1s0class Foo: advise(instancesProvide=[IProtocol1])(sadvises IProtocol1sd(sselfsd((s<build/bdist.darwin-8.0.1-x86/egg/protocols/tests/__init__.pyscheckAdviseInClassExec?scCsÅdfd„ƒY}dfd„ƒY}|ƒ}t|dtƒd|fjpt‚t||tƒd|fjpt‚td|tƒddfjpt‚tddtƒtjpt‚dS(Ns ConformercBstZd„ZRS(NcCs|djod|fSndS(Ni*s hitchhiker(sprotocolsself(sselfsprotocol((s<build/bdist.darwin-8.0.1-x86/egg/protocols/tests/__init__.pys __conform__Es (s__name__s __module__s __conform__(((s<build/bdist.darwin-8.0.1-x86/egg/protocols/tests/__init__.pys ConformerDssAdaptingProtocolcBstZd„ZeeƒZRS(NcCsd|fSdS(Nsadapted(sob(sklasssob((s<build/bdist.darwin-8.0.1-x86/egg/protocols/tests/__init__.pys __adapt__Is(s__name__s __module__s __adapt__s classmethod(((s<build/bdist.darwin-8.0.1-x86/egg/protocols/tests/__init__.pysAdaptingProtocolHs i*s hitchhikersadapted(s ConformersAdaptingProtocolscsadaptsNonesAssertionError(sselfsAdaptingProtocolscs Conformer((s<build/bdist.darwin-8.0.1-x86/egg/protocols/tests/__init__.pyscheckSimpleAdaptationCs &&&cCs¬dfd„ƒY}dfd„ƒY}tt|tƒtjpt‚t|ttƒtjpt‚|it|ƒtƒ|i|ƒttƒ|ittttƒdS(Ns NonconformistcBstZd„ZRS(NcCstdƒ‚dS(Ns You got me!(s TypeError(sselfsob((s<build/bdist.darwin-8.0.1-x86/egg/protocols/tests/__init__.pys __conform__Vs(s__name__s __module__s __conform__(((s<build/bdist.darwin-8.0.1-x86/egg/protocols/tests/__init__.pys NonconformistUss UnadaptivecBstZd„ZRS(NcCstdƒ‚dS(Ns You got me!(s TypeError(sselfsob((s<build/bdist.darwin-8.0.1-x86/egg/protocols/tests/__init__.pys __adapt__Zs(s__name__s __module__s __adapt__(((s<build/bdist.darwin-8.0.1-x86/egg/protocols/tests/__init__.pys UnadaptiveYs( s Nonconformists UnadaptivesadaptsNonesAssertionErrorsselfsassertTypeErrorPasseds assertRaisessAdaptationFailure(sselfs Unadaptives Nonconformist((s<build/bdist.darwin-8.0.1-x86/egg/protocols/tests/__init__.pyscheckAdaptFiltersTypeErrorsSs  cGsPyt|ŒWn/tj o#}|idfjpt‚nXtdƒ‚dS(Ns You got me!s"Should've passed TypeError through(sadaptsargss TypeErrorsvsAssertionError(sselfsargssv((s<build/bdist.darwin-8.0.1-x86/egg/protocols/tests/__init__.pysassertTypeErrorPassedis cCsOdtfd„ƒY}d|fd„ƒY}td„d|gd|gƒdS(NsI1cBstZRS(N(s__name__s __module__(((s<build/bdist.darwin-8.0.1-x86/egg/protocols/tests/__init__.pysI1sssI2cBstZRS(N(s__name__s __module__(((s<build/bdist.darwin-8.0.1-x86/egg/protocols/tests/__init__.pysI2tscCs|S(N(so(so((s<build/bdist.darwin-8.0.1-x86/egg/protocols/tests/__init__.pysussprovidess forProtocols(s InterfacesI1sI2sdeclareAdapter(sselfsI1sI2((s<build/bdist.darwin-8.0.1-x86/egg/protocols/tests/__init__.pyscheckImplicationBugrscs’x‹tdƒtgD]v‰dtf‡d†ƒY}|ƒ}|iˆjpt‚x4tdƒD]&}||_|i|jpt‚q`WqWdS(Ni sAbstractcstZeddˆƒZRS(Nstestingsvalue(s__name__s __module__s Attributesisvalue((si(s<build/bdist.darwin-8.0.1-x86/egg/protocols/tests/__init__.pysAbstract€s( srangesNonesis AbstractBasesAbstractsobsvaluesAssertionErrorsj(sselfsisAbstractsjsob((sis<build/bdist.darwin-8.0.1-x86/egg/protocols/tests/__init__.pyscheckAttribute|s   c südfd„ƒY‰ˆƒ}dtfd„ƒY‰dkl}d|f‡‡d†ƒY}ˆ|ƒ}t|ˆƒ|jpt ‚|i |jpt ‚ˆƒ}ˆ|ƒ}||j pt ‚|i |jpt ‚t|ˆƒ|jpt ‚dS(NsTcBstZRS(N(s__name__s __module__(((s<build/bdist.darwin-8.0.1-x86/egg/protocols/tests/__init__.pysTŒssIcBstZRS(N(s__name__s __module__(((s<build/bdist.darwin-8.0.1-x86/egg/protocols/tests/__init__.pysIŽs(s StickyAdaptersAcs*tZˆfZedˆgdˆgƒRS(NsinstancesProvidesasAdapterForTypes(s__name__s __module__sIsattachForProtocolssadvisesT((sIsT(s<build/bdist.darwin-8.0.1-x86/egg/protocols/tests/__init__.pysAs ( sTsts InterfacesIsprotocols.adapterss StickyAdaptersAsasadaptsAssertionErrorssubjectsnsa2( sselfsAsasIs StickyAdaptersnsa2sTst((sIsTs<build/bdist.darwin-8.0.1-x86/egg/protocols/tests/__init__.pyscheckStickyAdapter‹s     (s__name__s __module__s"checkAdaptTrapsTypeErrorsOnConformscheckAdaptHandlesIsInstancescheckAdviseFailsInCallContexts!checkAdviseClassKeywordsValidateds"checkAdviseModuleKeywordsValidatedscheckAdviseInClassExecscheckSimpleAdaptationscheckAdaptFiltersTypeErrorssassertTypeErrorPassedscheckImplicationBugscheckAttributescheckStickyAdapter(((s<build/bdist.darwin-8.0.1-x86/egg/protocols/tests/__init__.pysAPITestss      (sprotocolForTypesprotocolForURIs sequenceOfsadvise(sdeclareImplementations Variation(sUserDicts __getitem__s __setitem__sreadsimplicits)http://peak.telecommunity.com/PyProtocolss MyUserMappingcBstZRS(N(s__name__s __module__(((s<build/bdist.darwin-8.0.1-x86/egg/protocols/tests/__init__.pys MyUserMapping·ssGenerationTestscBs>tZd„Zd„Zd„Zd„Zd„Zd„ZRS(NcCsDh}t|tƒ|jpt‚t|tƒ|jpt‚dS(N(sdsIGetSetMappingsNonesAssertionErrors IGetMapping(sselfsd((s<build/bdist.darwin-8.0.1-x86/egg/protocols/tests/__init__.pyscheckTypeSubsetÏscCsGtƒ}t|tƒ|jpt‚t|tƒtjpt‚dS(N(sUserDictsds IGetMappingsNonesAssertionErrors IImplicitRead(sselfsd((s<build/bdist.darwin-8.0.1-x86/egg/protocols/tests/__init__.pyscheckImplicationsÔs cCsWdkl}|dƒ}t|tƒtjpt‚t|tƒ|jpt‚dS(N(sStringIOsfoo(s cStringIOsStringIOsssISimpleReadFilesNonesAssertionErrors IImplicitRead(sselfsStringIOss((s<build/bdist.darwin-8.0.1-x86/egg/protocols/tests/__init__.pys checkWeakÙs  cCsDtdƒ}|tj pt‚tdƒ}|tjpt‚dS(Nshttp://www.python.org/s)http://peak.telecommunity.com/PyProtocols(sprotocolForURIsps IProtocol1sAssertionError(sselfsp((s<build/bdist.darwin-8.0.1-x86/egg/protocols/tests/__init__.pyscheckURIßs  cCs‘hhf\}}t||gƒ}|||gjpt‚|d|jo|d|jpt‚dtfd„ƒY}|||gƒdS(Niis ISequenceLikecBstZedegƒRS(NsprotocolIsSubsetOf(s__name__s __module__sadvisesmultimap(((s<build/bdist.darwin-8.0.1-x86/egg/protocols/tests/__init__.pys ISequenceLikeês(sd1sd2smultimapsseqsAssertionErrors Interfaces ISequenceLike(sselfsseqs ISequenceLikesd2sd1((s<build/bdist.darwin-8.0.1-x86/egg/protocols/tests/__init__.pys checkSequenceås )cCsŸh}t|tƒ|jpt‚tƒ}t|tƒ|jpt‚t|tƒtjpt‚|ittƒdƒ|itt t dƒƒdƒdS(NsCVariation(TypeSubset(,('__getitem__', '__setitem__')))i*s6Variation(,42)( sdsIMyUnusualMappingsNonesAssertionErrors MyUserMappingsIGetSetMappingsselfs assertEqualsreprs Variations Interface(sselfsd((s<build/bdist.darwin-8.0.1-x86/egg/protocols/tests/__init__.pyscheckVariationís&(s__name__s __module__scheckTypeSubsetscheckImplicationss checkWeakscheckURIs checkSequencescheckVariation(((s<build/bdist.darwin-8.0.1-x86/egg/protocols/tests/__init__.pysGenerationTestsÎs      cCsædkl}l}l}|iƒ|iƒ|iƒttdƒttdƒg}y dk }Wnt j on"Xdkl }|i |iƒƒy dk}Wnt j on"Xdkl}|i |iƒƒt|ƒSdS(N(s test_advices test_directs test_classesscheck(s test_zope(s test_twisted(sprotocols.testss test_advices test_directs test_classess test_suites makeSuitesAPITestssGenerationTestsstestsszope.interfaceszopes ImportErrors test_zopesappendstwisted.python.componentsstwisteds test_twisteds TestSuite(stestss test_twisteds test_advicestwisteds test_zopes test_classesszopes test_direct((s<build/bdist.darwin-8.0.1-x86/egg/protocols/tests/__init__.pys test_suite÷s9    N(!sunittests TestSuitesTestCases makeSuites protocolssadaptsadvises Interfaces AttributesdeclareAdapters AbstractBasesAdaptationFailuresAPITestssprotocolForTypesprotocolForURIs sequenceOfsdeclareImplementations VariationsUserDictsdictsIGetSetMappings IGetMappingsfilesISimpleReadFilesTrues IImplicitReads IProtocol1smultimapsIMyUnusualMappingsobjects MyUserMappingsGenerationTestss test_suite(s sequenceOfsIMyUnusualMappings Variations TestSuitesAdaptationFailuresISimpleReadFilesprotocolForTypesTestCasesadapts IImplicitReads InterfacesadvisesAPITestssmultimapsUserDicts makeSuitesGenerationTestssprotocolForURIsdeclareAdaptersIGetSetMappingsdeclareImplementations MyUserMappings Attributes IGetMappings test_suites IProtocol1s AbstractBase((s<build/bdist.darwin-8.0.1-x86/egg/protocols/tests/__init__.pys?s$%     )PKÛ\â2Ô¥$$protocols/tests/test_classes.py"""Tests for implementor declarations (i.e. instancesProvides)""" from unittest import TestCase, makeSuite, TestSuite from protocols import * from checks import ImplementationChecks, AdaptiveChecks, makeClassTests class IA(Interface): pass class IB(IA): pass class IPure(Interface): # We use this for pickle/copy tests because the other protocols # imply various dynamically created interfaces, and so any object # registered with them won't be picklable pass class BasicChecks(AdaptiveChecks, ImplementationChecks): """PyProtocols-only class-instances-provide checks""" IA = IA IB = IB Interface = Interface IPure = IPure def checkChangingBases(self): # Zope and Twisted fail this because they rely on the first-found # __implements__ attribute and ignore a class' MRO/__bases__ M1, M2 = self.setupBases(self.klass) m1 = self.make(M1) m2 = self.make(M2) declareImplementation(M1, instancesProvide=[self.IA]) declareImplementation(M2, instancesProvide=[self.IB]) self.assertM1ProvidesOnlyAandM2ProvidesB(m1,m2) self.assertChangingBasesChangesInterface(M1,M2,m1,m2) TestClasses = makeClassTests(BasicChecks) def test_suite(): return TestSuite([makeSuite(t,'check') for t in TestClasses]) PKIŸC8d>‡×4O4Oprotocols/tests/test_advice.pyc;ò þÕBc@sðdZdklZlZlZdkTdkZdklZd„Z d„Z defd„ƒYZ d efd „ƒYZ e eiƒƒZd efd „ƒYZd efd„ƒYZdefd„ƒYZe e eeefZd„ZdS(sTests for advice(sTestCases makeSuites TestSuite(s*N(s InstanceTypecs‡‡d†}t|ƒdS(Ncsˆiˆ|fƒ|gSdS(N(slogsappendsvaluesklass(sklass(svalueslog(s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pyspong s(spongsaddClassAdvisor(slogsvaluespong((slogsvalues?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pyspingscsTtˆƒdjotˆƒ‰ˆiƒn‡d†}dkl}||ƒSdS(sçUse Python 2.4 decorators w/Python 2.2+ Example:: import dispatch class Foo(object): [dispatch.as(classmethod)] def something(cls,etc): """This is a classmethod""" ics%xˆD]}||ƒ}qW|SdS(N(s decoratorssdsv(sframesksvs old_localssd(s decorators(s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pyscallback!s(sadd_assignment_advisorN(slens decoratorsslistsreversescallbacksprotocols.advicesadd_assignment_advisor(s decoratorssadd_assignment_advisorscallback((s decoratorss?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pysas_s    s SuperTestcBs#tZd„Zd„Zd„ZRS(Ncsßdtfd„ƒY‰dtf‡d†ƒY}|idƒdjpt‚|ƒidƒdjpt‚dˆf‡d†ƒY‰d |f‡d †ƒY}|idƒd jpt‚|ƒidƒdjpt‚dS( NsMetacBstZd„ZeeƒZRS(NcCs|SdS(N(sarg(sselfsarg((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pysfoo/s(s__name__s __module__sfoos metamethod(((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pysMeta.s sClasscstZˆZd„ZRS(NcCs |dSdS(Ni(sarg(sselfsarg((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pysfoo6s(s__name__s __module__sMetas __metaclass__sfoo((sMeta(s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pysClass3siisSubMetacs tZ‡d†ZeeƒZRS(Ncstˆ|ƒi|ƒ SdS(N(s supermetasSubMetasselfsfoosarg(sselfsarg(sSubMeta(s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pysfooAs(s__name__s __module__sfoos metamethod((sSubMeta(s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pysSubMeta@s sClassOfSubMetacstZˆZRS(N(s__name__s __module__sSubMetas __metaclass__((sSubMeta(s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pysClassOfSubMetaEsiÿÿÿÿ(stypesMetasobjectsClasssfoosAssertionErrorsSubMetasClassOfSubMeta(sselfsClassOfSubMetasSubMetasMetasClass((sSubMetasMetas?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pyscheckMetaSuper,s cs_dtfd„ƒY‰dˆf‡‡d†ƒY‰ˆƒ}d|_|idjpt‚dS(NsBasecBstZdZRS(Nsfoo(s__name__s __module__s __slots__(((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pysBaseUssSubcs/tZ‡d†Z‡d†ZeeeƒZRS(Ncstˆ|ƒidSdS(Ni(s supermetasSubsselfsfoo(sself(sSub(s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pysgetFooZscsˆii||ƒdS(N(sBasesfoos__set__sselfsval(sselfsval(sBase(s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pyssetFoo]s(s__name__s __module__sgetFoossetFoospropertysfoo((sSubsBase(s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pysSubXs  ii(sobjectsBasesSubsobsfoosAssertionError(sselfsBasesSubsob((sBasesSubs?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pyscheckPropSuperSs   cCsYdtfd„ƒY}|ƒ}yt||ƒiWntj onXtdƒ‚dS(NsBasecBstZRS(N(s__name__s __module__(((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pysBasehssShouldn't have returned a value(sobjectsBasesbs supermetasfoosAttributeErrorsAssertionError(sselfsbsBase((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pyscheckSuperNotFoundgs (s__name__s __module__scheckMetaSuperscheckPropSuperscheckSuperNotFound(((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pys SuperTest*s ' sDecoratorTestscBs#tZd„Zd„Zd„ZRS(NcsÛg‰‡d†}t|dtiƒƒd}|iˆtiƒddfgƒg‰t|dƒd}|iˆtiƒddfgƒg‰t|dƒt|dƒd}|iˆtiƒddfgdƒdS(Ncs8ˆi|||fƒ||ijo|i|=ndS(N(slogsappendsfsksvsf_locals(sfsksvsd(slog(s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pystrackssframeistest_vari*stest2i( slogstracksadd_assignment_advisorssyss _getframestest_varsselfs assertEqualstest2(sselfstest2slogstrackstest_var((slogs?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pyscheckAssignAdvice~s " "  cCsbd„}td„ƒg|}|i||gƒttd„ƒg|}|i||gƒdS(NcCsdS(N((((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pysf™scCs|gS(N(sx(sx((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pys›scCs|fS(N(sx(sx((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pys s(sfsas_sf1sselfs assertEqualslist(sselfsf1sf((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pyscheckAs—s csZg‰‡d†}d„}t|dƒ|ƒd}|iˆtiƒd|fgƒdS(Ncsˆi|||fƒ|SdS(N(slogsappendsfsksv(sfsksvsd(slog(s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pystrack¨scCsdS(N((sx((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pysfoo¬sisfoo( slogstracksfoosadd_assignment_advisorsxsselfs assertEqualssyss _getframe(sselfslogstracksxsfoo((slogs?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pyscheck24DecoratorMode¥s   (s__name__s __module__scheckAssignAdvicescheckAsscheck24DecoratorMode(((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pysDecoratorTests|s  s FrameInfoTestcBs>tZeeiƒƒZd„Zd„Zd„Zd„Z RS(NcCs^t\}}}}|djpt‚x1|i||fD]}|tƒjpt‚q9WdS(Nsmodule( smoduleLevelFrameInfoskindsmodulesf_localss f_globalssAssertionErrors__dict__sdsglobals(sselfskindsds f_globalssmodulesf_locals((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pyscheckModuleInfoÔs cCsy|i\}}}}|djpt‚|d|ijpt‚x.|i|fD]}|t ƒjpt‚qTWdS(NsclasssclassLevelFrameInfo( sselfsclassLevelFrameInfoskindsmodulesf_localss f_globalssAssertionErrors__dict__sdsglobals(sselfskindsds f_globalssmodulesf_locals((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pyscheckClassInfoÚs cCs~ttiƒƒ\}}}}|djpt‚|tƒjpt‚x.|i |fD]}|t ƒjpt‚qYWdS(Ns function call( s getFrameInfossyss _getframeskindsmodulesf_localss f_globalssAssertionErrorslocalss__dict__sdsglobals(sselfskindsds f_globalssmodulesf_locals((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pys checkCallInfoâs cBsThde<de<}d|U|di\}}}}|djp t|‚dS(Nssyss getFrameInfos-class Foo: info=getFrameInfo(sys._getframe())sFoosclass( ssyss getFrameInfosdsinfoskindsmodulesf_localss f_globalssAssertionError(sselfskindsds f_globalssmodulesf_locals((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pyscheckClassExecês( s__name__s __module__s getFrameInfossyss _getframesclassLevelFrameInfoscheckModuleInfoscheckClassInfos checkCallInfoscheckClassExec(((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pys FrameInfoTestÐs    sMROTestscBstZd„Zd„ZRS(NcCs|dtfd„ƒY}d|fd„ƒY}d|fd„ƒY}d||fd„ƒY}t|ƒ|ijpt‚dS( NsfoocBstZRS(N(s__name__s __module__(((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pysfooússbarcBstZRS(N(s__name__s __module__(((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pysbarûssbazcBstZRS(N(s__name__s __module__(((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pysbazüssspamcBstZRS(N(s__name__s __module__(((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pysspamýs(sobjectsfoosbarsbazsspamsgetMROs__mro__sAssertionError(sselfsbarsspamsbazsfoo((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pys checkStdMROùs cCs¾dfd„ƒY}d|fd„ƒY}d|fd„ƒY}d||fd„ƒY}|||||g}tt|ƒƒ|jpt‚tt|tƒƒ|t t gjpt‚dS( NsfoocBstZRS(N(s__name__s __module__(((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pysfoossbarcBstZRS(N(s__name__s __module__(((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pysbarssbazcBstZRS(N(s__name__s __module__(((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pysbazssspamcBstZRS(N(s__name__s __module__(((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pysspams( sfoosbarsbazsspamsbasicMROslistsgetMROsAssertionErrorsTrues InstanceTypesobject(sselfsbarsspamsbazsbasicMROsfoo((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pyscheckClassicMROs (s__name__s __module__s checkStdMROscheckClassicMRO(((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pysMROTests÷s s AdviceTestscBs>tZd„Zd„Zd„Zd„Zd„Zd„ZRS(Ncs’g‰df‡d†ƒY}x7dddfD]&}t|tƒpt‚|\}q,Wˆd|fd|gfd|ggfgjpt‚dS(NsFoocs/tZeˆdƒeˆdƒeˆdƒRS(Niii(s__name__s __module__spingslog((slog(s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pysFoo$s  iii(slogsFoosis isinstanceslistsAssertionError(sselfslogsisFoo((slogs?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pys checkOrder"s cCs7ytgdƒWntj onXtdƒ‚dS(Nis.Should have detected advice outside class body(spings SyntaxErrorsAssertionError(sself((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pys checkOutside4s cCsUtidjodSndttfd„ƒY}|\}|itjpt‚dS(NisaTypecBstZegdƒRS(Ni(s__name__s __module__sping(((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pysaTypeAs(ssyss hexversionstypesaTypes __class__sAssertionError(sselfsaType((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pyscheckDoubleType>s  csSdtfd„ƒY‰dˆf‡d†ƒY}|\}|iˆjpt‚dS(NsMcBstZRS(N(s__name__s __module__(((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pysMKssCcstZˆZegdƒRS(Ni(s__name__s __module__sMs __metaclass__sping((sM(s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pysCMs(stypesMsCs __class__sAssertionError(sselfsMsC((sMs?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pyscheckSingleExplicitMetaIs csdtfd„ƒY‰dtfd„ƒY‰df‡d†ƒY}df‡d†ƒY}yd ||fd „ƒY}Wntj onXtd ƒ‚d ˆˆfd „ƒY‰d ||f‡d†ƒY}t |t ƒpt‚|\}t |ˆƒpt‚dS(NsM1cBstZRS(N(s__name__s __module__(((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pysM1WssM2cBstZRS(N(s__name__s __module__(((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pysM2XssB1cstZˆZRS(N(s__name__s __module__sM1s __metaclass__((sM1(s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pysB1ZssB2cstZˆZRS(N(s__name__s __module__sM2s __metaclass__((sM2(s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pysB2[ssCcBstZegdƒRS(Ni(s__name__s __module__sping(((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pysC^ss(Should have gotten incompatibility errorsM3cBstZRS(N(s__name__s __module__(((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pysM3escstZˆZegdƒRS(Ni(s__name__s __module__sM3s __metaclass__sping((sM3(s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pysCgs( stypesM1sM2sB1sB2sCs TypeErrorsAssertionErrorsM3s isinstanceslist(sselfsCsM3sM1sB1sB2sM2((sM3sM1sM2s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pyscheckMixedMetasUs  csSdtfd„ƒY‰dtf‡d†ƒY}t|tfƒˆjpt‚dS(NsmetametacBstZRS(N(s__name__s __module__(((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pysmetametatssmetacstZˆZRS(N(s__name__s __module__smetametas __metaclass__((smetameta(s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pysmetaws(stypesmetametasmetasdetermineMetaclasssAssertionError(sselfsmetametasmeta((smetametas?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pyscheckMetaOfClassrs(s__name__s __module__s checkOrders checkOutsidescheckDoubleTypescheckSingleExplicitMetascheckMixedMetasscheckMetaOfClass(((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pys AdviceTests s   cCs8tgi}tD]}|t|dƒƒq~ƒSdS(Nscheck(s TestSuitesappends_[1]s TestClassessts makeSuite(s_[1]st((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pys test_suite„s(s__doc__sunittestsTestCases makeSuites TestSuitesprotocols.advicessysstypess InstanceTypespingsas_s SuperTestsDecoratorTestss getFrameInfos _getframesmoduleLevelFrameInfos FrameInfoTestsMROTestss AdviceTestss TestClassess test_suite(s TestSuites TestClassessDecoratorTestssas_s makeSuitespingsmoduleLevelFrameInfosTestCases AdviceTestss FrameInfoTests test_suitessyss SuperTests InstanceTypesMROTests((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_advice.pys?s    RR')`PKKŸC8\¬3 ¼ ¼ protocols/tests/test_twisted.pyo;ò µÆBc@sœdZdklZlZlZdkTdkZdklZdefd„ƒYZ de fd„ƒYZ d efd „ƒYZ d k l Z lZlZd k lZlZd fd„ƒYZdefd„ƒYZdee fd„ƒYZdefd„ƒYZeeƒZeeeeeƒ7Zdeifd„ƒYZ de fd„ƒYZdefd„ƒYZeeeƒ7Zeeeeeƒ7Zd„ZdS(sTwisted Interface tests(sTestCases makeSuites TestSuite(s*N(s InterfacesIAcBstZRS(N(s__name__s __module__(((s@build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_twisted.pysIA ssIBcBstZRS(N(s__name__s __module__(((s@build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_twisted.pysIB ssIPurecBstZRS(N(s__name__s __module__(((s@build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_twisted.pysIPures(sInstanceImplementationCheckssmakeClassTestssProviderChecks(smakeInstanceTestssSimpleAdaptiveCheckss PicklablecBstZRS(N(s__name__s __module__(((s@build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_twisted.pys PicklablessNewStylecBstZRS(N(s__name__s __module__(((s@build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_twisted.pysNewStyless BasicCheckscBs tZeZeZeZeZRS(N(s__name__s __module__sIAsIBs InterfacesIPure(((s@build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_twisted.pys BasicChecksssInstanceCheckscBs tZeZeZeZeZRS(N(s__name__s __module__sIAsIBs InterfacesIPure(((s@build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_twisted.pysInstanceChecks$scBstZedegƒRS(NsprotocolExtends(s__name__s __module__sadvisesIA(((s@build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_twisted.pysIB-scCs8tgi}tD]}|t|dƒƒq~ƒSdS(Nscheck(s TestSuitesappends_[1]s TestClassessts makeSuite(s_[1]st((s@build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_twisted.pys test_suite?s(s__doc__sunittestsTestCases makeSuites TestSuites protocolssprotocols.twisted_supportstwisted.python.componentss InterfacesIAsIBsIPurescheckssInstanceImplementationCheckssmakeClassTestssProviderCheckssmakeInstanceTestssSimpleAdaptiveCheckss PicklablesobjectsNewStyles BasicCheckssInstanceCheckss TestClassess test_suite(s Picklables TestSuitesSimpleAdaptiveCheckssInstanceImplementationCheckssmakeClassTestssIPures makeSuitesTestCases InterfacesProviderCheckss TestClassess BasicCheckssInstanceCheckssmakeInstanceTestssIAsNewStylesIBs test_suites protocols((s@build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_twisted.pys?s*   PKJŸC8\¬3 ¼ ¼ protocols/tests/test_twisted.pyc;ò µÆBc@sœdZdklZlZlZdkTdkZdklZdefd„ƒYZ de fd„ƒYZ d efd „ƒYZ d k l Z lZlZd k lZlZd fd„ƒYZdefd„ƒYZdee fd„ƒYZdefd„ƒYZeeƒZeeeeeƒ7Zdeifd„ƒYZ de fd„ƒYZdefd„ƒYZeeeƒ7Zeeeeeƒ7Zd„ZdS(sTwisted Interface tests(sTestCases makeSuites TestSuite(s*N(s InterfacesIAcBstZRS(N(s__name__s __module__(((s@build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_twisted.pysIA ssIBcBstZRS(N(s__name__s __module__(((s@build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_twisted.pysIB ssIPurecBstZRS(N(s__name__s __module__(((s@build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_twisted.pysIPures(sInstanceImplementationCheckssmakeClassTestssProviderChecks(smakeInstanceTestssSimpleAdaptiveCheckss PicklablecBstZRS(N(s__name__s __module__(((s@build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_twisted.pys PicklablessNewStylecBstZRS(N(s__name__s __module__(((s@build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_twisted.pysNewStyless BasicCheckscBs tZeZeZeZeZRS(N(s__name__s __module__sIAsIBs InterfacesIPure(((s@build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_twisted.pys BasicChecksssInstanceCheckscBs tZeZeZeZeZRS(N(s__name__s __module__sIAsIBs InterfacesIPure(((s@build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_twisted.pysInstanceChecks$scBstZedegƒRS(NsprotocolExtends(s__name__s __module__sadvisesIA(((s@build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_twisted.pysIB-scCs8tgi}tD]}|t|dƒƒq~ƒSdS(Nscheck(s TestSuitesappends_[1]s TestClassessts makeSuite(s_[1]st((s@build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_twisted.pys test_suite?s(s__doc__sunittestsTestCases makeSuites TestSuites protocolssprotocols.twisted_supportstwisted.python.componentss InterfacesIAsIBsIPurescheckssInstanceImplementationCheckssmakeClassTestssProviderCheckssmakeInstanceTestssSimpleAdaptiveCheckss PicklablesobjectsNewStyles BasicCheckssInstanceCheckss TestClassess test_suite(s Picklables TestSuitesSimpleAdaptiveCheckssInstanceImplementationCheckssmakeClassTestssIPures makeSuitesTestCases InterfacesProviderCheckss TestClassess BasicCheckssInstanceCheckssmakeInstanceTestssIAsNewStylesIBs test_suites protocols((s@build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_twisted.pys?s*   PKIŸC8IÉ.Ü&z&zprotocols/tests/doctest.pyc;ò µÆBc!@sÞyeWnej oeefZnXyeWnej od„ZnXdZdddddddd d d d d ddddddddddddddddddd d!d"g!Zd#kZd#kZd#k Z d#k Z d#k Z d#k Z d#k Z d#kZd#kZd#kZd#kZd#kZd#kZd$klZeid%deed&ƒhZd'„ZedƒZedƒZedƒZedƒZedƒZeeBeBeBeBZed ƒZ ed ƒZ!ed ƒZ"ed ƒZ#e e!Be"Be#BZ$d(Z%d)Z&d*„Z'd+„Z(d,d-„Z)d.d/„Z*d0„Z+d1efd2„ƒYZ,d3„Z-d4„Z.d5ei/fd6„ƒYZ0d7„Z1dfd8„ƒYZ2dfd9„ƒYZ3dfd:„ƒYZ4dfd;„ƒYZ5dfd<„ƒYZ6dfd=„ƒYZ7de8fd>„ƒYZ9de8fd?„ƒYZ:de6fd@„ƒYZ;e<a=e<e<e<e<e<e>d&e<e?e?dA„ Z@e>e<e<e<e<e>d&e<e?e4ƒdB„ ZAe?dCe<d&dD„ZBdfdE„ƒYZCd&aDdF„ZEdGeiFfdH„ƒYZGe<e<e<e<dI„ZHdJeGfdK„ƒYZIe>e<e<e4ƒdL„ZJdM„ZKdN„ZLdO„ZMe?e<dP„ZNe?e<dQ„ZOe?dR„ZPdSfdT„ƒYZQhdSeQ<dUdV<dWdX<dYdZ<d[d\<d]d^}|t|<|SdS(Ni(slensOPTIONFLAGS_BY_NAMEsflagsname(snamesflag((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pysregister_optionflags s s...cCsOtidtddƒ|d djo$|d djo|djn SdS( sÞprefix, base -> true iff name prefix + "." + base is "private". Prefix may be an empty string, and base does not contain a period. Prefix is ignored (although functions you write conforming to this protocol may make use of it). Return true iff base begins with an (at least one) underscore, but does not both begin and end with (at least) two underscores. >>> is_private("a.b", "my_func") False >>> is_private("____", "_my_func") True >>> is_private("someclass", "__init__") False >>> is_private("sometypo", "__init_") True >>> is_private("x.y.z", "_") True >>> is_private("_x.y.z", "__") False >>> is_private("", "") # senseless but consistent False sVis_private is deprecated; it wasn't useful; examine DocTestFinder.find() lists insteads stackleveliis_s__iþÿÿÿN(swarningsswarnsDeprecationWarningsbase(sprefixsbase((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pys is_private¾s  cCs[d}xJtiD]?}|i|tƒ}|tt|ƒjo||i O}qqW|SdS(s… Return the compiler-flags associated with the future features that have been imported into the given namespace (globs). iN( sflagss __future__sall_feature_namessfnamesglobssgetsNonesfeaturesgetattrs compiler_flag(sglobssfeaturesflagssfname((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pys_extract_future_flagsÛs icCsŠti|ƒo|Snot|ttfƒo t|tƒtƒdgƒSn9|t jot i t i |ƒidSn tdƒ‚dS(s‡ Return the module specified by `module`. In particular: - If `module` is a module, then return module. - If `module` is a string, then import and return the module with that name. - If `module` is None, then return the calling module. The calling module is assumed to be the module of the stack frame at the given depth in the call stack. s*s__name__s"Expected a module, string, or NoneN(sinspectsismodulesmodules isinstancesstrsunicodes __import__sglobalsslocalssNonessyssmoduless _getframesdepths f_globalss TypeError(smodulesdepth((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pys_normalize_moduleçs   icCstid|d|ƒSdS(s{ Add the given number of space characters to the beginning every non-blank line in `s`, and return the result. s (?m)^(?!$)s N(sressubsindentss(sssindent((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pys_indentúscCs?tƒ}|\}}}ti|||d|ƒ|iƒSdS(sz Return a string containing a traceback message for the given exc_info tuple (as returned by sys.exc_info()). sfileN( sStringIOsexcoutsexc_infosexc_typesexc_valsexc_tbs tracebacksprint_exceptionsgetvalue(sexc_infosexc_valsexc_typesexcoutsexc_tb((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pys_exception_tracebacks  s _SpoofOutcBstZd„Zed„ZRS(NcCsWti|ƒ}|o|idƒ o|d7}nt|dƒo |`n|SdS(Ns s softspace(sStringIOsgetvaluesselfsresultsendswithshasattrs softspace(sselfsresult((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pysgetvalues  cCs.ti||ƒt|dƒo |`ndS(Ns softspace(sStringIOstruncatesselfssizeshasattrs softspace(sselfssize((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pystruncates(s__name__s __module__sgetvaluesNonestruncate(((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pys _SpoofOuts cCsQ|itƒdjo||jSn|itƒ}t|ƒdjpt‚dt|ƒf\}}|d}|o/|i |ƒot|ƒ}|d=q¥t Sn|d}|o3|i |ƒo|t|ƒ8}|d=qét Sn||jot SnxH|D]@}|i|||ƒ}|djot Sn|t|ƒ7}qWtSdS(s_ Essentially the only subtle case: >>> _ellipsis_match('aa...aa', 'aaa') False iÿÿÿÿiiN(swantsfindsELLIPSIS_MARKERsgotssplitswsslensAssertionErrorsstartpossendpossws startswithsFalsesendswithsTrue(swantsgotswswssstartpossendpos((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pys_ellipsis_match"s6       cCs'|iƒ}|o d|SndSdS(s)Return a commented form of the given lines# s#N(slinesrstrip(sline((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pys _comment_lineSs   s_OutputRedirectingPdbcBs tZdZd„Zd„ZRS(sÀ A specialized version of the python debugger that redirects stdout to a given stream when interacting with the user. Stdout is *not* redirected when traced code is executed. cCs||_tii|ƒdS(N(soutsselfs_OutputRedirectingPdb__outspdbsPdbs__init__(sselfsout((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pys__init__as cGs=ti}|it_ztii||ŒSWd|t_XdS(N( ssyssstdouts save_stdoutsselfs_OutputRedirectingPdb__outspdbsPdbstrace_dispatchsargs(sselfsargss save_stdout((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pystrace_dispatches   (s__name__s __module__s__doc__s__init__strace_dispatch(((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pys_OutputRedirectingPdb[s  cCsti|ƒ otd|‚n|idƒo td‚nt|dƒotii |i ƒd}n}|i djoXt tiƒdjotiddjo!tii tidƒd}qèti}ntd|d ƒ‚tii||i dƒŒSdS( NsExpected a module: %rs/s1Module-relative files may not have absolute pathss__file__is__main__ss+Can't resolve paths relative to the module s (it has no __file__)(sinspectsismodulesmodules TypeErrorspaths startswiths ValueErrorshasattrsosssplits__file__sbasedirs__name__slenssyssargvscurdirsjoin(smodulespathsbasedir((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pys_module_relative_pathps *! cBs#tZdZedded„ZRS(sn A single doctest example, consisting of source code and expected output. `Example` defines the following attributes: - source: A single Python statement, always ending with a newline. The constructor adds a newline if needed. - want: The expected output from running the source code (either from stdout, or a traceback in case of exception). `want` ends with a newline unless it's empty, in which case it's an empty string. The constructor adds a newline if needed. - exc_msg: The exception message generated by the example, if the example is expected to generate an exception; or `None` if it is not expected to generate an exception. This exception message is compared against the return value of `traceback.format_exception_only()`. `exc_msg` ends with a newline unless it's `None`. The constructor adds a newline if needed. - lineno: The line number within the DocTest string containing this Example where the Example begins. This line number is zero-based, with respect to the beginning of the DocTest. - indent: The example's indentation in the DocTest string. I.e., the number of space characters that preceed the example's first prompt. - options: A dictionary mapping from option flags to True or False, which is used to override default options for this example. Any option flags not contained in this dictionary are left at their default value (as specified by the DocTestRunner's optionflags). By default, no options are set. icCsÂ|idƒ o|d7}n|o|idƒ o|d7}n|tj o|idƒ o|d7}n||_||_||_||_|tjo h}n||_||_dS(Ns ( ssourcesendswithswantsexc_msgsNonesselfslinenosindentsoptions(sselfssourceswantsexc_msgslinenosindentsoptions((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pys__init__·s      (s__name__s __module__s__doc__sNones__init__(((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pysExample”s "cBs)tZdZd„Zd„Zd„ZRS(se A collection of doctest examples that should be run in a single namespace. Each `DocTest` defines the following attributes: - examples: the list of examples. - globs: The namespace (aka globals) that the examples should be run in. - name: A name identifying the DocTest (typically, the name of the object whose docstring this DocTest was extracted from). - filename: The name of the file that this DocTest was extracted from, or `None` if the filename is unknown. - lineno: The line number within filename where this DocTest begins, or `None` if the line number is unavailable. This line number is zero-based, with respect to the beginning of the file. - docstring: The string that the examples were extracted from, or `None` if the string is unavailable. cCs[t|tƒ p td‚||_||_|iƒ|_||_||_ ||_ dS(sŒ Create a new DocTest containing the given examples. The DocTest's globals are initialized with a copy of `globs`. s8DocTest no longer accepts str; use DocTestParser insteadN( s isinstancesexampless basestringsAssertionErrorsselfs docstringsglobsscopysnamesfilenameslineno(sselfsexamplessglobssnamesfilenameslinenos docstring((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pys__init__ás    cCstt|iƒdjo d}n4t|iƒdjo d}ndt|iƒ}d|i|i|i|fSdS(Nis no examplesis 1 examples %d exampless(slensselfsexamplessnamesfilenameslineno(sselfsexamples((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pys__repr__ïs   cCs`t|tƒ odSnt|i|i|it|ƒf|i|i|it|ƒfƒSdS(Niÿÿÿÿ( s isinstancesothersDocTestscmpsselfsnamesfilenameslinenosid(sselfsother((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pys__cmp__ûs!(s__name__s __module__s__doc__s__init__s__repr__s__cmp__(((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pysDocTestÉs   cBs×tZdZeideieiBƒZeideieiBeiBƒZ eidƒi Z dd„Z d„Z dd„Zd„Zeid eiƒZd „Zeid eiƒZd „Zd „Zd„ZRS(sD A class used to parse strings containing doctest examples. sú # Source consists of a PS1 line followed by zero or more PS2 lines. (?P (?:^(?P [ ]*) >>> .*) # PS1 line (?:\n [ ]* \.\.\. .*)*) # PS2 lines \n? # Want consists of any non-blank lines that do not start with PS1. (?P (?:(?![ ]*$) # Not a blank line (?![ ]*>>>) # Not a line starting with PS1 .*$\n? # But any other line )*) sß # Grab the traceback header. Different versions of Python have # said different things on the first traceback line. ^(?P Traceback\ \( (?: most\ recent\ call\ last | innermost\ last ) \) : ) \s* $ # toss trailing whitespace on the header. (?P .*?) # don't blink: absorb stuff until... ^ (?P \w+ .*) # a line *starts* with alphanum. s ^[ ]*(#.*)?$sc Cs•|iƒ}|i|ƒ}|djoAdigi}|idƒD]}|||ƒqE~ƒ}ng} ddf\} } xø|i i|ƒD]ä}| i|| |iƒ!ƒ| |id| |iƒƒ7} |i||| ƒ\}} } }|i|ƒ oB| it|| |d| d|t|idƒƒd| ƒƒn| |id|iƒ|iƒƒ7} |iƒ} q”W| i|| ƒ| SdS(s= Divide the given string into examples and intervening text, and return them as a list of alternating Examples and strings. Line numbers for the Examples are 0-based. The optional argument `name` is a name identifying this string, and is only used for error messages. is slinenosindentsoptionsN(sstrings expandtabssselfs _min_indents min_indentsjoinsappends_[1]ssplitslsoutputscharnoslinenos _EXAMPLE_REsfinditersmsstartscounts_parse_examplesnamessourcesoptionsswantsexc_msgs_IS_BLANK_OR_COMMENTsExampleslensgroupsend(sselfsstringsnames min_indentsexc_msgsmsls_[1]ssourceslinenoswantsoutputscharnosoptions((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pysparse5s*  A!%cCs)t|i||ƒ|||||ƒSdS(s" Extract all doctest examples from the given string, and collect them into a `DocTest` object. `globs`, `name`, `filename`, and `lineno` are attributes for the new `DocTest` object. See the documentation for `DocTest` for more information. N(sDocTestsselfs get_examplessstringsnamesglobssfilenameslineno(sselfsstringsglobssnamesfilenameslineno((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pys get_doctest\scCsIgi}|i||ƒD]$}t|tƒo||ƒqq~SdS(sÑ Extract all doctest examples from the given string, and return them as a list of `Example` objects. Line numbers are 0-based, because it's most common in doctests that nothing interesting appears on the same line as opening triple-quote, and so the first interesting line is called "line 1" then. The optional argument `name` is a name identifying this string, and is only used for error messages. N( sappends_[1]sselfsparsesstringsnamesxs isinstancesExample(sselfsstringsnames_[1]sx((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pys get_exampleshs cCs£t|idƒƒ}|idƒidƒ} |i| |||ƒ|i | dd|d||ƒdi gi }| D]} || |dƒqy~ƒ} |idƒ} | idƒ}t|ƒdjotid |d ƒo |d =n|i |d|||t| ƒƒdi gi }|D]}|||ƒq(~ƒ} |ii| ƒ}|o|id ƒ}nt}|i| ||ƒ} | | | |fSd S( s¼ Given a regular expression match from `_EXAMPLE_RE` (`m`), return a pair `(source, want)`, where `source` is the matched example's source code (with prompts and indentation stripped); and `want` is the example's expected output (with indentation stripped). `name` is the string's name, and `lineno` is the line number where the example starts; both are used for error messages. sindentssources is s.iswants *$iÿÿÿÿsmsgN(slensmsgroupsindentssplits source_linessselfs_check_prompt_blanksnameslinenos _check_prefixsjoinsappends_[1]sslssourceswants want_linessresmatchswls _EXCEPTION_REsexc_msgsNones _find_optionssoptions(sselfsmsnameslinenosindents want_linessexc_msgswls_[1]ssourceswantssls source_linessoptions((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pys_parse_examplevs& "8* 4s#\s*doctest:\s*([^\n\'"]*)$c Csöh}x±|ii|ƒD]}|idƒiddƒiƒ}xs|D]k}|ddjp|dt jo!t d|d||fƒ‚nt |d}|ddj||>> tests = DocTestFinder().find(_TestClass) >>> runner = DocTestRunner(verbose=False) >>> for test in tests: ... print runner.run(test) (0, 2) (0, 1) (0, 2) (0, 2) The `summarize` method prints a summary of all the test cases that have been run by the runner, and returns an aggregated `(f, t)` tuple: >>> runner.summarize(verbose=1) 4 items passed all tests: 2 tests in _TestClass 2 tests in _TestClass.__init__ 2 tests in _TestClass.get 1 tests in _TestClass.square 7 tests in 4 items. 7 passed and 0 failed. Test passed. (0, 7) The aggregated number of tried examples and failed examples is also available via the `tries` and `failures` attributes: >>> runner.tries 7 >>> runner.failures 0 The comparison between expected outputs and actual outputs is done by an `OutputChecker`. This comparison may be customized with a number of option flags; see the documentation for `testmod` for more information. If the option flags are insufficient, then the comparison may also be customized by passing a subclass of `OutputChecker` to the constructor. The test runner's display output can be controlled in two ways. First, an output function (`out) can be passed to `TestRunner.run`; this function will be called with strings that should be displayed. It defaults to `sys.stdout.write`. If capturing the output is not sufficient, then the display output can be also customized by subclassing DocTestRunner, and overriding the methods `report_start`, `report_success`, `report_unexpected_exception`, and `report_failure`. s*iFicCsy|ptƒ|_|tjodtij}n||_||_ ||_ d|_ d|_ h|_ tƒ|_dS(sc Create a new test runner. Optional keyword arg `checker` is the `OutputChecker` that should be used to compare the expected outputs and actual outputs of doctest examples. Optional keyword arg 'verbose' prints lots of stuff if true, only failures if false; by default, it's true iff '-v' is in sys.argv. Optional argument `optionflags` can be used to control how the test runner compares expected output to actual output, and how it displays failures. See the documentation for `testmod` for more information. s-viN(scheckers OutputCheckersselfs_checkersverbosesNonessyssargvs_verboses optionflagssoriginal_optionflagsstriessfailuress_name2fts _SpoofOuts_fakeout(sselfscheckersverboses optionflags((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pys__init__Us       cCsc|ioU|io,|dt|iƒdt|iƒƒq_|dt|iƒdƒndS(s‡ Report that the test runner is about to process the given example. (Only displays a message if verbose=True) sTrying: s Expecting: sExpecting nothing N(sselfs_verbosesexampleswantsouts_indentssource(sselfsoutstestsexample((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pys report_startys   ,cCs|io|dƒndS(st Report that the given example ran successfully. (Only displays a message if verbose=True) sok N(sselfs_verbosesout(sselfsoutstestsexamplesgot((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pysreport_success†s cCs3||i||ƒ|ii|||iƒƒdS(s7 Report that the given example failed. N( soutsselfs_failure_headerstestsexamples_checkersoutput_differencesgots optionflags(sselfsoutstestsexamplesgot((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pysreport_failureŽscCs.||i||ƒdtt|ƒƒƒdS(sO Report that the given example raised an unexpected exception. sException raised: N(soutsselfs_failure_headerstestsexamples_indents_exception_tracebacksexc_info(sselfsoutstestsexamplesexc_info((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pysreport_unexpected_exception•scCsÓ|ig}|iob|itj o |itj o|i|id}nd}|id|i||i fƒn"|id|id|i fƒ|idƒ|i }|it |ƒƒdi |ƒSdS(Nis?sFile "%s", line %s, in %ssLine %s, in %ssFailed example:s ( sselfsDIVIDERsoutstestsfilenameslinenosNonesexamplesappendsnamessources_indentsjoin(sselfstestsexamplessourceslinenosout((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pys_failure_headerœs   $!  cBs¶d}} |i} edƒ\} }}|i i }xUe |iƒD]D\}}|ie@o |dj}| |_|ioNxK|iiƒD]6\}}|o|i|O_q|i|M_qWn| d7} | o|i|||ƒnd|i|f}y7e|i|d|dƒ|iU|ii ƒe!}Wn5e#j o ‚n!e$i%ƒ}|ii ƒnX|i&i'ƒ} |i&i)dƒ|}|e!jo'||i+| |iƒo | }qÄnöe$i%ƒ}e,i-|d Œd} | o| e/|ƒ7} n|i.e!jo |}n||i.| |iƒo | }nz|ie0@oke1i2d|i.ƒ}e1i2d| ƒ}|o,|o%||i5dƒ|i5dƒ|iƒo | }qÄn|| jo&| o|i6|||| ƒqˆqD||jo0| o|i7|||| ƒn|d7}qD||jo0| o|i8||||ƒn|d7}qDe9pt:d |f‚qDW| |_|i;||| ƒ|| fSd S( sÒ Run the examples in `test`. Write the outcome of each example with one of the `DocTestRunner.report_*` methods, using the writer function `out`. `compileflags` is the set of compiler flags that should be used to execute examples. Return a tuple `(f, t)`, where `t` is the number of examples tried, and `f` is the number of examples that failed. The examples are run in the namespace `test.globs`. iiisssingleiiÿÿÿÿs[^:]*:sunknown outcomeN(<sfailuresstriessselfs optionflagssoriginal_optionflagssrangesSUCCESSsFAILUREsBOOMs_checkers check_outputschecks enumeratestestsexampless examplenumsexamplesREPORT_ONLY_FIRST_FAILUREsquietsoptionssitemss optionflagsvals report_startsoutsnamesfilenamescompilessources compileflagssglobssdebuggers set_continuesNones exceptionsKeyboardInterruptssyssexc_infos_fakeoutsgetvaluesgotstruncatesoutcomeswants tracebacksformat_exception_onlysexc_msgs_exception_tracebacksIGNORE_EXCEPTION_DETAILsresmatchsm1sm2sgroupsreport_successsreport_failuresreport_unexpected_exceptionsFalsesAssertionErrors_DocTestRunner__record_outcome(sselfstests compileflagssoutschecksvalsfilenamesm1sm2sgotsoriginal_optionflagssSUCCESSsexc_msgstriessexc_infos exceptions optionflagsquietsFAILUREsBOOMs examplenumsfailuressoutcomesexample((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pys__run°s‚                )      cCsd|ii|iddfƒ\}}||||f|i|i<|i |7_ |i |7_ dS(s{ Record the fact that the given DocTest (`test`) generated `f` failures out of `t` tried examples. iN( sselfs_name2ftsgetstestsnamesf2st2sfstsfailuresstries(sselfstestsfstsf2st2((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pys__record_outcome(s $s3[\w\.]+)\[(?P\d+)\]>$cCsy|ii|ƒ}|o|idƒ|iijo3|iit |idƒƒ}|i i t ƒSn|i|ƒSdS(Nsnames examplenum(sselfs%_DocTestRunner__LINECACHE_FILENAME_REsmatchsfilenamesmsgroupstestsnamesexamplessintsexamplessources splitlinessTruessave_linecache_getlines(sselfsfilenamesmsexample((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pys__patched_linecache_getlines5s #cCsù||_|tjot|iƒ}nti}|tjo |i }n|i t_t i }t|ƒ|_|iiƒ|ii t _ ti|_|it_z|i|||ƒSWd|t_|t _ |it_|o|iiƒnXdS(sJ Run the examples in `test`, and display the results using the writer function `out`. The examples are run in the namespace `test.globs`. If `clear_globs` is true (the default), then this namespace will be cleared after the test runs, to help with garbage collection. If you would like to examine the namespace after the test completes, then use `clear_globs=False`. `compileflags` gives the set of flags that should be used by the Python compiler when running the examples. If not specified, then it will default to the set of future-import flags that apply to `globs`. The output of each example is checked using `DocTestRunner.check_output`, and the results are formatted by the `DocTestRunner.report_*` methods. N(stestsselfs compileflagssNones_extract_future_flagssglobsssyssstdouts save_stdoutsoutswrites_fakeoutspdbs set_tracessave_set_traces_OutputRedirectingPdbsdebuggersresets linecachesgetlinesssave_linecache_getliness*_DocTestRunner__patched_linecache_getliness_DocTestRunner__runs clear_globssclear(sselfstests compileflagssouts clear_globss save_stdoutssave_set_trace((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pysrun=s,             c Cs7|tjo |i}ng} g}g}d}} x |i i ƒD]} | \}\}}||jpt‚||7}| |7} |djo| i|ƒqF|djo|i||fƒqF|i| ƒqFW|oŒ| o7t| ƒGdGH| iƒx| D]} dG| GHqWn|oCt|ƒGdGH|iƒx'|D]\} }d|| fGHqEWqln|oT|iGHt|ƒGdGH|iƒx0|D]$\} \}}d||| fGHq›Wn|o3|GdGt|i ƒGd GH|| Gd G| Gd GHn| od G| Gd GHn|o dGHn| |fSdS(s¦ Print a summary of all the test cases that have been run by this DocTestRunner, and return a tuple `(f, t)`, where `f` is the total number of failed examples, and `t` is the total number of tried examples. The optional `verbose` argument controls how detailed the summary is. If the verbosity is not specified, then the DocTestRunner's verbosity is used. isitems had no tests:s sitems passed all tests:s %3d tests in %ssitems had failures:s %3d of %3d in %sstests insitems.s passed andsfailed.s***Test Failed***s failures.s Test passed.N(sverbosesNonesselfs_verbosesnotestsspassedsfailedstotaltstotalfs_name2ftsitemssxsnamesfstsAssertionErrorsappendslenssortsthingscountsDIVIDER( sselfsverbosescountsfstotaltsnamesfailedstspassedsxstotalfsthingsnotests((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pys summarizevs\             cCs…|i}xu|iiƒD]d\}\}}||jo5d|dGH||\}}||}||}n||f||>> runner = DebugRunner(verbose=False) >>> test = DocTestParser().get_doctest('>>> raise KeyError\n42', ... {}, 'foo', 'foo.py', 0) >>> try: ... runner.run(test) ... except UnexpectedException, failure: ... pass >>> failure.test is test True >>> failure.example.want '42\n' >>> exc_info = failure.exc_info >>> raise exc_info[0], exc_info[1], exc_info[2] Traceback (most recent call last): ... KeyError We wrap the original exception to give the calling application access to the test and example information. If the output doesn't match, then a DocTestFailure is raised: >>> test = DocTestParser().get_doctest(''' ... >>> x = 1 ... >>> x ... 2 ... ''', {}, 'foo', 'foo.py', 0) >>> try: ... runner.run(test) ... except DocTestFailure, failure: ... pass DocTestFailure objects provide access to the test: >>> failure.test is test True As well as to the example: >>> failure.example.want '2\n' and the actual output: >>> failure.got '1\n' If a failure or error occurs, the globals are left intact: >>> del test.globs['__builtins__'] >>> test.globs {'x': 1} >>> test = DocTestParser().get_doctest(''' ... >>> x = 2 ... >>> raise KeyError ... ''', {}, 'foo', 'foo.py', 0) >>> runner.run(test) Traceback (most recent call last): ... UnexpectedException: >>> del test.globs['__builtins__'] >>> test.globs {'x': 2} But the globals are cleared if there is no error: >>> test = DocTestParser().get_doctest(''' ... >>> x = 2 ... ''', {}, 'foo', 'foo.py', 0) >>> runner.run(test) (0, 1) >>> test.globs {} cCs;ti||||tƒ}|o|i i ƒn|SdS(N( s DocTestRunnersrunsselfstests compileflagssoutsFalsesrs clear_globssglobssclear(sselfstests compileflagssouts clear_globssr((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pysrunÀscCst|||ƒ‚dS(N(sUnexpectedExceptionstestsexamplesexc_info(sselfsoutstestsexamplesexc_info((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pysreport_unexpected_exceptionÆscCst|||ƒ‚dS(N(sDocTestFailurestestsexamplesgot(sselfsoutstestsexamplesgot((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pysreport_failureÉs(s__name__s __module__s__doc__sNonesTruesrunsreport_unexpected_exceptionsreport_failure(((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pys DebugRunneres Y c CsS|tj otidtƒn|tjotiidƒ}nt i |ƒ ot d|fƒ‚n|tjo |i }ntd|d| ƒ} |otd|d|ƒ} ntd|d|ƒ} x3| i||d|d |ƒD]} | i| ƒqïW|o| iƒnttjo | anti| ƒ| i | i!fSd S( så m=None, name=None, globs=None, verbose=None, isprivate=None, report=True, optionflags=0, extraglobs=None, raise_on_error=False, exclude_empty=False Test examples in docstrings in functions and classes reachable from module m (or the current module if m is not supplied), starting with m.__doc__. Unless isprivate is specified, private names are not skipped. Also test examples reachable from dict m.__test__ if it exists and is not None. m.__test__ maps names to functions, classes and strings; function and class docstrings are tested even if the name is private; strings are tested directly, as if they were docstrings. Return (#failures, #tests). See doctest.__doc__ for an overview. Optional keyword arg "name" gives the name of the module; by default use m.__name__. Optional keyword arg "globs" gives a dict to be used as the globals when executing examples; by default, use m.__dict__. A copy of this dict is actually used for each docstring, so that each docstring's examples start with a clean slate. Optional keyword arg "extraglobs" gives a dictionary that should be merged into the globals that are used to execute examples. By default, no extra globals are used. This is new in 2.4. Optional keyword arg "verbose" prints lots of stuff if true, prints only failures if false; by default, it's true iff "-v" is in sys.argv. Optional keyword arg "report" prints a summary at the end when true, else prints nothing at the end. In verbose mode, the summary is detailed, else very brief (in fact, empty if all tests passed). Optional keyword arg "optionflags" or's together module constants, and defaults to 0. This is new in 2.3. Possible values (see the docs for details): DONT_ACCEPT_TRUE_FOR_1 DONT_ACCEPT_BLANKLINE NORMALIZE_WHITESPACE ELLIPSIS IGNORE_EXCEPTION_DETAIL REPORT_UDIFF REPORT_CDIFF REPORT_NDIFF REPORT_ONLY_FIRST_FAILURE Optional keyword arg "raise_on_error" raises an exception on the first unexpected exception or failure. This allows failures to be post-mortem debugged. Deprecated in Python 2.4: Optional keyword arg "isprivate" specifies a function used to determine whether a name is private. The default function is treat all functions as public. Optionally, "isprivate" can be set to doctest.is_private to skip over functions marked as private using the underscore naming convention; see its docs for details. Advanced tomfoolery: testmod runs methods of a local instance of class doctest.Tester, then merges the results into (or creates) global Tester instance doctest.master. Methods of doctest.master can be called directly too, if you want to do something unusual. Passing report=0 to testmod is especially useful then, to delay displaying a summary. Invoke doctest.master.summarize(verbose) when you're done fiddling. sPthe isprivate argument is deprecated; examine DocTestFinder.find() lists insteads__main__stestmod: module required; %rs _namefilters exclude_emptysverboses optionflagssglobss extraglobsN("s isprivatesNoneswarningsswarnsDeprecationWarningsmssyssmodulessgetsinspectsismodules TypeErrorsnames__name__s DocTestFinders exclude_emptysfindersraise_on_errors DebugRunnersverboses optionflagssrunners DocTestRunnersfindsglobss extraglobsstestsrunsreports summarizesmastersmergesfailuresstries( smsnamesglobssverboses isprivatesreports optionflagss extraglobssraise_on_errors exclude_emptysrunnerstestsfinder((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pystestmodÕs0H         c Cse|o| otdƒ‚n|ot|ƒ}t||ƒ}n|tjoti i |ƒ}n|tjo h}n |i ƒ}|tj o|i|ƒn| otd|d|ƒ} ntd|d|ƒ} t|ƒiƒ} | i| |||dƒ} | i| ƒ|o| iƒnttjo | anti| ƒ| i | i!fSdS(s Test examples in the given file. Return (#failures, #tests). Optional keyword arg "module_relative" specifies how filenames should be interpreted: - If "module_relative" is True (the default), then "filename" specifies a module-relative path. By default, this path is relative to the calling module's directory; but if the "package" argument is specified, then it is relative to that package. To ensure os-independence, "filename" should use "/" characters to separate path segments, and should not be an absolute path (i.e., it may not begin with "/"). - If "module_relative" is False, then "filename" specifies an os-specific path. The path may be absolute or relative (to the current working directory). Optional keyword arg "name" gives the name of the test; by default use the file's basename. Optional keyword argument "package" is a Python package or the name of a Python package whose directory should be used as the base directory for a module relative filename. If no package is specified, then the calling module's directory is used as the base directory for module relative filenames. It is an error to specify "package" if "module_relative" is False. Optional keyword arg "globs" gives a dict to be used as the globals when executing examples; by default, use {}. A copy of this dict is actually used for each docstring, so that each docstring's examples start with a clean slate. Optional keyword arg "extraglobs" gives a dictionary that should be merged into the globals that are used to execute examples. By default, no extra globals are used. Optional keyword arg "verbose" prints lots of stuff if true, prints only failures if false; by default, it's true iff "-v" is in sys.argv. Optional keyword arg "report" prints a summary at the end when true, else prints nothing at the end. In verbose mode, the summary is detailed, else very brief (in fact, empty if all tests passed). Optional keyword arg "optionflags" or's together module constants, and defaults to 0. Possible values (see the docs for details): DONT_ACCEPT_TRUE_FOR_1 DONT_ACCEPT_BLANKLINE NORMALIZE_WHITESPACE ELLIPSIS IGNORE_EXCEPTION_DETAIL REPORT_UDIFF REPORT_CDIFF REPORT_NDIFF REPORT_ONLY_FIRST_FAILURE Optional keyword arg "raise_on_error" raises an exception on the first unexpected exception or failure. This allows failures to be post-mortem debugged. Optional keyword arg "parser" specifies a DocTestParser (or subclass) that should be used to extract tests from the files. Advanced tomfoolery: testmod runs methods of a local instance of class doctest.Tester, then merges the results into (or creates) global Tester instance doctest.master. Methods of doctest.master can be called directly too, if you want to do something unusual. Passing report=0 to testmod is especially useful then, to delay displaying a summary. Invoke doctest.master.summarize(verbose) when you're done fiddling. s8Package may only be specified for module-relative paths.sverboses optionflagsiN("spackagesmodule_relatives ValueErrors_normalize_modules_module_relative_pathsfilenamesnamesNonesosspathsbasenamesglobsscopys extraglobssupdatesraise_on_errors DebugRunnersverboses optionflagssrunners DocTestRunnersopensreadsssparsers get_docteststestsrunsreports summarizesmastersmergesfailuresstries(sfilenamesmodule_relativesnamespackagesglobssverbosesreports optionflagss extraglobssraise_on_errorsparsersrunnerstestss((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pystestfileIs4J          sNoNamec Csdtd|dtƒ}td|d|ƒ}x3|i||d|ƒD]}|i |d|ƒqCWdS(sr Test examples in the given object's docstring (`f`), using `globs` as globals. Optional argument `name` is used in failure messages. If the optional argument `verbose` is true, then generate output even if there are no failures. `compileflags` gives the set of flags that should be used by the Python compiler when running the examples. If not specified, then it will default to the set of future-import flags that apply to `globs`. Optional keyword arg `optionflags` specifies options for the testing and output. See the documentation for `testmod` for more information. sverbosesrecurses optionflagssglobss compileflagsN(s DocTestFindersverbosesFalsesfinders DocTestRunners optionflagssrunnersfindsfsnamesglobsstestsruns compileflags( sfsglobssverbosesnames compileflagss optionflagssrunnerstestsfinder((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pysrun_docstring_examples¿s cBsbtZeeeedd„Zd„Zeed„Zed„Zd„Zed„Zd„Z RS( NicCsátidtddƒ|tjo |tjotdƒ‚n|tj oti|ƒ otd|fƒ‚n|tjo |i }n||_||_ ||_ ||_ td|ƒ|_td|d|ƒ|_dS( NsCclass Tester is deprecated; use class doctest.DocTestRunner insteads stacklevelis*Tester.__init__: must specify mod or globss)Tester.__init__: mod must be a module; %rs _namefiltersverboses optionflags(swarningsswarnsDeprecationWarningsmodsNonesglobss TypeErrorsinspectsismodules__dict__sselfsverboses isprivates optionflagss DocTestFinders testfinders DocTestRunners testrunner(sselfsmodsglobssverboses isprivates optionflags((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pys__init__Ýs         cCstƒi||i|ttƒ}|io dG|GHn|i i |ƒ\}}|io|GdG|GdG|GHn||fSdS(NsRunning stringsofsexamples failed in string( s DocTestParsers get_doctestsssselfsglobssnamesNonestestsverboses testrunnersrunsfst(sselfsssnamesfststest((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pys runstringós!   c Csd}}|ii||d|d|iƒ}x@|D]8} |i i | ƒ\}}||||f\}}q5W||fSdS(Nismodulesglobs(sfstsselfs testfindersfindsobjectsnamesmodulesglobsstestsstests testrunnersrunsf2st2( sselfsobjectsnamesmodulestestssfst2sf2ststest((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pysrundocüs cCsVdk}|i|ƒ}|ii|ƒ|tjo t}n|i |||ƒSdS(N( snewsmodulesnamesms__dict__supdatesdsNonesFalsesselfsrundoc(sselfsdsnamesmodulesmsnew((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pysrundicts    cCs5dk}|i|ƒ}||_|i||ƒSdS(N(snewsmodulesnamesmsds__test__sselfsrundoc(sselfsdsnamesnewsm((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pys run__test__ s  cCs|ii|ƒSdS(N(sselfs testrunners summarizesverbose(sselfsverbose((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pys summarizescCs|ii|iƒdS(N(sselfs testrunnersmergesother(sselfsother((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pysmerges( s__name__s __module__sNones__init__s runstringsrundocsrundicts run__test__s summarizesmerge(((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pysTesterÜs    cCs8|t@|jotd|ƒ‚nt}|a|SdS(sSets the unittest option flags. The old flag is returned so that a runner could restore the old value if it wished to: >>> old = _unittest_reportflags >>> set_unittest_reportflags(REPORT_NDIFF | ... REPORT_ONLY_FIRST_FAILURE) == old True >>> import doctest >>> doctest._unittest_reportflags == (REPORT_NDIFF | ... REPORT_ONLY_FIRST_FAILURE) True Only reporting flags can be set: >>> set_unittest_reportflags(ELLIPSIS) Traceback (most recent call last): ... ValueError: ('Only reporting flags allowed', 8) >>> set_unittest_reportflags(old) == (REPORT_NDIFF | ... REPORT_ONLY_FIRST_FAILURE) True sOnly reporting flags allowedN(sflagssREPORTING_FLAGSs ValueErrors_unittest_reportflagssold(sflagssold((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pysset_unittest_reportflagsss DocTestCasecBsktZdeeed„Zd„Zd„Zd„Zd„Zd„Zd„Z d „Z e Z d „Z RS( NicCsAtii|ƒ||_||_||_ ||_ ||_ dS(N(sunittestsTestCases__init__sselfs optionflagss_dt_optionflagsscheckers _dt_checkerstests_dt_testssetUps _dt_setUpstearDowns _dt_tearDown(sselfstests optionflagsssetUpstearDownschecker((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pys__init__Es     cCs.|i}|itj o|i|ƒndS(N(sselfs_dt_teststests _dt_setUpsNone(sselfstest((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pyssetUpOs cCs;|i}|itj o|i|ƒn|iiƒdS(N(sselfs_dt_teststests _dt_tearDownsNonesglobssclear(sselfstest((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pystearDownUs cCsË|i}ti}tƒ}|i}|t @ o|t O}nt d|d|i dtƒ}z5dd|_|i|d|idtƒ\}}Wd|t_X|o"|i|i|iƒƒƒ‚ndS(Ns optionflagsscheckersverboses-iFsouts clear_globs(sselfs_dt_teststestssyssstdoutsoldsStringIOsnews_dt_optionflagss optionflagssREPORTING_FLAGSs_unittest_reportflagss DocTestRunners _dt_checkersFalsesrunnersDIVIDERsrunswritesfailuresstriessfailureExceptionsformat_failuresgetvalue(sselfsoldsrunnerstriessfailuresstestsnews optionflags((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pysrunTest]s       ( cCsp|i}|itjo d}nd|i}di|iidƒdƒ}d|i|i |||fSdS(Nsunknown line numbers%ss.iÿÿÿÿs:Failed doctest test for %s File "%s", line %s, in %s %s( sselfs_dt_teststestslinenosNonesjoinsnamessplitslnamesfilenameserr(sselfserrslnameslinenostest((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pysformat_failureus    cCsI|iƒtd|id|idtƒ}|i|iƒ|i ƒdS(sÊRun the test case without results and without catching exceptions The unit test framework includes a debug method on test cases and test suites to support post-mortem debugging. The test code is run in such a way that errors are not caught. This way a caller can catch the errors and initiate post-mortem debugging. The DocTestCase provides a debug method that raises UnexpectedException errors if there is an unexepcted exception: >>> test = DocTestParser().get_doctest('>>> raise KeyError\n42', ... {}, 'foo', 'foo.py', 0) >>> case = DocTestCase(test) >>> try: ... case.debug() ... except UnexpectedException, failure: ... pass The UnexpectedException contains the test, the example, and the original exception: >>> failure.test is test True >>> failure.example.want '42\n' >>> exc_info = failure.exc_info >>> raise exc_info[0], exc_info[1], exc_info[2] Traceback (most recent call last): ... KeyError If the output doesn't match, then a DocTestFailure is raised: >>> test = DocTestParser().get_doctest(''' ... >>> x = 1 ... >>> x ... 2 ... ''', {}, 'foo', 'foo.py', 0) >>> case = DocTestCase(test) >>> try: ... case.debug() ... except DocTestFailure, failure: ... pass DocTestFailure objects provide access to the test: >>> failure.test is test True As well as to the example: >>> failure.example.want '2\n' and the actual output: >>> failure.got '1\n' s optionflagsscheckersverboseN( sselfssetUps DebugRunners_dt_optionflagss _dt_checkersFalsesrunnersruns_dt_teststearDown(sselfsrunner((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pysdebugs @  cCs|iiSdS(N(sselfs_dt_testsname(sself((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pysidÉscCs8|iiidƒ}d|ddi|d ƒfSdS(Ns.s%s (%s)iÿÿÿÿ(sselfs_dt_testsnamessplitsjoin(sselfsname((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pys__repr__ÌscCsd|iiSdS(Ns Doctest: (sselfs_dt_testsname(sself((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pysshortDescriptionÒs( s__name__s __module__sNones__init__ssetUpstearDownsrunTestsformat_failuresdebugsids__repr__s__str__sshortDescription(((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pys DocTestCaseCs    H  c Ks|tjo tƒ}nt|ƒ}|i|d|d|ƒ}|tjo |i }n| ot |dƒ‚n|i ƒt i ƒ}x‡|D]}t|iƒdjoq“n|i o;|i}|dddfjo|d }n||_n|it||ƒq“W|Sd S( s Convert doctest tests for a module to a unittest test suite. This converts each documentation string in a module that contains doctest tests to a unittest test case. If any of the tests in a doc string fail, then the test case fails. An exception is raised showing the name of the file containing the test and a (sometimes approximate) line number. The `module` argument provides the module to be tested. The argument can be either a module or a module name. If no argument is given, the calling module is used. A number of options may be provided as keyword arguments: setUp A set-up function. This is called before running the tests in each file. The setUp function will be passed a DocTest object. The setUp function can access the test globals as the globs attribute of the test passed. tearDown A tear-down function. This is called after running the tests in each file. The tearDown function will be passed a DocTest object. The tearDown function can access the test globals as the globs attribute of the test passed. globs A dictionary containing initial global variables for the tests. optionflags A set of doctest option flags expressed as an integer. sglobss extraglobss has no testsiiüÿÿÿs.pycs.pyoiÿÿÿÿN(s test_findersNones DocTestFinders_normalize_modulesmodulesfindsglobss extraglobsstestss__dict__s ValueErrorssortsunittests TestSuitessuitestestslensexamplessfilenames__file__saddTests DocTestCasesoptions( smodulesglobss extraglobss test_findersoptionsstestsstestssuitesfilename((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pys DocTestSuiteÕs,#          s DocFileCasecBs)tZd„Zd„ZeZd„ZRS(NcCs di|iiidƒƒSdS(Ns_s.(sjoinsselfs_dt_testsnamessplit(sself((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pysid scCs|iiSdS(N(sselfs_dt_testsfilename(sself((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pys__repr__ scCs!d|ii|ii|fSdS(Ns2Failed doctest test for %s File "%s", line 0 %s(sselfs_dt_testsnamesfilenameserr(sselfserr((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pysformat_failure s(s__name__s __module__sids__repr__s__str__sformat_failure(((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pys DocFileCase s  c Ks¬|tjo h}n|o| otdƒ‚n|ot|ƒ}t||ƒ}ntii |ƒ}t |ƒi ƒ}|i||||dƒ}t||SdS(Ns8Package may only be specified for module-relative paths.i(sglobssNonespackagesmodule_relatives ValueErrors_normalize_modules_module_relative_pathspathsossbasenamesnamesopensreadsdocsparsers get_docteststests DocFileCasesoptions( spathsmodule_relativespackagesglobssparsersoptionssnamesdocstest((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pys DocFileTest" s   cOsktiƒ}|idtƒot|idƒƒ|dA unittest suite for one or more doctest files. The path to each doctest file is given as a string; the interpretation of that string depends on the keyword argument "module_relative". A number of options may be provided as keyword arguments: module_relative If "module_relative" is True, then the given file paths are interpreted as os-independent module-relative paths. By default, these paths are relative to the calling module's directory; but if the "package" argument is specified, then they are relative to that package. To ensure os-independence, "filename" should use "/" characters to separate path segments, and may not be an absolute path (i.e., it may not begin with "/"). If "module_relative" is False, then the given file paths are interpreted as os-specific paths. These paths may be absolute or relative (to the current working directory). package A Python package or the name of a Python package whose directory should be used as the base directory for module relative paths. If "package" is not specified, then the calling module's directory is used as the base directory for module relative filenames. It is an error to specify "package" if "module_relative" is False. setUp A set-up function. This is called before running the tests in each file. The setUp function will be passed a DocTest object. The setUp function can access the test globals as the globs attribute of the test passed. tearDown A tear-down function. This is called after running the tests in each file. The tearDown function will be passed a DocTest object. The tearDown function can access the test globals as the globs attribute of the test passed. globs A dictionary containing initial global variables for the tests. optionflags A set of doctest option flags expressed as an integer. parser A DocTestParser (or subclass) that should be used to extract tests from the files. smodule_relativespackageN( sunittests TestSuitessuiteskwsgetsTrues_normalize_modulespathsspathsaddTests DocFileTest(spathsskwspathssuite((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pys DocFileSuite8 s4 cCsNg}xÝtƒi|ƒD]É}t|tƒou|i|id ƒ|i }|oM|idƒ|gi}|i dƒd D]}|d|ƒq~~7}qâq|gi}|i dƒd D]}|t |ƒƒqÂ~7}qWx'|o|ddjo|iƒqéWx*|o|ddjo|idƒqWdi|ƒSdS(scExtract script from text with examples. Converts text with examples to a Python script. Example input is converted to regular code. Example output and all other words are converted to comments: >>> text = ''' ... Here are examples of simple math. ... ... Python has super accurate integer addition ... ... >>> 2 + 2 ... 5 ... ... And very friendly error messages: ... ... >>> 1/0 ... To Infinity ... And ... Beyond ... ... You can use logic if you want: ... ... >>> if 0: ... ... blah ... ... blah ... ... ... ... Ho hum ... ''' >>> print script_from_examples(text) # Here are examples of simple math. # # Python has super accurate integer addition # 2 + 2 # Expected: ## 5 # # And very friendly error messages: # 1/0 # Expected: ## To Infinity ## And ## Beyond # # You can use logic if you want: # if 0: blah blah # # Ho hum iÿÿÿÿs # Expected:s s## s#iN(soutputs DocTestParsersparsessspieces isinstancesExamplesappendssourceswants_[1]ssplitsls _comment_linespopsjoin(ssspiecesls_[1]swantsoutput((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pysscript_from_examples~ s$8  DBcCs•t|ƒ}tƒi|ƒ}gi}|D]$}|i|jo||ƒq,q,~}| ot |dƒ‚n|d}t |i ƒ}|SdS(sExtract the test sources from a doctest docstring as a script. Provide the module (or dotted name of the module) containing the test to be debugged and the name (within the module) of the object with the doc string with tests to be debugged. snot found in testsiN(s_normalize_modulesmodules DocTestFindersfindstestssappends_[1]stsnamestests ValueErrorsscript_from_exampless docstringstestsrc(smodulesnamestestss_[1]stestsrcststest((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pys testsourceÎ s ; cCs t|ƒ}t|||ƒdS(s4Debug a single doctest docstring, in argument `src`'N(sscript_from_examplesssrcstestsrcs debug_scriptspmsglobs(ssrcspmsglobsstestsrc((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pys debug_srcÞ s cCsÝdk}tiddƒ}t|dƒ}|i|ƒ|iƒz‡|o|i ƒ}nh}|oHyt |||ƒWqÇt iƒdGH|it iƒdƒqÇXn|id|||ƒWdti|ƒXdS(s7Debug a test script. `src` is the script, as a string.Ns.pys doctestdebugswiis execfile(%r)(spdbstempfilesmktemps srcfilenamesopensfswritessrcsclosesglobsscopyspmsexecfilessyssexc_infos post_mortemsrunsossremove(ssrcspmsglobssfs srcfilenamespdb((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pys debug_scriptã s&   cCs2t|ƒ}t||ƒ}t|||iƒdS(såDebug a single doctest docstring. Provide the module (or dotted name of the module) containing the test to be debugged and the name (within the module) of the object with the docstring with tests to be debugged. N(s_normalize_modulesmodules testsourcesnamestestsrcs debug_scriptspms__dict__(smodulesnamespmstestsrc((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pysdebug s s _TestClasscBs)tZdZd„Zd„Zd„ZRS(så A pointless class, for sanity-checking of docstring testing. Methods: square() get() >>> _TestClass(13).get() + _TestClass(-12).get() 1 >>> hex(_TestClass(13).square().get()) '0xa9' cCs ||_dS(sƒval -> _TestClass object with associated value val. >>> t = _TestClass(123) >>> print t.get() 123 N(svalsself(sselfsval((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pys__init__ scCs|id|_|SdS(sosquare() -> square TestClass's associated value >>> _TestClass(13).square().get() 169 iN(sselfsval(sself((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pyssquare) scCs |iSdS(s}get() -> return TestClass's associated value. >>> x = _TestClass(-42) >>> print x.get() -42 N(sselfsval(sself((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pysget3 s(s__name__s __module__s__doc__s__init__ssquaresget(((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pys _TestClass s  sstringsÄ Example of a string object, searched as-is. >>> x = 1; y = 2 >>> x + y, x * y (3, 2) sbool-int equivalencesÜ In 2.2, boolean expressions displayed 0 or 1. By default, we still accept them. This can be disabled by passing DONT_ACCEPT_TRUE_FOR_1 to the new optionflags argument. >>> 4 == 4 1 >>> 4 == 4 True >>> 4 > 4 0 >>> 4 > 4 False s blank linessæ Blank lines can be marked with : >>> print 'foo\n\nbar\n' foo bar sellipsissó If the ellipsis flag is used, then '...' can be used to elide substrings in the desired output: >>> print range(1000) #doctest: +ELLIPSIS [0, 1, 2, ..., 999] swhitespace normalizations| If the whitespace normalization flag is used, then differences in whitespace are ignored. >>> print range(30) #doctest: +NORMALIZE_WHITESPACE [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29] cCs tiƒ}|itƒƒdS(N(sunittestsTextTestRunnersrsruns DocTestSuite(sr((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pys_testo s s__main__(Ts basestrings NameErrorsstrsunicodes enumerates __docformat__s__all__s __future__ssyss tracebacksinspects linecachesossrestypessunittestsdifflibspdbstempfileswarningssStringIOsfilterwarningssDeprecationWarnings__name__sOPTIONFLAGS_BY_NAMEsregister_optionflagsDONT_ACCEPT_TRUE_FOR_1sDONT_ACCEPT_BLANKLINEsNORMALIZE_WHITESPACEsELLIPSISsIGNORE_EXCEPTION_DETAILsCOMPARISON_FLAGSs REPORT_UDIFFs REPORT_CDIFFs REPORT_NDIFFsREPORT_ONLY_FIRST_FAILUREsREPORTING_FLAGSsBLANKLINE_MARKERsELLIPSIS_MARKERs is_privates_extract_future_flagss_normalize_modules_indents_exception_tracebacks _SpoofOuts_ellipsis_matchs _comment_linesPdbs_OutputRedirectingPdbs_module_relative_pathsExamplesDocTests DocTestParsers DocTestFinders DocTestRunners OutputCheckers ExceptionsDocTestFailuresUnexpectedExceptions DebugRunnersNonesmastersTruesFalsestestmodstestfilesrun_docstring_examplessTesters_unittest_reportflagssset_unittest_reportflagssTestCases DocTestCases DocTestSuites DocFileCases DocFileTests DocFileSuitesscript_from_exampless testsources debug_srcs debug_scriptsdebugs _TestClasss__test__s_test(Fs_module_relative_paths __future__s OutputCheckersBLANKLINE_MARKERsunittestsNORMALIZE_WHITESPACEs __docformat__stestmods_normalize_modules REPORT_UDIFFsDONT_ACCEPT_TRUE_FOR_1s enumerates_OutputRedirectingPdbs_ellipsis_matchs basestringsIGNORE_EXCEPTION_DETAILs__all__sTesterstempfiles DocFileCases DocTestRunners DocFileTestsres is_privatesDocTestFailures DocTestCasesELLIPSISs_tests _comment_lines REPORT_CDIFFs testsourcesDocTestsDONT_ACCEPT_BLANKLINEs _SpoofOutswarningss DocFileSuitesrun_docstring_examplessREPORT_ONLY_FIRST_FAILUREsinspects _TestClasss debug_scriptssyssdebugsscript_from_exampless debug_srcs__test__s_extract_future_flagss_indentsExamplestypess DocTestSuitesregister_optionflagsOPTIONFLAGS_BY_NAMEs DocTestParsersStringIOsset_unittest_reportflagss REPORT_NDIFFs tracebacksdifflibs linecaches DocTestFinders DebugRunnersELLIPSIS_MARKERsREPORTING_FLAGSsCOMPARISON_FLAGSsUnexpectedExceptionsosspdbstestfiles_exception_traceback((s;build/bdist.darwin-8.0.1-x86/egg/protocols/tests/doctest.pys? s–(i. ?$                  1  $5<ëÿ+ÿ¡…n't*vA $’? F P  ,<2  PKKŸC8*E°z`#`#protocols/tests/test_direct.pyo;ò µÆBc@sÒdZdklZlZlZdkTdklZlZl Z dkl Z l Z dkl Z de fd„ƒYZdefd „ƒYZd e fd „ƒYZd eefd „ƒYZde efd„ƒYZdfd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZdeefd„ƒYZdeefd„ƒYZdfd„ƒYZdefd„ƒYZeefZee eƒ7Zee eƒ7Zee eeeƒ7Zd „Zd!S("scTests for default IOpenProvider (etc.) adapters TODO: - Test Zope interface registrations (sTestCases makeSuites TestSuite(s*(sProviderCheckssAdaptiveCheckssClassProvidesChecks(smakeClassProvidesTestssmakeInstanceTests(smakeMetaClassProvidesTestssIAcBstZRS(N(s__name__s __module__(((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_direct.pysIAssIBcBstZRS(N(s__name__s __module__(((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_direct.pysIBssIPurecBstZRS(N(s__name__s __module__(((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_direct.pysIPuress BasicCheckscBs/tZdZeZeZeZeZd„ZRS(s!Checks to be done on every objectcCs^tƒ}tƒ}ttd|gd|gƒttd|gd|gƒ|i|gƒdS(Nsprovidess forProtocols(sProtocolsP1sP2sdeclareAdaptersNO_ADAPTER_NEEDEDsselfsdeclareObImplements(sselfsP2sP1((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_direct.pyscheckCircularRegister s   (s__name__s __module__s__doc__sIAsIBs InterfacesIPurescheckCircularRegister(((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_direct.pys BasicCheckss s ClassCheckscBstZdZRS(s&Checks to be done on classes and types(s__name__s __module__s__doc__(((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_direct.pys ClassChecks's sInstanceConformCheckscBs tZdZd„Zd„ZRS(s$Things to check on adapted instancescCs5d„}||i_|i|i|ig|ƒdS(NcCsdS(N((sproto((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_direct.pys __conform__.s(s __conform__sselfsobsassertBadConformsIA(sselfs __conform__((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_direct.pyscheckBadConform-s  cCs<yt|d|ƒWntj o }nXtdƒ‚dS(Nsprovidess&Should've detected invalid __conform__(s adviseObjectsobs protocolss TypeErrorsvsAssertionError(sselfsobs protocolssconformsv((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_direct.pysassertBadConform4s (s__name__s __module__s__doc__scheckBadConformsassertBadConform(((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_direct.pysInstanceConformChecks*s  sClassConformCheckscBs tZdZd„Zd„ZRS(s"Things to check on adapted classescCsRd|ifd„ƒY}d|fd„ƒY}|i||ig|iiƒdS(NsBasecBstZd„ZRS(NcCsdS(N((sselfsprotocol((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_direct.pys __conform__Ds(s__name__s __module__s __conform__(((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_direct.pysBaseCssSubcBstZRS(N(s__name__s __module__(((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_direct.pysSubFs(sselfsobsBasesSubsassertBadConformsIAs __conform__sim_func(sselfsBasesSub((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_direct.pyscheckInheritedConformBscCsBd|ifd„ƒY}|ƒ}|i||ig|iƒdS(NsBasecBstZd„ZRS(NcCsdS(N((sselfsprotocol((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_direct.pys __conform__Ms(s__name__s __module__s __conform__(((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_direct.pysBaseLs(sselfsobsBasesbsassertBadConformsIAs __conform__(sselfsBasesb((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_direct.pyscheckInstanceConformJs (s__name__s __module__s__doc__scheckInheritedConformscheckInstanceConform(((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_direct.pysClassConformChecks?s  sAdviseMixinInstancecBstZd„ZRS(NcCstƒ|_dS(N(s ProviderMixinsselfsob(sself((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_direct.pyssetUpUs(s__name__s __module__ssetUp(((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_direct.pysAdviseMixinInstanceSssAdviseMixinMultiMeta1cBstZd„ZRS(NcsEdttfd„ƒY‰dttf‡d†ƒY}|ƒ|_dS(NsMetacBstZRS(N(s__name__s __module__(((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_direct.pysMetaassTestcstZˆZRS(N(s__name__s __module__sMetas __metaclass__((sMeta(s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_direct.pysTestbs(s ProviderMixinstypesMetasobjectsTestsselfsob(sselfsMetasTest((sMetas?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_direct.pyssetUp`s(s__name__s __module__ssetUp(((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_direct.pysAdviseMixinMultiMeta1^ssInstanceTestsBasecBstZRS(N(s__name__s __module__(((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_direct.pysInstanceTestsBasefssClassTestsBasecBstZRS(N(s__name__s __module__(((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_direct.pysClassTestsBaseiss PicklablecBstZRS(N(s__name__s __module__(((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_direct.pys PicklablelssNewStylecBstZRS(N(s__name__s __module__(((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_direct.pysNewStylepscCs8tgi}tD]}|t|dƒƒq~ƒSdS(Nscheck(s TestSuitesappends_[1]s TestClassessts makeSuite(s_[1]st((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_direct.pys test_suite|sN(s__doc__sunittestsTestCases makeSuites TestSuites protocolsscheckssProviderCheckssAdaptiveCheckssClassProvidesCheckssmakeClassProvidesTestssmakeInstanceTestssmakeMetaClassProvidesTestss InterfacesIAsIBsIPures BasicCheckss ClassCheckssInstanceConformCheckssClassConformCheckssAdviseMixinInstancesAdviseMixinMultiMeta1sInstanceTestsBasesClassTestsBases PicklablesobjectsNewStyles TestClassess test_suite(s TestClassessAdviseMixinInstancesmakeInstanceTestssClassConformCheckssInstanceConformCheckss TestSuitesClassTestsBasesTestCasesmakeClassProvidesTestssInstanceTestsBasesAdaptiveCheckss BasicCheckss makeSuitesIPuresAdviseMixinMultiMeta1sClassProvidesCheckssIAsIBsmakeMetaClassProvidesTestss PicklablesProviderCheckss test_suites ClassCheckssNewStyle((s?build/bdist.darwin-8.0.1-x86/egg/protocols/tests/test_direct.pys?s.   PK¸")8“×2EGG-INFO/zip-safe PKBŸC8ìò#ÉEGG-INFO/SOURCES.txtREADME.txt setup.cfg setup.py src/PyProtocols.egg-info/PKG-INFO src/PyProtocols.egg-info/SOURCES.txt src/PyProtocols.egg-info/dependency_links.txt src/PyProtocols.egg-info/native_libs.txt src/PyProtocols.egg-info/top_level.txt src/PyProtocols.egg-info/zip-safe src/protocols/__init__.py src/protocols/_speedups.pyx src/protocols/adapters.py src/protocols/advice.py src/protocols/api.py src/protocols/classic.py src/protocols/generate.py src/protocols/interfaces.py src/protocols/twisted_support.py src/protocols/zope_support.py src/protocols/tests/__init__.py src/protocols/tests/checks.py src/protocols/tests/doctest.py src/protocols/tests/test_advice.py src/protocols/tests/test_classes.py src/protocols/tests/test_direct.py src/protocols/tests/test_twisted.py src/protocols/tests/test_zope.py PKKŸC8¡3ntEGG-INFO/native_libs.txtprotocols/_speedups.so PKBŸC8“×2EGG-INFO/dependency_links.txt PKBŸC8×Íß  EGG-INFO/PKG-INFOMetadata-Version: 1.0 Name: PyProtocols Version: 1.0a0 Summary: Open Protocols and Component Adaptation for Python Home-page: http://peak.telecommunity.com/PyProtocols.html Author: Phillip J. Eby Author-email: peak@eby-sarna.com License: PSF or ZPL Description: UNKNOWN Platform: UNKNOWN PKBŸC8ºæ; EGG-INFO/top_level.txtprotocols PKJŸC8‚< ½7½7¤protocols/advice.pycPKKŸC8ê%,Áüü¤ï7protocols/classic.pyoPKIŸC8 gH-¤Xprotocols/zope_support.pycPKKŸC80†ŸÓ::¤klprotocols/_speedups.pyoPKKŸC80†ŸÓ::¤Únprotocols/_speedups.pycPKKŸC8ºÜèÉO&O&¤Iqprotocols/generate.pyoPKÜ\â2d»)àyy¤Ì—protocols/__init__.pyPKIŸC8dqK~~¤x™protocols/adapters.pycPKÜ\â2º-\ÑOO¤*¹protocols/adapters.pyPKÜ\â2)D·^ ^ ¤¬Íprotocols/zope_support.pyPKÜ\â2 K¢ã§§¤AÙprotocols/classic.pyPKKŸC8åïöŒLŒL¤îprotocols/interfaces.pyoPKÜ\â28û¿¿¤Ü:protocols/generate.pyPKKŸC8lá“DD¤ÎPprotocols/__init__.pyoPKKŸC8 gH-¤FUprotocols/zope_support.pyoPKÜ\â2· )¹Á/Á/¤“iprotocols/interfaces.pyPKKŸC86’­óÕÕ¤‰™protocols/twisted_support.pyoPKKŸC8ò"¤™°protocols/_speedups.pyPKKŸC8‚< ½7½7¤Ñ±protocols/advice.pyoPKÜ\â2TèÌ5ÝݤÀéprotocols/api.pyPKKŸC8dqK~~¤Ë protocols/adapters.pyoPKKŸC8ÉV¯…&…&¤})protocols/api.pyoPKÜ\â2Él)[[¤1Pprotocols/twisted_support.pyPKIŸC8åïöŒLŒL¤Æ_protocols/interfaces.pycPK¨")8ó­Fdd투protocols/_speedups.soPKIŸC8lá“DD¤Ìprotocols/__init__.pycPKIŸC8ÉV¯…&…&¤Dprotocols/api.pycPKÜ\â2£Þ—*(,(,¤ø;protocols/advice.pyPKIŸC8ê%,Áüü¤Qhprotocols/classic.pycPKIŸC8ºÜèÉO&O&¤€ˆprotocols/generate.pycPKJŸC86’­óÕÕ¤¯protocols/twisted_support.pycPK—í2)ó’ÕÕ¤Æprotocols/tests/test_advice.pyPKIŸC8m¥hÊ#Ê#¤$ãprotocols/tests/test_direct.pycPKKŸC8©/XØyJyJ¤+protocols/tests/test_advice.pyoPKIí2Àµ‹6VV¤áQprotocols/tests/__init__.pyPKJŸC8‡ ô†‡ ‡ ¤ppprotocols/tests/test_classes.pycPKKŸC8|’Áa¼¼¤5{protocols/tests/test_zope.pyoPKKŸC8¥°_66¤,‹protocols/tests/__init__.pyoPKJŸC8|’Áa¼¼¤ƒÁprotocols/tests/test_zope.pycPKÛ\â2"†Î Î ¤zÑprotocols/tests/test_direct.pyPKKŸC8‡ ô†‡ ‡ ¤„ßprotocols/tests/test_classes.pyoPKJŸC8­CÇwEpEp¤Iêprotocols/tests/checks.pycPKÛ\â2u²ü‰à„à„¤ÆZprotocols/tests/doctest.pyPKKŸC8ó÷GüŽfŽf¤Þßprotocols/tests/checks.pyoPKÛ\â2.¢~*  ¤¤Fprotocols/tests/test_zope.pyPKÛ\â2ãú‡½Q.Q.¤çNprotocols/tests/checks.pyPKKŸC8›¨dó¿x¿x¤o}protocols/tests/doctest.pyoPKÛ\â2Cä®SS¤gö protocols/tests/test_twisted.pyPKIŸC8vÃ&ó<ó<¤÷ü protocols/tests/__init__.pycPKÛ\â2Ô¥$$¤$: protocols/tests/test_classes.pyPKIŸC8d>‡×4O4O¤…? protocols/tests/test_advice.pycPKKŸC8\¬3 ¼ ¼ ¤öŽ protocols/tests/test_twisted.pyoPKJŸC8\¬3 ¼ ¼ ¤ðœ protocols/tests/test_twisted.pycPKIŸC8IÉ.Ü&z&z¤êª protocols/tests/doctest.pycPKKŸC8*E°z`#`#¤I% protocols/tests/test_direct.pyoPK¸")8“×2¤æH EGG-INFO/zip-safePKBŸC8ìò#ɤI EGG-INFO/SOURCES.txtPKKŸC8¡3nt¤dL EGG-INFO/native_libs.txtPKBŸC8“×2¤±L EGG-INFO/dependency_links.txtPKBŸC8×Íß  ¤íL EGG-INFO/PKG-INFOPKBŸC8ºæ; ¤