Separate wildcard specs into more specs
490749
def _parse_file_spec(self, spec):
        '''
        
        '''
        # separate wildcard specs into more specs
        if '*' in spec['file']:
            expanded_paths = _expand_paths(spec['file'])
            if not expanded_paths:
                return []
            expanded_specs = []
            for p in expanded_paths:
                _spec = copy.copy(spec)
                _spec['file'] = p
                expanded_specs.append(_spec)
            return expanded_specs

        else:
            return [spec]
270107
def optimize_specs( specs )
      names     = {}
      versions  = {}
      platforms = {}

      specs.collect do |(name, version, platform)|
        names[name]         = name     unless names.include?( name )
        versions[version]   = version  unless versions.include?( version )
        platforms[platform] = platform unless platforms.include?( platform )

        [ names[name], versions[version], platforms[platform] ]
      end
    end
803926
@SuppressWarnings("unchecked")
  private Set<String> extractIgnorePatterns(Map<String, Object> configuration) {
    List<String> patterns = asList("glob:.*",// hidden files
        "glob:*~", "glob:#*#", "glob:.#*", // emacs
        "glob:*~", "glob:[._]*.s[a-w][a-z]", "glob:[._]s[a-w][a-z]", "glob:*.un~" // vim
    );
    Set<String> s = new HashSet<>((List<String>) configuration.getOrDefault("ignore-patterns",patterns));
    s.addAll(patterns);
    return unmodifiableSet(s);
  }
546295
function completeSpecFiles(argv, _filters) {
        // if user manually defined an empty specFiles array, do not add specFiles from folder
        if (Object.keys(_filters.specFiles).length === 0 && !argv.specFiles) {
            io_1.getAllFiles(specsDir, '.spec.ts').forEach(specFile => _filters.specFiles[specFile] = true);
            return true;
        }
        else {
            let removeOnly = true;
            const removeSpecFiles = {};
            for (const specFile in _filters.specFiles) {
                let remove = false;
                let matchStr = specFile;
                if (specFile.substr(0, 1) === '-') {
                    remove = true;
                    matchStr = specFile.substr(1, specFile.length - 1);
                }
                else {
                    removeOnly = false;
                }
                if (remove) {
                    delete _filters.specFiles[specFile];
                    removeSpecFiles[matchStr] = true;
                }
            }
            if (removeOnly) {
                io_1.getAllFiles(specsDir, '.spec.ts')
                    .filter(specFile => !(specFile in removeSpecFiles))
                    .forEach(specFile => _filters.specFiles[specFile] = true);
            }
        }
        return false;
    }
1260545
def parse_specs(cls, target_specs, build_root=None, exclude_patterns=None, tags=None):
    
    build_root = build_root or get_buildroot()
    spec_parser = CmdLineSpecParser(build_root)

    dependencies = tuple(OrderedSet(spec_parser.parse_spec(spec_str) for spec_str in target_specs))
    return Specs(
      dependencies=dependencies,
      exclude_patterns=exclude_patterns if exclude_patterns else tuple(),
      tags=tags)
439304
def _combine_core_aux_specs(self):
        """"""
        all_specs = []
        for core_dict in self._permute_core_specs():
            for aux_dict in self._permute_aux_specs():
                all_specs.append(_merge_dicts(core_dict, aux_dict))
        return all_specs
1006206
def make_tokenizer(specs):
    """"""

    def compile_spec(spec):
        name, args = spec
        return name, re.compile(*args)

    compiled = [compile_spec(s) for s in specs]

    def match_specs(specs, str, i, position):
        line, pos = position
        for type, regexp in specs:
            m = regexp.match(str, i)
            if m is not None:
                value = m.group()
                nls = value.count(u'\n')
                n_line = line + nls
                if nls == 0:
                    n_pos = pos + len(value)
                else:
                    n_pos = len(value) - value.rfind(u'\n') - 1
                return Token(type, value, (line, pos + 1), (n_line, n_pos))
        else:
            errline = str.splitlines()[line - 1]
            raise LexerError((line, pos + 1), errline)

    def f(str):
        length = len(str)
        line, pos = 1, 0
        i = 0
        while i < length:
            t = match_specs(compiled, str, i, (line, pos))
            yield t
            line, pos = t.end
            i += len(t.value)

    return f
1283095
def filter_wildcard(names, pattern):
    
    return tuple(name for name in names
                 if fnmatch.fnmatch(name, pattern))
237516
function pathMatchesGlobs(filePath, patterns, excludedPatterns) {
  const patternList = [].concat(patterns);
  const excludedPatternList = [].concat(excludedPatterns || []);
  const opts = { matchBase: true };

  return (
    patternList.some(pattern => minimatch(filePath, pattern, opts)) &&
    !excludedPatternList.some(excludedPattern =>
      minimatch(filePath, excludedPattern, opts)
    )
  );
}
751288
function applyPaths(loader, name) {
  // most specific (most number of slashes in path) match wins
  var pathMatch = '', wildcard, maxWildcardPrefixLen = 0;

  var paths = loader.paths;
  var pathsCache = loader._loader.paths;

  // check to see if we have a paths entry
  for (var p in paths) {
    if (paths.hasOwnProperty && !paths.hasOwnProperty(p))
      continue;

    // paths sanitization
    var path = paths[p];
    if (path !== pathsCache[p])
      path = paths[p] = pathsCache[p] = urlResolve(paths[p], isRel(paths[p]) ? baseURI : loader.baseURL);

    // exact path match
    if (p.indexOf('*') === -1) {
      if (name == p)
        return paths[p];
      
      // support trailing / in paths rules
      else if (name.substr(0, p.length - 1) == p.substr(0, p.length - 1) && (name.length < p.length || name[p.length - 1] == p[p.length - 1]) && (paths[p][paths[p].length - 1] == '/' || paths[p] == '')) {
        return paths[p].substr(0, paths[p].length - 1) + (name.length > p.length ? (paths[p] && '/' || '') + name.substr(p.length) : '');
      }
    }
    // wildcard path match
    else {
      var pathParts = p.split('*');
      if (pathParts.length > 2)
        throw new TypeError('Only one wildcard in a path is permitted');

      var wildcardPrefixLen = pathParts[0].length;
      if (wildcardPrefixLen >= maxWildcardPrefixLen &&
          name.substr(0, pathParts[0].length) == pathParts[0] &&
          name.substr(name.length - pathParts[1].length) == pathParts[1]) {
            maxWildcardPrefixLen = wildcardPrefixLen;
            pathMatch = p;
            wildcard = name.substr(pathParts[0].length, name.length - pathParts[1].length - pathParts[0].length);
          }
    }
  }

  var outPath = paths[pathMatch];
  if (typeof wildcard == 'string')
    outPath = outPath.replace('*', wildcard);

  return outPath;
}
1009163
def _spec_to_globs(address_mapper, specs):
  """"""
  patterns = set()
  for spec in specs:
    patterns.update(spec.make_glob_patterns(address_mapper))
  return PathGlobs(include=patterns, exclude=address_mapper.build_ignore_patterns)
139532
def load_wildcard(as = nil)
      seg = nesting_segments[enclosing_resources.size] or ResourcesController.raise_resource_mismatch(self)

      segment = seg[:segment]
      singleton = seg[:singleton]

      if resource_specification_map[segment]
        spec = resource_specification_map[segment]
        spec = spec.dup.tap {|s| s.as = as} if as
      else
        spec = Specification.new(singleton ? segment : segment.singularize, :singleton => singleton, :as => as)
      end
      load_enclosing_resource_from_specification(spec)
    end
726624
def split_vars(_vars):
    """"""
    return (
        {
            k.upper().strip(): parse_conf_data(v.strip(), tomlfy=True)
            for k, _, v in [item.partition("=") for item in _vars]
        }
        if _vars
        else {}
    )
70885
def splits(cls, fields, root=".data", train="en-ud-tag.v2.train.txt",
               validation="en-ud-tag.v2.dev.txt",
               test="en-ud-tag.v2.test.txt", **kwargs):
        

        return super(UDPOS, cls).splits(
            fields=fields, root=root, train=train, validation=validation,
            test=test, **kwargs)
1017950
def glob_in_parents(dir, patterns, upper_limit=None):
    """"""

    assert(isinstance(dir, str))
    assert(isinstance(patterns, list))

    result = []

    absolute_dir = os.path.join(os.getcwd(), dir)
    absolute_dir = os.path.normpath(absolute_dir)
    while absolute_dir:
        new_dir = os.path.split(absolute_dir)[0]
        if new_dir == absolute_dir:
            break
        result = glob([new_dir], patterns)
        if result:
            break
        absolute_dir = new_dir

    return result
881646
def _permute_core_specs(self):
        """"""
        obj_trees = []
        projects = self._get_requested_spec(self._obj_lib, _PROJECTS_STR)
        for project in projects:
            models = self._get_requested_spec(project, _MODELS_STR)
            for model in models:
                runs = self._get_requested_spec(model, _RUNS_STR)
                for run in runs:
                    obj_trees.append({
                        self._NAMES_SUITE_TO_CALC[_PROJECTS_STR]: project,
                        self._NAMES_SUITE_TO_CALC[_MODELS_STR]: model,
                        self._NAMES_SUITE_TO_CALC[_RUNS_STR]: run,
                    })
        return obj_trees
38741
def normalize_excludes(rootpath, excludes):
    """"""
    return [path.normpath(path.abspath(exclude)) for exclude in excludes]