def __enter__(self):
        try:
            self.exc = None
            self.control = ControlHandler()
            self.logfile = self.cache._upload_open(self.archive, mode='r+')
            getLogger().debug("Found state file for %s", self.archive)
        except __HOLE__ as e:
            if e.errno == errno.ENOENT:
                getLogger().debug("Creating state file for %s", self.archive)
                self.logfile = self.cache._upload_open(self.archive, mode='w+')
            else:
                raise e
        # update keys from file
        upload = self.cache._validate_upload(self.logfile)
        self.uri = upload.get('uri', self.uri)
        self.keys = upload.get('keys', self.keys)
        if self._paused is True:
            self._paused = False
            self.cache._write_upload(
                self.uri, self.capsule, self.logfile,
                self.exc, self._paused)
        return self
dataset/ETHPy150Open longaccess/longaccess-client/lacli/upload.py/UploadState.__enter__