§
    ÈtºfpZ  ã                   óö  — d dl Z d dlZd dlZd dlZd dlZd dlZd dlZd dlmZ d dl	m
Z
mZmZ d dlmZmZ d dlmZmZ d dlmZ d dlmZ d dlmZ d d	lmZmZmZmZmZmZ d d
l m!Z!m"Z"m#Z#  G d„ d¦  «        Z$ G d„ de$¦  «        Z% G d„ de$¦  «        Z& G d„ d¦  «        Z' G d„ d¦  «        Z(d„ Z)d%d„Z*d„ Z+d„ Z, G d„ d¦  «        Z-d„ Z.d„ Z/ G d„ d¦  «        Z0 G d„ d ej1        e0¦  «        Z2d!„ Z3d"„ Z4d#„ Z5d$„ Z6dS )&é    N)Ú
attrgetter)Ú	copyrightÚloggerÚplugin)ÚreactorsÚservice)ÚNoSuchReactorÚinstallReactor)Údefer)Ú_ISupportsExitSignalCapturing)Úsob)ÚfailureÚlogÚlogfileÚruntimeÚusageÚutil)ÚnamedAnyÚnamedModuleÚqualc                   ó   — e Zd ZdZd„ Zd„ ZdS )Ú_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                 ó"   — || _         || _        d S ©N)ÚprofileOutputÚ	saveStats)Úselfr   r   s      úV/var/www/surfInsights/venv3-11/lib/python3.11/site-packages/twisted/application/app.pyÚ__init__z_BasicProfiler.__init__%   s   € Ø*ˆÔØ"ˆŒˆˆó    c                 ó:   — d|› d|› �}|dz  }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.
        zFailed 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Úss       r   Ú_reportImportErrorz!_BasicProfiler._reportImportError)   s6   € ð 5 vÐ4Ð4°Ð4Ð4ˆØ	ð ñ 	ˆõ ˜‰mŒmÐr    N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r'   © r    r   r   r      s<   € € € € € ðð ð#ð #ð #ðð ð ð ð r    r   c                   ó   — e Zd ZdZd„ ZdS )ÚProfileRunnerz1
    Runner for the standard profile module.
    c                 óN  — 	 ddl }n-# t          $ r }|                      d|¦  «         Y d}~nd}~ww xY w|                     ¦   «         }|                     |j        ¦  «         | j        r|                     | j        ¦  «         dS t          j
        t          | j        d¦  «        c}t          _
        	 |                     ¦   «          |t          j
        ct          _
        }|                     ¦   «          dS # |t          j
        ct          _
        }|                     ¦   «          w xY w)z:
        Run reactor under the standard profiler.
        r   NÚprofileÚa)r0   ÚImportErrorr'   ÚProfileÚruncallÚrunr   Ú
dump_statsr   ÚsysÚstdoutÚopenÚprint_statsÚclose)r   Úreactorr0   r%   ÚpÚtmps         r   r5   zProfileRunner.run>   s  € ð	2ØˆNˆNˆNˆNøÝð 	2ð 	2ð 	2Ø×#Ò# I¨qÑ1Ô1Ð1Ð1Ð1Ð1Ð1Ð1øøøøð	2øøøð �OŠOÑÔˆØ	�	Š	�'”+ÑÔÐØŒ>ð 	Ø�LŠL˜Ô+Ñ,Ô,Ð,Ð,Ð,å!œj­$¨tÔ/AÀ3Ñ*GÔ*GˆOˆC•”ðØ—’‘”�à"%¥s¤z�•”
˜CØ—	’	‘”���øð #&¥s¤z�•”
˜CØ—	’	‘”��øøøs   ‚ ‡
1‘,¬1Â2C5 Ã5/D$N©r(   r)   r*   r+   r5   r,   r    r   r.   r.   9   s-   € € € € € ðð ðð ð ð ð r    r.   c                   ó   — e Zd ZdZd„ ZdS )ÚCProfileRunnerz)
    Runner for the cProfile module.
    c                 ó  — 	 ddl }ddl}n-# t          $ r }|                      d|¦  «         Y d}~nd}~ww xY w|                     ¦   «         }|                     |j        ¦  «         | j        r|                     | j	        ¦  «         dS t          | j	        d¦  «        5 }|                     ||¬¦  «        }|                     ¦   «          |                     d¦  «         |                     ¦   «          ddd¦  «         dS # 1 swxY w Y   dS )z:
        Run reactor under the cProfile profiler.
        r   NÚcProfileÚw)Ústreaméÿÿÿÿ)rC   Úpstatsr2   r'   r3   r4   r5   r   r6   r   r9   ÚStatsÚ
strip_dirsÚ
sort_statsr:   )r   r<   rC   rG   r%   r=   rE   r&   s           r   r5   zCProfileRunner.runY   s`  € ð	3ØˆOˆOˆOØˆMˆMˆMˆMøÝð 	3ð 	3ð 	3Ø×#Ò# J°Ñ2Ô2Ð2Ð2Ð2Ð2Ð2Ð2øøøøð	3øøøð ×ÒÑÔˆØ	�	Š	�'”+ÑÔÐØŒ>ð 	 Ø�LŠL˜Ô+Ñ,Ô,Ð,Ð,Ð,å�dÔ(¨#Ñ.Ô.ð  °&Ø—L’L ¨6�LÑ2Ô2�Ø—’‘”�Ø—’˜RÑ Ô Ð Ø—’‘”�ð	 ð  ð  ñ  ô  ð  ð  ð  ð  ð  ð  ð  øøøð  ð  ð  ð  ð  ð  s#   ‚ ‹
5•0°5ÂAD Ä DÄDNr?   r,   r    r   rA   rA   T   s-   € € € € € ðð ð ð  ð  ð  ð  r    rA   c                   ó"   — e Zd ZdZeedœZd„ ZdS )ÚAppProfilerz®
    Class which selects a specific profile runner based on configuration
    options.

    @ivar profiler: the name of the selected profiler.
    @type profiler: C{str}
    )r0   Úcprofilec                 óR  — |                      dd¦  «        }|                      dd ¦  «        }|                      dd¦  «                             ¦   «         | _        | j        | j        v r* | j        | j                 ||¦  «        }|j        | _        d S t          d| j        › �¦  «        ‚)NÚ	savestatsFr0   ÚprofilerrM   zUnsupported profiler name: )ÚgetÚlowerrP   Ú	profilersr5   r#   )r   Úoptionsr   r   rP   s        r   r   zAppProfiler.__init__z   s˜   € Ø—K’K ¨UÑ3Ô3ˆ	ØŸš I¨tÑ4Ô4ˆØŸš J°
Ñ;Ô;×AÒAÑCÔCˆŒØŒ=˜DœNÐ*Ð*Ø4�t”~ d¤mÔ4°]ÀIÑNÔNˆHØ”|ˆDŒHˆHˆHåÐJ¸4¼=ÐJÐJÑKÔKÐKr    N)r(   r)   r*   r+   r.   rA   rS   r   r,   r    r   rL   rL   o   sA   € € € € € ðð ð *°~ÐFÐF€IðLð Lð Lð Lð Lr    rL   c                   ó4   — e Zd ZdZdZd„ Zd„ Zd„ Zd„ Zd„ Z	dS )Ú	AppLoggera]  
    An L{AppLogger} attaches the configured log observer specified on the
    commandline to a L{ServerOptions} object, a custom L{logger.ILogObserver},
    or a legacy custom {log.ILogObserver}.

    @ivar _logfilename: The name of the file to which to log, if other than the
        default.
    @type _logfilename: C{str}

    @ivar _observerFactory: Callable object that will create a log observer, or
        None.

    @ivar _observer: log observer added at C{start} and removed at C{stop}.
    @type _observer: a callable that implements L{logger.ILogObserver} or
        L{log.ILogObserver}.
    Nc                 ót   — |                      dd¦  «        | _        |                      d¦  «        pd| _        dS )zE
        Initialize an L{AppLogger} with a L{ServerOptions}.
        r   Ú r   N)rQ   Ú_logfilenameÚ_observerFactory©r   rT   s     r   r   zAppLogger.__init__™   s9   € ð $ŸKšK¨	°2Ñ6Ô6ˆÔØ '§¢¨HÑ 5Ô 5Ð =¸ˆÔÐÐr    c                 ó¦  — | j         �|                       ¦   «         }nB|                     t          j        d¦  «        }|€ |                     t          j        d¦  «        }|€|                      ¦   «         }|| _        t          j                             | j        ¦  «        r	| j        g}nut          j                             | j        ¦  «        rt          j        | j        ¦  «        g}n6t          j
        dt          d¬¦  «         t          j        | j        ¦  «        g}t          j                             |¦  «         |                      ¦   «          dS )a›  
        Initialize the global logging system for the given application.

        If a custom logger was specified on the command line it will be used.
        If not, and an L{logger.ILogObserver} or legacy L{log.ILogObserver}
        component has been set on C{application}, then it will be used as the
        log observer. Otherwise a log observer will be created based on the
        command line options for built-in loggers (e.g. C{--logfile}).

        @param application: The application on which to check for an
            L{logger.ILogObserver} or legacy L{log.ILogObserver}.
        @type application: L{twisted.python.components.Componentized}
        NaZ  Passing a logger factory which makes log observers which do not implement twisted.logger.ILogObserver or twisted.python.log.ILogObserver to twisted.application.app.AppLogger was deprecated in Twisted 16.2. Please use a factory that produces twisted.logger.ILogObserver (or the legacy twisted.python.log.ILogObserver) implementing objects instead.é   )Ú
stacklevel)rZ   ÚgetComponentr   ÚILogObserverr   Ú_getLogObserverÚ	_observerÚ
providedByÚLegacyLogObserverWrapperÚwarningsÚwarnÚDeprecationWarningÚglobalLogBeginnerÚbeginLoggingToÚ_initialLog)r   ÚapplicationÚobserverÚ	observerss       r   ÚstartzAppLogger.start    s;  € ð Ô Ð,Ø×,Ò,Ñ.Ô.ˆHˆHà"×/Ò/µÔ0CÀTÑJÔJˆHØÐà&×3Ò3µCÔ4DÀdÑKÔK�àÐØ×+Ò+Ñ-Ô-ˆHØ!ˆŒåÔ×)Ò)¨$¬.Ñ9Ô9ð 	JØœÐ(ˆIˆIÝÔ×(Ò(¨¬Ñ8Ô8ð 	JÝÔ8¸¼ÑHÔHÐIˆIˆIåŒMðõ #Øðñ ô ð õ  Ô8¸¼ÑHÔHÐIˆIåÔ ×/Ò/°	Ñ:Ô:Ð:Ø×ÒÑÔÐÐÐr    c                 ó(  — ddl m} t          j        | ¦  «                             dt
          j        t          j        t          j
        ¦   «         ¬¦  «         t          j        | ¦  «                             dt          |j        ¦  «        ¬¦  «         dS )z1
        Print twistd start log message.
        r   ©r<   z1twistd {version} ({exe} {pyVersion}) starting up.)ÚversionÚexeÚ	pyVersionzreactor class: {reactor}.N)Útwisted.internetr<   r   Ú
_loggerForÚinfor   rq   r7   Ú
executabler   ÚshortPythonVersionr   Ú	__class__)r   r<   s     r   rj   zAppLogger._initialLogÒ   sœ   € ð 	-Ð,Ð,Ð,Ð,Ð,åÔ˜$ÑÔ×$Ò$Ø?ÝÔ%Ý”ÝÔ0Ñ2Ô2ð	 	%ñ 	
ô 	
ð 	
õ 	Ô˜$ÑÔ×$Ò$Ø'µ°gÔ6GÑ1HÔ1Hð 	%ñ 	
ô 	
ð 	
ð 	
ð 	
r    c                 ó°   — | j         dk    s| j         st          j        }n$t          j                             | j         ¦  «        }t          j        |¦  «        S )zr
        Create a log observer to be added to the logging system before running
        this application.
        ú-)rY   r7   r8   r   ÚLogFileÚfromFullPathr   ÚtextFileLogObserver)r   ÚlogFiles     r   ra   zAppLogger._getLogObserverâ   sL   € ð
 Ô Ò#Ð#¨4Ô+<Ð#Ý”jˆGˆGå”o×2Ò2°4Ô3DÑEÔEˆGÝÔ)¨'Ñ2Ô2Ð2r    c                 ó¼   — t          j        | ¦  «                             d¦  «         | j        �-t           j                             | j        ¦  «         d| _        dS dS )zS
        Remove all log observers previously set up by L{AppLogger.start}.
        zServer Shut Down.N)r   ru   rv   rb   ÚglobalLogPublisherÚremoveObserver©r   s    r   ÚstopzAppLogger.stopí   sX   € õ 	Ô˜$ÑÔ×$Ò$Ð%8Ñ9Ô9Ð9ØŒ>Ð%ÝÔ%×4Ò4°T´^ÑDÔDÐDØ!ˆDŒNˆNˆNð &Ð%r    )
r(   r)   r*   r+   rb   r   rn   rj   ra   r„   r,   r    r   rV   rV   …   sq   € € € € € ðð ð" €Ið>ð >ð >ð0ð 0ð 0ðd
ð 
ð 
ð 	3ð 	3ð 	3ð"ð "ð "ð "ð "r    rV   c                  ó~   — d„ } d„ }d„ }|t           j        _        | t           j        _        |t           j        _        d S )Nc                 ó˜   — |                       ¦   «          |                      ¦   «          ddlm} |                     d|j        ¦  «         dS )Nr   rp   é   )Úclear_all_breaksÚset_continuert   r<   Ú	callLaterr„   )r   Úargr<   s      r   Údo_stopzfixPdb.<locals>.do_stopø   sU   € Ø×ÒÑÔÐØ×ÒÑÔÐØ,Ð,Ð,Ð,Ð,Ð,à×Ò˜!˜Wœ\Ñ*Ô*Ð*Øˆqr    c                 ó$   — t          d¦  «         d S )NzEstop - Continue execution, then cleanly shutdown the twisted reactor.)Úprintrƒ   s    r   Ú	help_stopzfixPdb.<locals>.help_stop   s!   € ÝØVñ	
ô 	
ð 	
ð 	
ð 	
r    c                 ó.   — t          j        d¦  «         d S )Nr   )ÚosÚ_exitrƒ   s    r   Úset_quitzfixPdb.<locals>.set_quit  s   € Ý
Œ�‰Œˆˆˆr    )ÚpdbÚPdbr“   rŒ   r�   )rŒ   r�   r“   s      r   ÚfixPdbr–   ÷   sT   € ðð ð ð
ð 
ð 
ð
ð ð ð  …C„GÔØ…C„G„OØ!…C„GÔÐÐr    c                 óÖ  — |€ddl m} 	 | d         r|�|                     |¦  «         dS dS | d         r‘|t          _        |t          _        t          j        dk    r@t          j        t          j	        d„ ¦  «         t          j        t          j
        d„ ¦  «         t          ¦   «          t          j        |j        ¦  «         dS |                     ¦   «          dS # t          $ r‚ d	}| d
         r|}nt          dd¦  «        }d}	 t!          j        |¬¦  «         |                     ¦   «          |r|                     ¦   «          Y dS Y dS # |r|                     ¦   «          w w xY ww xY w)aN  
    Start the reactor, using profiling if specified by the configuration, and
    log any error happening in the process.

    @param config: configuration of the twistd application.
    @type config: L{ServerOptions}

    @param oldstdout: initial value of C{sys.stdout}.
    @type oldstdout: C{file}

    @param oldstderr: initial value of C{sys.stderr}.
    @type oldstderr: C{file}

    @param profiler: object used to run the reactor with profiling.
    @type profiler: L{AppProfiler}

    @param reactor: The reactor to use.  If L{None}, the global reactor will
        be used.
    Nr   rp   r0   ÚdebugÚposixc                  ó(   — t          j        ¦   «         S r   ©r”   Ú	set_trace©Úargss    r   ú<lambda>z'runReactorWithLogging.<locals>.<lambda>+  s   € ½C¼M¹O¼O€ r    c                  ó(   — t          j        ¦   «         S r   r›   r�   s    r   rŸ   z'runReactorWithLogging.<locals>.<lambda>,  s   € ½3¼=¹?¼?€ r    FÚnodaemonzTWISTD-CRASH.logr1   T©Úfile)rt   r<   r5   r7   r8   Ústderrr   ÚplatformTypeÚsignalÚSIGUSR2ÚSIGINTr–   r”   r4   ÚBaseExceptionr9   Ú	tracebackÚ	print_excÚflushr;   )ÚconfigÚ	oldstdoutÚ	oldstderrrP   r<   r;   r£   s          r   ÚrunReactorWithLoggingr°     s•  € ð( €Ø,Ð,Ð,Ð,Ð,Ð,ðØ�)Ôð 	ØÐ#Ø—’˜WÑ%Ô%Ð%Ð%Ð%ð $Ð#à�GŒ_ð 		Ø"�CŒJØ"�CŒJÝÔ# wÒ.Ð.Ý”�fœnÐ.KÐ.KÑLÔLÐLÝ”�fœmÐ-JÐ-JÑKÔKÐKÝ‰HŒHˆHÝŒK˜œÑ$Ô$Ð$Ð$Ð$à�KŠK‰MŒMˆMˆMˆMøÝð ð ð ØˆØ�*Ôð 	ØˆDˆDåÐ*¨CÑ0Ô0ˆDØˆEð	ÝÔ TÐ*Ñ*Ô*Ð*Ø�JŠJ‰LŒLˆLàð Ø—
’
‘”����ðð ð øˆuð Ø—
’
‘”��ðøøøðøøøs/   ŠC ­BC ÃC Ã)E(Ä)EÄ/E(ÅE$Å$E(c                 ó2   — | rt          j         d¦  «        S d S )NzPassphrase: )Úgetpass©Úneededs    r   ÚgetPassphraserµ   @  s   € Øð ÝŒ˜~Ñ.Ô.Ð.àˆtr    c                 ó2   — | rt          j        d¦  «        S d S )NzEncryption passphrase: )r   ÚgetPasswordr³   s    r   ÚgetSavePassphraser¸   G  s!   € Øð ÝÔÐ 9Ñ:Ô:Ð:àˆtr    c                   ó>   — e Zd ZdZeZeZd„ Zd„ Z	d„ Z
d„ Zd„ Zd„ ZdS )	ÚApplicationRunnera  
    An object which helps running an application based on a config object.

    Subclass me and implement preApplication and postApplication
    methods. postApplication generally will want to run the reactor
    after starting the application.

    @ivar config: The config object, which provides a dict-like interface.

    @ivar application: Available in postApplication, but not
       preApplication. This is the application object.

    @ivar profilerFactory: Factory for creating a profiler object, able to
        profile the application if options are set accordingly.

    @ivar profiler: Instance provided by C{profilerFactory}.

    @ivar loggerFactory: Factory for creating object responsible for logging.

    @ivar logger: Instance provided by C{loggerFactory}.
    c                 ó|   — || _         |                      |¦  «        | _        |                      |¦  «        | _        d S r   )r­   ÚprofilerFactoryrP   ÚloggerFactoryr   )r   r­   s     r   r   zApplicationRunner.__init__h  s7   € ØˆŒØ×,Ò,¨VÑ4Ô4ˆŒØ×(Ò(¨Ñ0Ô0ˆŒˆˆr    c                 óø   — |                       ¦   «          |                      ¦   «         | _        | j                             | j        ¦  «         |                      ¦   «          | j                             ¦   «          dS )z&
        Run the application.
        N)ÚpreApplicationÚcreateOrGetApplicationrk   r   rn   ÚpostApplicationr„   rƒ   s    r   r5   zApplicationRunner.runm  so   € ð 	×ÒÑÔÐØ×6Ò6Ñ8Ô8ˆÔàŒ×Ò˜$Ô*Ñ+Ô+Ð+à×ÒÑÔÐØŒ×ÒÑÔÐÐÐr    c                 ó¢   — |€ddl m} t          | j        ||| j        |¦  «         t          j        |¦  «        r|j        | _        dS d| _        dS )z®
        Run the reactor with the given configuration.  Subclasses should
        probably call this from C{postApplication}.

        @see: L{runReactorWithLogging}
        Nr   rp   )rt   r<   r°   r­   rP   r   rc   Ú_exitSignal)r   r<   r®   r¯   s       r   ÚstartReactorzApplicationRunner.startReactory  sh   € ð ˆ?Ø0Ð0Ð0Ð0Ð0Ð0Ý˜dœk¨9°iÀÄÐPWÑXÔXÐXå(Ô3°GÑ<Ô<ð 	$Ø&Ô2ˆDÔÐÐà#ˆDÔÐÐr    c                 ó   — t          ¦   «         ‚)z‹
        Override in subclass.

        This should set up any state necessary before loading and
        running the Application.
        ©ÚNotImplementedErrorrƒ   s    r   r¿   z ApplicationRunner.preApplication‰  s   € õ "Ñ#Ô#Ð#r    c                 ó   — t          ¦   «         ‚)zê
        Override in subclass.

        This will be called after the application has been loaded (so
        the C{application} attribute will be set). Generally this
        should start the application and run the reactor.
        rÆ   rƒ   s    r   rÁ   z!ApplicationRunner.postApplication’  s   € õ "Ñ#Ô#Ð#r    c                 óP  — | j         j        rj| j         j        | j         j                 }|                     | j         j        ¦  «        }t          j        |j        ¦  «        }|                     |¦  «         n/t          | j         d         ¦  «        }t          | j         |¦  «        }|S )a�  
        Create or load an Application based on the parameters found in the
        given L{ServerOptions} instance.

        If a subcommand was used, the L{service.IServiceMaker} that it
        represents will be used to construct a service to be added to
        a newly-created Application.

        Otherwise, an application will be loaded based on parameters in
        the config.
        Ú	encrypted)r­   Ú
subCommandÚloadedPluginsÚmakeServiceÚ
subOptionsr   ÚApplicationÚtapnameÚsetServiceParentrµ   ÚgetApplication)r   ÚplgÚserrk   Ú
passphrases        r   rÀ   z(ApplicationRunner.createOrGetApplicationœ  s’   € ð Œ;Ô!ð 	Bð ”+Ô+¨D¬KÔ,BÔCˆCØ—/’/ $¤+Ô"8Ñ9Ô9ˆCÝ!Ô-¨c¬kÑ:Ô:ˆKØ× Ò  Ñ-Ô-Ð-Ð-å& t¤{°;Ô'?Ñ@Ô@ˆJÝ(¨¬°jÑAÔAˆKØÐr    N)r(   r)   r*   r+   rL   r¼   rV   r½   r   r5   rÄ   r¿   rÁ   rÀ   r,   r    r   rº   rº   N  s„   € € € € € ðð ð, "€OØ€Mð1ð 1ð 1ð

ð 
ð 
ð$ð $ð $ð $ð $ð $ð$ð $ð $ðð ð ð ð r    rº   c                 ó\  ‡ — ˆ fd„dD ¦   «         d         }|d         ddi                      |d         |d         ¦  «        }}	 t          j        d|z  ¦  «         t          j        |||¦  «        }t          j        d¦  «         n§# t
          $ rš}d	|z  }t          |t          ¦  «        r|j        d         d
k    r|dz  }t          j
        t          j        ¬¦  «         t          j        |¦  «         t          j        ¦   «          t          j        d|z   dz   ¦  «         Y d }~nd }~ww xY w|S )Nc                 ó4   •— g | ]}‰|         ¯
‰|         |f‘ŒS r,   r,   )Ú.0Útr­   s     €r   ú
<listcomp>z"getApplication.<locals>.<listcomp>º  s*   ø€ ÐKÐKÐK˜AÀÈÄÐKˆ&�Œ)�QˆÐKÐKÐKr    )ÚpythonÚsourcer£   r   r£   Úpickler‡   zLoading %s...zLoaded.zFailed to load application: %srk   aN  
Could not find 'application' in the file. To use 'twistd -y', your .tac
file must create a suitable object (e.g., by calling service.Application())
and store it in a variable named 'application'. twistd loads your .tac file
and scans the global variables for one of this name.

Please read the 'Using Application' HOWTO for details.
r¢   ú
)rQ   r   Úmsgr   ÚloadApplicationÚ	ExceptionÚ
isinstanceÚKeyErrorrž   rª   r«   r   Údeferrr7   Úexit)r­   rÕ   r&   ÚfilenameÚstylerk   r%   s   `      r   rÒ   rÒ   ¹  sF  ø€ ØKÐKÐKÐKÐ!=ÐKÑKÔKÈAÔN€AØ˜”d˜V XÐ.×2Ò2°1°Q´4¸¸1¼Ñ>Ô>ˆe€Hð"ÝŒ� (Ñ*Ñ+Ô+Ð+ÝÔ-¨h¸¸zÑJÔJˆÝŒ�	ÑÔÐÐøÝð "ð "ð "Ø,¨qÑ0ˆÝ�a�Ñ"Ô"ð 	 q¤v¨a¤y°MÒ'AÐ'AØð ñ ˆAõ 	Ô¥¤Ð-Ñ-Ô-Ð-ÝŒ�‰
Œ
ˆ
ÝŒ
‰ŒˆÝŒ�˜‘˜D‘Ñ!Ô!Ð!Ð!Ð!Ð!Ð!Ð!øøøøð"øøøð Ðs   ÁAB Â
D)ÂBD$Ä$D)c                  ó`   — t          j        d„ t          j        ¦   «         D ¦   «         ¦  «        S )Nc                 ó   — g | ]	}|j         ‘Œ
S r,   )Ú	shortName)rØ   Úrs     r   rÚ   z"_reactorAction.<locals>.<listcomp>Ó  s   € ÐOÐOÐO¨q˜qœ{ÐOÐOÐOr    )r   ÚCompleteListr   ÚgetReactorTypesr,   r    r   Ú_reactorActionrî   Ò  s+   € ÝÔÐOÐOµHÔ4LÑ4NÔ4NÐOÑOÔOÑPÔPÐPr    c                   óv   — e Zd ZdZ ej        dei¬¦  «        Zej	        Z
 eej        ¦  «        Zd„ Zd„ ZeZdS )ÚReactorSelectionMixinz½
    Provides options for selecting a reactor to install.

    If a reactor is installed, the short name which was used to locate it is
    saved as the value for the C{"reactor"} key.
    r<   )Ú
optActionsc           	      ó<  — t          |                      ¦   «         t          d¦  «        ¬¦  «        }d}|D ]‰}	 t          |j        ¦  «         | j                             d|j        d›d|j        › d�¦  «         ŒD# t          $ r9}|d 
                    |j        |j        |j        d	         ¦  «        z  }Y d
}~Œ‚d
}~ww xY w|rN| j                             d¦  «         | j                             d¦  «         | j                             |¦  «         t          d	¦  «        ‚)zE
        Display a list of possibly available reactor names.
        rê   ©ÚkeyrX   z    z<4ú	rÞ   z    !{:<4}	{} ({})
r   Nz.    reactors not available on this platform:

)ÚsortedÚ_getReactorTypesr   r   Ú
moduleNameÚmessageOutputÚwriterê   Údescriptionr2   Úformatrž   r#   )r   ÚrctsÚnotWorkingReactorsrë   r%   s        r   Úopt_help_reactorsz'ReactorSelectionMixin.opt_help_reactorsã  sM  € õ �d×+Ò+Ñ-Ô-µ:¸kÑ3JÔ3JÐKÑKÔKˆØÐØð 		ð 		ˆAðÝ˜AœLÑ)Ô)Ð)ØÔ"×(Ò(Ð)S°´Ð)SÐ)SÐ)SÀ!Ä-Ð)SÐ)SÐ)SÑTÔTÐTÐTøÝð ð ð Ø"Ð&=×&DÒ&DØ”KØ”MØ”F˜1”Iñ'ô 'ñ Ð"Ð"Ð"Ð"Ð"Ð"øøøøðøøøð ð 	9ØÔ×$Ò$ TÑ*Ô*Ð*ØÔ×$Ò$ØEñô ð ð Ô×$Ò$Ð%7Ñ8Ô8Ð8Ý˜‰mŒmÐs   ¸A A9Á9
B<Â/B7Â7B<c                 óÎ   — 	 t          |¦  «         || d<   dS # t          $ r d|›d�}t          j        |¦  «        ‚t          $ r}d|›d�}t          j        |¦  «        ‚d}~ww xY w)zX
        Which reactor to use (see --help-reactors for a list of possibilities)
        r<   z'The specified reactor does not exist: 'z:'.
See the list of available reactors with --help-reactorsz9The specified reactor cannot be used, failed with error: z9.
See the list of available reactors with --help-reactorsN)r
   r	   r   Ú
UsageErrorrá   )r   rê   rß   r%   s       r   Úopt_reactorz!ReactorSelectionMixin.opt_reactorü  s­   € ð	(Ý˜9Ñ%Ô%Ð%ð  (ˆD�‰OˆOˆOøõ ð 	(ð 	(ð 	(ð 	(ð &/ Y Yð1ð õ
 Ô" 3Ñ'Ô'Ð'Ýð 	(ð 	(ð 	(ð 	(ð &' Q Qð)ð õ
 Ô" 3Ñ'Ô'Ð'øøøøð	(øøøs   ‚ ˜-A$ÁAÁA$N)r(   r)   r*   r+   r   ÚCompletionsrî   ÚcompDatar7   r8   rù   Ústaticmethodr   rí   r÷   rÿ   r  Úopt_rr,   r    r   rð   rð   Ö  ss   € € € € € ðð ð !ˆuÔ ¨Y¸Ð,GÐHÑHÔH€Hà”J€MØ#�| HÔ$<Ñ=Ô=Ððð ð ð2(ð (ð (ð8 €E€E€Er    rð   c            
       óŽ  — e Zd ZdZg d¢g d¢g d¢gZg d¢g d¢g d¢dd	d
dd                     ej        ¦  «        z  gg d¢g d¢g d¢g d¢gZ e	j
        dg e	j        d¦  «         e	j        d¦  «         e	j        d¦  «         e	j        ¦   «         dœ¬¦  «        Z eej        ¦  «        Zd„ Zd„ ZeZd„ Zdd„Zd„ Zed„ ¦   «         Zd	S )ÚServerOptionszQtwistd reads a twisted.application.service.Application out of a file and runs it.)rO   NzBsave the Stats object rather than the text output of the profiler.)Úno_saveÚozdo not save state on shutdown)rÊ   r%   z(The specified tap/aos file is encrypted.)r   ÚlNz%log to a specified file, - for stdout)r   NNz•A fully-qualified name to a log observer factory to use for the initial log observer.  Takes precedence over --logfile and --syslog (when available).)r0   r=   Nz7Run in profile mode, dumping results to specified file.rP   NrM   z!Name of the profiler to use (%s).z, )r£   Úfz
twistd.tapzread the given .tap file)rÛ   ÚyNz:read an application from within a Python file (implies -o))rÜ   r&   Nz2Read an application from a .tas file (AOT format).)ÚrundirÚdú.z-Change to a supplied directory before running)r£   rÛ   rÜ   z*.tapz
*.(tac|py)z*.tas)r£   rÛ   rÜ   r  )ÚmutuallyExclusiverñ   c                 ó”   — d| d<   d|v r|d         | _         nt          j         | _         t          j                             | ¦  «         d S )NFr˜   r8   )r8   r7   r   ÚOptionsr   )r   r1   Úkws      r   r   zServerOptions.__init__X  sF   € ØˆˆW‰Ø�rˆ>ˆ>Ø˜Xœ,ˆDŒKˆKåœ*ˆDŒKÝŒ×Ò˜tÑ$Ô$Ð$Ð$Ð$r    c                 ó^   — t          j        d¦  «         t          j        ¦   «          d| d<   dS )z€
        Run the application in the Python Debugger (implies nodaemon),
        sending SIGUSR2 will drop into debugger
        Tr˜   N)r   ÚsetDebuggingr   ÚstartDebugModerƒ   s    r   Ú	opt_debugzServerOptions.opt_debug`  s1   € õ
 	Ô˜4Ñ Ô Ð ÝÔÑ Ô Ð ØˆˆW‰ˆˆr    c                 ó®   — t          j        t          j        ¦  «         	 ddl}n# t
          $ r Y dS w xY w|                     t          j        ¦  «         dS )z‹
        Print an insanely verbose log of everything that happens.
        Useful when debugging freezes or locks in complex code.
        r   N)r7   Úsettracer   ÚspewerÚ	threadingr2   )r   r  s     r   Úopt_spewzServerOptions.opt_spewk  sh   € õ
 	Œ•T”[Ñ!Ô!Ð!ð	ØÐÐÐÐøÝð 	ð 	ð 	ØˆFˆFð	øøøà×Ò�4œ;Ñ'Ô'Ð'Ð'Ð's    % ¥
3²3c                 óx   — |€t           j        dd …         pdg}t          j                             | |¦  «         d S )Nr‡   z--help)r7   Úargvr   r  ÚparseOptionsr[   s     r   r   zServerOptions.parseOptionsw  s;   € Øˆ?Ý”h˜q˜r˜r”lÐ0 x jˆGÝŒ×"Ò" 4¨Ñ1Ô1Ð1Ð1Ð1r    c                 óô   — | j         s| d         rd| d<   | d         �[	 t          | d         ¦  «        | d<   d S # t          $ r3}t          j        d                     | d         |¦  «        ¦  «        ‚d }~ww xY wd S )NrÛ   Tr	  r   z%Logger '{}' could not be imported: {})rË   r   rá   r   r  rü   )r   r%   s     r   ÚpostOptionszServerOptions.postOptions|  sœ   € ØŒ?ð 	#˜d 8œnð 	#Ø"ˆD�‰OØ�Œ>Ð%ðÝ!)¨$¨x¬.Ñ!9Ô!9��X‘��øÝð ð ð ÝÔ&Ø;×BÒBÀ4ÈÄ>ÐSTÑUÔUñô ð øøøøðøøøð &Ð%s   ž8 ¸
A5Á.A0Á0A5c              #   óà   K  — |                       t          j        ¦  «        }i | _        t	          |t          d¦  «        ¬¦  «        D ]&}|| j        |j        <   |j        d |fd„|j        fV — Œ'd S )NrÐ   ró   c                 ó*   — |                       ¦   «         S r   )rT   )Úplugs    r   rŸ   z+ServerOptions.subCommands.<locals>.<lambda>“  s   €  $§,¢,¡.¤.€ r    )Ú_getPluginsr   ÚIServiceMakerrÌ   rö   r   rÐ   rû   )r   Úpluginsr%  s      r   ÚsubCommandszServerOptions.subCommands‡  s–   è è € à×"Ò"¥7Ô#8Ñ9Ô9ˆØˆÔÝ˜7­
°9Ñ(=Ô(=Ð>Ñ>Ô>ð 
	ð 
	ˆDØ/3ˆDÔ˜tœ|Ñ,à”Øð !Ð0Ð0Ð0ØÔ ðð ð ð ð ð
	ð 
	r    r   )r(   r)   r*   ÚlongdescÚoptFlagsÚjoinrL   rS   ÚoptParametersr   r  ÚCompleteFilesÚCompleteDirsr  r  r   Ú
getPluginsr&  r   r  Úopt_br  r   r"  Úpropertyr)  r,   r    r   r  r    sÀ  € € € € € ð	!ð ð	
ð 	
ð 	
ð
 	:Ð9Ð9ØFÐFÐFð€Hð 	HÐGÐGð	
ð 	
ð 	
ð	
ð 	
ð 	
ð ØØØ/°$·)²)¸KÔ<QÑ2RÔ2RÑRð		
ð 	@Ð?Ð?ð	
ð 	
ð 	
ð 	TÐSÐSØMÐMÐMð=€MðB !ˆuÔ Ø7Ð8à'�EÔ'¨Ñ0Ô0Ø)�eÔ)¨,Ñ7Ô7Ø)�eÔ)¨'Ñ2Ô2Ø(�eÔ(Ñ*Ô*ð	
ð 
ðñ ô €Hð �,˜vÔ0Ñ1Ô1€Kð%ð %ð %ðð ð ð €Eð
(ð 
(ð 
(ð2ð 2ð 2ð 2ð
	ð 	ð 	ð ðð ñ „Xðð ð r    r  c                 ó(  —  |¦   «         }	 |                      ¦   «           | |¦  «         d S # t          j        $ rU}d                     t          j        dd…         ¦  «        }t          |¦  «         t          |› d|› �¦  «         Y d }~d S d }~ww xY w)Nú r   r]   r"   )r   r   Úerrorr,  r7   r  rŽ   )ÚrunAppr  r­   ÚueÚcommstrs        r   r5   r5   ˜  s®   € Øˆ]‰_Œ_€FðØ×ÒÑÔÐð 	ˆˆv‰Œˆˆˆøõ Œ;ð "ð "ð "Ø—(’(�3œ8 A a Cœ=Ñ)Ô)ˆÝˆf‰ŒˆÝ�Ð Ð ˜BÐ Ð Ñ!Ô!Ð!Ð!Ð!Ð!Ð!Ð!Ð!øøøøð"øøøs   Œ- ­B¼A
BÂBc                 óø   — t          j        | ||¦  «        }t          j        |¦  «                             |¦  «         t          |¦  «        }|rd }t          j        |¦  «                             ||¬¦  «         d S )N)ræ   rÕ   )r   rà   r   ÚIPersistableÚsetStyler¸   Úsave)ÚfileinÚtypeinrÕ   ÚfileoutÚtypeoutÚencryptrk   s          r   ÚconvertStylerB  ¤  sy   € ÝÔ)¨&°&¸*ÑEÔE€KÝÔ�[Ñ!Ô!×*Ò*¨7Ñ3Ô3Ð3Ý" 7Ñ+Ô+€JØð ØˆÝÔ�[Ñ!Ô!×&Ò&°ÀJÐ&ÑOÔOÐOÐOÐOr    c                 ó   — ddl m} t          j        | ¦  «                             ¦   «          |r1t          j        | ¦  «        }|                     dd|j        d¦  «         |                     ddt          j        | ¦  «        j	        ¦  «         d S )Nr   rp   ÚafterÚshutdownÚbefore)
rt   r<   r   ÚIServiceÚstartServicer   r:  ÚaddSystemEventTriggerr<  ÚstopService)rk   r<  r<   r=   s       r   ÚstartApplicationrK  ­  s�   € Ø(Ð(Ð(Ð(Ð(Ð(åÔ�[Ñ!Ô!×.Ò.Ñ0Ô0Ð0Øð OÝÔ˜[Ñ)Ô)ˆØ×%Ò% g¨z¸1¼6À:ÑNÔNÐNØ×!Ò!Ø�*�gÔ.¨{Ñ;Ô;ÔGñô ð ð ð r    c                 ó�   — t          j         | t           j        ¦  «         t          j        t          j        ¦   «         | ¦  «         dS )a  
    Force the application to terminate with the specified signal by replacing
    the signal handler with the default and sending the signal to ourselves.

    @param sig:  Signal to use to terminate the process with C{os.kill}.
    @type sig:  C{int}
    N)r¦   ÚSIG_DFLr‘   ÚkillÚgetpid)Úsigs    r   Ú_exitWithSignalrQ  ¹  s6   € õ „M�#•v”~Ñ&Ô&Ð&Ý„G�BŒI‰KŒK˜ÑÔÐÐÐr    )NN)7r²   r‘   r”   r¦   r7   rª   re   Úoperatorr   Útwistedr   r   r   Útwisted.applicationr   r   Útwisted.application.reactorsr	   r
   rt   r   Útwisted.internet.interfacesr   Útwisted.persistedr   Útwisted.pythonr   r   r   r   r   r   Útwisted.python.reflectr   r   r   r   r.   rA   rL   rV   r–   r°   rµ   r¸   rº   rÒ   rî   rð   r  r  r5   rB  rK  rQ  r,   r    r   ú<module>rZ     sS  ðð €€€Ø 	€	€	€	Ø 
€
€
€
Ø €€€Ø 
€
€
€
Ø Ð Ð Ð Ø €€€Ø Ð Ð Ð Ð Ð à -Ð -Ð -Ð -Ð -Ð -Ð -Ð -Ð -Ð -Ø 1Ð 1Ð 1Ð 1Ð 1Ð 1Ð 1Ð 1ð GÐ FÐ FÐ FÐ FÐ FÐ FÐ FØ "Ð "Ð "Ð "Ð "Ð "Ø EÐ EÐ EÐ EÐ EÐ EØ !Ð !Ð !Ð !Ð !Ð !Ø FÐ FÐ FÐ FÐ FÐ FÐ FÐ FÐ FÐ FÐ FÐ FÐ FÐ FÐ FÐ FØ >Ð >Ð >Ð >Ð >Ð >Ð >Ð >Ð >Ð >ðð ð ð ð ñ ô ð ð<ð ð ð ð �Nñ ô ð ð6 ð  ð  ð  ð  �^ñ  ô  ð  ð6Lð Lð Lð Lð Lñ Lô Lð Lð,o"ð o"ð o"ð o"ð o"ñ o"ô o"ð o"ðd"ð "ð "ð,0ð 0ð 0ð 0ðfð ð ðð ð ðhð hð hð hð hñ hô hð hðVð ð ð2Qð Qð QðBð Bð Bð Bð Bñ Bô Bð BðJzð zð zð zð z�E”MÐ#8ñ zô zð zðz	ð 	ð 	ðPð Pð Pð	ð 	ð 	ð	ð 	ð 	ð 	ð 	r    