Decorator to register an action decorator
350979
def action_decorator(name):
    
    def decorator(cls):
        action_decorators.append((name, cls))
        return cls
    return decorator
1080081
def add(self, method_class, action, version=None):
        
        by_version = self._by_action.setdefault(action, {})
        if version in by_version:
            raise RuntimeError("A method was already registered for action"
                               " %s in version %s" % (action, version))
        by_version[version] = method_class
1143960
def get(cls, action, suffix=None):
        
        action_id = _action_id(action, suffix)
        if action_id not in cls._HANDLERS:
            if LOG_OPTS['register']:
                hookenv.log('Registering reactive handler for %s' % _short_action_id(action, suffix),
                            level=hookenv.DEBUG)
            cls._HANDLERS[action_id] = cls(action, suffix)
        return cls._HANDLERS[action_id]
32634
def register_actions(self, shortcut_manager):
        
        self.add_callback_to_shortcut_manager('save', partial(self.call_action_callback, "on_save_activate"))
        self.add_callback_to_shortcut_manager('save_as', partial(self.call_action_callback, "on_save_as_activate"))
        self.add_callback_to_shortcut_manager('save_as_copy', partial(self.call_action_callback,
                                                                      "on_save_as_copy_activate"))
        self.add_callback_to_shortcut_manager('save_state_as', partial(self.call_action_callback,
                                                                       "on_save_selected_state_as_activate"))
        self.add_callback_to_shortcut_manager('substitute_state', partial(self.call_action_callback,
                                                                          "on_substitute_selected_state_activate"))
        self.add_callback_to_shortcut_manager('substitute_library_with_template',
                                              partial(self.call_action_callback,
                                                      "on_substitute_library_with_template_activate"))
        self.add_callback_to_shortcut_manager('open', partial(self.call_action_callback, "on_open_activate"))
        self.add_callback_to_shortcut_manager('open_library_state_separately',
                                              self.on_open_library_state_separately_activate)
        self.add_callback_to_shortcut_manager('new', partial(self.call_action_callback, "on_new_activate"))
        self.add_callback_to_shortcut_manager('quit', partial(self.call_action_callback, "on_quit_activate"))

        self.add_callback_to_shortcut_manager('is_start_state', partial(self.call_action_callback,
                                                                        "on_toggle_is_start_state_active"))
        callback_function = partial(self.call_action_callback, "on_add_transitions_from_closest_sibling_state_active")
        self.add_callback_to_shortcut_manager('transition_from_closest_sibling_state', callback_function)
        callback_function = partial(self.call_action_callback, "on_add_transitions_to_closest_sibling_state_active")
        self.add_callback_to_shortcut_manager('transition_to_closest_sibling_state', callback_function)
        callback_function = partial(self.call_action_callback, "on_add_transitions_to_parent_state_active")
        self.add_callback_to_shortcut_manager('transition_to_parent_state', callback_function)
        self.add_callback_to_shortcut_manager('group', partial(self.call_action_callback, "on_group_states_activate"))
        self.add_callback_to_shortcut_manager('ungroup', partial(self.call_action_callback,
                                                                 "on_ungroup_state_activate"))

        self.add_callback_to_shortcut_manager('start', partial(self.call_action_callback, "on_start_activate"))
        self.add_callback_to_shortcut_manager('start_from_selected', partial(self.call_action_callback,
                                                                             "on_start_from_selected_state_activate"))
        self.add_callback_to_shortcut_manager('run_to_selected', partial(self.call_action_callback,
                                                                         "on_run_to_selected_state_activate"))

        self.add_callback_to_shortcut_manager('stop', partial(self.call_action_callback, "on_stop_activate"))
        self.add_callback_to_shortcut_manager('pause', partial(self.call_action_callback, "on_pause_activate"))
        self.add_callback_to_shortcut_manager('step_mode', partial(self.call_action_callback, "on_step_mode_activate"))
        self.add_callback_to_shortcut_manager('step', partial(self.call_action_callback, "on_step_into_activate"))
        self.add_callback_to_shortcut_manager('backward_step', partial(self.call_action_callback,
                                                                       "on_backward_step_activate"))

        self.add_callback_to_shortcut_manager('reload', partial(self.call_action_callback, "on_refresh_all_activate"))

        self.add_callback_to_shortcut_manager('show_data_flows', self.show_data_flows_toggled_shortcut)
        self.add_callback_to_shortcut_manager('show_data_values', self.show_data_values_toggled_shortcut)
        self.add_callback_to_shortcut_manager('data_flow_mode', self.data_flow_mode_toggled_shortcut)
        self.add_callback_to_shortcut_manager('show_aborted_preempted', self.show_aborted_preempted)

        self.add_callback_to_shortcut_manager('fullscreen', self.on_toggle_full_screen_mode)
213257
def decorate(self, func, target, *anoop, **kwnoop):
        
        if target:
            self.target = target

        def decorated(decorated_self, *args, **kwargs):
            self.handle_target(
                request=decorated_self.request,
                controller_args=args,
                controller_kwargs=kwargs
            )
            return func(decorated_self, *args, **kwargs)

        return decorated
1135319
def register(self, name):
        
        def register_func(func):
            self.store[name] = func
            return func
        return register_func
1011284
def handler_all(func=None):
	
	if not func:
		return functools.partial(handler_all)

	registrations_global.append(func)

	return func
327529
def register_function(self, name: Optional[str]=None):
        
        def wrap(function: Callable)->Any:
            nonlocal name
            if name is None:
                name = function.__name__
            self.funcs[name] = function
            return function
        return wrap
933952
def register(cls, name):
        

        def decorate(klazz):
            """ Decorator. """
            if name in cls._events:
                raise GerritError("Duplicate event: %s" % name)
            cls._events[name] = [klazz.__module__, klazz.__name__]
            klazz.name = name
            return klazz
        return decorate
749565
def action_handler_adapter(handler_cls: type, action_name: str) -> Callable:
    

    if not hasattr(handler_cls(), action_name):
        message = "{0} does'nt have attr:{1}".format(handler_cls, action_name)
        raise ValueError(message)

    def wsgiapp(environ, start_response):
        """ inner app """
        handler = handler_cls()
        return getattr(handler, action_name)(environ, start_response)
    return wsgiapp
1038769
def ensure_configured(func):
    """"""
    @functools.wraps(func)
    def wrapper(*args, **kwargs):
        if len(logging.root.handlers) == 0:
            basicConfig()
        return func(*args, **kwargs)
    return wrapper
952150
def wrap_with(wrapper_cls):
    
    def wrapper(func):
        annotate(func, 'wrapper', [{'wrapper': wrapper_cls}])
        return activate(func)
    return wrapper
224612
def register(action, max, period)
      @limits ||= {}
      @limits[action.to_sym] = { max: max, period: period }
    end
276547
def register(self, procedure=None, options=None):
        

        def decorator(func):
            if self._started:
                self.session.register(endpoint=func, procedure=procedure, options=options)
            else:

                def registerer():
                    self.session.register(endpoint=func, procedure=procedure, options=options)

                # Wait for the WAMP session to be started
                self._on_running_callbacks.append(registerer)
            return func

        return decorator
1363178
def handler(event):
    """"""
    def decorator(fn):
        def apply(cls):
            event.connect(fn, sender=cls)
            return cls

        fn.apply = apply
        return fn
    return decorator
1085557
def register(name=''):
    ""
    def reg(widget):
        """A decorator registering a widget class in the widget registry."""
        w = widget.class_traits()
        Widget.widget_types.register(w['_model_module'].default_value,
                                    w['_model_module_version'].default_value,
                                    w['_model_name'].default_value,
                                    w['_view_module'].default_value,
                                    w['_view_module_version'].default_value,
                                    w['_view_name'].default_value,
                                    widget)
        return widget
    if isinstance(name, string_types):
        import warnings
        warnings.warn("Widget registration using a string name has been deprecated. Widget registration now uses a plain `@register` decorator.", DeprecationWarning)
        return reg
    else:
        return reg(name)
122889
def register(self, name, fun, description=None):
        
        self.methods[name] = fun
        self.descriptions[name] = description