get filename and check if in getcwd then get from
    the package resources folder
976704
def file_or_resource(fname=None):
    '''
    '''
    if fname is not None:
        filename = os.path.expanduser(fname)
    
        resource_package = opentargets_validator.__name__
        resource_path = os.path.sep.join(('resources', filename))

        abs_filename = os.path.join(os.path.abspath(os.getcwd()), filename) \
                       if not os.path.isabs(filename) else filename

        return abs_filename if os.path.isfile(abs_filename) \
            else res.resource_filename(resource_package, resource_path)
1316041
def get_filenames(self):
        """"""
        # Warning: glob returns a empty list if the directory is unreadable, without raising an Exception
        return list(glob.glob(os.path.join(self.worldfolder,'region','r.*.*.'+self.extension)))
1308321
private static String getStringResourceByName(Context ctx, String resourceName) {
        String packageName = ctx.getPackageName();
        int resId = ctx.getResources().getIdentifier(resourceName, "string", packageName);
        if (resId == 0) {
            return "";
        } else {
            return ctx.getString(resId);
        }
    }
1203202
def _getPFilename(self,native,prompt):
        
        return self.get(native=native,prompt=prompt)
1276250
function getBin(filename) {
    try {
        return escape(whichLocal.sync(filename));
    } catch (unused) {
        return escape(whichCwd.sync(filename));
    }
}
730838
def get_path(self, dir=None):
        """"""
        if not dir:
            dir = self.fs.getcwd()
        if self == dir:
            return '.'
        path_elems = self.get_path_elements()
        pathname = ''
        try: i = path_elems.index(dir)
        except ValueError:
            for p in path_elems[:-1]:
                pathname += p.dirname
        else:
            for p in path_elems[i+1:-1]:
                pathname += p.dirname
        return pathname + path_elems[-1].name
11269
def cwd():
    """"""
    cwd = os.environ.get("BE_CWD")
    if cwd and not os.path.isdir(cwd):
        sys.stderr.write("ERROR: %s is not a directory" % cwd)
        sys.exit(lib.USER_ERROR)
    return cwd or os.getcwd().replace("\\", "/")
1290359
def _GetPkgResources(package_name, filepath):
  """"""
  requirement = pkg_resources.Requirement.parse(package_name)
  try:
    return pkg_resources.resource_filename(requirement, filepath)
  except pkg_resources.DistributionNotFound:
    # It may be that the working set is not in sync (e.g. if sys.path was
    # manipulated). Try to reload it just in case.
    pkg_resources.working_set = pkg_resources.WorkingSet()
    try:
      return pkg_resources.resource_filename(requirement, filepath)
    except pkg_resources.DistributionNotFound:
      logging.error("Distribution %s not found. Is it installed?", package_name)
      return None
319823
private static String getFileName(Resource file) {
	String name = file.getName();
	int pos = name.lastIndexOf(".");

	if (pos == -1) return name;
	return name.substring(0, pos);
    }
1108395
def getFilesForName(name):
    
    if not os.path.exists(name):
        # check for glob chars
        if containsAny(name, "*?[]"):
            files = glob.glob(name)
            list = []
            for file in files:
                list.extend(getFilesForName(file))
            return list

        # try to find module or package
        name = _get_modpkg_path(name)
        if not name:
            return []

    if os.path.isdir(name):
        # find all python files in directory
        list = []
        os.path.walk(name, _visit_pyfiles, list)
        return list
    elif os.path.exists(name):
        # a single file
        return [name]

    return []
94110
def filename(out_dir, name, undefine=False):
    """"""
    if undefine:
        prefix = 'undef_'
    else:
        prefix = ''
    return os.path.join(out_dir, '{0}{1}.hpp'.format(prefix, name.lower()))
1364372
function getFiles(packageName,files,bundledFile){
	    	if(!traversed_bundles[packageName]){
	    		traversed_bundles[packageName] = true;
	    		var bundle = resourcesJs.bundles[packageName];
	    		if(bundle){
		    		bundle.bundled = bundledFile;
	    			for(var i in bundle.on){
	    				files = getFiles(bundle.on[i],files);
	    			}
	    			for(var i in bundle.js){
	    				var file = dir+ "/" + bundle.js[i];
	    				if(!traversed_files[file]){
	    					files.push(file);
	    					traversed_files[file] = true;
	    				}
	    			}
	    		}
	    	}
	    	return files;
	    }
1076054
function getShortChunkName (source) {
  if (source.match(relativePkg) || path.isAbsolute(source)) {
    return path.dirname(source).split(path.sep).slice(-2).join('/') + '/' + path.basename(source)
  }
  else {
    return source
  }
}
729666
def get_files (dirname):
    """"""
    for entry in os.listdir(dirname):
        fullentry = os.path.join(dirname, entry)
        if os.path.islink(fullentry):
            continue
        if os.path.isfile(fullentry):
            yield entry
        elif os.path.isdir(fullentry):
            yield entry+"/"
142115
def getabsfile(object):
    """"""
    return os.path.normcase(
        os.path.abspath(getsourcefile(object) or getfile(object)))
718885
def walk_resources(package_or_requirement, resource_name, recurse=True, base=''):
    
    base = base.rstrip('/') + '/'
    resource_base = (resource_name.rstrip('/') + '/' + base.strip('/')).rstrip('/')

    # Create default configuration files
    for filename in pymagic.resource_listdir(package_or_requirement, resource_base):
        # Skip hidden and other trashy names
        if filename.startswith('.') or any(filename.endswith(i) for i in (".pyc", ".pyo", "~")):
            continue

        # Handle subdirectories
        if pymagic.resource_isdir(package_or_requirement, resource_base + '/' + filename):
            if recurse:
                for i in walk_resources(package_or_requirement, resource_name, recurse, base=base + filename):
                    yield i
        else:
            yield base + filename
430964
def get_resource_by_path(self, path, folder_key=None):
        
        logger.debug("resolving %s", path)

        # remove empty path components
        path = posixpath.normpath(path)
        components = [t for t in path.split(posixpath.sep) if t != '']

        if not components:
            # request for root
            return Folder(
                self.api.folder_get_info(folder_key)['folder_info']
            )

        resource = None

        for component in components:
            exists = False
            for item in self._folder_get_content_iter(folder_key):
                name = item['name'] if 'name' in item else item['filename']

                if name == component:
                    exists = True
                    if components[-1] != component:
                        # still have components to go through
                        if 'filename' in item:
                            # found a file, expected a directory
                            raise NotAFolderError(item['filename'])
                        folder_key = item['folderkey']
                    else:
                        # found the leaf
                        resource = item
                    break

                if resource is not None:
                    break

            if not exists:
                # intermediate component does not exist - bailing out
                break

        if resource is None:
            raise ResourceNotFoundError(path)

        if "quickkey" in resource:
            file_info = self.api.file_get_info(
                resource['quickkey'])['file_info']
            result = File(file_info)
        elif "folderkey" in resource:
            folder_info = self.api.folder_get_info(
                resource['folderkey'])['folder_info']
            result = Folder(folder_info)

        return result