Load JSON data from ``uri`` with JSON references proxied to their referent
    data.

    :param uri: URI to fetch the JSON from
    :param kwargs: This function takes any of the keyword arguments from
        :meth:`JsonRef.replace_refs`
488488
def load_uri(uri, base_uri=None, loader=None, jsonschema=False, load_on_repr=True):
    

    if loader is None:
        loader = jsonloader
    if base_uri is None:
        base_uri = uri

    return JsonRef.replace_refs(
        loader(uri),
        base_uri=base_uri,
        loader=loader,
        jsonschema=jsonschema,
        load_on_repr=load_on_repr,
    )
425182
function request(refs, opts, callback) {
  var url = fmt(format, endpoint, cache.user, cache.repo, refs);

  got.get(url, opts, function(err, res) {
    res = res ? JSON.parse(res) : {};
    if (res.ref === refs) {
      callback(null, true);
      return;
    }

    callback(null, false);
  });
}
217611
def from_json(cls, json):
        ''' 

        '''
        roots_json = json['roots']
        root_ids = roots_json['root_ids']
        references_json = roots_json['references']

        references = instantiate_references_json(references_json)
        initialize_references_json(references_json, references)

        doc = Document()
        for r in root_ids:
            doc.add_root(references[r])

        doc.title = json['title']

        return doc
468143
def load_uri(self, uri, verbose):
        

        if verbose: printDebug("----------")
        if verbose: printDebug("Reading: <%s>" % uri)
        success = False
        for f in self.rdf_format_opts:
            if verbose: printDebug(".. trying rdf serialization: <%s>" % f)
            try:
                self.rdfgraph.parse(uri, format=f)
                if verbose: printDebug("..... success!", bold=True)
                success = True
                self.sources_valid += [uri]
                break
            except:
                if verbose: printDebug("..... failed")

        if not success == True:
            self.loading_failed(self.rdf_format_opts)
            self.sources_invalid += [uri]
426247
def get(self, uri, query=None, **kwargs):
        """"""
        return self.fetch('get', uri, query, **kwargs)
516382
def fetch(self, method, uri, query=None, body=None, **kwargs):
        
        if not query: query = {}
        fetch_url = self.get_fetch_url(uri, query)

        args = [fetch_url]

        kwargs.setdefault("timeout", self.timeout)
        kwargs["headers"] = self.get_fetch_headers(method, kwargs.get("headers", {}))

        if body:
            if self.is_json(kwargs["headers"]):
                kwargs['json'] = self.get_fetch_body(body)
            else:
                kwargs['data'] = self.get_fetch_body(body)

        res = self.get_fetch_request(method, *args, **kwargs)
        #res = requests.request(method, *args, **kwargs)
        res = self.get_fetch_response(res)
        self.response = res
        return res
1297785
def reload(self):
        
        try:
            data = self._api.get(self.href, append_base=False).json()
            resource = File(api=self._api, **data)
        except Exception:
            try:
                data = self._api.get(
                    self._URL['get'].format(id=self.id)).json()
                resource = File(api=self._api, **data)
            except Exception:
                raise SbgError('Resource can not be refreshed!')

        self._data = resource._data
        self._dirty = resource._dirty
        self._old = copy.deepcopy(self._data.data)

        # If file.metadata = value was executed
        # file object will have attribute _method='PUT', which tells us
        # to force overwrite of metadata on the server. This is metadata
        # specific. Once we reload the resource we delete the attribute
        # _method from the instance.
        try:
            delattr(self, '_method')
        except AttributeError:
            pass
593566
def _load(self):
        
        try:
            get = requests.get(self._ref,
                               verify=self.http_verify,
                               auth=self.auth,
                               timeout=self.timeout)
        except requests.exceptions.RequestException as err:
            raise NotFoundError(err)
        return get.content
823126
def get_uri(self, uri, reference):
        
        if uri == "":
            return self.canonicalization(
                constants.TransformInclC14N, reference.getroottree()
            )
        if uri.startswith("#"):
            query = "//*[@*[local-name() = '{}' ]=$uri]"
            node = reference.getroottree()
            results = self.check_uri_attr(node, query, uri, constants.ID_ATTR)
            if len(results) == 0:
                results = self.check_uri_attr(node, query, uri, 'ID')
            if len(results) == 0:
                results = self.check_uri_attr(node, query, uri, 'Id')
            if len(results) == 0:
                results = self.check_uri_attr(node, query, uri, 'id')
            if len(results) > 1:
                raise Exception(
                    "Ambiguous reference URI {} resolved to {} nodes".format(
                        uri, len(results)))
            elif len(results) == 1:
                return self.canonicalization(
                    constants.TransformInclC14N, results[0]
                )
        raise Exception('URI "' + uri + '" cannot be readed')
668396
private static URI asSystemInputRef( JsonValue json)
    {
    try
      {
      URI uri = null;
      if( json != null && json.getValueType() == STRING)
        {
        uri = new URI( ((JsonString) json).getChars().toString());
        }

      return uri;
      }
    catch( Exception e)
      {
      throw new ProjectException( "Error reading input definition", e);
      }
    }
40228
def jsonp(data, **json_kwargs):
    
    from uliweb import request
    
    if 'jsonp' in json_kwargs:
        cb = json_kwargs.pop('jsonp')
    else:
        cb = 'callback'
        
    begin = str(request.GET.get(cb))
    if not begin:
        raise BadRequest("Can't found %s parameter in request's query_string" % cb)
    if not r_callback.match(begin):
        raise BadRequest("The callback name is not right, it can be alphabetic, number and underscore only")
    
    if callable(data):
        @wraps(data)
        def f(*arg, **kwargs):
            ret = data(*arg, **kwargs)
            return Response(begin + '(' + json_dumps(ret) + ');', **json_kwargs)
        return f
    else:
        return Response(begin + '(' + json_dumps(data) + ');', **json_kwargs)
832743
def load(path, **kw):
    
    _kw = {}
    if PY3:  # pragma: no cover
        _kw['encoding'] = 'utf-8'
    with open(str(path), **_kw) as fp:
        return json.load(fp, **kw)
373976
def url(self, version=None, **kwargs):
        """"""
        for url in self.urls(version):
            if [key for key in kwargs.keys() if not '{' + key + '}' in url]:
                continue

            return url.format(**kwargs)

        raise KeyError('URL that takes all provided parameters not found')
159455
def load_all(self, target_uris, **kwargs):
        '''
        
        '''
        yaml_series = self._load_first(
            target_uris, yamlsettings.yamldict.load_all, **kwargs
        )
        yaml_dicts = []
        for yaml_dict in yaml_series:
            yaml_dicts.append(yaml_dict)
        # return YAMLDict objects
        return yaml_dicts
918545
def _get(self, *args, **kwargs):
        """"""
        prev_data = kwargs.pop('prev_data', [])
        resp = self._request('get', *args, **kwargs)
        resp_content = resp._content
        if not resp_content:
            # No content so its obviously not paginated
            return resp

        # if resp._content is a bytes object, decode it so we can loads it as json
        if isinstance(resp_content, bytes):
            resp_content = resp_content.decode('utf-8')

        # Load the json so we can use the data as python objects
        content = json.loads(resp_content)
        if 'pagination' not in content:
            # Result is not paginated
            return resp

        page_info = content['pagination']
        if not page_info['next_uri']:
            # next_uri is None when the cursor has been iterated to the last element
            content['data'].extend(prev_data)
            # If resp._content was is a bytes object, only set it as a bytes object
            if isinstance(resp_content, bytes):
                resp._content = json.dumps(content).decode('utf-8')
            else:
                resp._content = json.dumps(content)
            return resp

        prev_data.extend(content['data'])
        next_page_id = page_info['next_uri'].split('=')[-1]
        kwargs.update({
            'prev_data': prev_data,
            'params': {'starting_after': next_page_id}
        })
        return self._get(*args, **kwargs)
694679
def put(self, uri, data, **kwargs):
        
        return self.request("PUT", uri, data=data, **kwargs)
825433
def _http_call(self, url, method, data=None, **kwargs):
        
        response = self._http_response(url, method, data=data, **kwargs)
        if not response.content:
            return {}

        return response.json()