:class:`~zhmcclient.BaseResource`: The Python resource object of the
          resource these metric values apply to.

        Raises:

          :exc:`~zhmcclient.NotFound`: No resource found for this URI in the
            management scope of the HMC.
178679
def resource(self):
        
        if self._resource is not None:
            return self._resource

        resource_class = self.metric_group_definition.resource_class
        resource_uri = self.resource_uri

        if resource_class == 'cpc':
            filter_args = {'object-uri': resource_uri}
            resource = self.client.cpcs.find(**filter_args)
        elif resource_class == 'logical-partition':
            for cpc in self.client.cpcs.list():
                try:
                    filter_args = {'object-uri': resource_uri}
                    resource = cpc.lpars.find(**filter_args)
                    break
                except NotFound:
                    pass  # Try next CPC
            else:
                raise
        elif resource_class == 'partition':
            for cpc in self.client.cpcs.list():
                try:
                    filter_args = {'object-uri': resource_uri}
                    resource = cpc.partitions.find(**filter_args)
                    break
                except NotFound:
                    pass  # Try next CPC
            else:
                raise
        elif resource_class == 'adapter':
            for cpc in self.client.cpcs.list():
                try:
                    filter_args = {'object-uri': resource_uri}
                    resource = cpc.adapters.find(**filter_args)
                    break
                except NotFound:
                    pass  # Try next CPC
            else:
                raise
        elif resource_class == 'nic':
            for cpc in self.client.cpcs.list():
                found = False
                for partition in cpc.partitions.list():
                    try:
                        filter_args = {'element-uri': resource_uri}
                        resource = partition.nics.find(**filter_args)
                        found = True
                        break
                    except NotFound:
                        pass  # Try next partition / next CPC
                if found:
                    break
            else:
                raise
        else:
            raise ValueError(
                "Invalid resource class: {!r}".format(resource_class))

        self._resource = resource
        return self._resource
694706
def get_resource(self, resource_wrapper=None):
        
        rtracker = None

        if resource_wrapper is None:
            resource_wrapper = self._resource_wrapper

        if self.empty():
            self._harvest_lost_resources()

        try:
            rtracker = self._get(0)
        except PoolEmptyError:
            pass

        if rtracker is None:
            # Could not find resource, try to make one.
            try:
                rtracker = self._make_resource()
            except PoolFullError:
                pass

        if rtracker is None:
            # Could not find or make resource, so must wait for a resource
            # to be returned to the pool.
            try:
                rtracker = self._get(timeout=self._timeout)
            except PoolEmptyError:
                pass

        if rtracker is None:
            raise PoolEmptyError

        # Ensure resource is active.
        if not self.ping(rtracker.resource):
            # Lock here to prevent another thread creating a resource in the
            # index that will have this resource removed. This ensures there
            # will be space for _make_resource() to place a newly created
            # resource.
            with self._lock:
                self._remove(rtracker)
                rtracker = self._make_resource()

        # Ensure all resources leave pool with same attributes.
        # normalize_connection() is used since it calls
        # normalize_resource(), so if a user implements either one, the
        # resource will still be normalized. This will be changed in 1.0 to
        # call normalize_resource() when normalize_connection() is
        # removed.
        self.normalize_connection(rtracker.resource)

        return rtracker.wrap_resource(self, resource_wrapper)
1033809
public static Resources getBaseResources( String baseName, Locale locale, ClassLoader classLoader )
    {
        synchronized( ResourceManager.class )
        {
            Resources resources = getCachedResource( baseName + "_" + locale.hashCode() );
            if( null == resources )
            {
                resources = new Resources( baseName, locale, classLoader );
                putCachedResource( baseName + "_" + locale.hashCode(), resources );
            }
            return resources;
        }
    }
1171632
def _get_base_url(request):
    
    if request.is_secure():
        base_url = 'https://%s'
    else:
        base_url = 'http://%s'
    base_url %= request.META['HTTP_HOST']
    return base_url
714817
def _get_resource(self, relative_url, params=None):
        
        response = self._get(relative_url, params=params, raise_for_status=False)
        if response.status_code == 404:
            return None
        self._raise_for_status(response)
        return response.json()
628822
def virtual_resource(self):
        
        resource = create_collection(
            self.get_relation(
                'virtual_resources',
                UnsupportedEngineFeature),
            VirtualResource)
        resource._load_from_engine(self, 'virtualResources')
        return resource
142012
public static URL[] findResourceBases(String baseResource, ClassLoader loader)
   {
      ArrayList<URL> list = new ArrayList<URL>();
      try
      {
         Enumeration<URL> urls = loader.getResources(baseResource);
         while (urls.hasMoreElements())
         {
            URL url = urls.nextElement();
            list.add(findResourceBase(url, baseResource));
         }
      }
      catch (IOException e)
      {
         throw new RuntimeException(e);
      }
      return list.toArray(new URL[list.size()]);
   }
593822
def get(cls, api=None, **kwargs):
        
        api = api if api else cls._API
        extra = {
            'resource': cls.__name__,
            'query': {}
        }
        logger.info('Getting resources', extra=extra)
        endpoints = api.get(url=cls._URL['get']).json()
        return Endpoints(api=api, **endpoints)
744460
def get_resource(self):
        '''
        
        '''
        # Basename could be used for controlling caching
        # basename = 'viewers_%s' % settings.get_cache_string()
        node_packages = self.get_node_packages()
        # sort_keys is essential to ensure resulting string is
        # deterministic (and thus hashable)
        viewers_data_str = json.dumps(node_packages, sort_keys=True)
        viewers_data = viewers_data_str.encode('utf8')
        viewers_resource = ForeignBytesResource(
            viewers_data,
            extension=VIEWER_EXT,
            # basename=basename,
        )
        return viewers_resource
928172
public static Resources getBaseResources( String baseName, ClassLoader classLoader )
    {
        synchronized( ResourceManager.class )
        {
            Resources resources = getCachedResource( baseName );
            if( null == resources )
            {
                resources = new Resources( baseName, classLoader );
                putCachedResource( baseName, resources );
            }

            return resources;
        }
    }
527526
def base_url(klass, space_id, webhook_id, resource_id=None):
        

        return "spaces/{0}/webhooks/{1}/calls/{2}".format(
            space_id,
            webhook_id,
            resource_id if resource_id is not None else ''
        )
1079025
def resource_name(cls):
        
        if cls.__name__ == "NURESTRootObject" or cls.__name__ == "NURESTObject":
            return "Not Implemented"

        if cls.__resource_name__ is None:
            raise NotImplementedError('%s has no defined resource name. Implement resource_name property first.' % cls)

        return cls.__resource_name__
1100310
def get_resource(self):
        
        return Resource(self.rest_client.make_request(self.resource), self.rest_client)
992811
def _construct_url(self, base_api, params):
        
        params['key'] = self.api_key
        return super(OpenMapQuest, self)._construct_url(base_api, params)
100994
def resource_of_node(resources, node):
    
    for resource in resources:
        model = getattr(resource, 'model', None)
        if type(node) == model:
            return resource
    return BasePageResource
692828
public static URL getResourceUrl(String resource, Class<?> baseClass) {
		return ResourceUtil.getResource(resource, baseClass);
	}
861691
def available(self, context):
	
		
		
		try:
			if self.__available is None:
				encoded_name = urllib.parse.quote_plus(self.__name)
				status_code, msg = self.__endpoint.get(
					"/resources/custom-resource/{}".format(encoded_name)
				)
				self.__available = status_code == 200
		except:
			self.__available = False
			
		return self.__available