Separate include and exclude globs.
187044
def separate_globs(globs):
	""""""
	exclude = []
	include = []

	for path in globs:
		if path.startswith("!"):
			exclude.append(path[1:])
		else:
			include.append(path)

	return (exclude, include)
437018
function filesFromFileSet (dirname, fileset) {
  if (!fileset.includes || !fileset.includes.length) {
    return [];
  }
  return fileset.includes
    .filter(include => !glob.hasMagic(include))
    .map(include => path.join(dirname, include));
}
1348156
def eglob(path, exclude=None):
    """"""
    fi = itertools.chain.from_iterable
    paths = list(fi(glob2.iglob(d) for d in expand_paths(path)))
    if exclude:
        cached_regex = cached_regices.get(exclude, None)
        if not cached_regex:
            cached_regex = cached_regices[exclude] = re.compile(exclude)
        paths = [x for x in paths if not cached_regex.search(x)]

    return paths
1285143
public void addInclude(String include) {

        include = normalizePath(include);
        m_includes.add(include);
        m_allPaths.add(include);
    }
1139023
def exclude_options(ignore_file_path)
      ar = File.read(ignore_file_path)
      ar = ar.split("\n")
      ar.map! do |r|
        r.gsub!(/#.*$/,""); r.gsub!(/^\s*?$/,"")
        r.gsub!(/^\//,"./"); r.gsub!(/\/$/,"/*")
        r
      end
      ar =  ar.delete_if{|r|r==""}
      ar.map! do |r|
        "--exclude '" + r + "'"
      end
      return ar.join(" ")
    end
1374998
def map_over_glob(fn, path, pattern):
    """"""
    return [fn(x) for x in glob.glob(os.path.join(path, pattern))]
572681
function excludeIncludeKeys(objA, objB, excludeKeys, includeKeys) {
  let keysA = Object.keys(objA);
  let keysB = Object.keys(objB);

  if (excludeKeys) {
    keysA = keysA.filter(key => excludeKeys.indexOf(key) === -1);
    keysB = keysB.filter(key => excludeKeys.indexOf(key) === -1);
  } else if (includeKeys) {
    keysA = keysA.filter(key => includeKeys.indexOf(key) !== -1);
    keysB = keysB.filter(key => includeKeys.indexOf(key) !== -1);
  }

  return [keysA, keysB];
}
678848
function includedFile(fileName) {
            var relativePath = fileName.substring(appDir.length + 1);
            var result = false;
            for (var i = 0; i < onlyIncludeList.length; i++) {
                var prefix = onlyIncludeList[i];
                if (relativePath.indexOf(prefix) === 0) {
                    result = true;
                    break;
                }
            }
            return result;
        }
713832
def setup(self):
        """"""
        super(RequireJSFilter, self).setup()

        excluded_files = []
        for bundle in self.excluded_bundles:
            excluded_files.extend(
                map(lambda f: os.path.splitext(f)[0],
                    bundle.contents)
            )

        if excluded_files:
            self.argv.append(
                'exclude={0}'.format(','.join(excluded_files))
            )
223287
def glob1(self, dir_relpath, glob):
    """"""
    if self.isignored(dir_relpath, directory=True):
      return []

    matched_files = self._glob1_raw(dir_relpath, glob)
    prefix = self._relpath_no_dot(dir_relpath)
    return self._filter_ignored(matched_files, selector=lambda p: os.path.join(prefix, p))
816517
public void addExclude(String exclude) {

        exclude = normalizePath(exclude);
        m_excludes.add(exclude);
        m_allPaths.add(exclude);
    }
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
887863
def _parse_exclude(exclude_file):
    '''
    
    '''
    if os.path.isfile(exclude_file):
        exclude = excludemod.parseExcludeFile(exclude_file, lambda x: None)
    else:
        exclude = dict()
    return exclude
242356
def find_files_to_add(self, exclude_build=True):  # type: (bool) -> list
        
        to_add = []

        for include in self._module.includes:
            for file in include.elements:
                if "__pycache__" in str(file):
                    continue

                if file.is_dir():
                    continue

                file = file.relative_to(self._path)

                if self.is_excluded(file) and isinstance(include, PackageInclude):
                    continue

                if file.suffix == ".pyc":
                    continue

                if file in to_add:
                    # Skip duplicates
                    continue

                self._io.writeln(
                    " - Adding: <comment>{}</comment>".format(str(file)),
                    verbosity=self._io.VERBOSITY_VERY_VERBOSE,
                )
                to_add.append(file)

        # Include project files
        self._io.writeln(
            " - Adding: <comment>pyproject.toml</comment>",
            verbosity=self._io.VERBOSITY_VERY_VERBOSE,
        )
        to_add.append(Path("pyproject.toml"))

        # If a license file exists, add it
        for license_file in self._path.glob("LICENSE*"):
            self._io.writeln(
                " - Adding: <comment>{}</comment>".format(
                    license_file.relative_to(self._path)
                ),
                verbosity=self._io.VERBOSITY_VERY_VERBOSE,
            )
            to_add.append(license_file.relative_to(self._path))

        # If a README is specificed we need to include it
        # to avoid errors
        if "readme" in self._poetry.local_config:
            readme = self._path / self._poetry.local_config["readme"]
            if readme.exists():
                self._io.writeln(
                    " - Adding: <comment>{}</comment>".format(
                        readme.relative_to(self._path)
                    ),
                    verbosity=self._io.VERBOSITY_VERY_VERBOSE,
                )
                to_add.append(readme.relative_to(self._path))

        # If a build script is specified and explicitely required
        # we add it to the list of files
        if self._package.build and not exclude_build:
            to_add.append(Path(self._package.build))

        return sorted(to_add)
1104213
def _match_excluded(self, filename, patterns):
        """"""

        return _wcparse._match_real(
            filename, patterns._include, patterns._exclude, patterns._follow, self.symlinks
        )
618271
protected function includes()
    {
        $moduleInclude = (array) $this->def('include');
        $globalInclude = $this->app['config']->get('module::include');
        $specificInclude = array($this->name.'.php');
        $include = array_merge($moduleInclude, $specificInclude, $globalInclude);
        foreach ($include as $file)
		{
			$path = $this->path.'/'.$file;
			if ($this->app['files']->exists($path)) require $path;
		}
    }
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)