File: //usr/lib/python3/dist-packages/twisted/application/__pycache__/app.cpython-310.pyc
o
�bqZ � @ s� d dl Z d dlZd dlZd dlZd dlZd dlZd dlZd dlmZ d dl m
Z
mZmZ d dl
mZmZ d dlmZmZ d dlmZ d dlmZ d dlmZ d d lmZmZmZmZmZmZ d d
l m!Z!m"Z"m#Z# G dd� d�Z$G d
d� de$�Z%G dd� de$�Z&G dd� d�Z'G dd� d�Z(dd� Z)d/dd�Z*dd� Z+dd� Z,G dd� d�Z-dd � Z.d!d"� Z/G d#d$� d$�Z0G d%d&� d&ej1e0�Z2d'd(� Z3d)d*� Z4d+d,� Z5d-d.� Z6dS )0� N)�
attrgetter)� copyright�logger�plugin)�reactors�service)�
NoSuchReactor�installReactor)�defer)�_ISupportsExitSignalCapturing)�sob)�failure�log�logfile�runtime�usage�util)�namedAny�namedModule�qualc @ s e Zd ZdZdd� Zdd� ZdS )�_BasicProfilerz�
@ivar saveStats: if C{True}, save the stats information instead of the
human readable format
@type saveStats: C{bool}
@ivar profileOutput: the name of the file use to print profile data.
@type profileOutput: C{str}
c C s || _ || _d S �N)�
profileOutput� saveStats)�selfr r � r �9/usr/lib/python3/dist-packages/twisted/application/app.py�__init__% s
z_BasicProfiler.__init__c C s d|� d|� �}|d7 }t |��)z�
Helper method to report an import error with a profile module. This
has to be explicit because some of these modules are removed by
distributions due to them being non-free.
zFailed to import module �: z�
This is most likely caused by your operating system not including
the module due to it being non-free. Either do not use the option
--profile, or install the module; your operating system vendor
may provide it in a separate package.
)�
SystemExit)r �module�e�sr r r �_reportImportError) s z!_BasicProfiler._reportImportErrorN)�__name__�
__module__�__qualname__�__doc__r r# r r r r r s r c @ � e Zd ZdZdd� ZdS )�
ProfileRunnerz1
Runner for the standard profile module.
c
C s� zddl }W n ty } z| �d|� W Y d}~nd}~ww |�� }|�|j� | jr4|�| j� dS t j
t| jd�}t _
z|�� W |t j
t _
}|�
� dS |t j
t _
}|�
� w )z:
Run reactor under the standard profiler.
r N�profile�a)r* �ImportErrorr# �Profile�runcall�runr �
dump_statsr �sys�stdout�open�print_stats�close)r �reactorr* r! �p�tmpr r r r/ >