Returns a list of resources contained in the given resource
512129
public String[] list()
    {
        String[] list =_file.list();
        if (list==null)
            return null;
        for (int i=list.length;i-->0;)
        {
            if (new File(_file,list[i]).isDirectory() &&
                !list[i].endsWith("/"))
                list[i]+="/";
        }
        return list;
    }
552292
def split_resource_path(resource):
    
    pieces = []
    for piece in resource.split('/'):
        if path.sep in piece \
           or (path.altsep and path.altsep in piece) or \
           piece == path.pardir:
            raise ResourceNotFound(resource)
        elif piece and piece != '.':
            pieces.append(piece)
    return pieces
942278
def list_resources(self, session, query='?*::INSTR'):
        

        # For each session type, ask for the list of connected resources and
        # merge them into a single list.

        resources = sum([st.list_resources()
                         for key, st in sessions.Session.iter_valid_session_classes()], [])

        resources = rname.filter(resources, query)

        return resources
355739
def _extract_resources(elem):
        
        resources = collections.defaultdict(list)
        for child in itertools.islice(elem.iter(), 1, None):
            try:
                basename = child.tag.split('}', 1)[-1]
                if child.text is not None:
                    child.text = child.text.strip()
                if child.text:
                    resources[basename].append(child.text)
                elif child.get(RDF_RESOURCE) is not None:
                    resources[basename].append(child.get(RDF_RESOURCE))
            except AttributeError:
                pass
        return dict(resources)
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
        })
427397
def get_resources(cls):
        """"""
        exts = []
        parent = dict(member_name="agent",
                      collection_name="agents")
        controller = resource.Resource(HostingDeviceSchedulerController(),
                                       cb_faults.FAULT_MAP)
        exts.append(extensions.ResourceExtension(CFG_AGENT_HOSTING_DEVICES,
                                                 controller, parent))
        parent = dict(member_name=ciscohostingdevicemanager.DEVICE,
                      collection_name=ciscohostingdevicemanager.DEVICES)
        controller = resource.Resource(
            CfgAgentsHandlingHostingDeviceController(), cb_faults.FAULT_MAP)
        exts.append(extensions.ResourceExtension(HOSTING_DEVICE_CFG_AGENTS,
                                                 controller, parent,
                                                 PATH_PREFIX))
        return exts
1254860
public static List<String> getResourceLines(String resourceName) throws IOException {
        InputStreamReader isreader = null;
        BufferedReader reader = null;
        try {
            isreader = new InputStreamReader(Util.class.getResourceAsStream(resourceName));
            reader = new BufferedReader(isreader);
            List<String> lines = new ArrayList<String>();
            String tmp;
            while ((tmp = reader.readLine()) != null) {
                lines.add(tmp);
            }
            return lines;
        } finally {
            closeQuietly(reader);
            closeQuietly(isreader);
        }
    }
599760
def _get_sorted(self, resources):
        
        tmp = []
        for resource in resources:
            path = resource._path
            # Each slash counts as 10 priority, each variable takes one away
            priority = path.count('/') * 10 - path.count('{')
            tmp.append((priority, resource))
        return [resource for prio, resource in reversed(sorted(tmp))]
167125
def do_list(self, args):
        """"""

        try:
            resources = self.resource_manager.list_resources_info()
        except Exception as e:
            print(e)
        else:
            self.resources = []
            for ndx, (resource_name, value) in enumerate(resources.items()):
                if not args:
                    print('({0:2d}) {1}'.format(ndx, resource_name))
                    if value.alias:
                        print('     alias: {}'.format(value.alias))

                self.resources.append((resource_name, value.alias or None))
612932
public @NotNull List<Resource> getResources() {
    return getResources((Predicate<Resource>)null, (Resource)null);
  }
278002
def read_resource_list(self, uri):
        """"""
        self.logger.info("Reading resource list %s" % (uri))
        try:
            resource_list = ResourceList(allow_multifile=self.allow_multifile,
                                         mapper=self.mapper)
            resource_list.read(uri=uri)
        except Exception as e:
            raise ClientError("Can't read source resource list from %s (%s)" %
                              (uri, str(e)))
        self.logger.debug("Finished reading resource list")
        return(resource_list)
904922
public List getResources() {

        if ((m_resources == null) || m_resources.isEmpty()) {
            m_resources = new ArrayList();
            m_resources.add("/");
        }
        return m_resources;
    }
431847
def resources(self):
        '''  '''
        used_resources = self._used_resources()
        ret = collections.defaultdict(dict)
        for resource, total in six.iteritems(self._resources):
            ret[resource]['total'] = total
            if resource in used_resources:
                ret[resource]['used'] = used_resources[resource]
            else:
                ret[resource]['used'] = 0
        return ret
759799
def get_resources_dests(resources_root, rules):
    """"""

    def get_rel_path(base, path):
        # normalizes and returns a lstripped-/-separated path
        base = base.replace(os.path.sep, '/')
        path = path.replace(os.path.sep, '/')
        assert path.startswith(base)
        return path[len(base):].lstrip('/')


    destinations = {}
    for base, suffix, dest in rules:
        prefix = os.path.join(resources_root, base)
        for abs_base in iglob(prefix):
            abs_glob = os.path.join(abs_base, suffix)
            for abs_path in iglob(abs_glob):
                resource_file = get_rel_path(resources_root, abs_path)
                if dest is None:  # remove the entry if it was here
                    destinations.pop(resource_file, None)
                else:
                    rel_path = get_rel_path(abs_base, abs_path)
                    rel_dest = dest.replace(os.path.sep, '/').rstrip('/')
                    destinations[resource_file] = rel_dest + '/' + rel_path
    return destinations
1032690
protected List<CmsResource> getInternalResources(CmsObject cms, Map<String, String> params) throws CmsException {

        synchronized (this) {
            if (m_resources == null) {
                m_resources = getResources(cms, params);
                Iterator<CmsResource> it = m_resources.iterator();
                while (it.hasNext()) {
                    CmsResource resource = it.next();
                    m_resCache.put(resource.getStructureId().toString(), resource);
                }
            }
        }
        return m_resources;
    }
1203515
private List<String> findJadeResources(final List<ResourceRef> resources) {
        List<String> urls = new LinkedList<String>();
        for (ResourceRef ref : resources) {
            if (ref.hasModifier("dao") || ref.hasModifier("DAO")) {
                try {
                    Resource resource = ref.getResource();
                    File resourceFile = resource.getFile();
                    if (resourceFile.isFile()) {
                        urls.add("jar:file:" + resourceFile.toURI().getPath()
                                + ResourceUtils.JAR_URL_SEPARATOR);
                    } else if (resourceFile.isDirectory()) {
                        urls.add(resourceFile.toURI().toString());
                    }
                } catch (IOException e) {
                    throw new ApplicationContextException("error on resource.getFile", e);
                }
            }
        }
        if (logger.isInfoEnabled()) {
            logger.info("[jade] found " + urls.size() + " jade urls: " + urls);
        }
        return urls;
    }
1364069
def _find_resources(resource, name=None, resource_id=None, tags=None,
                    region=None, key=None, keyid=None, profile=None):
    '''
    
    '''

    if all((resource_id, name)):
        raise SaltInvocationError('Only one of name or id may be '
                                  'provided.')

    if not any((resource_id, name, tags)):
        raise SaltInvocationError('At least one of the following must be '
                                  'provided: id, name, or tags.')

    conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)

    f = 'get_all_{0}'.format(resource)
    if not f.endswith('s'):
        f = f + 's'
    get_resources = getattr(conn, f)

    filter_parameters = {}
    if name:
        filter_parameters['filters'] = {'tag:Name': name}
    if resource_id:
        filter_parameters['{0}_ids'.format(resource)] = resource_id
    if tags:
        for tag_name, tag_value in six.iteritems(tags):
            filter_parameters['filters']['tag:{0}'.format(tag_name)] = tag_value

    try:
        r = get_resources(**filter_parameters)
    except BotoServerError as e:
        if e.code.endswith('.NotFound'):
            return None
        raise
    return r