%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/twisted/application/runner/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/twisted/application/runner/__pycache__/_runner.cpython-312.pyc

�

Ϫ�f�����dZddlmZddlmZddlmZddlmZm	Z	m
Z
mZddlm
Z
mZmZddlmZddlmZdd	lmZmZmZmZmZmZmZd
dlmZmZd
dlm Z m!Z!m"Z"m#Z#ed
��Gd�d��Z$y)z
Twisted application runner.
�)�kill)�SIGTERM)�stderr)�Any�Callable�Mapping�TextIO)�Factory�attrib�attrs)�
NamedConstant)�IReactorCore)�FileLogObserver�FilteringLogObserver�Logger�LogLevel�LogLevelFilterPredicate�globalLogBeginner�textFileLogObserver�)�
ExitStatus�exit)�AlreadyRunningError�InvalidPIDFileError�IPIDFile�nonePIDFileT)�frozenc�p�eZdZdZe�Zee��Zee	e
��Zeed��Z
eeej ��Zeee��Zeeegefe��Zeedd���Zeeeefee���Zeedd���Z eeeefee���Z!dd	�Z"dd
�Z#dd�Z$dd�Z%dd
�Z&dd�Z'y)�Runnera
    Twisted application runner.

    @cvar _log: The logger attached to this class.

    @ivar _reactor: The reactor to start and run the application in.
    @ivar _pidFile: The file to store the running process ID in.
    @ivar _kill: Whether this runner should kill an existing running
        instance of the application.
    @ivar _defaultLogLevel: The default log level to start the logging
        system with.
    @ivar _logFile: A file stream to write logging output to.
    @ivar _fileLogObserverFactory: A factory for the file log observer to
        use when starting the logging system.
    @ivar _whenRunning: Hook to call after the reactor is running;
        this is where the application code that relies on the reactor gets
        called.
    @ivar _whenRunningArguments: Keyword arguments to pass to
        C{whenRunning} when it is called.
    @ivar _reactorExited: Hook to call after the reactor exits.
    @ivar _reactorExitedArguments: Keyword arguments to pass to
        C{reactorExited} when it is called.
    )�type)r �defaultF).Nc��y�N���_s �D/usr/lib/python3/dist-packages/twisted/application/runner/_runner.py�<lambda>zRunner.<lambda>C���c��yr#r$r%s r'r(zRunner.<lambda>Er)r*Nc��|j}|j�	|5|j�|j�|j	�ddd�y#1swYyxYw#t
$rt
tjd�YywxYw)z#
        Run this command.
        NzAlready running.)	�_pidFile�killIfRequested�startLogging�startReactor�
reactorExitedrrr�	EX_CONFIG)�self�pidFiles  r'�runz
Runner.runHs~���-�-������		��
%��!�!�#��!�!�#��"�"�$�
%�
%�
%��
#�	���%�%�'9�:��	�s.�A&�1A�A&�A#�A&�#A&�&#B�Bc���|j}|jr�|turttj
d�y	|j
�}|j�|jjd|��t|t�ttj �yy#t$rttjd�Yyt$rttjd�YywxYw)zj
        If C{self._kill} is true, attempt to kill a running instance of the
        application.
        zNo PID file specified.NzUnable to read PID file.zInvalid PID file.zTerminating process: {pid})�pid)r-�_killrrr�EX_USAGE�read�OSError�EX_IOERRr�
EX_DATAERRr/�_log�inforr�EX_OK)r3r4r7s   r'r.zRunner.killIfRequested[s���
�-�-���:�:��+�%��Z�(�(�*B�C��	
��l�l�n��
�����I�I�N�N�7�S�N�A���g����!�!�"��1���
��Z�(�(�*D�E��&�
��Z�*�*�,?�@��
�s�B%�%#C/�
"C/�.C/c��|j}|j}||�}t|j��}t	||g�}tj|g�y)z=
        Start the L{twisted.logger} logging system.
        )�defaultLogLevelN)�_logFile�_fileLogObserverFactoryr�_defaultLogLevelrr�beginLoggingTo)r3�logFile�fileLogObserverFactory�fileLogObserver�logLevelPredicate�filteringObservers      r'r/zRunner.startLogging|s\���-�-��!%�!=�!=��0��9��3� �1�1�
��1��CT�BU�V���(�(�*;�)<�=r*c��|jj|j�|jj	d�|jj�y)z�
        Register C{self._whenRunning} with the reactor so that it is called
        once the reactor is running, then start the reactor.
        zStarting reactor...N)�_reactor�callWhenRunning�whenRunningr>r?r5�r3s r'r0zRunner.startReactor�s=��
	
�
�
�%�%�d�&6�&6�7��	�	���,�-��
�
���r*c�<�|jdi|j��y)z�
        Call C{self._whenRunning} with C{self._whenRunningArguments}.

        @note: This method is called after the reactor starts running.
        Nr$)�_whenRunning�_whenRunningArgumentsrPs r'rOzRunner.whenRunning�s��	����7�D�6�6�7r*c�<�|jdi|j��y)z�
        Call C{self._reactorExited} with C{self._reactorExitedArguments}.

        @note: This method is called after the reactor exits.
        Nr$)�_reactorExited�_reactorExitedArgumentsrPs r'r1zRunner.reactorExited�s��	����;�d�:�:�;r*)�returnN)(�__name__�
__module__�__qualname__�__doc__rr>rrrMrrr-�boolr8r
rr?rEr	rrCrrrrDrRr�strrr
�dictrSrUrVr5r.r/r0rOr1r$r*r'rrs����0�8�D��<�(�H��8�[�9�H���e�,�E��=�(�-�-�H���6�6�2�H�$�
�v�h��/�
0�:M����x�	�2�<L�M�L�"���S��(9�7�4�=�Q����)�!4�>N�O�N�$�'�#�s�(�*;�W�T�]�S���&�B>�$�8�<r*rN)%r[�osr�signalr�sysr�typingrrrr	�attrr
rr�
constantlyr
�twisted.internet.interfacesr�twisted.loggerrrrrrrr�_exitrr�_pidfilerrrrrr$r*r'�<module>risb��
����1�1�'�'�$�4����$�U�U��d��F<�F<��F<r*

Zerion Mini Shell 1.0