/* find any excess folders in node_modules that are not in
deps.
348405
function validateExcess(dir, file, shrinkwrap, opts, scope, cb) {  // jshint ignore:line
    file = file.toLowerCase();

    // don't consider node_modules/.bin
    if (file === '.bin') {
        return cb();
    }

    // consider top-level scoped packages only; e.g. those nested at the level
    // node_modules/{*}
    var isScopedDir = file[0] === '@';
    if (isScopedDir) {
        return findExcess(path.join(dir, scope + '/' + file), shrinkwrap, opts,
          file, cb);
    }

    // the file is in excess if it does not exist in the package.json's
    // dev dependencies; this step is skipped if we are not analyzing
    // dev dependencies
    if (opts.dev && shrinkwrap.devDependencies &&
        lowercaseContains(Object.keys(shrinkwrap.devDependencies), file)) {
        return cb();
    }

    // the file is in excess if it does not exist in the package.json's
    // regular dependencies
    if (shrinkwrap.dependencies && lowercaseContains(Object.keys(shrinkwrap.dependencies), file)) {
        return cb();
    }

    // if all checks pass up until this point, the file is in excess
    return cb(null, [file]);
}
748053
def _get_module_folders(self, temp_repo):
        
        paths = (
            os.path.join(temp_repo, path) for path in os.listdir(temp_repo)
            if self._is_module_included(path)
        )
        return (path for path in paths if os.path.isdir(path))
850296
function getSubmodules(packageRoot) {
  const submodules = {};
  const parentPath = resolve(packageRoot, './modules');

  if (fs.existsSync(parentPath)) {
    //monorepo
    fs.readdirSync(parentPath)
    .forEach(item => {
      const itemPath = resolve(parentPath, item);
      const moduleInfo = getModuleInfo(itemPath);
      if (moduleInfo) {
        submodules[moduleInfo.name] = moduleInfo;
      }
    });
  } else {
    const moduleInfo = getModuleInfo(packageRoot);
    submodules[moduleInfo.name] = moduleInfo;
  }

  return submodules;
}
1257738
def find_clean_dirs(self):
        """"""

        for folder in glob.glob(self.glob_pattern):
            if re.match(self.re_pattern, folder):
                yield folder
        for folder in glob.glob(self.orig_glob_pattern):
            if re.match(self.orig_re_pattern, folder):
                yield folder
884680
def clean_extra(self):
        """"""
        extra_paths = self.get_extra_paths()
        for path in extra_paths:
            if not os.path.exists(path):
                continue
            if os.path.isdir(path):
                self._clean_directory(path)
            else:
                self._clean_file(path)
840294
function(dir) {

        // Return if the node_modules directory doesn't exist.
        try {
          FS.statSync(dir);
        } catch (e) {return;}

        // Check each direcory for a monitor-dashboard app
        FS.readdirSync(dir).forEach(function(moduleName) {

          // See if this is a monitor app, and load if it is
          // then load sub-modules
          var moduleDir = dir + '/' + moduleName;
          if (testAppDir(moduleDir) || moduleName === 'monitor') {

            // If it is a monitor-app, process any sub node_modules
            loadNodeModulesDir(moduleDir + '/node_modules');
          }
        });
      }
155911
function nodeModulesPaths (start, cb) {
    var splitRe = process.platform === 'win32' ? /[\/\\]/ : /\/+/;
    var parts = start.split(splitRe);

    var dirs = [];
    for (var i = parts.length - 1; i >= 0; i--) {
        if (parts[i] === 'node_modules') continue;
        var dir = path.join.apply(
            path, parts.slice(0, i + 1).concat(['node_modules'])
        );
        if (!parts[0].match(/([A-Za-z]:)/)) {
            dir = '/' + dir;
        }
        dirs.push(dir);
    }
    return dirs;
}
207065
function extractFolders( files ) {
    return files.data.files.map( function extractPath( file ) {
      return path.parse( file ).dir;
    }).filter( function extractUnique( path, index, array ) {
      return array.indexOf( path ) === index;
    });
  }
962942
public List<String> getExtraModules() {
		return extraModules == null ? Collections.<String>emptyList() : Collections.unmodifiableList(extraModules);
	}
988731
protected static function removeNodeModules()
    {
        tap(new Filesystem, function ($files) {
            $files->deleteDirectory(base_path('node_modules'));

            $files->delete(base_path('yarn.lock'));
        });
    }
681637
function() {
    try {
        var statbuf = fs.statSync(folder);
        if (statbuf.isDirectory()) {
            return;
        }
    }
    catch (x) {
    }

    try {
        fs.mkdirSync("node_modules");
    } catch (x) {
    }

    statbuf = fs.statSync(folder);
    if (statbuf.isDirectory()) {
        return;
    }
}
526978
def get_dirtree(module_name, dirlist=[]):
    '''
    
    '''
    ret = []
    curdir = os.getcwd()
    if not os.path.isdir(module_name):
        return ret
    os.chdir(module_name)
    try:
        for dirname in dirlist:
            if not os.path.isdir(dirname):
                continue
            for (d, ds, fs) in os.walk(dirname):
                for f in fs:
                    ret += [os.path.join(d, f)]
        return ret
    except:
        return ret
    finally:
        os.chdir(curdir)
159623
async function (directory, filesInSassTree, exclusions) {
  const filesInDirectory = (await recursive(directory));

  const unusedFiles = filesInDirectory
    .filter((file) => isUnused(file, filesInSassTree, exclusions));

  return unusedFiles;
}
740752
@Optional
  @InputFiles
  public FileCollection getExtraFilesDirectoriesAsInputFiles() {
    if (extraFilesDirectories == null) {
      return null;
    }
    FileCollection files = project.files();
    for (File directory : extraFilesDirectories) {
      files = files.plus(project.fileTree(directory));
    }
    return files;
  }
739532
def has_subdirectories(path, include, exclude, show_all):
    """"""
    try:
        # > 1 because of '..'
        return len( listdir(path, include, exclude,
                            show_all, folders_only=True) ) > 1
    except (IOError, OSError):
        return False
704784
private boolean findFiles(String[] args, String option, Set<String> suffixes,
                              Map<String,Source> found_files, Map<String, Module> found_modules,
                              Module current_module, boolean inLinksrc)
        throws ProblemException, ProblemException
    {
        // Track which source roots, source path roots and class path roots have been added.
        Set<File> roots = new HashSet<File>();
        // Track the current set of package includes,excludes as well as excluded source files,
        // to be used in the next -src/-sourcepath/-classpath
        List<String> includes = new LinkedList<String>();
        List<String> excludes = new LinkedList<String>();
        List<String> excludefiles = new LinkedList<String>();
        List<String> includefiles = new LinkedList<String>();
        // This include is used to find all modules in the source.
        List<String> moduleinfo = new LinkedList<String>();
        moduleinfo.add("module-info.java");

        for (int i = 0; i<args.length; ++i) {
            if (args[i].equals("-i")) {
                if (i+1 >= args.length) {
                    throw new ProblemException("You have to specify a package pattern following -i");
                }
                String incl = args[i+1];
                checkPattern(incl);
                includes.add(incl);
            }
            if (args[i].equals("-x")) {
                if (i+1 >= args.length) {
                    throw new ProblemException("You have to specify a package pattern following -x");
                }
                String excl = args[i+1];
                checkPattern(excl);
                excludes.add(excl);
            }
            if (args[i].equals("-xf")) {
                if (i+1 >= args.length) {
                    throw new ProblemException("You have to specify a file following -xf");
                }
                String exclf = args[i+1];
                checkFilePattern(exclf);
                exclf = Util.normalizeDriveLetter(exclf);
                excludefiles.add(fixupSeparator(exclf));
            }
            if (args[i].equals("-if")) {
                if (i+1 >= args.length) {
                    throw new ProblemException("You have to specify a file following -xf");
                }
                String inclf = args[i+1];
                checkFilePattern(inclf);
                inclf = Util.normalizeDriveLetter(inclf);
                includefiles.add(fixupSeparator(inclf));
            }
            if (args[i].equals(option)) {
                if (i+1 >= args.length) {
                    throw new ProblemException("You have to specify a directory following "+option);
                }
                String[] root_dirs = args[i+1].split(File.pathSeparator);
                for (String r : root_dirs) {
                    File root = new File(r);
                    if (!root.isDirectory()) {
                        throw new ProblemException("\""+r+"\" is not a directory.");
                    }
                    try {
                        root = root.getCanonicalFile();
                    } catch (IOException e) {
                        throw new ProblemException(""+e);
                    }
                    if (roots.contains(root)) {
                        throw new ProblemException("\""+r+"\" has already been used for "+option);
                    }
                    if (root.equals(bin_dir)) {
                        throw new ProblemException("\""+r+"\" cannot be used both for "+option+" and -d");
                    }
                    if (root.equals(gensrc_dir)) {
                        throw new ProblemException("\""+r+"\" cannot be used both for "+option+" and -s");
                    }
                    if (root.equals(header_dir)) {
                        throw new ProblemException("\""+r+"\" cannot be used both for "+option+" and -h");
                    }
                    roots.add(root);
                    Source.scanRoot(root, suffixes, excludes, includes, excludefiles, includefiles,
                                    found_files, found_modules, current_module,
                                    findBooleanOption(args, "--permit-sources-without-package"),
                                    false, inLinksrc);
                }
            }
            if (args[i].equals("-src") ||
                args[i].equals("-sourcepath") ||
                args[i].equals("-modulepath") ||
                args[i].equals("-classpath") ||
                args[i].equals("-cp"))
            {
                // Reset the includes,excludes and excludefiles after they have been used.
                includes = new LinkedList<String>();
                excludes = new LinkedList<String>();
                excludefiles = new LinkedList<String>();
                includefiles = new LinkedList<String>();
            }
        }
        return true;
    }
1088258
function getIncludes(ext, exclude) {
    var globs = [];

    modules.forEach(function (module) {

      if (!settings.release) {

        // Not in release mode:
        // Ensure the main module file is included first

        globs.push(module.folder + '/' + module.folder + ext);
        globs.push(module.folder + '/**/*' + ext);
      } else {

        // In release mode:
        // Include the minified version.

        globs.push(module.folder + '/' + module.folder + '.min' + ext);
      }

    });

    var res = gulp.src(globs, {
      read: false,
      cwd: path.resolve(settings.folders.dest)
    });

    if (exclude) {
      res = res.pipe(gfilter('!**/*' + exclude));
//      res = res.pipe(utils.dumpFilePaths());
    }

    return res;
  }