Get a json parameter and rebuild the context back to a dictionary (probably kwargs)
348887
def set_context_json(self, jsonquery):
        '''
        
        '''

        # Make sure we are getting dicts
        if type(jsonquery) != dict:
            raise IOError("set_json_context() method can be called only with dictionaries, you gave me a '{}'".format(type(jsonquery)))

        # Set we will answer json to this request
        self.json = True

        # Transfer keys
        newget = {}
        for key in ['search', 'search_filter_button', 'page', 'pages_to_bring', 'rowsperpage', 'filters', 'year', 'month', 'day', 'hour', 'minute', 'second']:
            if key in jsonquery:
                newget[key] = jsonquery[key]

        # Add transformed ordering
        json_ordering = jsonquery.get('ordering', None)
        if json_ordering:
            # Convert to list
            ordering = []
            for key in json_ordering:
                ordering.append({key: jsonquery['ordering'][key]})

            # Order the result from ordering
            # ordering = sorted(ordering, key=lambda x: abs(x.values()[0]))
            ordering = sorted(ordering, key=lambda x: abs(list(x.values())[0]))
            # Save ordering
            newget['ordering'] = []
            for orderer in ordering:
                key = list(orderer.keys())[0]
                value = orderer[key]
                if value > 0:
                    value = 'asc'
                elif value < 0:
                    value = 'desc'
                else:
                    value = None
                if value:
                    newget['ordering'].append({key: value})

        # Get listid
        newget['listid'] = jsonquery.get("listid", None)

        # Get elementid
        newget['elementid'] = jsonquery.get("elementid", None)

        # Return new get
        return newget
188956
def extract_props(self, settings):
        '''
        
        '''

        props = {}

        for param in self.call_parameters:
            if param in settings:
                props[param] = settings[param]
            else:
                props[param] = None

        return props
1086806
def context(names):
    """"""
    import json

    contexts = [_context_json(name) for name in set(names)]
    if contexts:
        click.echo(
            json.dumps(
                contexts[0] if len(contexts) == 1 else contexts,
                indent=2,
            )
        )
576604
def to_json(self, *args, **kwargs):
        
        return json.dumps(self.to_schema(), *args, **kwargs)
595789
def get_kwargs(args, exp_keys, exp_elems):
    """"""
    arg_dict = {}    # For arguments that have values
    for key, val in args.items():
        if exp_keys is not None and key in exp_keys and val:
            if isinstance(val, str):
                val = val.strip()
            arg_dict[key] = val
        elif exp_elems is not None and key in exp_elems and val:
            arg_dict[key] = True
    return arg_dict
338891
def json(self, build_context) -> str:
        """"""
        if self._json is None:
            self.compute_json(build_context)
        return self._json
111966
def load(*args, **kwargs):
    
    kwargs.update(dict(object_hook=json_numpy_obj_hook))
    return _json.load(*args, **kwargs)
1342343
def _get_context(argspec, kwargs):
    
    if argspec.keywords is not None:
        return kwargs
    return dict((arg, kwargs[arg]) for arg in argspec.args if arg in kwargs)
917156
def from_json(cls, plugin):
        

        process = None
        repair = None

        name = plugin["name"] + "Proxy"
        cls = type(name, (cls,), plugin)

        # Emulate function
        for name in ("process", "repair"):
            args = ", ".join(plugin["process"]["args"])
            func = "def {name}({args}): pass".format(name=name,
                                                     args=args)
            exec(func)

        cls.process = process
        cls.repair = repair

        cls.__orig__ = plugin

        return cls
1356807
def get_context_arguments(self):
        """"""
        cargs = {}
        for context in self.__context_stack:
            cargs.update(context.context_arguments)
        return cargs
804218
def get_context(self, name, value, attrs):
        
        context = super(NgWidgetMixin, self).get_context(name, value, attrs)
        if callable(getattr(self._field, 'update_widget_rendering_context', None)):
            self._field.update_widget_rendering_context(context)
        return context
541681
def get_context_data(self, **kwargs):
        
        context = {}
        if 'forms' not in kwargs:
            context['forms'] = self.get_forms()
        else:
            context['forms'] = kwargs['forms']
        return context
329955
def to_json(self, **kwargs: Mapping) -> str:
        
        content = {
            'Header': dict(self.Header),
            'Reads': self.Reads,
            'Settings': dict(self.Settings),
            'Data': [sample.to_json() for sample in self.samples],
            **{title: dict(getattr(self, title)) for title in self._sections},
        }
        return json.dumps(content, **kwargs)
555730
def _get_clean_parameters(kwargs):
        
        return dict((k, v) for k, v in kwargs.items() if v is not None)
1111618
def get_api_params(self):
        
        result = self.params
        if type(result) != dict:
            raise ValueError(
                '{}.params should return dictionary'.format(
                    self.__class__.__name__
                )
            )
        return result
418756
def _prepare_request_json(self, kwargs):
        """"""

        # Check for python keywords in dict
        kwargs = self._check_for_python_keywords(kwargs)

        # Check for the key 'check' in kwargs
        if 'check' in kwargs:
            od = OrderedDict()
            od['check'] = kwargs['check']
            kwargs.pop('check')
            od.update(kwargs)
            return od
        return kwargs
1232437
def to_json(value, **kwargs):
        
        serial_dict = {
            key: (
                val.serialize(**kwargs) if isinstance(val, HasProperties)
                else val
            )
            for key, val in iteritems(value)
        }
        return serial_dict