Finds a single resource by ID related to the current space.
352784
def find(self, resource_id, query=None):
        

        return self.proxy.find(resource_id, query=query)
824482
def find_by_id(cls, id):
        
        obj = cls.find_one(cls._id_spec(id))
        if not obj:
            raise NotFoundException(cls.collection, id)
        return obj
345696
def resource(self, name):
        
        for resource in self.resources():
            if resource.name.lower() == name.lower():
                return resource
        raise NotFound('Unable to find resource %s' % name)
585216
def get(self, id_or_uri):
        
        uri = self.build_uri(id_or_uri)
        logger.debug('Get resource (uri = %s, ID = %s)' %
                     (uri, str(id_or_uri)))
        return self._connection.get(uri)
1199344
def find_by_url(self, space_url, id_only=True):
        
        resp = self.transport.GET(url='/space/url?%s' % urlencode({'url': space_url}))
        if id_only:
            return resp['space_id']
        return resp
717214
public Optional<LinkedResource> getById(String id)
  {
    return Optional.fromNullable(resourcesById.get(id));
  }
1258682
def get_resource(id_or_uri, opts = {})
      data, _status_code, _headers = get_resource_with_http_info(id_or_uri, opts)
      return data
    end
297048
def _resource(self, resource_id):
        
        resource = self.__model__.query.get(resource_id)
        if not resource:
            raise NotFoundException()
        return resource
220755
@Override
    @Transactional
    public Namespace findNamespaceByPrimaryKey(BigInteger id) {
        requireNotDisposed();
        requireArgument(id != null && id.compareTo(ZERO) > 0, "ID must be a positive non-zero value.");

        Namespace result = findEntity(emf.get(), id, Namespace.class);

        _logger.debug("Query for namespace having id {} resulted in : {}", id, result);
        return result;
    }
345125
private Boolean isMainId(String id, String resource, String lastElement) {
		Boolean isMainId = false;
		if (id == null) {
			if (!utils.singularize(utils.cleanURL(lastElement)).equals(resource) && resource == null) {
				isMainId = true;
			}
		}
		return isMainId;
	}
1109325
def _find(self, id_):
        
        cur = self._connection.cursor()
        cur.execute(
            'SELECT fileNumber, offset FROM sequences WHERE id = ?', (id_,))
        row = cur.fetchone()
        if row is None:
            return None
        else:
            return self._getFilename(row[0]), row[1]
139064
def allocate_resource_id(self):
        

        self.resource_id_lock.acquire()
        try:
            i = self.last_resource_id
            while i in self.resource_ids:
                i = i + 1
                if i > self.info.resource_id_mask:
                    i = 0
                if i == self.last_resource_id:
                    raise error.ResourceIDError('out of resource ids')

            self.resource_ids[i] = None
            self.last_resource_id = i
            return self.info.resource_id_base | i
        finally:
            self.resource_id_lock.release()
792327
def find(cls, _id):
        

        if not _id:
            return None
        try:
            return next(cls.where(id=_id))
        except StopIteration:
            raise PanoptesAPIException(
                "Could not find {} with id='{}'".format(cls.__name__, _id)
            )
697188
def find(self, name, limit=None):
        """"""
        if name == self.name:
            if limit is not None:
                assert limit == 1
                self.subdirs = []
            return self
        for subdir in self.subdirs:
            res = subdir.find(name, limit)
            if res is not None:
                return res
        return None
207480
def _get_by_id(collection, id):
    '''
    
    '''
    matches = [item for item in collection if item.id == id]
    if not matches:
        raise ValueError('Could not find a matching item')
    elif len(matches) > 1:
        raise ValueError('The id matched {0} items, not 1'.format(len(matches)))
    return matches[0]
1161400
def find_one(self, cls, id):
        """"""
        one = self._find(cls, {"_id": id})
        if not one:
            return None
        return one[0]
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)