Ejemplo n.º 1
0
def _update_account(evt, user):
    """Updates account data of a user for networks which don't support certain features."""
    from src.decorators import handle_error
    if evt.params.old in _pending_account_updates:
        updates = list(_pending_account_updates[evt.params.old].items())
        del _pending_account_updates[evt.params.old]
        for command, callback in updates:
            # handle_error swallows exceptions so that a callback raising an exception
            # does not prevent other registered callbacks from running
            handle_error(callback)(user)
Ejemplo n.º 2
0
def impl(f):
    if f.__name__ not in SIGS:
        raise NameError(("Attempting to implement a proxy stub {0} that does " "not exist").format(f.__name__))
    if f.__name__ in IMPLS:
        raise SyntaxError(
            ("Attempting to implement a proxy stub {0} that " "already has an implementation").format(f.__name__)
        )
    if hasattr(inspect, "signature"):
        # Python 3.3+
        _sigmatch(f)

    # Always wrap proxy implementations in an error handler
    IMPLS[f.__name__] = handle_error(f)
    # allows this method to be called directly in our module rather
    # than forcing use of the stub's module
    return handle_error(f)
Ejemplo n.º 3
0
Archivo: proxy.py Proyecto: io4/lykos
def impl(f):
    if f.__name__ not in SIGS:
        raise NameError(("Attempting to implement a proxy stub {0} that does "
                         "not exist").format(f.__name__))
    if f.__name__ in IMPLS:
        raise SyntaxError(("Attempting to implement a proxy stub {0} that "
                           "already has an implementation").format(f.__name__))
    if hasattr(inspect, "signature"):
        # Python 3.3+
        _sigmatch(f)

    # Always wrap proxy implementations in an error handler
    IMPLS[f.__name__] = handle_error(f)
    # allows this method to be called directly in our module rather
    # than forcing use of the stub's module
    return handle_error(f)
Ejemplo n.º 4
0
def impl(f):
    if f.__name__ not in SIGS:
        raise NameError(("Attempting to implement a proxy stub {0} that does "
                         "not exist").format(f.__name__))
    if f.__name__ in IMPLS:
        raise SyntaxError(("Attempting to implement a proxy stub {0} that "
                           "already has an implementation").format(f.__name__))
    _sigmatch(f)

    # Always wrap proxy implementations in an error handler
    # proxy needs to be a top level (no dependencies) module, so can't import this
    # up top or else we get loops
    from src.decorators import handle_error
    IMPLS[f.__name__] = handle_error(f)
    # allows this method to be called directly in our module rather
    # than forcing use of the stub's module
    return handle_error(f)
Ejemplo n.º 5
0
def impl(f):
    if f.__name__ not in SIGS:
        raise NameError(("Attempting to implement a proxy stub {0} that does " "not exist").format(f.__name__))
    if f.__name__ in IMPLS:
        raise SyntaxError(
            ("Attempting to implement a proxy stub {0} that " "already has an implementation").format(f.__name__)
        )
    if hasattr(inspect, "signature"):
        # Python 3.3+
        _sigmatch(f)

    # Always wrap proxy implementations in an error handler
    # proxy needs to be a top level (no dependencies) module, so can't import this
    # up top or else we get loops
    from src.decorators import handle_error

    IMPLS[f.__name__] = handle_error(f)
    # allows this method to be called directly in our module rather
    # than forcing use of the stub's module
    return handle_error(f)