Return set of local URLs if files already exist
162702
def _from_metadata(self, urlpath):
        """"""
        md = self.get_metadata(urlpath)
        if md is not None:
            return [self._path(urlpath)]
1024459
function hasFileInLocal(url, mockFileDir) {
    var filePath = findInLocal(url, mockFileDir);
    var status;
    try{
        status = fs.statSync(filePath);
    }catch(e){
        return false;
    }
    return status.isFile();
}
812525
def files(self, absolute=False):
        """"""

        _paths = []

        for arg in self.all:
            for path in _expand_path(arg):
                if os.path.exists(path):
                    if absolute:
                        _paths.append(os.path.abspath(path))
                    else:
                        _paths.append(path)

        return _paths
1170702
def _get_files(self, folderId):
        """"""
        uri = '/'.join([self.base_url, self.name, folderId, 'Files'])
        return uri, {}, 'get', None, None, False, None
1099684
def _file_local_list(self, dest):
        '''
        
        '''
        if os.path.isdir(dest):
            destdir = dest
        else:
            destdir = os.path.dirname(dest)

        filelist = set()

        for root, dirs, files in salt.utils.path.os_walk(destdir, followlinks=True):
            for name in files:
                path = os.path.join(root, name)
                filelist.add(path)

        return filelist
1167066
def getfiles(qfiles, dirname, names):
    """"""
    for name in names:
        fullname = os.path.join(dirname, name)
        if os.path.isfile(fullname) and \
            fullname.endswith('.cf') or \
                fullname.endswith('.post'):
            qfiles.put(fullname)
529563
def walkfiles(self, *args, **kwargs):
        
        return (
            item
            for item in self.walk(*args, **kwargs)
            if item.isfile()
        )
1040745
def iwhere( filename ):
    

    possible_paths =      _gen_possible_matches( filename )
    existing_file_paths = filter( os.path.isfile, possible_paths )
    return existing_file_paths
347204
private List<String> existingRootFiles() {
        List<String> filesFound = new ArrayList<>();
        for (String path : SU_PATHS) {
            if (new File(path).exists()) {
                filesFound.add(path);
            }
        }
        return filesFound;
    }
782784
def _get_all_files(self, path, *exclude):
        '''
        
        '''
        files = list()
        dirs = list()
        links = list()

        if os.access(path, os.R_OK):
            for obj in os.listdir(path):
                obj = os.path.join(path, obj)
                valid = True
                for ex_obj in exclude:
                    if obj.startswith(str(ex_obj)):
                        valid = False
                        continue
                if not valid or not os.path.exists(obj) or not os.access(obj, os.R_OK):
                    continue
                if salt.utils.path.islink(obj):
                    links.append(obj)
                elif os.path.isdir(obj):
                    dirs.append(obj)
                    f_obj, d_obj, l_obj = self._get_all_files(obj, *exclude)
                    files.extend(f_obj)
                    dirs.extend(d_obj)
                    links.extend(l_obj)
                elif os.path.isfile(obj):
                    files.append(obj)

        return sorted(files), sorted(dirs), sorted(links)
665072
function getNextClar(params, string, files) {
		if (params === 'all') {
			files.push(string);
			return true;
		}
		if (Array.isArray(params)){
			params.forEach(function(item, i, array) {
				files.push(string + '.' + item + '$');
				return true;
			});
		}else if (typeof params === 'object'){
			var param;
			for (param in params) {
				var buffer = string;
				var regular;
				if (param === 'all'){
					regular = '\\w+';
				}else{
					regular = param;
				}
				string += !string ? regular : '-' + regular;
				getNextClar(params[param], string, files);
				string = buffer;
			}
		}else{
			files.push(string + '.' + params + '$');
		}
		return true;
	}
443872
def url_or_file_open(uri):
    """"""
    if (not re.match(r'''\w+:''', uri)):
        uri = 'file:' + uri
    return(urlopen(uri))
694757
def is_local(filename, pathlist):
  '''
  
  '''

  filename = os.path.abspath(filename)
  for path_name in pathlist:
    path_name = os.path.abspath(path_name)
    if is_subpath(filename, path_name):
      return True
  return False
55445
def _get_local_files(local_dir, pattern=''):
    
    local_files = {}
    
    if pattern:
        cwd = os.getcwd()
        os.chdir(local_dir)
        patterns = pattern.split('|')
        local_list = set([])
        for p in patterns: local_list = local_list | set(glob(p))
        for path in local_list:
            dir, file = os.path.split(path)
            if os.path.isfile(path):
                local_files[dir] = local_files.get(dir,[])+[file]
            elif os.path.isdir(path):
                local_files[file] = local_files.get(dir,[])
        os.chdir(cwd)
    return local_files
78901
def _get_s3_files(local_dir, file_info, params):
    
    assert len(file_info) == 1
    files = file_info.values()[0]
    fnames = []
    for k in ["1", "2"]:
        if files[k] not in fnames:
            fnames.append(files[k])
    out = []
    for fname in fnames:
        bucket, key = fname.replace("s3://", "").split("/", 1)
        if params["access_key_id"] == "TEST":
            out.append(os.path.join(local_dir, os.path.basename(key)))
        else:
            out.append(s3.get_file(local_dir, bucket, key, params))
    return out
152813
def _thumbnail_local(self, original_filename, thumb_filename,
                         thumb_size, thumb_url, crop=None, bg=None,
                         quality=85):
        """"""

        # create folders
        self._get_path(thumb_filename)

        thumb_url_full = url_for('static', filename=thumb_url)

        # Return the thumbnail URL now if it already exists locally
        if os.path.exists(thumb_filename):
            return thumb_url_full

        try:
            image = Image.open(original_filename)
        except IOError:
            return ''

        img = self._thumbnail_resize(image, thumb_size, crop=crop, bg=bg)

        img.save(thumb_filename, image.format, quality=quality)

        return thumb_url_full
953616
def glob_files_locally(folder_path, pattern):
    """"""

    pattern = os.path.join(
        folder_path, pattern.lstrip('/')) if pattern else None

    len_folder_path = len(folder_path) + 1
    for root, _, files in os.walk(folder_path):
        for f in files:
            full_path = os.path.join(root, f)
            if not pattern or _match_path(full_path, pattern):
                yield (full_path, full_path[len_folder_path:])