optimistic,if no error,goto done
7499
protected void readHeader(ByteBuffer buffer) {
    super.readHeader(buffer);
    if (this.responseStatus == ResponseStatus.NO_ERROR) {
      this.decodeStatus = BinaryDecodeStatus.DONE;
    }
  }
1110511
private synchronized boolean pessimisticDelete(
                                                  DeleteStack       stack,
                                                  Object            deleteKey)
    {
        _pessimisticDeletes++;
        if (root() != null)
        {
            stack.reset();
            DeleteNode point = stack.deleteNode();

            _vno++;
            if ((_vno&1) == 1)
            {
                findDelete(point, stack, deleteKey);
                if (point.wasFound())
                {
                    finishDelete(point, stack, deleteKey);
                    if (_population <= 0)
                        throw new GBSTreeException("_population = " + _population);
                    _population--;
                }

                synchronized(stack)
                {
                }
                _vno++;
            }
        }

        return optimisticWorked;
    }
342713
private boolean isDone()
   {
      switch (status) {
      case Status.STATUS_PREPARING:
      case Status.STATUS_PREPARED:
      case Status.STATUS_COMMITTING:
      case Status.STATUS_COMMITTED:
      case Status.STATUS_ROLLING_BACK:
      case Status.STATUS_ROLLEDBACK:
         return true;
      default:
         return false;
      }
   }
715117
def ok(self):
        
        try:
            v = int(self._value)
            if v < 0:
                return False
            else:
                return True
        except:
            return False
308053
def ensure_result(self, supress_exception = False, defaultresult = None):
        '''
        
        '''
        try:
            yield self
        except Exception as exc:
            if not self.done():
                self.set_exception(exc)
            if not supress_exception:
                raise
        except:
            if not self.done():
                self.set_exception(FutureCancelledException('cancelled'))
            raise
        else:
            if not self.done():
                self.set_result(defaultresult)
1144845
function done( error ) {
				if ( error ) {
					next( error );
					return;
				}
				if ( !request.hasOwnProperty( 'locals' ) ) {
					request.locals = {};
				}
				request.locals.monitor = metrics;
				next();
			}
426192
async function waitForOperationSucceeded(config, result) {
    let count = 0;
    while (true) {
        let opResult = await new Operations().getOperationDetails({
            subscriptionKey: config.subscriptionKey,
            operationId: result.operationId
        });

        if (opResult.error)
            throw new Error(JSON.stringify(opResult.error, null, 4));

        result = await opResult.json();
        process.stderr.write(`'\r${result.operationState}`);
        count++;
        for (let x = 0; x < count; x++)
            process.stderr.write(`.`);
        process.stderr.write('              ');

        if (result.operationState === 'Failed')
            throw new Error(JSON.stringify(result, null, 4));

        if (result.operationState === 'Succeeded')
            break;
        await Delay(1000);
    }
    process.stderr.write('done\n');
    return result;
}
31809
function done( error ) {
		if ( error && !err ) {
			err = error;
		}
		if ( count === total ) {
			debug( 'Request completed.' );
			if ( err ) {
				if ( ratelimit ) {
					return clbk( err, null, ratelimit );
				}
				return clbk( err );
			}
			if ( total > 1 ) {
				debug( 'Flattening paginated results.' );
				data = flatten( data );
				debug( 'Total number of results: %d', data.length );
			}
			return clbk( null, data, ratelimit );
		}
	}
306113
def done(self, result):
        """"""
        self._geometry = self.geometry()
        QtWidgets.QDialog.done(self, result)
1190667
def raise_on_failure(mainfunc):
    """"""
    try:
        errors = mainfunc()
        if errors:
            exit(errors)
    except CalledProcessError as error:
        exit(error.returncode)
    except SystemExit as error:
        if error.code:
            raise
    except KeyboardInterrupt:  # I don't plan to test-cover this.  :pragma:nocover:
        exit(1)
1108791
def success(self, msg, *args, **kw):
        """"""
        if self.isEnabledFor(SUCCESS):
            self._log(SUCCESS, msg, args, **kw)
903782
def on_finished(self):
        """"""
        self.controller.is_running = False

        error = self.controller.current_error
        if error is not None:
            self.info(self.tr("Stopped due to error(s), see Terminal."))
        else:
            self.info(self.tr("Finished successfully!"))
571264
function settlePromise (p, state, value) {
        var i = 0
            , len = p._pCount;

        // 2.1.2
        // 2.1.3
        if (p._s === $pending) {
            // 2.1.1.1
            p._s = state;
            p._v = value;

            if (state === $rejected) {
                scheduleUnhandledRejection(p);
            }

            // 2.2.4
            while (i < len) {
                scheduleHandler(p, p[i++]);
            }
        }

        return p;
    }
366718
def on_ok(self):
        
        if self.dir_select.value:
            npyscreen.notify_wait('In the process of restoring',
                                  title='Restoring...')
            status = self.restore(self.dirs[self.dir_select.value[0]])
            if status[0]:
                npyscreen.notify_confirm('Status of restore:\n' +
                                         status[1])
            else:
                npyscreen.notify_confirm(status[1])
            self.quit()
        else:
            npyscreen.notify_confirm('Choose a version to restore from')
370115
function whenDone (val, fn) {
  if (isPromise(val)) {
    return val.done(fn);
  } else {
    return fn(val);
  }
}
622387
def check_error(result):
    
    return (result.value != ReturnCode.SUCCESSFUL) and (result.value < ReturnCode.WARNING)
511645
function done(req, next, err, obj) {
    if (err) {
        req.error = {error: err.error || err.message};
    } else {
        req.provider = obj;
    }
    next();
}