Helper function to get event kwargs.

    :param view_obj: Instance of View that processes the request.
    :returns dict: Containing event kwargs or None if events shouldn't
        be fired.
348587
def _get_event_kwargs(view_obj):
    
    request = view_obj.request

    view_method = getattr(view_obj, request.action)
    do_trigger = not (
        getattr(view_method, '_silent', False) or
        getattr(view_obj, '_silent', False))

    if do_trigger:
        event_kwargs = {
            'view': view_obj,
            'model': view_obj.Model,
            'fields': FieldData.from_dict(
                view_obj._json_params,
                view_obj.Model)
        }
        ctx = view_obj.context
        if hasattr(ctx, 'pk_field') or isinstance(ctx, DataProxy):
            event_kwargs['instance'] = ctx
        return event_kwargs
762884
def _watch_callback(obj_weakref, method_name, *args, **kwargs):
    
    obj = obj_weakref()
    if obj is None:
        return
    getattr(obj, method_name)(*args, **kwargs)
443591
def get_object(self, view_name, view_args, view_kwargs):
        

        # default lookup from rest_framework.relations.HyperlinkedRelatedField
        lookup_value = view_kwargs[self.lookup_url_kwarg]
        kwargs = {self.lookup_url_kwarg: lookup_value}

        # multi-level lookup
        for parent_lookup_kwarg in list(self.parent_lookup_kwargs.keys()):
            lookup_value = view_kwargs[parent_lookup_kwarg]
            kwargs.update({self.parent_lookup_kwargs[parent_lookup_kwarg]: lookup_value})

        return self.get_queryset().get(**kwargs)
658558
def populate_event_que(self, que_obj):
        
        for ip in self.obj_dict:
            drvr_obj = self.obj_dict.get(ip).get('drvr_obj')
            drvr_obj.populate_event_que(que_obj)
78635
def view_get(method_name):
    

    def view_get(_value, context, **_params):
        method = getattr(context["view"], method_name)
        return _get(method, context["key"], (), {})

    return view_get
520550
def viewvalues(obj, **kwargs):
    
    func = getattr(obj, "viewvalues", None)
    if not func:
        func = obj.values
    return func(**kwargs)
172289
def _trigger_events(view_obj, events_map, additional_kw=None):
    
    if additional_kw is None:
        additional_kw = {}

    event_kwargs = _get_event_kwargs(view_obj)
    if event_kwargs is None:
        return

    event_kwargs.update(additional_kw)
    event_cls = _get_event_cls(view_obj, events_map)
    event = event_cls(**event_kwargs)
    view_obj.request.registry.notify(event)
    return event
102971
def read_parameters(request, view_kwargs=None, capture_errors=False):  # noqa: C901
    
    if view_kwargs is None:
        view_kwargs = {}
    params = {}
    errors = {}
    for param in request.api_info.operation.parameters:
        try:
            value = param.get_value(request, view_kwargs)
            if value is NO_VALUE:
                if param.has_default:
                    params[param.name] = param.default
                elif param.required:  # Required but missing
                    errors[param.name] = MissingParameter('parameter %s is required but missing' % param.name)
                continue  # No value, or a default was added, or an error was added.
            params[param.name] = param.cast(request.api_info.api, value)
        except (NotImplementedError, ImproperlyConfigured):
            raise
        except Exception as e:
            if not capture_errors:
                raise
            errors[param.name] = e
    if errors:
        raise ErroneousParameters(errors, params)
    return params
492211
def get_form_kwargs(self):
        
        kwargs = super(ApiFormView, self).get_form_kwargs()
        kwargs['data'] = kwargs.get('initial')
        return kwargs
1343022
function(view, event_name, event_object, targets) {

		this._dispatchCallback(
			view,
			targets,
			this._callHandleEvent,
			{
				event_name: event_name,
				event_object: event_object
			},
			this._global_event_targets
		);

	}
697327
def get_object_from_list_detail_view(request, *args, **kwargs):
    
    queryset = kwargs['queryset']
    object_id = kwargs.get('object_id', None)
    slug = kwargs.get('slug', None)
    slug_field = kwargs.get('slug_field', 'slug')
    if object_id:
        obj = get_object_or_404(queryset, pk=object_id)
    elif slug and slug_field:
        obj = get_object_or_404(queryset, **{slug_field: slug})
    else:
        raise AttributeError(
                "Generic detail view must be called with either an "
                "object_id or a slug/slug_field."
            )
    return obj
1333895
def get_request_from_view_args(
        self, view: typing.Callable, args: typing.Iterable, kwargs: typing.Mapping
    ) -> Request:
        
        req = None
        for arg in args:
            if isinstance(arg, web.Request):
                req = arg
                break
            elif isinstance(arg, web.View):
                req = arg.request
                break
        assert isinstance(req, web.Request), "Request argument not found for handler"
        return req
976609
def get_serializer_class(self, view, method_func):
        
        if hasattr(method_func, 'request_serializer'):
            return getattr(method_func, 'request_serializer')

        if hasattr(view, 'serializer_class'):
            return getattr(view, 'serializer_class')

        if hasattr(view, 'get_serializer_class'):
            return getattr(view, 'get_serializer_class')()

        return None
1266287
def get_dict(self, obj, state=None, base_name='View'):
        
        return self.get_dict_for_class(class_name=obj.__class__,
                                       state=obj.state,
                                       base_name=base_name)
599402
def process_kwargs(obj, kwargs):
    '''
    
    '''
    with Modules() as m:
        kwargs = m.kwargs(obj, kwargs)
    return kwargs
610872
def process_on_event(self):
        
        if not self._queue:
            self._active = False
            return
        # Get unique event types in the queue
        events = list(OrderedDict([(event.event_name, event)
                                   for event in self._queue]).values())
        self._queue = []

        # Process event types
        for event in events:
            msg = {}
            for attr, path in self.attributes.items():
                model_obj = self.plot_handles.get(self.models[0])
                msg[attr] = self.resolve_attr_spec(path, event, model_obj)
            self.on_msg(msg)
        self.plot.document.add_timeout_callback(self.process_on_event, 50)
793708
def get_request_from_view_args(self, view, args, kwargs):
        
        if len(args) > 1 and isinstance(args[1], sanic.request.Request):
            req = args[1]
        else:
            req = args[0]
        assert isinstance(
            req, sanic.request.Request
        ), "Request argument not found for handler"
        return req