Function to be passed into json.loads obj_hook parameter
    Recreates the dashboard object from a json representation.
14516
def decode_dashboards(o):
    
    import superset.models.core as models
    from superset.connectors.sqla.models import (
        SqlaTable, SqlMetric, TableColumn,
    )

    if '__Dashboard__' in o:
        d = models.Dashboard()
        d.__dict__.update(o['__Dashboard__'])
        return d
    elif '__Slice__' in o:
        d = models.Slice()
        d.__dict__.update(o['__Slice__'])
        return d
    elif '__TableColumn__' in o:
        d = TableColumn()
        d.__dict__.update(o['__TableColumn__'])
        return d
    elif '__SqlaTable__' in o:
        d = SqlaTable()
        d.__dict__.update(o['__SqlaTable__'])
        return d
    elif '__SqlMetric__' in o:
        d = SqlMetric()
        d.__dict__.update(o['__SqlMetric__'])
        return d
    elif '__datetime__' in o:
        return datetime.strptime(o['__datetime__'], '%Y-%m-%dT%H:%M:%S')
    else:
        return o
429280
function (callback) {
    var data = JSON.stringify(this);
    this.cloneWithoutData(function(clone) {
      clone.loadFromJSON(data, function() {
        callback && callback(clone);
      });
    });
  }
13267
function(url, paramsObj) {
    if(!paramsObj || typeof paramsObj !== "object") {
        return url;
    }
    
    _.each(_.keys(paramsObj), function(paramName) {
        var string = paramsObj[paramName];
        if (typeof string === 'object') {
            string = JSON.stringify(string);
        }
        url = addParam(url, encodeURIComponent(paramName), encodeURIComponent(string));
    });
    
    return url;
}
652703
def serialize(obj, **options):
    '''
    
    '''

    try:
        if 'fp' in options:
            return salt.utils.json.dump(obj, _json_module=_json, **options)
        else:
            return salt.utils.json.dumps(obj, _json_module=_json, **options)
    except Exception as error:
        raise SerializationError(error)
897781
def from_json(cls, path, fatal=True, logger=None):
        
        result = cls()
        result.load(path, fatal=fatal, logger=logger)
        return result
478925
def json_decoder_hook(dct, str_decoders=STRING_DECODERS,
                      converters=MappingProxyType(dict())) -> dict:
    """"""

    for k, v in dct.items():
        if k in converters:
            parse_func = converters[k]
            dct[k] = parse_func(v)

        elif isinstance(v, str):
            for decode_func in str_decoders:
                v = decode_func(v)

                if not isinstance(v, str):
                    break

            dct[k] = v
        elif isinstance(v, collections.Mapping):
            dct[k] = json_decoder_hook(v, str_decoders, converters)

    return dct
1022587
def loads(s, encoding=None, cls=JSONTreeDecoder, object_hook=None,
         parse_float=None, parse_int=None, parse_constant=None,
         object_pairs_hook=None, **kargs):
    
    return json.loads(s, encoding, cls, object_hook,
         parse_float, parse_int, parse_constant,
         object_pairs_hook, **kargs)
989723
def update
      return render json: { errors: { message: 'Dashboard not found' } }, status: :not_found unless dashboard

      # Abort on failure
      unless dashboard.update(dashboard_params)
        return render json: { errors: dashboard.errors }, status: :bad_request
      end

      MnoEnterprise::EventLogger.info('dashboard_update', current_user.id, 'Dashboard Update', dashboard)
      render :show
    end
1348388
def create
      return render json: { errors: { message: 'Dashboard template not found' } }, status: :not_found unless template.present?

      @kpi = template.kpis.create(kpi_create_params)
      return render json: { errors: (@kpi && @kpi.errors).to_a }, status: :bad_request unless @kpi.present? && @kpi.valid?

      MnoEnterprise::EventLogger.info('kpi_create', current_user.id, 'Template KPI Creation', @kpi)
      @no_content = true
      render 'show'
    end
146676
def post_loader(*decorator_args, serializer):
    
    def wrapped(fn):
        @wraps(fn)
        def decorated(*args, **kwargs):
            return fn(*serializer.load(request.get_json()))
        return decorated

    if decorator_args and callable(decorator_args[0]):
        return wrapped(decorator_args[0])
    return wrapped
1137418
def json(self, *,  # type: ignore
             loads: Callable[[Any], Any]=json.loads) -> None:
        
        return loads(self.data)
1269506
def load_data(self, table_name, obj, **kwargs):
        
        # kwargs is a catch all for any options required by other backends.
        self.dictionary[table_name] = pd.DataFrame(obj)
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
216609
def loads(cls, s, **kwargs):
    """"""
    json_obj = json.loads(s, **kwargs)
    return parse(cls, json_obj)
1010112
def parameter_from_json(dictionary, bundle=None):
    
    if isinstance(dictionary, str):
        dictionary = json.loads(dictionary, object_pairs_hook=parse_json)

    classname = dictionary.pop('Class')

    if classname not in _parameter_class_that_require_bundle:
        bundle = None

    # now let's do some dirty magic and get the actual classitself
    # from THIS module.  __name__ is a string to lookup this module
    # from the sys.modules dictionary
    cls = getattr(sys.modules[__name__], classname)

    return cls._from_json(bundle, **dictionary)
490225
def update_object(objref, data, **api_opts):
    '''
    
    '''
    if '__opts__' in globals() and __opts__['test']:
        return {'Test': 'Would attempt to update object: {0}'.format(objref)}
    infoblox = _get_infoblox(**api_opts)
    return infoblox.update_object(objref, data)
1176117
def webhook_to_object(self, webhook):
        
        if isinstance(webhook, string_type):
            # If still JSON, convert to a Python dict
            webhook = json.dumps(webhook)

        # if a flask.Request object, try to convert that to a webhook
        if not isinstance(webhook, dict):
            webhook = get_webhook_from_request(webhook)

        try:
            webhook['api_url']
        except KeyError:
            raise InvalidWebhook

        payload = self.get(webhook['api_url'])

        return payload