Perform

@param {boolean} showPrompts - Show prompts

@return {promise<result>}
975600
async function (showPrompts) {

    logger.step('** Deploying OpenST Utility Contract');
    if (showPrompts) {
      logger.info('Utility Chain Deployer Address: ' + utilityDeployerAddress);
      logger.info('Value Chain ID: ' + VALUE_CHAIN_ID);
      logger.info('Utility Chain ID: ' + UTILITY_CHAIN_ID);
      logger.info('Foundation Address: ' + foundationAddress);

      await new Promise(
        function (onResolve, onReject) {
          prompts.question("Please verify all above details. Do you want to proceed? [Y/N]", function (intent) {
            if ((intent === 'Y') || (intent === 'y')) {
              logger.info('Great! Proceeding deployment.');
              prompts.close();
              onResolve();
            } else {
              logger.error('Exiting deployment scripts. Change the env vars and re-run.');
              process.exit(1);
            }
          });
        }
      );
    } else {
      prompts.close();
    }

    const openSTUtiltiyContractDeployResponse = await deployHelper.perform(openSTUtilityContractName,
      web3Provider, openSTUtilityContractAbi, openSTUtilityContractBin, utilityDeployerName,
      {gasPrice: UC_GAS_PRICE, gas: UC_GAS_LIMIT}, [VALUE_CHAIN_ID, UTILITY_CHAIN_ID, utilityRegistrarContractAddress]
    );

    const openSTUtilityContractAddress = openSTUtiltiyContractDeployResponse.contractAddress
      , openStUtility = new OpenStUtilityKlass(openSTUtilityContractAddress);

    logger.step('** Initiating OwnerShipTransfer of openSTUtility Contract to foundation');

    await openStUtility.initiateOwnerShipTransfer(utilityDeployerName,
      foundationAddress, {gasPrice: UC_GAS_PRICE, gas: UC_GAS_LIMIT});

    const getOwnerResponse = await openStUtility.getOwner();

    if (!foundationAddress.equalsIgnoreCase(getOwnerResponse.data.address)) {
      logger.error('Exiting the deployment as owner of openSTUtility Contract does not match');
      process.exit(1);
    }

    return Promise.resolve(responseHelper.successWithData(
      {contract: 'openSTUtility', address: openSTUtilityContractAddress}));
  }
1360423
def for_prompt(cls, **kw):
        
        kw.setdefault('enable_abort_and_exit_bindings', True)
        kw.setdefault('enable_search', True)
        kw.setdefault('enable_auto_suggest_bindings', True)

        return cls(**kw)
1043603
public void setPromptView(View prompt) {
        boolean showing = isShowing();
        if (showing) {
            removePromptView();
        }
        mPromptView = prompt;
        if (showing) {
            show();
        }
    }
1281714
function show() {
    var _this3 = this;

    if (this[_show]) return this[_show];
    var originalDisplay = this.attr('__originalDisplay') || '';
    var originalState = this.attr('__originalState') || 'default';
    var states = this.attr('states');

    if (states.show) {
      var _st = ['show', originalState];

      if (states.beforeShow) {
        _st.unshift('beforeShow');
      }

      var deferred = this.resolveStates(_st, function () {
        var state = _this3.attr('state');

        if (state === 'hide') {
          _this3.once('state-from-hide', function () {
            _this3.attr('display', originalDisplay);
          });
        }
      });
      deferred.promise = deferred.promise.then(function () {
        if (!_this3[_hide]) {
          delete _this3.__attr.__originalDisplay;
          delete _this3.__attr.__originalState;

          if (states.show.__default) {
            delete states.show;

            _this3.attr('states', states);
          }
        }

        delete _this3[_show];
      });
      this[_show] = deferred;
      return deferred;
    }

    var rs = this[_resolveState];

    if (rs) {
      rs.resolve();
      rs.promise.then(function () {
        _this3.attr('state', originalState);

        _this3.attr('display', originalDisplay);
      });
      return rs;
    }

    this.attr('state', originalState);
    this.attr('display', originalDisplay);
    return this;
  }
1307857
function when(promises) {
	promises = arrayify(promises);
	var whenPromise = new PromiseFactory();

	var pending = promises.length;
	var results = [];

	var resolve = function (i) {
		return function (val) {
			results[i] = val;
			pending--;

			if (pending === 0) {
				whenPromise.resolve(results);
			}
		};
	};

	promises.forEach(function (p, i) {
		if (!p || !p.then) return;

		p.then(resolve(i), whenPromise.reject);
	});

	return whenPromise.promise();
}
686651
async function (showPrompts) {
    logger.step('** Deploying valueCore Contract');
    if (showPrompts) {
      // confirming the important addresses
      logger.info("Deployer Address: " + valueDeployerAddress);
      logger.info("Value Ops Address: " + valueOpsAddress);
      logger.info("Value Registrar Contract: " + valueRegistrarContractAddress);
      logger.info("OpenST Utility Contract: " + openSTUtilityContractAddress);
      logger.info("OpenST Value Contract: " + openSTValueContractAddress);

      await new Promise(
        function (onResolve, onReject) {
          prompts.question("Please verify all above details. Do you want to proceed? [Y/N]", function (intent) {
            if ((intent === 'Y') || (intent === 'y')) {
              logger.info('Great! Proceeding deployment.');
              prompts.close();
              onResolve();
            } else {
              logger.error('Exiting deployment scripts. Change the env vars and re-run.');
              process.exit(1);
            }
          });
        }
      );
    } else {
      prompts.close();
    }

    const valueCoreContractDeployResponse = await deployHelper.perform(valueCoreContractName, web3Provider,
      valueCoreContractAbi, valueCoreContractBin, valueDeployerName, {gasPrice: VALUE_GAS_PRICE, gas: VALUE_GAS_LIMIT},
      [valueRegistrarContractAddress, VALUE_CHAIN_ID, UTILITY_CHAIN_ID, openSTUtilityContractAddress]);

    const valueCoreContractAddress = valueCoreContractDeployResponse.contractAddress;

    logger.step('** Calling addCore of Value Registrar Contract');
    await valueRegistrar.addCore(valueOpsName, openSTValueContractAddress, valueCoreContractAddress);

    return Promise.resolve(responseHelper.successWithData(
      {contract: 'valueCore', address: valueCoreContractAddress}));
  }
64785
function showResults(files, formattedFiles, unformattedFiles, errors) {
    const formattedCount = formattedFiles.length;
    const unformattedCount = unformattedFiles.length;
    const errorCount = errors.length;
    const filesCount = files.length;
    const okCount = filesCount - formattedCount - unformattedCount - errorCount;

    if (okCount > 0 && !simplifyOutput) {
        console.log(okCount + ' of ' + filesCount + ' files already correct.');
    }

    if (formattedCount > 0) {
        if (!simplifyOutput) {
            console.log('Formatted ' + formattedCount + ' of ' + filesCount + ' files:');
        }
        for (const sourcePath of formattedFiles) {
            if (simplifyOutput) {
                console.log(sourcePath);
            } else {
                console.log('    - ' + sourcePath);
            }
        }
    }

    if (unformattedCount > 0) {
        // Should only happen when !fixMode
        console.error(unformattedCount + ' of ' + filesCount + ' files need formatting:');
        for (const sourcePath of unformattedFiles) {
            console.error('    - ' + sourcePath);
        }
        process.exitCode = 1;
    }

    if (errorCount > 0) {
        console.error('\x1b[32mErrors occured processing ' + errorCount + ' of ' + filesCount + ' files.\x1b[m');
        process.exitCode = -1;
    }

    return { formattedFiles, unformattedFiles };
}
335419
def _prereqs_fulfilled?(p)
      ret = true
      p.prereqs.each do |req|
        a = @prompts.find do |answer|
          answer.config_key == req[:config_key] &&
          answer.answer == req[:config_value]
        end
        ret = false if a.nil?
      end
      ret
    end
1015674
public Message messageAt(ConversationPrompt prompt, Conversation conversation) {
        return messageAt(conversation.getPrompts().indexOf(prompt));
    }
709786
public String showPrompt() {
        String prompt = isAnsiEnabled() ? ansiPrompt(PROMPT).toString() : PROMPT;
        return showPrompt(prompt);
    }
215685
function executePromiseTask (promise, fn) {
    // Promise Resolution Procedure:
    // https://github.com/promises-aplus/promises-spec#the-promise-resolution-procedure
    try {
        fn(value => {
            if (promise._state !== null) return; // Already settled
            if (value === promise) throw new TypeError('A promise cannot be resolved with itself.');
            var shouldExecuteTick = promise._lib && beginMicroTickScope();
            if (value && typeof value.then === 'function') {
                executePromiseTask(promise, (resolve, reject) => {
                    value instanceof Promise ?
                        value._then(resolve, reject) :
                        value.then(resolve, reject);
                });
            } else {
                promise._state = true;
                promise._value = value;
                propagateAllListeners(promise);
            }
            if (shouldExecuteTick) endMicroTickScope();
        }, handleRejection.bind(null, promise)); // If Function.bind is not supported. Exception is handled in catch below
    } catch (ex) {
        handleRejection(promise, ex);
    }
}
1221103
function runPrompts (opts) {
  if (opts.questionnaire && this.init.configure) {
    this.sprout.emit('msg', 'running questionnaire function')
    const unansweredConfig = lodash.filter(this.init.configure, (q) => {
      return !lodash.includes(lodash.keys(this.config), q.name)
    })
    return opts.questionnaire(unansweredConfig)
      .then((answers) => { return lodash.assign(this.config, answers) })
  }
}
957487
function writePrompt () {
        charm.position(1,1);
        charm.display('bright');
        charm.write(promptStart);
        charm.write(' ');
        charm.display('reset');
    }
516774
function Prompt( question, rl, answers ) {

  // Setup instance defaults property
  _.assign( this, {
    height : 0,
    status : "pending"
  });

  // Set defaults prompt options
  this.opt = _.defaults( _.clone(question), {
    validate: function() { return true; },
    filter: function( val ) { return val; },
    when: function() { return true; }
  });

  // Check to make sure prompt requirements are there
  if (!this.opt.message) {
    this.throwParamError("message");
  }
  if (!this.opt.name) {
    this.throwParamError("name");
  }

  // Normalize choices
  if ( _.isArray(this.opt.choices) ) {
    this.opt.choices = new Choices( this.opt.choices, answers );
  }

  this.rl = rl;

  return this;
}
323901
function handlePromise(query, q, model, resultsPerPage) {
  return Promise.all([
    query.exec(),
    model.count(q).exec()
  ]).spread(function(results, count) {
    return [
      results,
      Math.ceil(count / resultsPerPage) || 1,
      count
    ]
  });
}
214159
function () {

    var after = {
        loop: function (condition) {
            if (!utils.isFunction(condition)) {
                throw new Error('Asynk loop function require a function as first argument');
            }
            _Context.loopDefer = _Context.loopDefer || new Deferred();
            _Context.loopResults = _Context.loopResults || [];
            this.done(function () {
                var result = utils.toArray(arguments);
                if (result.length > 1) {

                    _Context.loopResults.push(result);
                }
                else {
                    _Context.loopResults.push(result[0]);
                }

                if (condition.apply(null, result)) {
                    //reset values
                    for (var i in _Context.tasks) {
                        _Context.tasks[i].status = WAITING;
                    }
                    _Context.results = [];
                    _Context.currentTasks = [];
                    _Context.exec.fct.apply(null, _Context.exec.args).loop(condition);
                }
                else {
                    _Context.loopDefer.resolve(_Context.loopResults);
                }
            });
            this.fail(_Context.loopDefer.reject);
            return _Context.loopDefer.promise();
        },
        asyncLoop: function (condition) {
            if (!utils.isFunction(condition)) {
                throw new Error('Asynk loop function require a function as first argument');
            }
            _Context.loopDefer = _Context.loopDefer || new Deferred();
            _Context.loopResults = _Context.loopResults || [];
            this.done(function () {
                var result;
                if (arguments.length > 1) {
                    result = utils.toArray(arguments);
                }
                else {
                    result = arguments[0];
                }
                _Context.loopResults.push(result);
                
                condition.apply(null, [result, function (err, loop) {
                    if (err) {
                        return _Context.loopDefer.reject(err);
                    }
                    if (loop) {
                        //reset values
                        for (var i in _Context.tasks) {
                            _Context.tasks[i].status = WAITING;
                        }
                        _Context.results = [];
                        _Context.currentTasks = [];
                        _Context.exec.fct.apply(null, _Context.exec.args).asyncLoop(condition);
                    }
                    else {
                        _Context.loopDefer.resolve(_Context.loopResults);
                    }
                }]);
            });
            this.fail(_Context.loopDefer.reject);
            return _Context.loopDefer.promise();
        }
    };

    var Asynk = {};

    var _Context = {
        tasks: [],
        aliasMap: {},
        results: [],
        currentTasks: Asynk.currentTasks
    };

    Asynk.add = function (fct) {
        if (utils.isUndefined(fct) || !utils.isFunction(fct)) {
            throw new Error('Asynk add require a function as argument');
        }
        var newId = _Context.tasks.length;
        _Context.tasks[newId] = new Task(_Context, newId, fct);
        _Context.currentTasks = [newId];
        this.args(new DefArg('callback'));
        return this;
    };

    Asynk.each = function (datas, fct) {
        if (utils.isUndefined(fct) || !utils.isFunction(fct)) {
            throw new Error('Asynk each require a function as second argument');
        }
        _Context.currentTasks = [];
        datas.forEach(function (data) {
            var newId = _Context.tasks.length;
            _Context.tasks[newId] = new Task(_Context, newId, fct);
            _Context.tasks[newId].item = data;
            _Context.currentTasks.push(newId);
        });
        this.args(new DefArg('item'), new DefArg('callback'));
        return this;
    };

    Asynk.args = function () {
        var args = utils.toArray(arguments);
        _Context.currentTasks.forEach(function(currentTask) {
            _Context.tasks[currentTask].args = utils.toArray(args);
        });
        return this;
    };

    Asynk.require = function (dependencies) {
        if (!utils.isArray(dependencies)) {
          dependencies = [dependencies];
        }
        _Context.currentTasks.forEach(function(currentTask) {
            var current = _Context.tasks[currentTask];
            current.dependencies = current.dependencies.concat(dependencies);
        });
        return this;
    };

    Asynk.alias = function (alias) {
        if (utils.isString(alias)) {
            _Context.currentTasks.forEach(function (currentTask, index) {
                _Context.tasks[currentTask].alias = alias;
            });
            if (_Context.currentTasks.length > 1) {
                _Context.aliasMap[alias] = _Context.currentTasks;
            }
            else {
                _Context.aliasMap[alias] = _Context.currentTasks[0];
            }
        }
        return this;
    };

    Asynk.serie = function(endcallArgs) {
        _Context.exec = {
            fct: Asynk.serie,
            args: [endcallArgs]
        };
        var defer = new Deferred();
        var endTask = new Task(_Context, 'end', defer.resolve.bind(defer));
        endTask.args = endcallArgs || [new DefArg('alias', 'all')];
        var currentId = 0;

        var cb = function (err, data) {
            if (err) {
                _Context.tasks[currentId].status = FAIL;
                defer.reject(err);
                endTask.reject(err);
                return;
            }
            _Context.tasks[currentId].status = DONE;
            _Context.results.push(data);
            currentId++;
            next();
        };
        var next = function() {
            var current = _Context.tasks[currentId];
            if (current) {
                current.setCallback(cb);
                current.execute();
                if (current.status === WAITING_FOR_DEPENDENCY) {
                    defer.reject(new Error('could not resolve this dependancies'));
                }
            }
            else {
                endTask.execute();
            }
        };
        next();
        return defer.promise(after);
    };

    Asynk.parallel = function(endcallArgs) {
        _Context.exec = {
            fct: Asynk.parallel,
            args: [endcallArgs]
        };
        var defer = new Deferred();
        var endTask = new Task(_Context, 'end', defer.resolve.bind(defer));
        endTask.args = endcallArgs || [new DefArg('alias', 'all')];

        var count = 0;
        var todo = _Context.tasks.length;
        var cb = function (task, err, data) {
            task.status = DONE;
            if (err) {
                defer.reject(err);
                endTask.reject(err);
                return;
            }
            _Context.results[task.id] = data;
            count++;
            if (count >= todo) {
                endTask.execute();
            }
            else {
                _Context.tasks.forEach(function(task) {
                    if (task.status === WAITING_FOR_DEPENDENCY) {
                        task.execute();
                    }
                });
            }
        };

        if (_Context.tasks.length === 0) {
            endTask.execute();
            return defer.promise();
        }

        _Context.tasks.forEach(function(task) {
            task.setCallback(function (err, data) {
                cb(task, err, data);
            });
        });

        _Context.tasks.forEach(function(task) {
            task.execute();
        });

        return defer.promise(after);
    };

    Asynk.parallelLimited = function(limit, endcallArgs) {
        _Context.exec = {
            fct: Asynk.parallelLimited,
            args: [limit, endcallArgs]
        };
        var defer = new Deferred();
        var endTask = new Task(_Context, 'end', defer.resolve.bind(defer));
        endTask.args = endcallArgs || [new DefArg('alias', 'all')];

        var count = 0;
        var todo = _Context.tasks.length;
        var cb = function (task, err, data) {
            task.status = DONE;
            if (err) {
                defer.reject(err);
                endTask.reject(err);
                return;
            }
            _Context.results[task.id] = data;
            count++;
            if (count >= todo) {
                endTask.execute();
            }
            else {
                _Context.tasks.forEach(function(task) {
                    var stats = utils.countBy(_Context.tasks, function(task) {
                        return task.status;
                    });
                    var running = stats[RUNNING] || 0;
                    if ((running < limit) && (task.status < RUNNING)) {
                        task.execute();
                    }
                });
            }
        };

        if (_Context.tasks.length === 0) {
            endTask.execute();
            return defer.promise();
        }

        _Context.tasks.forEach(function(task) {
            task.setCallback(function (err, data) {
                cb(task, err, data);
            });
        });

        _Context.tasks.forEach(function(task) {
            var stats = utils.countBy(_Context.tasks, function(task) {
                return task.status;
            });
            var running = stats[RUNNING] || 0;
            if ((running < limit) && (task.status < RUNNING)) {
                task.execute();
            }
        });

        return defer.promise(after);
    };

    return Asynk;
}
195838
function withPromise(callback, {raf = false} = {}) {
  return new Promise((resolve, reject) => {
    if (raf) {
      requestAnimationFrame(() => {
        callback(resolve, reject);
      });
    } else {
      callback(resolve, reject);
    }
  });
}