§ 1jãó,—dZddlZGd„d¦«ZdS)aß This is a fork of the pymox library intended to work with Python 3. The file was modified by quermit@gmail.com and dawid.fatyga@gmail.com Previously, pyfakefs used just this file from the mox3 library. However, mox3 will soon be decommissioned, yet standard mock cannot be used because of the problem described in pyfakefs #182 and mock issue 250 (https://github.com/testing-cabal/mock/issues/250). Therefore just this file was forked from mox3 and incorporated into pyfakefs. éNcó6—eZdZdZd„Zd„Zd„Zd„Zd„Zd„Z dS) ÚStubOutForTestingaˆSample Usage: You want os.path.exists() to always return true during testing. stubs = StubOutForTesting() stubs.Set(os.path, 'exists', lambda x: 1) ... stubs.UnsetAll() The above changes os.path.exists into a lambda that returns 1. Once the ... part of the code finishes, the UnsetAll() looks up the old value of os.path.exists and restores it. có"—g|_g|_dS©N)ÚcacheÚstubs©Úselfs úg/builddir/build/BUILD/cloudlinux-venv-1.0.11/venv/lib/python3.11/site-packages/pyfakefs/mox3_stubout.pyÚ__init__zStubOutForTesting.__init__.s€ØˆŒ ؈Œ ˆ ˆ ócóV—| ¦«| ¦«dSr)Úsmart_unset_allÚ unset_allr s r Ú__del__zStubOutForTesting.__del__2s*€Ø ×ÒÑÔÐØ �ŠÑÔÐÐÐr có>—tj|¦«stj|¦«s%||jvr|}||jvr|j|}nšd}n—tj|¦«s't tj|j¦«¦«}n!t tj|¦«¦«}| ¦«d}|D]"} |}|j|}Œ#t$rYŒwxYw|€td¦«‚|j   |||f¦«||j|<dS)aˆReplace obj.attr_name with new_attr. This method is smart and works at the module, class, and instance level while preserving proper inheritance. It will not stub out C types however unless that has been explicitly allowed by the type. This method supports the case where attr_name is a staticmethod or a classmethod of obj. If obj is an instance, then it is its class that will actually be stubbed. Note that the method Set() does not do that: if obj is an instance, it (and not its class) will be stubbed. Raises AttributeError if the attribute cannot be found. NzAttribute not found.) ÚinspectÚismoduleÚisclassÚ__dict__ÚlistÚgetmroÚ __class__ÚreverseÚKeyErrorÚAttributeErrorrÚappend)r ÚobjÚ attr_nameÚnew_attrÚorig_objÚ orig_attrÚmroÚclss r Ú smart_setzStubOutForTesting.smart_set6sC€õ Ô ˜CÑ Ô ð Ý” Ñ$Ô$ð Ø)2°c´lÐ)BÐ)BàˆHؘCœLÐ(Ð(ØœL¨Ô3� � à � � õ”? 3Ñ'Ô'ð 0Ý�7œ>¨#¬-Ñ8Ô8Ñ9Ô9��å�7œ>¨#Ñ.Ô.Ñ/Ô/�à �KŠK‰MŒMˆMàˆIàð ð �ðØ"�HØ #¤ ¨YÔ 7�I�IøÝðððØ�Hðøøøð Ð Ý Ð!7Ñ8Ô8Ð 8à Œ ×Ò˜8 Y° Ð:Ñ;Ô;Ð;Ø'/ˆÔ˜)Ñ$Ð$Ð$sÃCà C"Ã!C"cóv—|j ¦«|jD]\}}}||j|<Œg|_dS)zäReverses all the SmartSet() calls. Restores things to their original definition. Its okay to call SmartUnsetAll() repeatedly, as later calls have no effect if no SmartSet() calls have been made. N)rrr)r rrÚold_attrs r rz!StubOutForTesting.smart_unset_allfsJ€ð Œ ×ÒÑÔÐà(,¬ ð /ð /Ñ $ˆC�˜HØ&.ˆCŒL˜Ñ #Ð #àˆŒ ˆ ˆ r cóH—t||¦«}|j |¦«}|�Nt|t¦«rt |¦«}n)t|t ¦«rt |j¦«}|j |||f¦«||j|<dS)aReplace child_name's old definition with new_child. Replace definition in the context of the given parent. The parent could be a module when the child is a function at module scope. Or the parent could be a class when a class' method is being replaced. The named child is set to new_child, while the prior definition is saved away for later, when unset_all() is called. This method supports the case where child_name is a staticmethod or a classmethod of parent. N) ÚgetattrrÚgetÚ isinstanceÚ staticmethodÚ classmethodÚ__func__rr)r ÚparentÚ child_nameÚ new_childÚ old_childÚ old_attributes r ÚsetzStubOutForTesting.setts €õ˜F JÑ/Ô/ˆ àœ×+Ò+¨JÑ7Ô7ˆ Ø Ð $ݘ-­Ñ6Ô6ð <Ý(¨Ñ3Ô3� � ݘM­;Ñ7Ô7ð <Ý'¨ Ô(:Ñ;Ô;� à Œ ×Ò˜6 9¨jÐ9Ñ:Ô:Ð:Ø&/ˆŒ˜ Ñ#Ð#Ð#r cóv—|j ¦«|jD]\}}}||j|<Œg|_dS)zÖReverses all the Set() calls. Restores things to their original definition. Its okay to call unset_all() repeatedly, as later calls have no effect if no Set() calls have been made. N)rrr)r r/r2r0s r rzStubOutForTesting.unset_allŒsJ€ð Œ ×ÒÑÔÐà-1¬Zð 4ð 4Ñ )ˆF�I˜zØ*3ˆFŒO˜JÑ 'Ð '؈Œ ˆ ˆ r N) Ú__name__Ú __module__Ú __qualname__Ú__doc__r rr%rr4r©r r rrsy€€€€€ð ð ððððððð.0ð.0ð.0ð` ð ð ð0ð0ð0ð0ððððr r)r9rrr:r r úr;sVðð ð ð€€€ð|ð|ð|ð|ð|ñ|ô|ð|ð|ð|r