Loads schema from remote server using a HTTP URI.

@private
@param  {String} uri - HTTP URI to schema
@return {Promise}
@see https://github.com/epoberezkin/ajv#asynchronous-schema-compilation
499280
function loadSchema(uri) {
  return new Promise(function(resolve, reject) {
    request.get(uri).end(function(error, response) {
      if (error || !response.ok) {
        error = error || new Error(response.body);
        debug("error fetching remote schema:", error);
        return reject(error);
      }
      return resolve(response.body);
    });
  });
}
758348
def load_schema(schema):
    
    with repo.Repo.db:
        repo.Repo.db.executescript(schema)
489732
async function(request, modules_root, options){
        /*
            extract request details for this request
        */
        var request_details = await this.utils.promise_to_decompose_request(
            request, // a relative path, absolute path, or module name
            modules_root, // defines where to look for modules
            options.relative_path_root, // defines where the relative path should start from
            options.search_for_dependencies // modules can define to not search for dependencies on their own, overriding the user
        );

        /*
            load dependencies into cache before loading the main file
                - recursive operation
        */
        if(request_details.search_for_dependencies){
            // this is the main (and most obvious) downside to synchronous_require; waiting until all dependencies load.
            var dependency_relative_path_root = request_details.path.substring(0, request_details.path.lastIndexOf("/")) + "/";
            await this.promise_dependencies_are_loaded(request_details.dependencies, dependency_relative_path_root, request_details.search_for_dependencies); // wait untill dependencies are loaded
        }

        /*
            retreive content with loader functions
                - handles scoping and env setup of js files (retreives content based on CommonJS exports)
                - supports js, css, html, json, txt, etc
        */
        var content = await this.utils.loader_functions[request_details.type](request_details.path);

        /*
            resolve with content
        */
        return content;
    }
917615
function loadSource(url) {
        if (!TraceKit.remoteFetching) { //Only attempt request if remoteFetching is on.
            return '';
        }
        try {
            var getXHR = function() {
                try {
                    return new window.XMLHttpRequest();
                } catch (e) {
                    // explicitly bubble up the exception if not found
                    return new window.ActiveXObject('Microsoft.XMLHTTP');
                }
            };

            var request = getXHR();
            request.open('GET', url, false);
            request.send('');
            return request.responseText;
        } catch (e) {
            return '';
        }
    }
659703
private URI toURI(String endpoint) throws IllegalArgumentException {

        if (endpoint.contains("://") == false) {
            endpoint = Protocol.HTTPS + "://" + endpoint;
        }

        try {
            return new URI(endpoint);
        } catch (URISyntaxException e) {
            throw new IllegalArgumentException(e);
        }
    }
744593
private static String massageUri(String uriString) {
        if(!uriString.startsWith(SCHEMA_SPECIFIC_PREFIX)) {
            uriString = SCHEMA_SPECIFIC_PREFIX + uriString;
        }
        return uriString;
    }
326571
function parse_uri(uri = document.location)
{
	const options =
	{
		strictMode: false,
		key:
		[
			"source",   // protocol:
			"protocol",
			"authority", // //user:password@
			"userInfo", // user:password
			"user",
			"password",
			"host",
			"port",
			"relative", 
			"path",
			"directory",
			"file",
			"query",
			"anchor"
		],
		query:
		{
			name:   "parameters",
			parser: /(?:^|&)([^&=]*)=?([^&]*)/g
		},
		parser:
		{
			//            protocol  :     //      user        :password    @  host          :port      path (relative,directory,file) ? query       #anchor
			strict: /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,
			loose:  /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/
		}
	}
		
	var matches = options.parser[options.strictMode ? "strict" : "loose"].exec(uri)
	
	const result = {}

	let i = 14
	while (i--)
	{
		result[options.key[i]] = matches[i] || ""
	}

	result[options.query.name] = {}

	// options.key[12] === "query"
	result[options.key[12]].replace(options.query.parser, function ($0, $1, $2)
	{
		if ($1)
		{
			result[options.query.name][$1] = $2
		}
	})

	return result
}
374813
def load_schema(path):
    """"""
    with open(path) as json_data:
        schema = json.load(json_data)
    return schema
629653
function callUri(uri) {
  var iframe = document.createElement('iframe');
  iframe.src = uri;
  iframe.style.display = 'none';
  document.documentElement.appendChild(iframe);
  setTimeout(function () {
    return document.documentElement.removeChild(iframe);
  }, 0);
}
1349952
function getHost(uri) {
  const uriObj = url.parse(uri);
  return `${uriObj.protocol}//${uriObj.host}`;
}
968508
function asyncLoadJs(src) {
  if (!isBrowser()) {
    _logger2.default.error({
      description: 'Document does not exsist to load assets into.',
      func: 'asyncLoadJs', obj: 'dom'
    });
    throw new Error('Document object is required to load assets.');
  }
  var js = window.document.createElement('script');
  js.src = src;
  js.type = 'text/javascript';
  window.document.getElementsByTagName('head')[0].appendChild(js);
  _logger2.default.log({
    description: 'JS was loaded into document.', element: js,
    func: 'asyncLoadJs', obj: 'dom'
  });
  return new Promise(function (resolve) {
    window.setTimeout(resolve, 200);
  });
}
193551
def load_ref_schema(parent_schema,ref)
      uri = URI.parse(ref)
      if uri.relative?
        uri = parent_schema.uri.clone

        # Check for absolute path
        path = ref.split("#")[0]

        # This is a self reference and thus the schema does not need to be
        # re-loaded
        if path.nil? || path == ''
        return
        end

        if path && path[0,1] == '/'
          uri.path = Pathname.new(path).cleanpath.to_s
        else
        uri = parent_schema.uri.merge(path)
        end
        uri.fragment = ''
      end

      if Validator.schemas[uri.to_s].nil?
        schema = JSON::Schema.new(JSON::Validator.parse(open(uri.to_s.chomp('#')).read), uri, @options[:version])
        Validator.add_schema(schema)
        build_schemas(schema)
      end
    end
429639
def resolve_remote(uri, handlers):
    
    scheme = urlparse.urlsplit(uri).scheme
    if scheme in handlers:
        result = handlers[scheme](uri)
    else:
        req = urlopen(uri)
        encoding = req.info().get_content_charset() or 'utf-8'
        result = json.loads(req.read().decode(encoding),)
    return result
219540
function URI(options) {
  if (!(this instanceof URI))
    return new URI(options);

  this.address = new Address();
  this.amount = -1;
  this.label = null;
  this.message = null;
  this.request = null;

  if (options)
    this.fromOptions(options);
}
850505
function load (source, options, callback = noop) {
      if (typeof options === 'function') callback = options, options = {}
      options = assign({type: null, encoding: 'base64'}, options)

      // Callback handler
      var contents = window.webContents
      eventcb(contents, 'did-finish-load', 'did-fail-load', callback)

      // Load source as data:
      if (options.type) {
        const data = Buffer.from(source).toString(options.encoding)
        return window.loadURL(`data:${options.type};${options.encoding},${data}`, options)
      }

      // Load source as URL:
      const protocol = url.parse(source).protocol
      if (!protocol) source = 'file://' + source
      return window.loadURL(source, options)
    }
1235479
function callApi(endpoint, schema) {
  const fullUrl = (endpoint.indexOf(API_ROOT) === -1) ? API_ROOT + endpoint : endpoint;

  return fetch(fullUrl)
    .then(response =>
      response.json().then(json => ({ json, response }))
    ).then(({ json, response }) => {
      if (json.error) {
        throw new Error(json.error);
      }
      if (!response.ok) {
        throw new Error(json && json.message || response.statusText || response.status + ' http error');
      }

      const camelizedJson = camelizeKeys(json);
      const nextPageUrl = getNextPageUrl(response);

      return Object.assign({},
        normalize(camelizedJson, schema),
        { nextPageUrl }
      );
    })
    .then(
      response => ({response})
    );
}
1315873
function load(path, callback, errorCallback) {
  try {
    var xhr = new XMLHttpRequest();
    xhr.open("GET", path, true);
    xhr.onreadystatechange = function() {
      if (xhr.readyState === 4) {
        if (xhr.status === 200 || xhr.status === 304) {
          try {
            var response = JSON.parse(xhr.responseText);
            callback(response);
          } catch (e) {
            errorCallback(e);
          }
        } else {
          errorCallback(xhr);
        }
      }
    };
    xhr.setRequestHeader("Content-Type", "application/json");
    xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
    xhr.send();
  } catch (e) {
    errorCallback(e);
  }
}