HEX
Server: Apache
System: Linux scp1.abinfocom.com 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: confeduphaar (1010)
PHP: 8.1.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //lib/python3/dist-packages/twisted/application/twist/__pycache__/_twist.cpython-38.pyc
U


W[�
�@s|dZddlZddlmZddlmZmZddlmZm	Z	ddl
mZdd	lm
Z
dd
lmZddlmZGdd
�d
e�ZdS)z
Run a Twisted application.
�N)�
UsageError�)�Application�IService)�exit�
ExitStatus)�Runner�)�TwistOptions)�_exitWithSignal)�_ISupportsExitSignalCapturingc@sReZdZdZedd��Zedd��Zedd��Zedd	��Ze	e
jfd
d��ZdS)
�Twistz$
    Run a Twisted application.
    c
CsXt�}z|�|dd��Wn6tk
rR}zttjd�||��W5d}~XYnX|S)z�
        Parse command line options.

        @param argv: Command line arguments.
        @type argv: L{list}

        @return: The parsed options.
        @rtype: L{TwistOptions}
        r	Nz
Error: {}

{})r
ZparseOptionsrrr�EX_USAGE�format)�argv�options�e�r�B/usr/lib/python3/dist-packages/twisted/application/twist/_twist.pyrs&z
Twist.optionscCs&|�|�}t|j�}|�|�t|�S)a|
        Create the application service.

        @param plugin: The name of the plugin that implements the service
            application to run.
        @type plugin: L{str}

        @param options: Options to pass to the application.
        @type options: L{twisted.python.usage.Options}

        @return: The created application service.
        @rtype: L{IService}
        )ZmakeServicerZtapnameZsetServiceParentr)�pluginr�serviceZapplicationrrrr/s


z
Twist.servicecCs|��|�dd|j�dS)a

        Start the application service.

        @param reactor: The reactor to run the service with.
        @type reactor: L{twisted.internet.interfaces.IReactorCore}

        @param service: The application service to run.
        @type service: L{IService}
        ZbeforeZshutdownN)�startServiceZaddSystemEventTriggerZstopService)�reactorrrrrrEs�zTwist.startServicecCsRt|d|d|d|dd�}|��|d}t�|�rN|jdk	rNt|j�dS)z�
        Run the application service.

        @param twistOptions: Command line options to convert to runner
            arguments.
        @type twistOptions: L{TwistOptions}
        rZlogLevel�logFile�fileLogObserverFactory)rZdefaultLogLevelrrN)r�runrZ
providedByZ_exitSignalr)ZtwistOptionsZrunnerrrrrrXs	�

z	Twist.runcCsD|�|�}|d}|j|j|j|jd�}|�||�|�|�dS)z�
        Executable entry point for L{Twist}.
        Processes options and run a twisted reactor with a service.

        @param argv: Command line arguments.
        @type argv: L{list}
        r)rrN)rrZpluginsZ
subCommandZ
subOptionsrr)�clsrrrrrrr�mainns	

�z
Twist.mainN)
�__name__�
__module__�__qualname__�__doc__�staticmethodrrrr�classmethod�sysrrrrrrr
s



r
)r!r$Ztwisted.python.usagerrrrZrunner._exitrrZrunner._runnerrZ_optionsr
Ztwisted.application.apprZtwisted.internet.interfacesr�objectr
rrrr�<module>s