/opt/imunify360/venv/lib/python3.11/site-packages/daemon/__pycache__
NameSizeModeActions
daemon.cpython-311.pyc423530644editdlrm
pidfile.cpython-311.pyc24370644editdlrm
runner.cpython-311.pyc147180644editdlrm
_metadata.cpython-311.pyc49820644editdlrm
__init__.cpython-311.pyc12740644editdlrm
Edit: /opt/imunify360/venv/lib/python3.11/site-packages/daemon/__pycache__/runner.cpython-311.pyc (14718B)
§ 0Æl’Ì߃“ãóZ—dZddlmZmZddlZddlZddlZddlZddlZddl Z ddl m Z ddl m Z mZmZmZ en #e$reZYnwxYweZejde¦«Gd„d e¦«ZGd „d ee¦«ZGd „d ee¦«ZGd„dee¦«ZGd„d¦«Zdd„Z d„Z!d„Z"dS)z Daemon runner library. é)Úabsolute_importÚunicode_literalsNé©Úpidfile)Ú0_chain_exception_from_existing_exception_contextÚ DaemonContextÚ basestringÚunicodeu@The ‘runner’ module is not a supported API for this library.có(‡—eZdZdZˆfd„Zd„ZˆxZS)ÚDaemonRunnerErrorz3 Abstract base class for errors from DaemonRunner. cób•—| ¦«t¦«j|i|¤ŽdS©N)Ú_chain_from_contextÚsuperÚ__init__)ÚselfÚargsÚkwargsÚ __class__s €úm/builddir/build/BUILD/imunify360-venv-2.6.3/opt/imunify360/venv/lib/python3.11/site-packages/daemon/runner.pyrzDaemonRunnerError.__init__2s7ø€Ø × Ò Ñ"Ô"Ð"à�‰ŒÔ˜$Ð) &Ð)Ð)Ð)Ð)Ð)ócó(—t|d¬¦«dS)NT©Úas_cause©r©rs rrz%DaemonRunnerError._chain_from_context7s€Ý8¸ÈÐMÑMÔMÐMÐMÐMr)Ú__name__Ú __module__Ú __qualname__Ú__doc__rrÚ __classcell__)rs@rr r /sTø€€€€€Ø=Ð=ð*ð*ð*ð*ð*ð NðNðNðNðNðNðNrr có—eZdZdZd„ZdS)ÚDaemonRunnerInvalidActionErrorz; Raised when specified action for DaemonRunner is invalid. có(—t|d¬¦«dS)NFrrrs rrz2DaemonRunnerInvalidActionError._chain_from_context>s€å8¸ÈÐNÑNÔNÐNÐNÐNrN)rrr r!r©rrr$r$;s.€€€€€ØEÐEðOðOðOðOðOrr$có—eZdZdZdS)ÚDaemonRunnerStartFailureErrorz, Raised when failure starting DaemonRunner. N©rrr r!r&rrr(r(Có€€€€€Ø6Ð6Ð6Ð6rr(có—eZdZdZdS)ÚDaemonRunnerStopFailureErrorz, Raised when failure stopping DaemonRunner. Nr)r&rrr,r,Gr*rr,có`—eZdZdZdZd„Zd„Zd„Zdd„Zd„Z d „Z d „Z d „Z e e e d œZ d „Zd„ZdS)Ú DaemonRunnera4 Controller for a callable running in a separate background process. The first command-line argument is the action to take: * 'start': Become a daemon and call `app.run()`. * 'stop': Exit the daemon process specified in the PID file. * 'restart': Stop, then start. zstarted with pid {pid:d}có—| ¦«||_t¦«|_| |¦«d|_|j�t|j|j¦«|_|j|j_dS)a# Set up the parameters of a new runner. :param app: The application instance; see below. :return: ``None``. The `app` argument must have the following attributes: * `stdin_path`, `stdout_path`, `stderr_path`: Filesystem paths to open and replace the existing `sys.stdin`, `sys.stdout`, `sys.stderr`. * `pidfile_path`: Absolute filesystem path to a file that will be used as the PID file for the daemon. If ``None``, no PID file will be used. * `pidfile_timeout`: Used as the default acquisition timeout value supplied to the runner's PID lock file. * `run`: Callable that will be invoked when the daemon is started. N) Ú parse_argsÚappr Údaemon_contextÚ#_open_streams_from_app_stream_pathsrÚ pidfile_pathÚmake_pidlockfileÚpidfile_timeout©rr1s rrzDaemonRunner.__init__Xsz€ð. �ŠÑÔÐØˆŒÝ+™oœoˆÔØ ×0Ò0°Ñ5Ô5Ð5àˆŒ Ø Ô Ð 'Ý+ØÔ$ cÔ&9ñ;ô;ˆDŒLà&*¤lˆÔÔ#Ð#Ð#rcóÄ—t|jd¦«|j_t|jd¦«|j_t|jdd¬¦«|j_dS)ab Open the `daemon_context` streams from the paths specified. :param app: The application instance. Open the `daemon_context` standard streams (`stdin`, `stdout`, `stderr`) as stream objects of the appropriate types, from each of the corresponding filesystem paths from the `app`. Úrtzw+tr)Ú bufferingN)ÚopenÚ stdin_pathr2ÚstdinÚ stdout_pathÚstdoutÚ stderr_pathÚstderrr7s rr3z0DaemonRunner._open_streams_from_app_stream_pathszs[€õ%)¨¬¸Ñ$>Ô$>ˆÔÔ!Ý%)¨#¬/¸5Ñ%AÔ%AˆÔÔ"Ý%)Ø” °!ð&5ñ&5ô&5ˆÔÔ"Ð"Ð"rcó —tj |d¦«}d}d |j ¦«¦«}d ||¬¦«}t|¦«tj |¦«dS)zÉ Emit a usage message, then exit. :param argv: The command-line arguments used to invoke the program, as a sequence of strings. :return: ``None``. réú|zusage: {progname} {usage})ÚprognameÚusageN) ÚosÚpathÚbasenameÚjoinÚ action_funcsÚkeysÚformatÚ emit_messageÚsysÚexit)rÚargvrEÚusage_exit_codeÚ action_usageÚmessages rÚ _usage_exitzDaemonRunner._usage_exit‰s…€õ”7×#Ò# D¨¤GÑ,Ô,ˆØˆØ—x’x Ô 1× 6Ò 6Ñ 8Ô 8Ñ9Ô9ˆ Ø-×4Ò4Ø!¨ð5ñ7ô7ˆå�WÑÔÐÝ Œ�Ñ!Ô!Ð!Ð!Ð!rNcóô—|€ tj}d}t|¦«|kr| |¦«t |d¦«|_|j|jvr| |¦«dSdS)a¹ Parse command-line arguments. :param argv: The command-line arguments used to invoke the program, as a sequence of strings. :return: ``None``. The parser expects the first argument as the program name, the second argument as the action to perform. If the parser fails to parse the arguments, emit a usage message and exit the program. NrCr)rOrQÚlenrUr ÚactionrK)rrQÚmin_argss rr0zDaemonRunner.parse_args™s€ð ˆ<Ý”8ˆDàˆÝ ˆt‰9Œ9�xÒ Ð Ø × Ò ˜TÑ "Ô "Ð "å˜d 1œgÑ&Ô&ˆŒ Ø Œ;˜dÔ/Ð /Ð /Ø × Ò ˜TÑ "Ô "Ð "Ð "Ð "ð 0Ð /rcó¼—t|j¦«r|j ¦« |j ¦«n=#t j$r+td |j¬¦«¦«}|‚wxYwtj ¦«}|j  |¬¦«}t|¦«|j  ¦«dS)zÔ Open the daemon context and run the application. :return: ``None``. :raises DaemonRunnerStartFailureError: If the PID file cannot be locked by this process. z(PID file {pidfile.path!r} already lockedr)ÚpidN)Úis_pidfile_stalerÚ break_lockr2r;ÚlockfileÚ AlreadyLockedr(rMrGÚgetpidÚ start_messagerNr1Úrun)rÚerrorr[rTs rÚ_startzDaemonRunner._start³sà€õ ˜DœLÑ )Ô )ð &Ø ŒL× #Ò #Ñ %Ô %Ð %ð Ø Ô × $Ò $Ñ &Ô &Ð &Ð &øÝÔ%ð ð ð Ý1Ø>×EÒEØ $¤ ðFñ.ô.ñ/ô/ˆEðˆKð  øøøõ Œi‰kŒkˆØÔ$×+Ò+°Ð+Ñ4Ô4ˆÝ�WÑÔÐà Œ� Š ‰Œˆˆˆs ¯A Á :Bcóè—|j ¦«} tj|tj¦«dS#t $r+}td ||¬¦«¦«}|‚d}~wwxYw)zâ Terminate the daemon process specified in the current PID file. :return: ``None``. :raises DaemonRunnerStopFailureError: If terminating the daemon fails with an OS error. z"Failed to terminate {pid:d}: {exc})r[ÚexcN) rÚread_pidrGÚkillÚsignalÚSIGTERMÚOSErrorr,rM)rr[rfrcs rÚ_terminate_daemon_processz&DaemonRunner._terminate_daemon_processÌs‰€ðŒl×#Ò#Ñ%Ô%ˆð Ý ŒG�C�œÑ (Ô (Ð (Ð (Ð (øÝð ð ð Ý0Ø8×?Ò?Ø Sð@ñ*ô*ñ+ô+ˆEðˆKøøøøð  øøøs›<¼ A1Á&A,Á,A1có—|j ¦«s*td |j¬¦«¦«}|‚t |j¦«r|j ¦«dS| ¦«dS)zÒ Exit the daemon process specified in the current PID file. :return: ``None``. :raises DaemonRunnerStopFailureError: If the PID file is not already locked. z$PID file {pidfile.path!r} not lockedrN)rÚ is_lockedr,rMr\r]rl)rrcs rÚ_stopzDaemonRunner._stopÝs’€ðŒ|×%Ò%Ñ'Ô'ð Ý0Ø:×AÒAØ $¤ ðBñ.ô.ñ/ô/ˆEðˆKå ˜DœLÑ )Ô )ð -Ø ŒL× #Ò #Ñ %Ô %Ð %Ð %Ð %à × *Ò *Ñ ,Ô ,Ð ,Ð ,Ð ,rcóV—| ¦«| ¦«dS)z Stop, then start. N)rordrs rÚ_restartzDaemonRunner._restartðs"€ð � Š ‰ Œ ˆ Ø � Š ‰ Œ ˆ ˆ ˆ r)ÚstartÚstopÚrestartcóž— |j|j}n8#t$r+td |j¬¦«¦«}|‚wxYw|S)ae Get the function for the specified action. :return: The function object corresponding to the specified action. :raises DaemonRunnerInvalidActionError: if the action is unknown. The action is specified by the `action` attribute, which is set during `parse_args`. zUnknown action: {action!r})rX)rKrXÚKeyErrorr$rM)rÚfuncrcs rÚ_get_action_funczDaemonRunner._get_action_funcüsm€ð ØÔ$ T¤[Ô1ˆDˆDøÝð ð ð Ý2Ø0×7Ò7Ø#œ{ð8ñ,ô,ñ-ô-ˆEðˆKð  øøøð ˆ s ‚•5A cóD—| ¦«}||¦«dS)zº Perform the requested action. :return: ``None``. The action is specified by the `action` attribute, which is set during `parse_args`. N)rx)rrws rÚ do_actionzDaemonRunner.do_actions&€ð×$Ò$Ñ&Ô&ˆØ ˆˆT‰ Œ ˆ ˆ ˆ rr)rrr r!rarr3rUr0rdrlrorqrKrxrzr&rrr.r.KsØ€€€€€ð ð ð/€Mð 3ð 3ð 3ðD 5ð 5ð 5ð"ð"ð"ð #ð#ð#ð#ð4ððð2ððð"-ð-ð-ð&ðððØØðð€Lð ððð* ð ð ð ð rr.cóœ—|€ tj}| d |¬¦«¦«| ¦«dS)z@ Emit a message to the specified stream (default `sys.stderr`). Nz {message} )rT)rOrAÚwriterMÚflush)rTÚstreams rrNrNsB€à €~Ý”ˆØ ‡L‚L�×%Ò%¨gÐ%Ñ6Ô6Ñ7Ô7Ð7Ø ‡L‚L�N„N€N€N€Nrcó,—t|t¦«s%td |¬¦«¦«}|‚tj |¦«s%td |¬¦«¦«}|‚tj||¦«}|S)z= Make a PIDLockFile instance with the given filesystem path. zNot a filesystem path: {path!r})rHzNot an absolute path: {path!r}) Ú isinstancer Ú ValueErrorrMrGrHÚisabsrÚTimeoutPIDLockFile)rHÚacquire_timeoutrcr^s rr5r5&s¡€å �d�JÑ 'Ô 'ðÝÐ<×CÒCØðDñôñôˆàˆ Ý Œ7�=Š=˜Ñ Ô ðÝÐ;×BÒBØðCñôñôˆàˆ ÝÔ)¨$°Ñ@Ô@€Hà €Orcóä—d}|j¦«}|�\ tj|tj¦«n;#t $rd}Yn-t $r!}|jtjkrd}Yd}~nd}~wwxYw|S)uü Determine whether a PID file is stale. :return: ``True`` iff the PID file is stale; otherwise ``False``. The PID file is “staleâ€� if its contents are valid but do not match the PID of a currently-running process. FNT) rgrGrhriÚSIG_DFLÚProcessLookupErrorrkÚerrnoÚESRCH)rÚresultÚ pidfile_pidrfs rr\r\5s—€ð€Fà"�'Ô"Ñ$Ô$€KØÐð Ý ŒG�K¥¤Ñ 0Ô 0Ð 0Ð 0øÝ!ð ð ð àˆFˆFˆFÝð ð ð ØŒy�EœKÒ'Ð'ð�øøøøøøøøøð  øøøð €Ms•5µ A-Á A-Á A(Á(A-r)#r!Ú __future__rrrˆrGrirOÚwarningsr^ÚrÚdaemonrr r r r‡Ú NameErrorÚNotImplementedÚtypeÚ __metaclass__ÚwarnÚDeprecationWarningÚ Exceptionr r�r$Ú RuntimeErrorr(r,r.rNr5r\r&rrúr˜s5ðððð;Ð:Ð:Ð:Ð:Ð:Ð:Ð:à € € € Ø € € € Ø € € € Ø € € € Ø€€€à€€€àÐÐÐÐÐððððððððððððð(àÐÐøØð(ð(ð(à'ÐÐÐð(øøøð€ ð€„ ØJØñôðð Nð Nð Nð Nð N˜ ñ Nô Nð NðOðOðOðOðOÐ%6¸ ñOôOðOð7ð7ð7ð7ð7Ð$5°|ñ7ô7ð7ð7ð7ð7ð7ð7Ð#4°lñ7ô7ð7ðPðPðPðPðPñPôPðPðfðððð ð ð ðððððs¶9¹AÁA