finds the resource from the enclosing resource.  Raise CantFindSingleton if there is no enclosing resource
3895
def find_resource(controller)
      ResourcesController.raise_cant_find_singleton(name, klass) unless controller.enclosing_resource
      controller.enclosing_resource.send(source)
    end
514132
def route_and_method_from_enclosing_resource_method_and_name_prefix(method, name_prefix)
      if enclosing_resource
        enclosing_route = name_prefix.sub(/_$/,'')
        route_method = method.to_s.sub(/enclosing_resource(s)?/) { $1 ? enclosing_route.pluralize : enclosing_route }
        return [Rails.application.routes.named_routes.get(route_method.sub(/_(path|url)$/,'').to_sym), route_method]
      else
        raise NoMethodError, "Tried to map :#{method} but there is no enclosing_resource for this controller"
      end
    end
162149
public static Resource getConsoleResource(BeanContext context) {
        SlingHttpServletRequest request = context.getRequest();
        ResourceResolver resolver = request.getResourceResolver();
        String path = null;
        // use the resource set by a probably executed 'defineObjects' tag (supports including components)
        Resource resource = context.getAttribute("resource", Resource.class);
        if (resource == null) {
            resource = request.getResource();
        }
        if (resource != null) {
            path = resource.getPath();
        }
        // use the suffix as the resource path if the resource is not defined or references a servlet
        if (StringUtils.isBlank(path) || path.startsWith("/bin/")) {
            RequestPathInfo requestPathInfo = request.getRequestPathInfo();
            path = requestPathInfo.getSuffix();
            resource = null;
        }
        if (resource == null && StringUtils.isNotBlank(path)) {
            resource = resolver.getResource(path);
        }
        if (resource == null) {
            // fallback to the root node if the servlet request has no suffix
            resource = resolver.getResource("/");
        }
        return resource;
    }
242743
def find_resource(r, *, pkg='cyther'):
    
    file_path = pkg_resources.resource_filename(pkg, os.path.join('test', r))
    if not os.path.isfile(file_path):
        msg = "Resource '{}' does not exist"
        raise FileNotFoundError(msg.format(file_path))
    return file_path
160309
public CloseableIterator<CaptureSearchResult> getPrefixIterator(String prefix)
			throws ResourceIndexNotAvailableException {
		if(getState() != STATE_SYNCHED) {
			throw new ResourceIndexNotAvailableException("Not synchronized");
		}
		return super.getPrefixIterator(prefix);
	}
1014530
function findResource(name, filepath, extList) {
  var candidates = [name, path.join(name, 'index')];
  var baseName = path.basename(name);
  if (baseName && baseName !== '.' && baseName !== '..') {
    candidates.push(path.join(name, baseName));
  }
  var info = null;

  candidates.every(function(candidate) {
    info = fis.uri(candidate, filepath);

    for (var i = 0, len = extList.length; i < len && !info.file; i++) {
      info = fis.uri(candidate + extList[i], filepath);
    }

    if (info && info.file) {
      return false;
    }

    return true;
  });

  return info;
}
1226452
def get(self, logicalId):
        
        if logicalId not in self.resources:
            return None

        return SamResource(self.resources.get(logicalId))
872999
protected ResourceEntry findResourceInternal(final String name, final String path) {

        checkStateForResourceLoading(name);

        if (name == null || path == null) {
            return null;
        }

        ResourceEntry entry = resourceEntries.get(path);
        if (entry != null) {
            return entry;
        }

        boolean isClassResource = path.endsWith(CLASS_FILE_SUFFIX);
        boolean isCacheable = isClassResource;
        if (!isCacheable) {
             isCacheable = path.startsWith(SERVICES_PREFIX);
        }

        WebResource resource = null;

        boolean fileNeedConvert = false;

        resource = resources.getClassLoaderResource(path);

        if (!resource.exists()) {
            return null;
        }

        entry = new ResourceEntry();
        entry.source = resource.getURL();
        entry.codeBase = resource.getCodeBase();
        entry.lastModified = resource.getLastModified();

        if (needConvert && path.endsWith(".properties")) {
            fileNeedConvert = true;
        }

        /* Only cache the binary content if there is some content
         * available one of the following is true:
         * a) It is a class file since the binary content is only cached
         *    until the class has been loaded
         *    or
         * b) The file needs conversion to address encoding issues (see
         *    below)
         *    or
         * c) The resource is a service provider configuration file located
         *    under META=INF/services
         *
         * In all other cases do not cache the content to prevent
         * excessive memory usage if large resources are present (see
         * https://issues.apache.org/bugzilla/show_bug.cgi?id=53081).
         */
        if (isCacheable || fileNeedConvert) {
            byte[] binaryContent = resource.getContent();
            if (binaryContent != null) {
                 if (fileNeedConvert) {
                    // Workaround for certain files on platforms that use
                    // EBCDIC encoding, when they are read through FileInputStream.
                    // See commit message of rev.303915 for details
                    // http://svn.apache.org/viewvc?view=revision&revision=303915
                    String str = new String(binaryContent);
                    try {
                        binaryContent = str.getBytes(StandardCharsets.UTF_8);
                    } catch (Exception e) {
                        return null;
                    }
                }
                entry.binaryContent = binaryContent;
                // The certificates and manifest are made available as a side
                // effect of reading the binary content
                entry.certificates = resource.getCertificates();
            }
        }
        entry.manifest = resource.getManifest();

//        if (isClassResource && entry.binaryContent != null &&
//                this.transformers.size() > 0) {
//            // If the resource is a class just being loaded, decorate it
//            // with any attached transformers
//            String className = name.endsWith(CLASS_FILE_SUFFIX) ?
//                    name.substring(0, name.length() - CLASS_FILE_SUFFIX.length()) : name;
//            String internalName = className.replace(".", "/");
//
//            for (ClassFileTransformer transformer : this.transformers) {
//                try {
//                    byte[] transformed = transformer.transform(
//                            this, internalName, null, null, entry.binaryContent
//                    );
//                    if (transformed != null) {
//                        entry.binaryContent = transformed;
//                    }
//                } catch (IllegalClassFormatException e) {
//                    log.error(sm.getString("webappClassLoader.transformError", name), e);
//                    return null;
//                }
//            }
//        }

        // Add the entry in the local resource repository
        synchronized (resourceEntries) {
            // Ensures that all the threads which may be in a race to load
            // a particular class all end up with the same ResourceEntry
            // instance
            ResourceEntry entry2 = resourceEntries.get(path);
            if (entry2 == null) {
                resourceEntries.put(path, entry);
            } else {
                entry = entry2;
            }
        }

        return entry;
    }
763580
def relative_resources(pathstring, failover='nifstd/resources'):
    

    if working_dir is None:
        return Path(failover, pathstring).resolve()
    else:
        return Path(devconfig.resources, pathstring).resolve().relative_to(working_dir.resolve())
981652
@Override
    @SuppressWarnings("unchecked")
    protected Enumeration<URL> findResources( final String name )
        throws IOException
    {
        Enumeration<URL> resources = m_bundle.getResources( name );
        // Bundle.getResources may return null, in such case return empty enumeration
        if( resources == null )
        {
            return EMPTY_URL_ENUMERATION;
        }
        else
        {
            return resources;
        }
    }
1333156
def get_resource(self, name):
        ''

        if name in self.resources:
            return self.resources[name]
        elif name in self.pushable_resources:
            return self.pushable_resources[name]
        else:
            return False
836184
def getResourceInst(self, path, environ):
        
        self._count_getResourceInst += 1
        fp = self._locToFilePath(path)
        if not os.path.exists(fp):
            return None

        if os.path.isdir(fp):
            return FolderResource(path, environ, fp)
        return FileResource(path, environ, fp)
947041
@Override
	public Reader getResource(JoinableResourceBundle bundle, String resourceName, boolean processingBundle) {

		Reader rd = null;
		String realPath = getRealResourcePath(resourceName);
		if (isFileSystemPath(resourceName, realPath)) { // The resource has been
														// remapped
			try {
				rd = new FileReader(realPath);
			} catch (FileNotFoundException e) {
				LOGGER.debug("The resource " + realPath + " has not been found");
			}
		}
		if (rd == null) {
			rd = super.getResource(bundle, realPath, processingBundle);
		}

		return rd;
	}
1033699
def resource(self, resource_type):
        
        try:
            resource = getattr(self.resources, self.safe_rt(resource_type))(self)
        except AttributeError:
            self._resources(True)
            resource = getattr(self.resources, self.safe_rt(resource_type))(self)
        return resource
349875
private ResourceAssignment getExistingResourceAssignment(Resource resource)
   {
      ResourceAssignment assignment = null;
      Integer resourceUniqueID = null;

      if (resource != null)
      {
         Iterator<ResourceAssignment> iter = m_assignments.iterator();
         resourceUniqueID = resource.getUniqueID();

         while (iter.hasNext() == true)
         {
            assignment = iter.next();
            Integer uniqueID = assignment.getResourceUniqueID();
            if (uniqueID != null && uniqueID.equals(resourceUniqueID) == true)
            {
               break;
            }
            assignment = null;
         }
      }

      return assignment;
   }
233505
protected EObject findAccessibleType(String fragment, ResourceSet resourceSet, Iterator<IEObjectDescription> fromIndex) throws UnknownNestedTypeException {
		IEObjectDescription description = fromIndex.next();
		return getAccessibleType(description, fragment, resourceSet);
	}
43604
protected boolean isOperationOnMovedResource() {

        Iterator<String> i = getResourceList().iterator();
        while (i.hasNext()) {
            String resName = i.next();
            String target = resourceOriginalPath(getCms(), resName);
            if ((target != null) && !target.equals(resName)) {
                // found a moved resource
                return true;
            }
        }
        return false;
    }