| Server IP : 61.19.30.66 / Your IP : 216.73.216.15 Web Server : Apache/2.2.22 (Ubuntu) System : Linux klw 3.11.0-15-generic #25~precise1-Ubuntu SMP Thu Jan 30 17:39:31 UTC 2014 x86_64 User : www-data ( 33) PHP Version : 5.3.10-1ubuntu3.48 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : ON | cURL : OFF | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /usr/lib/python2.7/dist-packages/landscape/ |
Upload File : |
ó
}9Rc @ s* d 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 d d l m
Z
d d l m Z d e
f d „ ƒ YZ d e
f d
„ ƒ YZ d e f d „ ƒ YZ d
e f d „ ƒ YZ d e f d „ ƒ YZ d e f d „ ƒ YZ d e f d „ ƒ YZ d e f d „ ƒ YZ d S( sB
Extend the regular Twisted reactor with event-handling features.
iÿÿÿÿN( t Failure( t ConnectError( t
deferToThread( t
format_objectt InvalidIDc B s e Z d Z RS( s= Raised when an invalid ID is used with reactor.cancel_call().( t __name__t
__module__t __doc__( ( ( s5 /usr/lib/python2.7/dist-packages/landscape/reactor.pyR s t
CallHookErrorc B s e Z d Z RS( s- Raised when hooking on a reactor incorrectly.( R R R ( ( ( s5 /usr/lib/python2.7/dist-packages/landscape/reactor.pyR s t EventIDc B s e Z d Z d „ Z RS( sß Unique identifier for an event handler.
@param event_type: Name of the event type handled by the handler.
@param pair: Binary tuple C{(handler, priority)} holding the handler
function and its priority.
c C s | | _ | | _ d S( N( t _event_typet _pair( t selft
event_typet pair( ( s5 /usr/lib/python2.7/dist-packages/landscape/reactor.pyt __init__ s ( R R R R ( ( ( s5 /usr/lib/python2.7/dist-packages/landscape/reactor.pyR s t EventHandlingReactorMixinc B s5 e Z d Z d „ Z d d „ Z d „ Z d „ Z RS( s„ Fire events identified by strings and register handlers for them.
Note that event handlers are executed synchronously when the C{fire} method
is called, so unit-tests can generally exercise events without needing to
run the real Twisted reactor (except of course if the event handlers
themselves contain asynchronous calls that need the Twisted reactor
running).
c C s t t | ƒ j ƒ i | _ d S( N( t superR R t _event_handlers( R ( ( s5 /usr/lib/python2.7/dist-packages/landscape/reactor.pyR / s i c C sN | | f } | j j | g ƒ } | j | ƒ | j d d „ ƒ t | | ƒ S( sÕ Register an event handler.
The handler will be invoked every time an event of the given type
is fired (there's no need to re-register the handler after the
event is fired).
@param event_type: The name of the event type to handle.
@param handler: The function handling the given event type.
@param priority: The priority of the given handler function.
@return: The L{EventID} of the registered handler.
t keyc S s | d S( Ni ( ( R ( ( s5 /usr/lib/python2.7/dist-packages/landscape/reactor.pyt <lambda>D s ( R t
setdefaultt appendt sortR ( R R
t handlert priorityR t handlers( ( s5 /usr/lib/python2.7/dist-packages/landscape/reactor.pyt call_on3 s
c O s÷ t j d | ƒ g } t | j j | d ƒ ƒ } x¯ | D]§ \ } } y6 t j d t | ƒ | | ƒ | j | | | Ž ƒ Wq8 t k
r¹ t j d t | ƒ | | | ƒ | j ƒ ‚ q8 t j d t | ƒ | | | ƒ q8 Xq8 Wt j d | ƒ | S( sc Fire an event of a given type.
Call all handlers registered for the given C{event_type}, in order
of priority.
@param event_type: The name of the event type to fire.
@param args: Positional arguments to pass to the registered handlers.
@param kwargs: Keyword arguments to pass to the registered handlers.
s Started firing %s.s# Calling %s for %s with priority %d.sT Keyboard interrupt while running event handler %s for event type %r with args %r %r.sA Error running event handler %s for event type %r with args %r %r.s Finished firing %s.( (
t loggingt debugt listR t getR R t KeyboardInterruptt exceptiont stop( R R
t argst kwargst resultsR R R ( ( s5 /usr/lib/python2.7/dist-packages/landscape/reactor.pyt fireH s(
c C sC t | ƒ t k r/ | j | j j | j ƒ n t d | ƒ ‚ d S( sf Unregister an event handler.
@param id: the L{EventID} of the handler to unregister.
s&