Extract the VQA V2 feature data set to directory unless it's there.
193117
def _get_vqa_v2_image_feature_dataset(
    directory, feature_url, feature_filename="mscoco_feat.tar.gz"):
  """"""
  feature_file = generator_utils.maybe_download_from_drive(
      directory, feature_filename, feature_url)
  with tarfile.open(feature_file, "r:gz") as feature_tar:
    feature_tar.extractall(directory)
405767
def exclude_data_files(self, package, src_dir, files):
        """'"""
        files = list(files)
        patterns = self._get_platform_patterns(
            self.exclude_package_data,
            package,
            src_dir,
        )
        match_groups = (
            fnmatch.filter(files, pattern)
            for pattern in patterns
        )
        # flatten the groups of matches into an iterable of matches
        matches = itertools.chain.from_iterable(match_groups)
        bad = set(matches)
        keepers = (
            fn
            for fn in files
            if fn not in bad
        )
        # ditch dupes
        return list(_unique_everseen(keepers))
940961
def extract(self, *args):
        
        self.time = np.loadtxt(self.abspath,
                               skiprows=self._attributes['data_idx']+1,
                               unpack=True, usecols=(0,))
        for variable_idx in args:
            data = np.loadtxt(self.abspath,
                              skiprows=self._attributes['data_idx']+1,
                              unpack=True,
                              usecols=(variable_idx,))
            with open(self.abspath) as fobj:
                for idx, line in enumerate(fobj):
                    if idx == 1 + variable_idx+self._attributes['CATALOG']:
                        try:
                            self.data[variable_idx] = data[:len(self.time)]
                        except TypeError:
                            self.data[variable_idx] = data.base
                        self.label[variable_idx] = line.replace("\'",
                                                                '').replace("\n",
                                                                            "")
                        break
550532
def extract(self, destination):
        """"""
        with tarfile.open(self.archive, 'r:') as tar:
            tar.extractall(path=destination)
1117685
def load_local_dataset(self, ds_str):
        '''
        
        '''
        if cdl.is_cdl(ds_str):
            ds_str = self.generate_dataset(ds_str)

        if netcdf.is_netcdf(ds_str):
            return MemoizedDataset(ds_str)

        # Assume this is just a Generic File if it exists
        if os.path.isfile(ds_str):
            return GenericFile(ds_str)

        raise ValueError("File is an unknown format")
790557
def ensure_versions_dir_exists(tfenv_path):
    """"""
    versions_dir = os.path.join(tfenv_path, 'versions')
    if not os.path.isdir(tfenv_path):
        os.mkdir(tfenv_path)
    if not os.path.isdir(versions_dir):
        os.mkdir(versions_dir)
    return versions_dir
37766
def detect_vcs():
    """"""
    location = os.path.abspath('.')
    while True:
        for vcs in Git, Mercurial, Bazaar, Subversion:
            if vcs.detect(location):
                return vcs
        parent = os.path.dirname(location)
        if parent == location:
            raise Failure("Couldn't find version control data"
                          " (git/hg/bzr/svn supported)")
        location = parent
1316746
def data_available(dataset_name=None):
    """"""
    try:
        from itertools import zip_longest
    except ImportError:
        from itertools import izip_longest as zip_longest
    dr = data_resources[dataset_name]
    zip_urls = (dr['files'], )
    if 'save_names' in dr: zip_urls += (dr['save_names'], )
    else: zip_urls += ([],)

    for file_list, save_list in zip_longest(*zip_urls, fillvalue=[]):
        for f, s in zip_longest(file_list, save_list, fillvalue=None):
            if s is not None: f=s # If there is a save_name given, use that one
            if not os.path.exists(os.path.join(data_path, dataset_name, f)):
                return False
    return True
242711
def extract_archive(archive_path, destination_path):
    """"""
    tar = tarfile.open(archive_path)
    tar.errorlevel = 1
    tar.extractall(destination_path)
746611
def check_local() -> None:
    
    to_check = ['./replay', './replay/toDo', './replay/archive']

    for i in to_check:
        if not os.path.exists(i):
            os.makedirs(i)
234380
def find_vext_files(self):
        
        packages = self.depends_on("vext")
        vext_files = []
        for location in [package.get("location") for package in packages]:
            if not location:
                continue
            vext_files.extend(glob(join(location, "*.vext")))
        return vext_files
932212
def run(self, dataset_path):
        """"""
        features = self._generate_features(self._feature_extractors)
        features.to_csv(dataset_path)
1054963
def extract_dms (archive, compression, cmd, verbosity, interactive, outdir):
    """"""
    check_archive_ext(archive)
    cmdlist = [cmd, '-d', outdir]
    if verbosity > 1:
        cmdlist.append('-v')
    cmdlist.extend(['u', archive])
    return cmdlist
1001641
def extract_cab (archive, compression, cmd, verbosity, interactive, outdir):
    """"""
    cmdlist = [cmd, '-d', outdir]
    if verbosity > 0:
        cmdlist.append('-v')
    cmdlist.append(archive)
    return cmdlist
684495
def extract(self, extractdir=None, verbose=False):
        """"""
        if extractdir is None:
            filebase, ext = os.path.splitext(self.path)
            if ext in ('.gz', '.bz2', '.xz'):
                filebase, _ext = os.path.splitext(filebase)
            extractdir = os.path.basename(filebase)
            if os.path.exists(extractdir):
                tempdir = tempfile.mkdtemp(prefix='vimball-', dir=os.getcwd())
                extractdir = os.path.join(tempdir.split('/')[-1], extractdir)

        self.fd.seek(0)
        for filename, lines, offset in self.files:
            filepath = os.path.join(extractdir, filename)
            try:
                directory = os.path.dirname(filepath)
                mkdir_p(directory)
            except OSError as e:
                raise ArchiveError(f"failed creating directory {directory!r}: {e.strerror}")
            with open(filepath, 'w') as f:
                if verbose:
                    print(filepath)
                self.fd.seek(offset)
                for i in range(lines):
                    f.write(self.readline())
261798
def data_from_archive(self):
        """"""

        archive_data = super(SetupPyMetadataExtractor, self).data_from_archive

        archive_data['has_packages'] = self.has_packages
        archive_data['packages'] = self.packages
        archive_data['has_bundled_egg_info'] = self.has_bundled_egg_info
        sphinx_dir = self.sphinx_dir
        if sphinx_dir:
            archive_data['sphinx_dir'] = "/".join(sphinx_dir.split("/")[1:])
            archive_data['build_deps'].append(
                ['BuildRequires', self.name_convertor.rpm_name(
                    "sphinx", self.base_python_version)])

        return archive_data
1267419
def write_to_directory(self, dataset_info_dir):
    """"""
    # Save the metadata from the features (vocabulary, labels,...)
    if self.features:
      self.features.save_metadata(dataset_info_dir)

    if self.redistribution_info.license:
      with tf.io.gfile.GFile(self._license_filename(dataset_info_dir),
                             "w") as f:
        f.write(self.redistribution_info.license)

    with tf.io.gfile.GFile(self._dataset_info_filename(dataset_info_dir),
                           "w") as f:
      f.write(self.as_json)