if no spec files are present in filters, use all spec files in specs folder
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;
    }
215592
def build_specfile_filesection(spec, files):
    
    str  = '%files\n'

    if 'X_RPM_DEFATTR' not in spec:
        spec['X_RPM_DEFATTR'] = '(-,root,root)'

    str = str + '%%defattr %s\n' % spec['X_RPM_DEFATTR']

    supported_tags = {
        'PACKAGING_CONFIG'           : '%%config %s',
        'PACKAGING_CONFIG_NOREPLACE' : '%%config(noreplace) %s',
        'PACKAGING_DOC'              : '%%doc %s',
        'PACKAGING_UNIX_ATTR'        : '%%attr %s',
        'PACKAGING_LANG_'            : '%%lang(%s) %s',
        'PACKAGING_X_RPM_VERIFY'     : '%%verify %s',
        'PACKAGING_X_RPM_DIR'        : '%%dir %s',
        'PACKAGING_X_RPM_DOCDIR'     : '%%docdir %s',
        'PACKAGING_X_RPM_GHOST'      : '%%ghost %s', }

    for file in files:
        # build the tagset
        tags = {}
        for k in list(supported_tags.keys()):
            try:
                v = file.GetTag(k)
                if v:
                    tags[k] = v
            except AttributeError:
                pass

        # compile the tagset
        str = str + SimpleTagCompiler(supported_tags, mandatory=0).compile( tags )

        str = str + ' '
        str = str + file.GetTag('PACKAGING_INSTALL_LOCATION')
        str = str + '\n\n'

    return str
780020
def set_exclude_filters(self, exclude_filters):
        '''
        
        '''
        self._exclude_filters = exclude_filters
        self.require_module = False
        for exclude_filter in exclude_filters:
            if not exclude_filter.is_path:
                self.require_module = True
                break
921164
function fileFilter(filter) {
  if (filter) {
     if (typeof filter === 'string') {
        var regex = new RegExp(filter);
        return function(filePath) { return regex.test(filePath); }
     }
     else if (filter instanceof RegExp)
        return function(filePath) { return filter.test(filePath); }
     else {   // must be a function itself
        return filter;
     }
   }
   else  // none, return "pass all"
      return function() { return true; };
}
97658
def apply_filters_to_scope(scope, user_params, options)
      helper_instance = fresh_helper_instance

      requested_filters = extract_filters(user_params, options)
      requested_filters.each do |filter_name, filter_arg|
        filter_lambda = configuration[:filters][filter_name][:value]

        args_for_filter_lambda = [filter_arg]
        args_for_filter_lambda << requested_filters if configuration[:filters][filter_name][:include_params]

        if filter_lambda
          scope = helper_instance.instance_exec(scope, *args_for_filter_lambda, &filter_lambda)
        else
          scope = scope.send(filter_name, *args_for_filter_lambda)
        end
      end

      scope
    end
529625
async function filterFiles(files) {
    const clearModule = replace(/^\.\//, '');
    const resources = files | filter(test(/^((icon\.png)|(README(\.\w+)?\.md))$/));
    const missing = without(files, requiredFiles);

    if (missing.length > 0) {
        return reject(Error(`missing ${missing.join(', ')} from the project`));
    }

    if (!contains('icon.png', files)) {
        emitWarning('compiling app without providing an icon.png file');
    }

    const infoFiles = await listFiles('info')
        | filter(test(/[a-z]{2}(_[A-Z]{2,3})?\.md/))
        | map(path.join('info/', _));

    return fs.readFileAsync('index.js', 'utf-8')
        .then(inspect)
        .then(over(lensProp('modules'), filter(startsWith('./'))))
        .then(({ code, modules }) => ({
            code,
            files: union(modules.map(clearModule),
                [...resources, ...requiredFiles, ...infoFiles])
        }));
}
648554
def load_filters(self):
        """"""
        for f in sorted(logdissect.filters.__filters__):
            self.filter_modules[f] = \
                __import__('logdissect.filters.' + f, globals(), \
                locals(), [logdissect]).FilterModule(args=self.filter_args)
92523
def clean():
    ""
    src_dir = easy.options.setdefault("docs", {}).get('src_dir', None)
    if src_dir is None:
        src_dir = 'src' if easy.path('src').exists() else '.'

    with easy.pushd(src_dir):
        for pkg in set(easy.options.setup.packages) | set(("tests",)):
            for filename in glob.glob(pkg.replace('.', os.sep) + "/*.py[oc~]"):
                easy.path(filename).remove()
857369
function inspector(files, options) {
    var spec = files[0],
        comparison = files[1],
        object;

    config = options || {};
    response = {
        passed: [],
        failed: [],
        pending: []
    };
    searchAndCompare(spec, comparison, [], config);
    return response;
}
436356
def missing_requirements(self, specifiers):
        
        for specifier in specifiers:
            try:
                pkg_resources.require(specifier)
            except pkg_resources.DistributionNotFound:
                yield specifier
429817
def clean(ctx, dry_run=False):
    """"""
    # -- VARIATION-POINT 1: Allow user to override in configuration-file
    directories = ctx.clean.directories
    files = ctx.clean.files

    # -- VARIATION-POINT 2: Allow user to add more files/dirs to be removed.
    extra_directories = ctx.clean.extra_directories or []
    extra_files = ctx.clean.extra_files or []
    if extra_directories:
        directories.extend(extra_directories)
    if extra_files:
        files.extend(extra_files)

    # -- PERFORM CLEANUP:
    execute_cleanup_tasks(ctx, cleanup_tasks, dry_run=dry_run)
    cleanup_dirs(directories, dry_run=dry_run)
    cleanup_files(files, dry_run=dry_run)
1109040
def canonicalize_spec(spec, parent_context):
  """"""

  test_specs = {k:v for (k,v) in spec.items() if k.startswith("Test")}
  local_context = {k:v for (k,v) in spec.items() if not k.startswith("Test")}

  context = reduce_contexts(parent_context, local_context)

  if test_specs:
    return {k: canonicalize_spec(v, context) for (k,v) in test_specs.items()}
  else:
    program_chunks = sum([resolve_module(m,context['Definitions']) for m in context['Modules']],[]) + [context['Program']]
    test_spec = {
      'Arguments': context['Arguments'],
      'Program': "\n".join(program_chunks),
      'Expect': context['Expect'],
    }
    return test_spec
1249031
def _build_filters(_filters):
    
    root = utils.NestedDict({})
    for _filter in _filters:
        operation = None
        for operation, token in SPLIT_TOKENS:
            # split "some.key=value" into ["some.key", "value"]
            top_parts = _filter.split(token, 1)
            if len(top_parts) == 2:
                break
        else:
            raise exceptions.CLIAbort('Failed to find valid operation for: %s'
                                      % _filter)

        key, value = top_parts
        current = root
        # split "some.key" into ["some", "key"]
        parts = [part.strip() for part in key.split('.')]

        # Actually drill down and add the filter
        for part in parts[:-1]:
            current = current[part]

        if operation == 'eq':
            current[parts[-1]] = utils.query_filter(value.strip())
        elif operation == 'in':
            current[parts[-1]] = {
                'operation': 'in',
                'options': [{
                    'name': 'data',
                    'value': [p.strip() for p in value.split(',')],
                }],
            }

    return root.to_dict()
645528
function RequireFilter(inputTree, options) {
  if (!(this instanceof RequireFilter)) {
    return new RequireFilter(inputTree, options);
  }

  Filter.call(this, inputTree, options); // this._super()

  options = options || {};

  this.inputTree = inputTree;
  this.files = options.files || [];
  this.description = options.description;
  this.amdPackages = options.amdPackages || [];
  this.amdModules = options.amdModules;
  this.excludePaths = options.excludePaths;
}
1351912
def _dump_spec(spec):
    
    with open("spec.yaml", "w") as f:
        yaml.dump(spec, f, Dumper=MyDumper, default_flow_style=False)
292637
def specs_from_names(names)
      names.map do |name|
        spec = available_spec(name)
        fail "#{name} was not found" if spec.nil?
        spec
      end
    end
1186545
def match_filters(self, path):
        
        # indicate if all required filters were matched
        all_required_match = True

        # iterate over filters to match files
        for filt, ftype in self.__filters:

            # handle "Required" filters:
            if all_required_match and ftype == self.FilterType.Required and not filt.match(path):
                all_required_match = False

            # handle "Include" filters:
            elif ftype == self.FilterType.Include and filt.match(path):
                return True

            # handle "Exclude" filters:
            elif ftype == self.FilterType.Exclude and filt.match(path):
                return False

        # if got here it means we processed all filters, and no include/exclude filter was matched.
        # return if all required were matched
        return all_required_match