Current Path : /usr/lib/python2.7/dist-packages/twisted/python/ |
Current File : //usr/lib/python2.7/dist-packages/twisted/python/monkey.pyc |
ó [³XMc @ s d e f d „ ƒ YZ d S( t MonkeyPatcherc B sD e Z d Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z RS( sn Cover up attributes with new objects. Neat for monkey-patching things for unit-testing purposes. c G s4 g | _ g | _ x | D] } | j | Œ q Wd S( N( t _patchesToApplyt _originalst addPatch( t selft patchest patch( ( s9 /usr/lib/python2.7/dist-packages/twisted/python/monkey.pyt __init__ s c C s | j j | | | f ƒ d S( sæ Add a patch so that the attribute C{name} on C{obj} will be assigned to C{value} when C{patch} is called or during C{runWithPatches}. You can restore the original values with a call to restore(). N( R t append( R t objt namet value( ( s9 /usr/lib/python2.7/dist-packages/twisted/python/monkey.pyR s c C s= x6 | j D]+ \ } } } | | f | | f k r t Sq Wt S( sc Has the C{name} attribute of C{obj} already been patched by this patcher? ( R t Truet False( R R R t ot nt v( ( s9 /usr/lib/python2.7/dist-packages/twisted/python/monkey.pyt _alreadyPatched! s c C sh xa | j D]V \ } } } | j | | ƒ sP | j j | | t | | ƒ f ƒ n t | | | ƒ q Wd S( s† Apply all of the patches that have been specified with L{addPatch}. Reverse this operation using L{restore}. N( R R R R t getattrt setattr( R R R R ( ( s9 /usr/lib/python2.7/dist-packages/twisted/python/monkey.pyR , s %c C s<