when a include pattern is specified, stop yielding directories
553371
function canInclude(entry, opts) {
  if (!opts.include || !opts.include.length) return true;
  return !entry.isDirectory();
}
1218637
def include_dir(self, root):
        """"""
        parts = [root]
        parts.extend(self.pathname.split(os.path.sep))
        return "/".join(parts)
365599
function clean(directoryPath, isRoot, done) {
  fs.stat(directoryPath, function(err, stat) {
    if (err) return done(isRoot ? undefined : err);
    if (stat.isFile()) return fs.unlink(directoryPath, done);
    fs.readdir(directoryPath, function(err, relativePaths) {
      if (err) return done(err);
      each(relativePaths, function(relativePath, next) {
        var absolutePath = path.join(directoryPath, relativePath);
        fs.stat(absolutePath, function(err, stats) {
          if (err) return next(err);
          if (!stats.isDirectory()) return fs.unlink(absolutePath, next);
          clean(absolutePath, false, next);
        });
      }, function(err) {
        if (err) return done(err);
        fs.rmdir(directoryPath, done);
      });
    });
  });
}
912940
function cleanup (dirs) {
  return function (mode, pass, callback) {
    var done = after(dirs.length, callback)

    dirs.forEach(function (dir) {
      rimraf(dir, done)
    })
  }
}
1362175
def global_include(self, pattern):
        
        if self.allfiles is None:
            self.findall()
        match = translate_pattern(os.path.join('**', pattern))
        found = [f for f in self.allfiles if match.match(f)]
        self.extend(found)
        return bool(found)
1306978
def cleanup():
    """"""
    lib_dir = os.path.join(os.environ['CONTAINER_DIR'], '_lib')
    if os.path.exists(lib_dir):
        shutil.rmtree(lib_dir)
    os.mkdir(lib_dir)
1312403
def p_include_once_ok(p):
    
    global CURRENT_DIR
    p[0] = [p[1] + p[2]] + p[3] + [p[4]]
    CURRENT_FILE.pop()  # Remove top of the stack
    CURRENT_DIR = os.path.dirname(CURRENT_FILE[-1])
182005
def cli(ctx):
    """"""
    dir_path = os.path.join(os.path.expanduser('~'), '.keep')
    if os.path.exists(dir_path):
        if click.confirm('[CRITICAL] Remove everything inside ~/.keep ?', abort=True):
            shutil.rmtree(dir_path)
    utils.first_time_use(ctx)
553354
def include_config(include, orig_path, verbose, exit_on_config_errors=False):
    '''
    
    '''
    # Protect against empty option
    if not include:
        return {}

    if orig_path is None:
        # When the passed path is None, we just want the configuration
        # defaults, not actually loading the whole configuration.
        return {}

    if isinstance(include, six.string_types):
        include = [include]

    configuration = {}
    for path in include:
        # Allow for includes like ~/foo
        path = os.path.expanduser(path)
        if not os.path.isabs(path):
            path = os.path.join(os.path.dirname(orig_path), path)

        # Catch situation where user typos path in configuration; also warns
        # for empty include directory (which might be by design)
        glob_matches = glob.glob(path)
        if not glob_matches:
            if verbose:
                log.warning(
                    'Warning parsing configuration file: "include" path/glob '
                    "'%s' matches no files", path
                )

        for fn_ in sorted(glob_matches):
            log.debug('Including configuration from \'%s\'', fn_)
            try:
                opts = _read_conf_file(fn_)
            except salt.exceptions.SaltConfigurationError as error:
                log.error(error)
                if exit_on_config_errors:
                    sys.exit(salt.defaults.exitcodes.EX_GENERIC)
                else:
                    # Initialize default config if we wish to skip config errors
                    opts = {}
            schedule = opts.get('schedule', {})
            if schedule and 'schedule' in configuration:
                configuration['schedule'].update(schedule)
            include = opts.get('include', [])
            if include:
                opts.update(include_config(include, fn_, verbose))

            salt.utils.dictupdate.update(configuration, opts, True, True)

    return configuration
1315660
private boolean handleResourceAsInclude(RebelResource rebelResource, Resource resource) {
    File dir = new File(resource.getDirectory());
    if (!dir.isAbsolute()) {
      dir = new File(getProject().getBasedir(), resource.getDirectory());
    }
    //if directory does not exist then exclude all
    if (!dir.exists() || !dir.isDirectory()) {
      return false;
    }

    resource.setDirectory(dir.getAbsolutePath());

    String[] files = getFilesToCopy(resource);
    if (files.length > 0) {
      //only include files that come from this directory
      List<String> includedFiles = new ArrayList<String>();
      for (String file : files) {
        includedFiles.add(StringUtils.replace(file, '\\', '/'));
      }
      rebelResource.setIncludes(includedFiles);
    }
    else {
      //there weren't any matching files
      return false;
    }

    return true;
  }
1258448
protected void unpackXARToOutputDirectory(Artifact artifact, String[] includes, String[] excludes)
        throws MojoExecutionException
    {
        if (!this.outputBuildDirectory.exists()) {
            this.outputBuildDirectory.mkdirs();
        }

        File file = artifact.getFile();
        unpack(file, this.outputBuildDirectory, "XAR Plugin", false, includes, excludes);
    }
726012
function emptyDirectory(path, callback) {
  fs.readdir('./' + path, function(err, files) {
    if (err && 'ENOENT' !== err.code) throw new Error(err);
    callback(!files || !files.length);
  });
}
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
782030
def include(self, path):
        """"""
        for extension in IGNORE_EXTENSIONS:
            if path.endswith(extension):
                return False
        parts = path.split(os.path.sep)
        for part in parts:
            if part in self.ignore_dirs:
                return False
        return True
7851
function fixOutputPaths(output, files) {

    // map directories to use for index files
    var dirMap = {};
    u.each(files, function(file) {
      dirMap[ppath.dirname(file.path)] = true;

      // edge case - treat /foo/ as directory too
      if (/\/$/.test(file.path) && ppath.dirname(file.path) !== file.path) {
        dirMap[file.path] = true;
      }
    });

    // default output file extension is .html
    var extension = 'extension' in output ? (output.extension || '') : '.html';
    var indexFile = output.indexFile || 'index';

    u.each(files, function(file) {
      if (dirMap[file.path]) {
        debug('index file for %s', file.path);
        file.path = ppath.join(file.path, indexFile);
      }
      if (!/\.[^/]*$/.test(file.path)) {
        file.path = file.path + extension;
      }
    });
  }
457141
function globsToExcludeFromFileSet (dirname, fileset) {
  if (fileset.excludes && fileset.excludes.length) {
    return fileset.excludes.map(exclude => '!' + path.join(dirname, exclude));
  } else {
    return [];
  }
}
1034359
def cleanup():
    """"""
    if _output_dir and os.path.exists(_output_dir):
        log.msg_warn("Cleaning up output directory at '{output_dir}' ..."
                     .format(output_dir=_output_dir))
        if not _dry_run:
            shutil.rmtree(_output_dir)