%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib64/python2.7/site-packages/tornado/
Upload File :
Create Path :
Current File : //usr/lib64/python2.7/site-packages/tornado/autoreload.pyc

�
��L]c@�s�dZddlmZmZmZmZddlZddlZedkr{ej	dej	j
t�kr{ej	d=q{nddlZddl
Z
ddlZddlZddlZddlZddlZddlZddlZddlmZddlmZddlmZddlmZyddlZWnek
rPdZnXejd	kZe�Z gZ!e"a#ej$�Z%dd
d�Z&d�Z'd
�Z(d�Z)d�Z*d�Z+d�Z,dZ-d�Z.edkr�e.�ndS(s�Automatically restart the server when a source file is modified.

Most applications should not access this module directly.  Instead,
pass the keyword argument ``autoreload=True`` to the
`tornado.web.Application` constructor (or ``debug=True``, which
enables this setting and several others).  This will enable autoreload
mode as well as checking for changes to templates and static
resources.  Note that restarting is a destructive operation and any
requests in progress will be aborted when the process restarts.  (If
you want to disable autoreload while using other debug-mode features,
pass both ``debug=True`` and ``autoreload=False``).

This module can also be used as a command-line wrapper around scripts
such as unit test runners.  See the `main` method for details.

The command-line wrapper and Application debug modes can be used together.
This combination is encouraged as the wrapper catches syntax errors and
other import-time failures, while debug mode catches changes once
the server has started.

This module depends on `.IOLoop`, so it will not work in WSGI applications
and Google App Engine.  It also will not work correctly when `.HTTPServer`'s
multi-process mode is used.

Reloading loses any Python interpreter command-line arguments (e.g. ``-u``)
because it re-executes Python using ``sys.executable`` and ``sys.argv``.
Additionally, modifying these variables will cause reloading to behave
incorrectly.

i(tabsolute_importtdivisiontprint_functiontwith_statementNt__main__(tioloop(tgen_log(tprocess(texec_intwin32i�cC�s�|ptjj�}|tkr%dStt|<tt�dkrQtjd�ntrvt	t
j|jdt��ni}t
jt
|�}tj||d|�}|j�dS(szBegins watching source files for changes.

    .. versionchanged:: 4.1
       The ``io_loop`` argument is deprecated.
    Nis=tornado.autoreload started more than once in the same processtall_fdstio_loop(RtIOLooptcurrentt	_io_loopstTruetlenRtwarningt
_has_execvtadd_reload_hookt	functoolstpartialtcloset_reload_on_updatetPeriodicCallbacktstart(Rt
check_timetmodify_timestcallbackt	scheduler((s8/usr/lib64/python2.7/site-packages/tornado/autoreload.pyRus
cC�s$tj�}t|�|j�dS(s�Wait for a watched file to change, then restart the process.

    Intended to be used at the end of scripts like unit test runners,
    to run the tests again after any source file changes (but see also
    the command-line interface in `main`)
    N(RRR(R((s8/usr/lib64/python2.7/site-packages/tornado/autoreload.pytwait�s
cC�stj|�dS(sTAdd a file to the watch list.

    All imported modules are watched by default.
    N(t_watched_filestadd(tfilename((s8/usr/lib64/python2.7/site-packages/tornado/autoreload.pytwatch�scC�stj|�dS(sAdd a function to be called before reloading the process.

    Note that for open file and socket handles it is generally
    preferable to set the ``FD_CLOEXEC`` flag (using `fcntl` or
    ``tornado.platform.auto.set_close_exec``) instead
    of using a reload hook to close them.
    N(t
_reload_hookstappend(tfn((s8/usr/lib64/python2.7/site-packages/tornado/autoreload.pyR�scC�s�tr
dStj�dk	r dSx�ttjj��D]t}t|t	j
�sTq6nt|dd�}|srq6n|jd�s�|jd�r�|d }nt
||�q6WxtD]}t
||�q�WdS(Nt__file__s.pycs.pyoi����(t_reload_attemptedRttask_idtNonetlisttsystmodulestvaluest
isinstancettypest
ModuleTypetgetattrtendswitht_check_fileR(Rtmoduletpath((s8/usr/lib64/python2.7/site-packages/tornado/autoreload.pyR�s

cC�ssytj|�j}Wntk
r*dSX||krE|||<dS|||krotjd|�t�ndS(Ns%s modified; restarting server(toststattst_mtimet	ExceptionRtinfot_reload(RR5tmodified((s8/usr/lib64/python2.7/site-packages/tornado/autoreload.pyR3�s

cC�sGtaxtD]
}|�q
Wttd�rFtjtjdd�ndtj}t	j
ddkr�tjjdd�j
|�r�|tjjdd�tjd<nts�tjt	jgt	j�t	jd�nky$tjt	jt	jgt	j�WnDtk
rBtjtjt	jt	jgt	j�tjd�nXdS(Nt	setitimerit.tt
PYTHONPATH(RR'R#thasattrtsignalR=tITIMER_REALR6tpathsepR+R5tenvirontgett
startswithRt
subprocesstPopent
executabletargvtexittexecvtOSErrortspawnvtP_NOWAITt_exit(R%tpath_prefix((s8/usr/lib64/python2.7/site-packages/tornado/autoreload.pyR;�s&

 $
s|Usage:
  python -m tornado.autoreload -m module.to.run [args...]
  python -m tornado.autoreload path/to/script.py [args...]
c	C�s]tj}tjt_ttj�dkratjddkrad}tjd}tjdd5n[ttj�dkr�d}tjd}tjdt_n ttdtj�tjd�y~|dkr�dd	l}|j|d
ddt	�nF|dkr9t
|��)}|at|j
�t�t��Wd	QXnWn�tk
rl}tj�tjd
|j�n�tk
r�}tj�tjddt	�x7tjtj�d�D]\}}}	}
t|�q�Wt|t�rt|j�qnXtj�tjd�|t_|dkrRtj|�}|d	k	rRt|j!��qRnt"�d	S(sCommand-line wrapper to re-run a script whenever its source changes.

    Scripts may be specified by filename or module name::

        python -m tornado.autoreload -m tornado.test.runtests
        python -m tornado.autoreload tornado/test/runtests.py

    Running a script with this wrapper is similar to calling
    `tornado.autoreload.wait` at the end of the script, but this wrapper
    can catch import-time problems like syntax errors that would otherwise
    prevent the script from reaching its call to `wait`.
    iis-mR4itscripttfileiNtrun_nameRt	alter_syssScript exited with status %ss%Script exited with uncaught exceptiontexc_infosScript exited normally(#R+RKRtprintt_USAGEtstderrRLtrunpyt
run_moduleRtopenR&Rtreadtglobalst
SystemExittloggingtbasicConfigRR:tcodeR9Rt	tracebackt
extract_tbRWR"R.tSyntaxErrorR!tpkgutilt
get_loaderR)tget_filenameR(t
original_argvtmodeR4RSR[tfteR!tlinenotnametlinetloader((s8/usr/lib64/python2.7/site-packages/tornado/autoreload.pytmainsL
	
(


)

,

	(/t__doc__t
__future__RRRRR6R+t__name__R5tdirnameR&RRaRgRdR/RHtweakrefttornadoRttornado.logRRttornado.utilRRBtImportErrorR)tplatformRtsetRR#tFalseR'tWeakKeyDictionaryRRRR"RRR3R;RYRr(((s8/usr/lib64/python2.7/site-packages/tornado/autoreload.pyt<module>-sN"

							
	0	H

Zerion Mini Shell 1.0