Load the resources and return an Enumeration

Note: Since they're Enumerations, do not cache these results!
969821
@Override
   @SuppressWarnings("unchecked")
   protected Enumeration<URL> findResources(String name) {
      final List<Enumeration<URL>> enumerations = new ArrayList<>();

      for (WeakReference<Bundle> ref : bundles) {
         final Bundle bundle = ref.get();
         if (bundle != null && bundle.getState() == Bundle.ACTIVE) {
            try {
               final Enumeration<URL> resources = bundle.getResources(name);
               if (resources != null) {
                  enumerations.add(resources);
               }
            } catch (Exception ignore) {
            }
         }
      }

      return new Enumeration<URL>() {

         @Override
         public boolean hasMoreElements() {
            for (Enumeration<URL> enumeration : enumerations) {
               if (enumeration != null && enumeration.hasMoreElements()) {
                  return true;
               }
            }
            return false;
         }

         @Override
         public URL nextElement() {
            for (Enumeration<URL> enumeration : enumerations) {
               if (enumeration != null && enumeration.hasMoreElements()) {
                  return enumeration.nextElement();
               }
            }
            throw new NoSuchElementException();
         }
      };
   }
139532
def load_wildcard(as = nil)
      seg = nesting_segments[enclosing_resources.size] or ResourcesController.raise_resource_mismatch(self)

      segment = seg[:segment]
      singleton = seg[:singleton]

      if resource_specification_map[segment]
        spec = resource_specification_map[segment]
        spec = spec.dup.tap {|s| s.as = as} if as
      else
        spec = Specification.new(singleton ? segment : segment.singularize, :singleton => singleton, :as => as)
      end
      load_enclosing_resource_from_specification(spec)
    end
318014
public Enumeration<URL> getResources(String name) throws IOException {
		if (name.length() == 0) return null;
		if (name.charAt(0) == '/') name = name.substring(1);
		CompoundCollection<URL> list = new CompoundCollection<>();
    	for (int i = 0; i < libs.size(); i++) {
    		AbstractClassLoader cl = libs.get(i);
    		Iterable<URL> urls = cl.getResourcesURL(name);
   			if (urls != null) list.add(urls);
    	}
    	list.add(AppClassLoader.class.getClassLoader().getResources(name));
        return list.enumeration();
	}
1218226
public static Enumeration<URL> getResources(String resource) {
        Enumeration<URL> urls = null;
        try {
            urls = ClassUtils.getContextClassLoader().getResources(resource);
        } catch (IOException e) {
            //noop
        }
        if (urls == null) {
            try {
                urls = IOUtils.class.getClassLoader().getResources(resource);
            } catch (IOException e) {
                //noop
            }
        }

        if (urls == null) {
            URL url = IOUtils.class.getResource(resource);
            if (url != null) {
                final Iterator<URL> it = Lists.newArrayList(url).iterator();
                urls = new Enumeration<URL>() {
                    public boolean hasMoreElements() {
                        return it.hasNext();
                    }

                    public URL nextElement() {
                        return it.next();
                    }
                };
            }
        }

        if (urls == null) {
            File file = new File(resource);
            if (file.isFile()) {
                try {
                    final Iterator<URL> it = Lists.newArrayList(file.toURI().toURL()).iterator();
                    urls = new Enumeration<URL>() {
                        public boolean hasMoreElements() {
                            return it.hasNext();
                        }

                        public URL nextElement() {
                            return it.next();
                        }
                    };
                } catch (MalformedURLException e) {
                    //no op
                }
            }
        }

        return urls == null ? new Enumeration<URL>() {
            public boolean hasMoreElements() {
                return false;
            }

            public URL nextElement() {
                return null;
            }
        } : urls;
    }
1009843
def _load_raw_data(self, resource_name):
        
        # Instantiating the resource again as a simple `Resource` ensures that
        # ``data`` will be returned as bytes.
        upcast_resource = datapackage.Resource(
            self.__resources[resource_name].descriptor,
            default_base_path=self.__base_path)
        return upcast_resource.data
413128
def get_resources(self):
        
        json_resources = self.rest_client.make_request(self.resource_url)['resources']
        return [RestResource(resource, self.rest_client) for resource in json_resources]
340126
def _load_enums(root):
    """"""
    out = collections.OrderedDict()
    for elem in root.findall('enums/enum'):
        name = elem.attrib['name']
        value = elem.attrib['value']
        comment = elem.get('comment')
        out[name] = Enum(name, value, comment)
    return out
274189
def get_resources(resources):  # pylint:disable=too-many-branches
    
    limits = {}
    requests = {}
    if resources is None:
        return None
    if resources.cpu:
        if resources.cpu.limits:
            limits['cpu'] = resources.cpu.limits
        if resources.cpu.requests:
            requests['cpu'] = resources.cpu.requests

    if resources.memory:
        if resources.memory.limits:
            limits['memory'] = '{}Mi'.format(resources.memory.limits)
        if resources.memory.requests:
            requests['memory'] = '{}Mi'.format(resources.memory.requests)

    if resources.gpu:
        if resources.gpu.limits:
            limits[conf.get('K8S_GPU_RESOURCE_KEY')] = resources.gpu.limits
        if resources.gpu.requests:
            requests[conf.get('K8S_GPU_RESOURCE_KEY')] = resources.gpu.requests

    if resources.tpu:
        if resources.tpu.limits:
            limits[conf.get('K8S_TPU_RESOURCE_KEY')] = resources.tpu.limits
        if resources.tpu.requests:
            requests[conf.get('K8S_TPU_RESOURCE_KEY')] = resources.tpu.requests
    return client.V1ResourceRequirements(limits=limits or None, requests=requests or None)
1282796
def load
      parsed = JSON.parse(File.read(SPECPATH))
      structs = StructureContainer.new(parsed['PropertyTypes'])

      parsed['ResourceTypes'].each do |key, spec|
        match = key.match(/\A(\w+)::(\w+)::(\w+)\z/)

        register(match[1], match[2], match[3], spec, structs.search(key))
      end
    end
662475
private Resource loadResource(String name, Locale locale, String encoding) throws IOException {
        Resource resource;
        if (stringLoader.exists(name, locale)) {
            resource = stringLoader.load(name, locale, encoding);
        } else {
            resource = loader.load(name, locale, encoding);
        }
        if (resource == null) {
            throw new FileNotFoundException("Not found resource " + name);
        }
        return resource;
    }
820866
def parse_resources(self, resources):
        """"""

        self.resources = {}
        resource_factory = ResourceFactory()
        for res_id, res_value in resources.items():
            r = resource_factory.create_resource(res_id, res_value)
            if r:
                if r.resource_type in self.resources:
                    self.resources[r.resource_type].append(r)
                else:
                    self.resources[r.resource_type] = [r]
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();
        }
    }
1254364
def get_sources(self, resources):
        

        rtype = self.rtype  # E.g. category
        label = self.props.label  # E.g. category1
        result = [
            resource
            for resource in resources.values()
            if is_reference_target(resource, rtype, label)
        ]
        return result
986124
function loadResources( state, filePath ) {
	var resourcePath = path.resolve( process.cwd(), filePath );
	return getResources( resourcePath )
		.then( function( list ) {
			return when.all( _.map( _.filter( list ), loadModule.bind( undefined, state ) ) )
				.then( function( lists ) {
					return _.flatten( lists );
				} );
		} );
}
1024511
protected Resource loadSchemaResources() {
        PathMatchingResourcePatternResolver resourcePatternResolver = new PathMatchingResourcePatternResolver();
        for (String location : schemas) {
            try {
                Resource[] findings = resourcePatternResolver.getResources(location);

                for (Resource finding : findings) {
                    if (finding.getFilename().endsWith(".xsd") || finding.getFilename().endsWith(".wsdl")) {
                        schemaResources.add(finding);
                    }
                }
            } catch (IOException e) {
                throw new CitrusRuntimeException("Failed to read schema resources for location: " + location, e);
            }
        }

        return schemaResources.get(0);
    }
120338
@Override
    public Enumeration<URL> findResources(final String name) throws IOException {
        if (name == null) {
            return null;
        }
        // On iOS, every resource is resolved by the SystemClassLoader, so
        // any URL in this class loader will, too.
        return Collections.enumeration(urls);
    }
117301
public <T> T loadResources(Class<T> type, List<String> resources) {
    if (resources == null || resources.isEmpty()) {
      throw new IllegalArgumentException("resources must be defined");
    }
    Config config = null;
    for (String resource : resources) {
      if (config == null) {
        config = ConfigFactory.load(classLoader, resource);
      } else {
        config = config.withFallback(ConfigFactory.load(classLoader, resource));
      }
    }
    return map(checkNotNull(config, "config cannot be null").resolve(), type);
  }