Gets a user parameter, either from the console or from an outer
        submodule/system

       Assumes conf has name, default, prompt and debug
559692
def get_input(context, conf):
    
    name = conf['name']['value']
    prompt = conf['prompt']['value']
    default = conf['default']['value'] or conf['debug']['value']

    if context.submodule or context.inputs:
        value = context.inputs.get(name, default)
    elif not context.test:
        # we skip user interaction during tests
        raw = raw_input("%s (default=%s) " % (encode(prompt), encode(default)))
        value = raw or default
    else:
        value = default

    return value
489686
def parse_user_params(user_params):
    
    if user_params:
        params = {}
        try:
            for param in options.params.split(','):
                param_key, param_value = param.split('=', 1)
                params[param_key] = param_value
        except ValueError as e:
            sys.stdout.write("Invalid params specified. Should be in format: <key=value>[,<key=value>..]\n")
            sys.exit(1)
        return params
    else:
        return {}
562534
def ParseConfigCommandLine():
  """"""
  # The user may specify the primary config file on the command line.
  if flags.FLAGS.config:
    _CONFIG.Initialize(filename=flags.FLAGS.config, must_exist=True)
  else:
    raise RuntimeError("A config file is not specified.")

  # Allow secondary configuration files to be specified.
  if flags.FLAGS.secondary_configs:
    for config_file in flags.FLAGS.secondary_configs:
      _CONFIG.LoadSecondaryConfig(config_file)

  # Allow individual options to be specified as global overrides.
  for statement in flags.FLAGS.parameter:
    if "=" not in statement:
      raise RuntimeError("statement %s on command line not valid." % statement)

    name, value = statement.split("=", 1)
    _CONFIG.global_override[name] = value

  # Load additional contexts from the command line.
  for context in flags.FLAGS.context:
    if context:
      _CONFIG.AddContext(context)

  if _CONFIG["Config.writeback"]:
    _CONFIG.SetWriteBack(_CONFIG["Config.writeback"])

  # Does the user want to dump help? We do this after the config system is
  # initialized so the user can examine what we think the value of all the
  # parameters are.
  if flags.FLAGS.config_help:
    print("Configuration overview.")

    _CONFIG.PrintHelp()
    sys.exit(0)
90519
def get_values(self, config_manager, ignore_mismatches, obj_hook=DotDict):
        """"""
        if self.delayed_parser_instantiation:
            try:
                app = config_manager._get_option('admin.application')
                source = "%s%s" % (app.value.app_name, file_name_extension)
                self.config_obj = configobj.ConfigObj(source)
                self.delayed_parser_instantiation = False
            except AttributeError:
                # we don't have enough information to get the ini file
                # yet.  we'll ignore the error for now
                return obj_hook()  # return empty dict of the obj_hook type
        if isinstance(self.config_obj, obj_hook):
            return self.config_obj
        return obj_hook(initializer=self.config_obj)
210166
def password_prompt(ctx, param, value):
    """"""
    if ctx.resilient_parsing:
        return

    if not value:
        if 'password_stdin' in ctx.params:
            with click.open_file('-') as fp:
                value = fp.read().strip('\n')
        else:
            value = click.prompt('Password', hide_input=True)

    click.echo(value)
    return value
796224
def _get_parameter(self, parameter, dest_addr_long=None):
        
        frame = self._send_and_wait(
            command=parameter, dest_addr_long=dest_addr_long)
        return frame["parameter"]
1015473
def get_settings(self):
    '''
    '''
    config = self._load_config_user()
    if self.name in config:
        return config[self.name]
662405
function getUser (argv, next) {
  if (argv.user) return next()

  const conf = rc('npm')
  if (!conf) return next('no npm config found')

  const github = conf['init.author.github']
  if (!github) return next('no init.author.github set')

  const name = conf['init.author.name']
  if (!name) return next('no init.author.name set')

  argv.user = github
  argv.realName = name
  next()
}
154982
def getParam(self, key):
        
        cur = self._conn.cursor()
        cur.execute("SHOW GLOBAL VARIABLES LIKE %s", key)
        row = cur.fetchone()
        return int(row[1])
907487
def _get_config_name():
  ''''''
  p = subprocess.Popen('git config --get user.name', shell=True,
                       stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
  output = p.stdout.readlines()
  return _stripslashes(output[0])
562568
def get_user(username):
    '''
    
    '''
    try:
        enable()
        configure_terminal()
        cmd_out = sendline('show running-config | include "username {0} password 7"'.format(username))
        cmd_out.split('\n')
        user = cmd_out[1:-1]
        configure_terminal_exit()
        disable()
        return user
    except TerminalException as e:
        log.error(e)
        return 'Failed to get user'
564940
def _get_conf_value(suffix):
    """"""
    pymp_name = "PYMP_" + suffix
    omp_name = "OMP_" + suffix
    value = None
    for env_name in [pymp_name, omp_name]:
        # pylint: disable=no-member
        if env_name in _os.environ:
            _LOGGER.debug(
                "Using %s environment variable: %s.", env_name, _os.environ[env_name]
            )
            value = _os.environ[env_name]
            break
    return value
747365
def get_user_cmd(node_dict):
    """"""
    key_lu = {"q": ["quit", True], "r": ["run", True],
              "s": ["stop", True], "u": ["update", True],
              "c": ["connect", True], "d": ["details", True]}
    ui_cmd_bar()
    cmd_valid = False
    input_flush()
    with term.cbreak():
        while not cmd_valid:
            val = input_by_key()
            cmd_name, cmd_valid = key_lu.get(val.lower(), ["invalid", False])
            if not cmd_valid:
                ui_print(" - {0}Invalid Entry{1}".format(C_ERR, C_NORM))
                sleep(0.5)
                ui_cmd_bar()
    return cmd_name
1048898
def getpath(cmd, name=None, url=None, cfg="~/.jcvirc", warn="exit"):
    
    p = which(cmd)  # if in PATH, just returns it
    if p:
        return p

    PATH = "Path"
    config = RawConfigParser()
    cfg = op.expanduser(cfg)
    changed = False
    if op.exists(cfg):
        config.read(cfg)

    assert name is not None, "Need a program name"

    try:
        fullpath = config.get(PATH, name)
    except NoSectionError:
        config.add_section(PATH)
        changed = True
    except:
        pass

    try:
        fullpath = config.get(PATH, name)
    except NoOptionError:
        msg = "=== Configure path for {0} ===\n".format(name, cfg)
        if url:
            msg += "URL: {0}\n".format(url)
        msg += "[Directory that contains `{0}`]: ".format(cmd)
        fullpath = input(msg).strip()
        config.set(PATH, name, fullpath)
        changed = True

    path = op.join(op.expanduser(fullpath), cmd)
    if warn == "exit":
        try:
            assert is_exe(path), \
                "***ERROR: Cannot execute binary `{0}`. ".format(path)
        except AssertionError as e:
            sys.exit("{0!s}Please verify and rerun.".format(e))

    if changed:
        configfile = open(cfg, "w")
        config.write(configfile)
        logging.debug("Configuration written to `{0}`.".format(cfg))

    return path
1105783
def _get_instance_params(cls, instance):
        
        url = instance.get("url")
        if url is None:
            raise ConfigurationError("You must specify a url for your instance in `conf.yaml`")
        username = instance.get("username")
        password = instance.get("password")
        ssl_params = None
        if url.startswith("ldaps"):
            ssl_params = {
                "key": instance.get("ssl_key"),
                "cert": instance.get("ssl_cert"),
                "ca_certs": instance.get("ssl_ca_certs"),
                "verify": is_affirmative(instance.get("ssl_verify", True)),
            }
        custom_queries = instance.get("custom_queries", [])
        tags = list(instance.get("tags", []))
        tags.append("url:{}".format(url))

        return url, username, password, ssl_params, custom_queries, tags
1043819
def get_param_arg(param, idx, klass, arg, attr='id'):
    """"""
    if isinstance(arg, klass):
        return getattr(arg, attr)
    elif isinstance(arg, (int, str)):
        return arg
    else:
        raise TypeError(
            "%s[%d] must be int, str, or %s, not %s" % (
                param, idx, klass.__name__, type(arg).__name__))
244831
def _get_args(self, executable, *args):
        """"""
        args = list(args)
        args.insert(0, executable)
        if self.username:
            args.append("--username={}".format(self.username))
        if self.host:
            args.append("--host={}".format(self.host))
        if self.port:
            args.append("--port={}".format(self.port))

        args.append(self.dbname)
        #args.extend(other_args)
        return args