§ |<ˆj‚ãó—dZddlmZddlmZddlmZddlmZddlmZddlm Z ddlm Z dd lm Z dd lm Z dd lm Z dd lmZdd lmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZGd„d¦«ZdS)zFakeProcess class declarationé)Ú defaultdict)Údeque)ÚAny)ÚCallable)ÚClassVar)Ú DefaultDict)ÚDeque)ÚDict)ÚList)ÚOptional)ÚType)ÚUnioné)Ú exceptions)ÚProcessDispatcher)ÚProcessRecorder)ÚCOMMAND)ÚOPTIONAL_TEXT_OR_ITERABLE)ÚCommand)ÚProgramcó|—eZdZUdZeZeeeed<e Z eee ed<dd„Z d d e d e d e d ed eedeedeeeefdeededeedefd„ZeZ d!d e deddfd„Zd"d„Zdededdfd„Zdeddfd„Zd e defd„Zdeddfd„Ze d"d„¦«Z!dS)#Ú FakeProcessz-Main class responsible for process operationsÚanyÚprogramÚreturnNcó’—tt¦«|_t¦«|_d|_d|_t |_dS)NF)rrÚ definitionsÚcallsÚ_allow_unregisteredÚ_keep_last_processr©Úselfs úp/builddir/build/BUILD/cloudlinux-venv-1.0.12/venv/lib/python3.11/site-packages/pytest_subprocess/fake_process.pyÚ__init__zFakeProcess.__init__ sA€ÝKVÝ ñL ôL ˆÔõ&+¡W¤WˆŒ Ø).ˆÔ Ø(-ˆÔå$ˆŒˆˆórrÚcommandÚstdoutÚstderrÚ returncodeÚwaitÚcallbackÚcallback_kwargsÚsignal_callbackÚ occurrencesÚstdin_callablec óø—|�|�tjd¦«‚t|t¦«st|¦«}t ¦«} |j| ||||||||| | dœ g| z¦«| S)aŒ Main method for registering the subprocess instances. Args: command: register the command that will be faked stdout: value of the standard output stderr: value of the error output returncode: return code of the faked process wait: artificially wait for the process to finish callback: function that will be executed instead of the process callback_kwargs: keyword arguments that will be passed into callback occurrences: allow multiple usages of the same command stdin_callable: function that will interact with stdin NzbThe 'callback' and 'wait' arguments cannot be used together. Add sleep() to your callback instead.) r&r'r(r)r*r+r,r-r/Úrecorder)rÚIncorrectProcessDefinitionÚ isinstancerrrÚextend) r"r&r'r(r)r*r+r,r-r.r/r1s r#ÚregisterzFakeProcess.register*s¶€ð6 Ð  Ð 4ÝÔ7ðBñôð õ˜'¥7Ñ+Ô+ð 'ݘgÑ&Ô&ˆGå"Ñ$Ô$ˆØ Ô˜Ô!×(Ò(ð 'Ø$Ø$Ø",Ø Ø (Ø'6Ø'6Ø&4Ø (ð ð ð ðñ ñ ô ð ð$ˆr%có–—t|t¦«st|¦«}|j| dg|z¦«dS)z× Allow to use a real subprocess together with faked ones. Args: command: allow to execute the supplied command occurrences: allow multiple usages of the same command TN)r3rrr4)r"r&r.s r#Ú pass_commandzFakeProcess.pass_commanddsL€õ˜'¥7Ñ+Ô+ð 'ݘgÑ&Ô&ˆGØ Ô˜Ô!×(Ò(¨$¨°+Ñ)=Ñ>Ô>Ð>Ð>Ð>r%có.—tj|¦«|S©N)rr5r!s r#Ú __enter__zFakeProcess.__enter__us€ÝÔ" 4Ñ(Ô(Ð(؈ r%ÚargsÚkwargscó.—tj|¦«dSr9)rÚ deregister)r"r;r<s r#Ú__exit__zFakeProcess.__exit__ys€ÝÔ$ TÑ*Ô*Ð*Ð*Ð*r%Úallowcó—||_dS)zû Allow / block unregistered processes execution. When allowed, the real subprocesses will be called. Blocking will raise the exception. Args: allow: decide whether the unregistered process shall be allowed N)r)r"r@s r#Úallow_unregisteredzFakeProcess.allow_unregistered|s€ð$)ˆÔ Ð Ð r%có°‡—t|t¦«st|¦«Šttt ˆfd„|j¦«¦«¦«S)zò Count how many times a certain command was called. Can be used together with `fake_process.any()`. Args: command: lookup command Returns: number of times a command was called có•—|‰kSr9©)ÚelemÚcommand_instances €r#úz(FakeProcess.call_count..“s ø€¨TÐ5EÒ-E€r%)r3rÚlenÚtupleÚfilterr)r"r&rGs @r#Ú call_countzFakeProcess.call_count†sQø€õ˜'¥7Ñ+Ô+ð 0Ý& wÑ/Ô/Ð Ý•5�Ð EÐ EÐ EÐ EÀtÄzÑRÔRÑSÔSÑTÔTÐTr%Úkeepcó—||_dS)zÔ Keep last process definition from being removed. That can allow / block multiple execution of the same command. Args: keep: decide whether last process shall be kept N)r )r"rMs r#Úkeep_last_processzFakeProcess.keep_last_process•s€ð#'ˆÔÐÐr%có—|¦«S)zAReturn a new FakeProcess instance to use it as a context manager.rE)Úclss r#ÚcontextzFakeProcess.contextŸs€ðˆs‰uŒuˆ r%)rN) NNrNNNNrN)r)rr)"Ú__name__Ú __module__Ú __qualname__Ú__doc__rrrr Ú__annotations__rrr$rrÚintr Úfloatrr ÚstrÚAnyTyperr5Úregister_subprocessr7r:r r?ÚboolrBrLrOÚ classmethodrRrEr%r#rrs1€€€€€€Ø7Ð7à"€Cˆ�$�s”)Ô Ð"Ð"Ñ"Ø'.€GˆX�d˜7”mÔ $Ð.Ð.Ñ.ð%ð%ð%ð%ð-1Ø,0ØØ $Ø'+Ø8<Ø.2ØØ-1ð6ð6àð6ð*ð6ð*ð 6ð ð 6ð �uŒoð 6ð˜8Ô$ð6ð" $ s¨G |Ô"4Ô5ð6ð" (Ô+ð6ðð6ð! Ô*ð6ð ð6ð6ð6ð6ðp#Ðð ð?ð?àð?ðð?ð ð ?ð?ð?ð?ð"ðððð+˜dð+¨dð+°tð+ð+ð+ð+ð)¨ð)°ð)ð)ð)ð)ð U 'ð U¨cð Uð Uð Uð Uð' dð'¨tð'ð'ð'ð'ððððñ„[ðððr%rN)rVÚ collectionsrrÚtypingrr[rrrr r r r r rÚrÚprocess_dispatcherrÚprocess_recorderrÚtypesrrÚutilsrrrrEr%r#úrfs¯ðØ#Ð#à#Ð#Ð#Ð#Ð#Ð#ØÐÐÐÐÐØ!Ð!Ð!Ð!Ð!Ð!ØÐÐÐÐÐØÐÐÐÐÐØÐÐÐÐÐØÐÐÐÐÐØÐÐÐÐÐØÐÐÐÐÐØÐÐÐÐÐØÐÐÐÐÐØÐÐÐÐÐàÐÐÐÐÐØ1Ð1Ð1Ð1Ð1Ð1Ø-Ð-Ð-Ð-Ð-Ð-ØÐÐÐÐÐØ,Ð,Ð,Ð,Ð,Ð,ØÐÐÐÐÐØÐÐÐÐÐØÐÐÐÐÐðHðHðHðHðHñHôHðHðHðHr%