Check if specific_resources parameter is valid.

        :param list includes: sub resources to check
        :param str resource: resource type to check sub resources.
         Must be one of: metadata | keyword.
351910
def _check_filter_includes(self, includes: list, resource: str = "metadata"):
        
        # check resource parameter
        if resource == "metadata":
            ref_subresources = _SUBRESOURCES_MD
        elif resource == "keyword":
            ref_subresources = _SUBRESOURCES_KW
        else:
            raise ValueError("Must be one of: metadata | keyword.")

        # sub resources manager
        if isinstance(includes, str) and includes.lower() == "all":
            includes = ",".join(ref_subresources)
        elif isinstance(includes, list):
            if len(includes) > 0:
                includes = ",".join(includes)
            else:
                includes = ""
        else:
            raise TypeError("'includes' expect a list or a str='all'")
        return includes
1298610
@SuppressWarnings("static-method")
	protected boolean isValidResource(IResource resource) {
		return resource.isAccessible() && !resource.isHidden() && !resource.isPhantom() && !resource.isDerived();
	}
973001
def etag_matches?(list, new_resource = request.post?)
      return !new_resource if list == '*'
      list.to_s.split(/\s*,\s*/).include? response['ETag']
    end
560762
public boolean checkResource(RequiredOrientResource resource, Action action)
	{
		if(!resource.action().equals(action.getName())) return true;
		OSecurityUser user = OrientDbWebSession.get().getEffectiveUser();
		if(user==null) return false;
		int iOperation = OrientPermission.combinedPermission(resource.permissions());
		ORule.ResourceGeneric value = OSecurityHelper.getResourceGeneric(resource.value());
		String specific = resource.specific();
		if(Strings.isEmpty(specific)) specific = null;
		if(user.checkIfAllowed(value, specific, iOperation)!=null) return true;
		while(!Strings.isEmpty(specific=Strings.beforeLastPathComponent(specific, '.')))
		{
			if(user.checkIfAllowed(value, specific+"."+ODatabaseSecurityResources.ALL, iOperation)!=null) return true;
		}
		return false;
	}
326454
def add(self, resource):
        
        if isinstance(resource, collections.Iterable):
            for r in resource:
                self.resources.append(r)
        else:
            self.resources.append(resource)
567314
def check_type_of_param_list_elements(param_list):
    
    try:
        assert isinstance(param_list[0], np.ndarray)
        assert all([(x is None or isinstance(x, np.ndarray))
                    for x in param_list])
    except AssertionError:
        msg = "param_list[0] must be a numpy array."
        msg_2 = "All other elements must be numpy arrays or None."
        total_msg = msg + "\n" + msg_2
        raise TypeError(total_msg)

    return None
532486
def check_valid(self):
		
		for k,input in self.inputs.items():
			if k in self.valid_opts:
				for param in self.valid_opts[k]:
					if param is None or input is None:
						return True
					elif type(param) is str and '+' in param:
						if re.search(r'^'+param,str(input)):
							return True
					elif type(param) is bool and type(input) is bool:
						return True
					elif type(param) is list and type(input) is list:
						return True
					else:
						if str(input).lower() == str(param):
							return True
				raise ValueError("Invalid input for '%s' parameter. Options are: %s" % (k,' '.join(["'%s'," % str(o) for o in self.valid_opts[k]]) ))
			else:
				raise ValueError("Invalid parameter for '%s'. Params are: %s" % (self.__class__.__name__,', '.join(["'%s'" % p for p in self.valid_opts.keys()]) ))
672625
def resource_listing(cls, request) -> [(200, 'Ok', ResourceListingModel)]:
        ''''''
        apis = [api.get_swagger_fragment() for api in Api if not api.private]
        Respond(200, {
            'apiVersion': cls.api.version,
            'swaggerVersion': cls.api.swagger_version,
            'apis': apis
        })
118237
def do_list(self, resource):
        
        if resource == 'plugins':
            self.__list_plugins()
        elif resource == 'volumes':
            self.__list_volumes()
        else:
            self.logger.error("Unknown resource: '{}', type 'help list' "
                              "to get more information".format(resource))
1127153
def is_empty(self, resource):
        
        args = self._es_args(resource)
        res = self.elastic(resource).count(body={'query': {'match_all': {}}}, **args)
        return res.get('count', 0) == 0
929591
def resource_name(self, resource):
        
        if not(resource in self.contents['files']):
            raise ValueError("No such resource %r in refpkg" % (resource,))
        return self.contents['files'][resource]
580766
def check_resources(self, number):
    ''''''
    if not current_app.config.get('LINKCHECKING_ENABLED'):
        log.error('Link checking is disabled.')
        return

    base_pipeline = [
        {'$match': {'resources': {'$gt': []}}},
        {'$project': {'resources._id': True,
                      'resources.extras.check:date': True}},
        {'$unwind': '$resources'},
    ]
    # unchecked resources
    pipeline = base_pipeline + [
        {'$match': {'resources.extras.check:date': {'$eq': None}}},
        {'$limit': number}
    ]
    resources = list(Dataset.objects.aggregate(*pipeline))
    # not recently checked resources
    slots_left = number - len(resources)
    if slots_left:
        pipeline = base_pipeline + [
            {'$match': {'resources.extras.check:date': {'$ne': None}}},
            {'$sort': {'resources.extras.check:date': 1}},
            {'$limit': slots_left}
        ]
        resources += list(Dataset.objects.aggregate(*pipeline))

    nb_resources = len(resources)
    log.info('Checking %s resources...', nb_resources)
    for idx, dataset_resource in enumerate(resources):
        dataset_obj = Dataset.objects.get(id=dataset_resource['_id'])
        resource_id = dataset_resource['resources']['_id']
        rid = uuid.UUID(resource_id)
        resource_obj = get_by(dataset_obj.resources, 'id', rid)
        log.info('Checking resource %s (%s/%s)',
                 resource_id, idx + 1, nb_resources)
        if resource_obj.need_check():
            check_resource(resource_obj)
        else:
            log.info("--> Skipping this resource, cache is fresh enough.")
    log.info('Done.')
1161889
private static void checkResource(final List<String> resources, final Pattern searchPattern, final String resourceName) {
        if (searchPattern.matcher(resourceName).matches()) {
            resources.add(resourceName);
        }
    }
267762
Boolean isResource(String resource) {
		Boolean isResource = false;
		if (!utils.isIdentifier(resource)) {
			try {
				String clazz = getControllerClass(resource);
				if (clazz != null) {
					Class.forName(clazz);
					isResource = true;
				}
			} catch (ClassNotFoundException e) {
				// It isn't a resource because there isn't a controller for it
			}
		}
		return isResource;
	}
266585
def _is_valid_index(self, index):
        
        if isinstance(index, int):
            return (index >= 0) and (index < len(self))
        if isinstance(index, list):
            valid = True
            for i in index:
                valid = valid or self._is_valid_index(i)
            return valid
        return False
677365
def _get_next_resource(self, resource, next_resource_name, selectors):
        
        # don't fetch twice
        if 'id_perms' not in resource:
            resource.fetch()

        res = None
        for res_list in (getattr(resource.refs, next_resource_name),
                         getattr(resource.back_refs, next_resource_name),
                         getattr(resource.children, next_resource_name)):
            res = self._select_next_resource(res_list, selectors)
            if res is not None:
                break

        if res is None:
            raise CommandError("Resource '%s' is not linked to resource type '%s'" %
                               (self.current_path(resource), next_resource_name))

        return (res.type, res)
233711
protected void setResourcesParam(List<String> resources) {

        m_collectorParameter += I_CmsListResourceCollector.SEP_PARAM
            + I_CmsListResourceCollector.PARAM_RESOURCES
            + I_CmsListResourceCollector.SEP_KEYVAL;
        if (resources == null) {
            // search anywhere
            m_collectorParameter += "/";
        } else {
            m_collectorParameter += CmsStringUtil.collectionAsString(resources, "#");
        }
    }