Opens archive.
        :return:
514653
def open(self):
        '''
        
        '''
        if self.__arch is not None:
            raise salt.exceptions.SaltException('Archive already opened.')
        self.__arch = tarfile.TarFile.bz2open(self.archive_path, 'w')
3930
def extract_tarfile(archive_name, destpath):
    ""
    archive = tarfile.open(archive_name)
    archive.extractall(destpath)
977562
def get_url(self):
        
        return os.path.join(
            '/archive',
            self.get_year(),
            self.get_month(),
            self.get_day()
        )
481263
async def open(self) -> 'Tails':
        

        LOGGER.debug('Tails.open >>>')

        self._reader_handle = await blob_storage.open_reader('default', self._tails_config_json)

        LOGGER.debug('Tails.open <<<')
        return self
110785
def read_archive(archive, fname):
    

    # Note that deduplication here is equivalent to an upsert/ignore,
    # but avoids requirement for a database-specific implementation.

    zfile = zipfile.ZipFile(archive)
    contents = zfile.open(fname, 'r')
    fobj = io.TextIOWrapper(contents)

    seen = set()
    for line in fobj:
        line = line.rstrip('\t|\n')
        if line not in seen:
            yield line.split('\t|\t')
            seen.add(line)
1238591
def open(self):
        """"""
        # guess protocol
        if self.protocol==0:
            _in = open(self.name) # don't specify binary mode !
        else:
            _in = open(self.name,'rb')
        self.fields = cPickle.load(_in)
        self.next_id = cPickle.load(_in)
        self.records = cPickle.load(_in)
        self.indices = cPickle.load(_in)
        for f in self.indices.keys():
            setattr(self,'_'+f,Index(self,f))
        _in.close()
        self.mode = "open"
        return self
190209
def from_archive(archive_filename, py_interpreter=sys.executable):
    
    with _extract_to_tempdir(archive_filename) as root_dir:
        data = _setup_py_run_from_dir(root_dir, py_interpreter)
    return data
993006
def _save_archive(self):
        
        import json
        from utility import json_serial
        with open(self.archpath, 'w') as f:
            json.dump(self.archive, f, default=json_serial)
723685
def _search_archive(pattern, archive, verbosity=0, interactive=True):
    """"""
    grep = util.find_program("grep")
    if not grep:
        msg = "The grep(1) program is required for searching archive contents, please install it."
        raise util.PatoolError(msg)
    tmpdir = util.tmpdir()
    try:
        path = _extract_archive(archive, outdir=tmpdir, verbosity=-1)
        return util.run_checked([grep, "-r", "-e", pattern, "."], ret_ok=(0, 1), verbosity=1, cwd=path)
    finally:
        shutil.rmtree(tmpdir, onerror=rmtree_log_error)
1090228
def open(self, mode='r', buffering=-1, encoding=None,
             errors=None, newline=None):
        
        if self._closed:
            self._raise_closed()
        return FakeFileOpen(self.filesystem, use_io=True)(
            self._path(), mode, buffering, encoding, errors, newline)
732083
def get_archive_link(self, archive_format, ref=github.GithubObject.NotSet):
        
        assert isinstance(archive_format, (str, unicode)), archive_format
        assert ref is github.GithubObject.NotSet or isinstance(ref, (str, unicode)), ref
        url = self.url + "/" + archive_format
        if ref is not github.GithubObject.NotSet:
            url += "/" + ref
        headers, data = self._requester.requestJsonAndCheck(
            "GET",
            url
        )
        return headers["location"]
575818
def OpenFile(self, filepath):
    
    archive = False
    if '.zip/' in filepath:
      archive = True
      archive_type = '.zip'
    if '.par/' in filepath:
      archive = True
      archive_type = '.par'
    if archive:
      path, archived_file = filepath.split(archive_type)
      path += archive_type
      zip_file = zipfile.ZipFile(path)
      return zip_file.open(archived_file.strip('/'))
    return open(filepath)
903619
def extract_to_disk(self):
        """"""
        archive_name, extension = os.path.splitext(os.path.basename(self.file.name))
        if not os.path.isdir(os.path.join(os.getcwd(), archive_name)):
            os.mkdir(archive_name)
        os.chdir(archive_name)
        for filename, data in self.extract().items():
            f = open(filename, 'wb')
            f.write(data or b'')
            f.close()
639588
def open(self):
        
        if self._f is not None:
            return self._f
        try:
            rv, self.should_close = open_stream(self.name, self.mode,
                                                self.encoding,
                                                self.errors,
                                                atomic=self.atomic)
        except (IOError, OSError) as e:
            from .exceptions import FileError
            raise FileError(self.name, hint=get_streerror(e))
        self._f = rv
        return rv
551923
def content(self):
        
        raw_content = self._manager.api.session.get(self.download_link).content
        data = BytesIO(raw_content)
        archive = ZipFile(data)
        filename = archive.filelist[0]  # Always 1 file in the archive
        return archive.read(filename)
272111
def download_archive(self, name, file_path):
        
        uri = self.URI + "/archive/" + name
        return self._client.download(uri, file_path)
538529
def _open_next(self):
        """"""

        # is the file split over archives?
        if (self._cur.flags & rarfile.RAR_FILE_SPLIT_AFTER) == 0:
            return False

        if self._fd:
            self._fd.close()
            self._fd = None

        # open next part
        self._volfile = self._parser._next_volname(self._volfile)
        fd = rarfile.XFile(self._volfile)
        self._fd = fd
        sig = fd.read(len(self._parser._expect_sig))
        if sig != self._parser._expect_sig:
            raise rarfile.BadRarFile("Invalid signature")

        # loop until first file header
        while 1:
            cur = self._parser._parse_header(fd)
            if not cur:
                raise rarfile.BadRarFile("Unexpected EOF")
            if cur.type in (rarfile.RAR_BLOCK_MARK, rarfile.RAR_BLOCK_MAIN):
                if cur.add_size:
                    fd.seek(cur.add_size, 1)
                continue
            if cur.orig_filename != self._inf.orig_filename:
                raise rarfile.BadRarFile("Did not found file entry")
            self._cur = cur
            self._cur_avail = cur.add_size
            return True