Iterates trough all .kirbi files in a given directory and converts all of them into one CCACHE object
359504
def from_kirbidir(directory_path):
		
		cc = CCACHE()
		dir_path = os.path.join(os.path.abspath(directory_path), '*.kirbi')
		for filename in glob.glob(dir_path):
			with open(filename, 'rb') as f:
				kirbidata = f.read()
				kirbi = KRBCRED.load(kirbidata).native
				cc.add_kirbi(kirbi)
		
		return cc
1153233
def mkdir(*components, **kwargs):
    
    _path = path(*components)
    if not isdir(_path):
        os.makedirs(_path, **kwargs)
    return _path
816005
private Collection<File> doListAllFiles(File rootDir,
                                            boolean includeDirectories) {
        Collection<File> result = new Stack<File>();
        File[] files = rootDir.listFiles();
        for (File f : files) {
            if (f.isDirectory()) {
                if (includeDirectories) {
                    result.add(f);
                }
                result.addAll(doListAllFiles(f, includeDirectories));
            } else if (f.isFile()) {
                result.add(f);
            }
        }
        return result;
    }
415625
def findAllCfgTasksUnderDir(aDir):
    
    retval = {}
    for f in irafutils.rglob(aDir, '*.cfg'):
        retval[f] = getEmbeddedKeyVal(f, TASK_NAME_KEY, '')
    return retval
702469
def _os_walk(directory, recurse=True, **kwargs):
    
    if recurse:
        for root, dirs, files in os.walk(directory, **kwargs):
            yield root, dirs, files
    else:
        files = []
        for filename in os.listdir(directory):
            if os.path.isfile(os.path.join(directory, filename)):
                files.append(filename)
        yield directory, [], files
910012
def for_each_file(base_dir, func):
    

    for dir_path, _, file_names in os.walk(base_dir):
        for filename in file_names:
            func(os.path.join(dir_path, filename))
305823
private static Set<File> findAllFiles(File dir) {
        Set<File> foundFiles = new HashSet<>();
        if (dir == null) {
            return foundFiles;
        }
        recurse(dir, foundFiles);
        return foundFiles;
    }
189940
def writeCache(self, filename):
        """"""
        with open(filename, 'wb') as f:
            pickle.dump(self.modules, f)
310257
def clean_caches(path):
    

    for dirname, subdirlist, filelist in os.walk(path):

        for f in filelist:
            if f.endswith('pyc'):
                try:
                    os.remove(os.path.join(dirname, f))
                except FileNotFoundError:
                    pass

        if dirname.endswith('__pycache__'):
            shutil.rmtree(dirname)
1120463
def _iter_files(self, mod_name):
        '''
        
        '''
        # do we have an exact match?
        if mod_name in self.file_mapping:
            yield mod_name

        # do we have a partial match?
        for k in self.file_mapping:
            if mod_name in k:
                yield k

        # anyone else? Bueller?
        for k in self.file_mapping:
            if mod_name not in k:
                yield k
103656
def to_disk
      mkdir
      @hash.each do |key, value|
        File.open(filename(key), 'w') { |file| file.write(value.to_yaml) }
      end
    end
179018
def from_dir(cwd):
    ""
    import os
    curdir = os.getcwd()
    try:
        os.chdir(cwd)
        yield
    finally:
        os.chdir(curdir)
204005
def cache_files(self, paths, saltenv='base', cachedir=None):
        '''
        
        '''
        ret = []
        if isinstance(paths, six.string_types):
            paths = paths.split(',')
        for path in paths:
            ret.append(self.cache_file(path, saltenv, cachedir=cachedir))
        return ret
710535
def iterSourceCode(paths):
    
    for path in paths:
        if os.path.isdir(path):
            for dirpath, dirnames, filenames in os.walk(path):
                for filename in filenames:
                    full_path = os.path.join(dirpath, filename)
                    if isPythonFile(full_path):
                        yield full_path
        else:
            yield path
5702
function (options, iterationInfo) {
        var files;
        var modules = {};

        // check if the counter has reached the desired depth indicated in options.depth
        if (typeof options.depth !== 'undefined' &&
            iterationInfo.currentDepth >= options.depth) {
            return;
        }

        // remember the starting directory
        try {
            files = fs.readdirSync(iterationInfo.dirName);
        } catch (e) {
            if (options.optional)
                return {};
            else
                throw new Error('Directory not found: ' + iterationInfo.dirName);
        }

        // iterate through files in the current directory
        files.forEach(function (fileName) {
            iterationInfo.fileName = fileName;
            //get absolute path
            iterationInfo.absolutePath = rtrim(iterationInfo.dirName, '/');
            iterationInfo.absoluteFullPath = iterationInfo.absolutePath + '/' + fileName;
            //get relative path
            iterationInfo.relativePath = iterationInfo.absolutePath.replace(iterationInfo.initialDirName, '');
            iterationInfo.relativeFullPath = iterationInfo.absoluteFullPath.replace(iterationInfo.initialDirName, '');
            // make sure a slash exists on the left side of relative paths
            iterationInfo.relativePath = '/' + ltrim(iterationInfo.relativePath, '/');
            iterationInfo.relativeFullPath = '/' + ltrim(iterationInfo.relativeFullPath, '/');

            if (fs.statSync(iterationInfo.absoluteFullPath).isDirectory()) {
                processDirectory(options, iterationInfo, modules)
            }
            else {
                processFile(options, iterationInfo, modules);
            }
        });

        return modules;
    }
1340931
private static List<File> findPythonLibDirectories(File parentDirectory) {
        List<File> foundDirectories = new ArrayList<>();
        if (parentDirectory != null && parentDirectory.exists()) {
            for (File dir : parentDirectory.listFiles(DIRECTORY_FILE_FILTER)) {
                if (dir.getName().equals("pythonlib")) {
                    foundDirectories.add(dir);
                } else {
                    foundDirectories.addAll(findPythonLibDirectories(dir));
                }
            }
        }
        return foundDirectories;
    }
67424
def convert(files, **kwargs):
    

    if len(files) < 1:
        raise ValueError("Files needs to be a non-empty list")

    if len(files) == 1:
        if os.path.isfile(files[0]):
            return files_to_pif(files, **kwargs)
        else:
            return directory_to_pif(files[0], **kwargs)
    else:
        return files_to_pif([x for x in files if os.path.isfile(x)], **kwargs)