Load a resource.
515711
def get_one(self, request, **kwargs):
        """"""
        resource = request.match_info.get(self.name)
        if not resource:
            return None

        try:
            return self.collection.where(self.meta.model_pk == resource).get()
        except Exception:
            raise RESTNotFound(reason='Resource not found.')
1157077
async def load(self, request, resource=None, **kwargs):
        """"""
        schema = self.get_schema(request, resource=resource, **kwargs)
        data = await self.parse(request)
        resource, errors = schema.load(
            data, partial=resource is not None, many=isinstance(data, list))
        if errors:
            raise RESTBadRequest(reason='Bad request', json={'errors': errors})
        return resource
1271712
def load(klass, client, id, **kwargs):
        """"""
        resource = klass.RESOURCE.format(id=id)
        response = Request(client, 'get', resource, params=kwargs).perform()
        return klass(client).from_response(response.body['data'])
1080234
def loader():
    """"""
    url = request.args.get('url')  # read image URL as a request URL param
    response = requests.get(url)  # make request to static image file
    return response.content
246215
def _load(self, **kwargs):
        '''
        '''
        # Some kwargs should be popped before we do a load
        for key in self._meta_data['disallowed_load_parameters']:
            if key in kwargs:
                kwargs.pop(key)

        self._check_load_parameters(**kwargs)
        name = kwargs.pop('name', '')
        partition = kwargs.pop('partition', '')
        read_session = self._meta_data['icr_session']
        base_uri = self._meta_data['container']._meta_data['uri']

        load_uri = self._build_service_uri(base_uri, partition, name)
        response = read_session.get(load_uri, uri_as_parts=False, **kwargs)
        return self._produce_instance(response)
729989
private T loadResourceValue(final URL resource)
	{
		try (final InputStream is = resource.openStream())
		{
			cached = null; // Prevent the old value from being used

			return setCached(clazz.cast(factory.getInstance(clazz).deserialise(is)));
		}
		catch (IOException e)
		{
			throw new RuntimeException("Error loading JAXB resource " + name + " " + clazz + " from " + resource, e);
		}
	}
239984
async def load(self, request):
        """"""
        if SESSION_KEY not in request:
            session = Session(self.cfg.secret, key=self.cfg.session_cookie,
                              max_age=self.cfg.max_age, domain=self.cfg.domain)
            session.load(request.cookies)
            self.app.logger.debug('Session loaded: %s', session)
            request[SESSION_KEY] = request.session = session
        return request[SESSION_KEY]
1148481
private static ResourceCache loadResourceCache() {
        try {
            ResourceCache cache = Bootstrap.getService(ResourceCache.class);
            if (cache == null) {
                cache = new DefaultResourceCache();
            }
            return cache;
        } catch (Exception e) {
            LOG.log(Level.SEVERE, "Error loading ResourceCache instance.", e);
            return new DefaultResourceCache();
        }
    }
41572
public void loadFromResource(String resource, Candidate.CandidateType type) throws IOException {
      InputStream candidatesConfig = classloader.getResourceAsStream(resource);
      if(candidatesConfig == null) {
         throw new IOException("Resource '" + resource + "' not found");
      }
      try {
         loadFrom(candidatesConfig, type);
      }
      finally {
         candidatesConfig.close();
      }
   }
550826
@SneakyThrows
   public static void loadConfig(Resource resource) {
      if (resource == null || !resource.exists()) {
         return;
      }
      if (resource.path() != null && getInstance().loaded.contains(resource.path())) {
         return; //Only load once!
      }
      new ConfigParser(resource).parse();
      if (resource.path() != null) {
         getInstance().loaded.add(resource.path());
      }
   }
677939
public static void load() {
        if (!isLoaded()) {
            ScriptInjector.fromString(LocalForageResources.INSTANCE.js().getText()).setWindow(ScriptInjector.TOP_WINDOW).inject();
        }
    }
240318
def load(cls, path):
        """"""
        with open(path) as f:
            context = cls.read_from_buffer(f, path)
        context.set_load_path(path)
        return context
768784
private function loadResourceMetadata()
    {
        foreach (get_declared_classes() as $className) {
            if (
                !isset($this->resources[$className]) &&
                is_subclass_of($className, 'Tonic\Resource')
            ) {
                $rm = new ResourceMetadata($className);
                if ($rm->getUri()) {
                    $this->resources[$className] = $rm;
                }
            }
        }
    }
666905
public static void load() {
        if (!isLoaded()) {
//            ScriptInjector.fromString(OpenLayersV3Resources.INSTANCE.proj4js().getText()).setWindow(ScriptInjector.TOP_WINDOW).inject();
//            ScriptInjector.fromString(OpenLayersV3Resources.INSTANCE.supercluster().getText()).setWindow(ScriptInjector.TOP_WINDOW).inject();
            ScriptInjector.fromString(OpenLayersV3Resources.INSTANCE.js().getText()).setWindow(ScriptInjector.TOP_WINDOW).inject();
            StyleInjector.injectStylesheetAtStart(OpenLayersV3Resources.INSTANCE.css().getText());
        }
    }
1207706
def resource(resource_id):
    """"""
    resource_obj = app.db.resource(resource_id)

    if 'raw' in request.args:
        return send_from_directory(os.path.dirname(resource_obj.path),
                                   os.path.basename(resource_obj.path))

    return render_template('resource.html', resource=resource_obj)
407544
def load(self):
        """"""
        if self.is_file_persisted:
            self.object_file.open()
            temp = dill.loads(self.object_file.read())
            self.set_object(temp)
            self.object_file.close()
1192096
def _load_contents(self, polib, resource):
        
        import struct
        try:
            return polib.mofile(resource)
        except (ValueError, AttributeError, struct.error) as e:
            self.rethrow(
                "Invalid resource {0}".format(resource),
                InvalidResourceException)