@classmethod
  def calculate_unpack_filter(cls, includes=None, excludes=None, spec=None):
    include_patterns = cls._compile_patterns(includes or [],
                                             field_name='include_patterns',
                                             spec=spec)
    exclude_patterns = cls._compile_patterns(excludes or [],
                                             field_name='exclude_patterns',
                                             spec=spec)
    return lambda f: cls._file_filter(f, include_patterns, exclude_patterns)

  # TODO(mateor) move unpack code that isn't jar-specific to fs.archive or an Unpack base class.
Take regex patterns and return a filter function.
dataset/ETHPy150Open pantsbuild/pants/src/python/pants/backend/jvm/tasks/unpack_jars.py/UnpackJars.calculate_unpack_filter