Create a string parameter
        :param help_string:
        :param default:
        :return:
770197
def create_str(help_string=NO_HELP, default=NO_DEFAULT):
        # type: (str, Union[str, NO_DEFAULT_TYPE]) -> str
        
        # noinspection PyTypeChecker
        return ParamFunctions(
            help_string=help_string,
            default=default,
            type_name="str",
            function_s2t=convert_string_to_string,
            function_t2s=convert_string_to_string,
        )
459
def create_enum(enum_type, help_string=NO_HELP, default=NO_DEFAULT):
        # type: (Type[Enum], str, Union[Any, NO_DEFAULT_TYPE]) -> Type[Enum]
        
        # noinspection PyTypeChecker
        return ParamEnum(
            help_string=help_string,
            default=default,
            enum_type=enum_type,
        )
630220
def lookup_field_help(self, field, default=None):
        
        default = None

        for form_field in self.form:
            if form_field.name == field:
                default = form_field.help_text
                break

        return super(SmartFormMixin, self).lookup_field_help(field, default=default)
1214290
def add_argument(self, name, value_type, item_help, default=None):
    
    if value_type and value_type not in self.__restricted_types:
      raise ArgumentException("Named argument couldn't have {} type".format(value_type.__name__))

    if default is not None and not isinstance(default, value_type):
      raise ArgumentException("Invalid default type for argument".format(name))

    if value_type is bool and default is None:
      default = False

    self._args.update({
      name: ModuleArgumentItem(name, value_type, item_help, default)
    })
    return self
403407
def ask_string(*question: Token, default: Optional[str] = None) -> Optional[str]:
    
    tokens = get_ask_tokens(question)
    if default:
        tokens.append("(%s)" % default)
    info(*tokens)
    answer = read_input()
    if not answer:
        return default
    return answer
595850
def create_int(help_string=NO_HELP, default=NO_DEFAULT):
        # type: (str, Union[int, NO_DEFAULT_TYPE]) -> int
        
        # noinspection PyTypeChecker
        return ParamFunctions(
            help_string=help_string,
            default=default,
            type_name="int",
            function_s2t=convert_string_to_int,
            function_t2s=convert_int_to_string,
            function_s2t_generate_from_default=convert_string_to_int_default,
        )
1244896
def create_existing_folder(help_string=NO_HELP, default=NO_DEFAULT, suffixes=None):
        # type: (str, Union[str, NO_DEFAULT_TYPE], Union[List[str], None]) -> str
        
        # noinspection PyTypeChecker
        return ParamFilename(
            help_string=help_string,
            default=default,
            type_name="existing_folder",
            suffixes=suffixes,
        )
23073
def help_text(values):
    
    result = ""
    for key in values:
        result += key + ' '.join('' for x in range(GESTURE_LENGTH - len(key))) +\
                        ': ' + values[key] + '\n'
    return result
386689
def generate_help(self, filename="", command=""):
    
    "{} [{}]\n\n".format(filename, "|".join(self.available_command_list))
    help_str = """Available commands:

    """

    command_list = self.available_command_list if command == "" else [command]

    for command in command_list:
      cmd_meta = self.get_command_metainfo(command)
      """:type cmd_meta ModuleMetaInfo"""

      if cmd_meta is None:
        continue

      args = {}
      args.update(cmd_meta.get_arguments_builder().arguments)
      args.update(cmd_meta.get_arguments_builder().default_arguments)

      cmd_arguments_help = {name: value.item_help for name, value in args.items() if value.item_help}

      if len(cmd_arguments_help) > 0:
        help_str += """
        {cmd} [{args}] - {cmd_help}

        Argument details:
        {arg_details}


        """.format(
          cmd=command,
          args=" | ".join(cmd_arguments_help.keys()),
          cmd_help=cmd_meta.help,
          arg_details="\n".join(["{} - {}".format(k, v) for k, v in cmd_arguments_help.items()])
        )

      else:
        help_str += """
        {cmd} - {cmd_help}""".format(
          cmd=command,
          cmd_help=cmd_meta.help
        )

    return help_str
216189
def help_function(self, command=None):
        
        if command:
            return self.registered[command].get(
                'description', 'No help available'
            )
        return ', '.join(sorted(self.registered))
299127
def default_help_formatter(quick_helps):
    
    ret = ''
    for line in quick_helps:
        cmd_path, param_hlp, cmd_hlp = line
        ret += ' '.join(cmd_path) + ' '
        if param_hlp:
            ret += param_hlp + ' '
        ret += '- ' + cmd_hlp + '\n'
    return ret
460673
def default_field_to_parameter(self, default_field):
        
        if default_field.get('type') == QVariant.Double:
            parameter = FloatParameter()
        elif default_field.get('type') in qvariant_whole_numbers:
            parameter = IntegerParameter()
        else:
            return
        default_value = default_field.get('default_value')
        if not default_value:
            message = (
                'InaSAFE default field %s does not have default value'
                % default_field.get('name'))
            LOGGER.exception(message)
            return

        parameter.guid = default_field.get('key')
        parameter.name = default_value.get('name')
        parameter.is_required = True
        parameter.precision = default_field.get('precision')
        parameter.minimum_allowed_value = default_value.get(
            'min_value', 0)
        parameter.maximum_allowed_value = default_value.get(
            'max_value', 100000000)
        parameter.help_text = default_value.get('help_text')
        parameter.description = default_value.get('description')

        # Check if user ask to restore to the most default value.
        if self.is_restore_default:
            parameter._value = default_value.get('default_value')
        else:
            # Current value
            qsetting_default_value = get_inasafe_default_value_qsetting(
                self.settings, GLOBAL, default_field['key'])

            # To avoid python error
            if qsetting_default_value > parameter.maximum_allowed_value:
                qsetting_default_value = parameter.maximum_allowed_value
            if qsetting_default_value < parameter.minimum_allowed_value:
                qsetting_default_value = parameter.minimum_allowed_value

            parameter.value = qsetting_default_value
        return parameter
36498
def prompt(prompt_string, default=None, secret=False, boolean=False, bool_type=None):
    
    if boolean or bool_type in BOOLEAN_DEFAULTS:
        if bool_type is None:
            bool_type = 'y_n'
        default_msg = BOOLEAN_DEFAULTS[bool_type][is_affirmative(default)]
    else:
        default_msg = " (default {val}): "
    prompt_string += (default_msg.format(val=default) if default else ": ")
    if secret:
        val = getpass(prompt_string)
    else:
        val = input(prompt_string)
    val = (val if val else default)
    if boolean:
        val = val.lower().startswith('y')
    return val
1290989
def DEFINE_string(flag_name, default_value, docstring, required=False):  # pylint: disable=invalid-name
    
    _define_helper(flag_name, default_value, docstring, str, required)
999187
def query_string(cls,
                     query,
                     default_field=None,
                     default_operator=None,
                     analyzer=None,
                     allow_leading_wildcard=None,
                     lowercase_expanded_terms=None,
                     enable_position_increments=None,
                     fuzzy_prefix_length=None,
                     fuzzy_min_sim=None,
                     phrase_slop=None,
                     boost=None,
                     analyze_wildcard=None,
                     auto_generate_phrase_queries=None,
                     minimum_should_match=None):
        '''
        
        '''
        instance = cls(query_string={'query': query})
        if default_field is not None:
            instance['query_string']['default_field'] = default_field
        if default_operator is not None:
            instance['query_string']['default_operator'] = default_operator
        if analyzer is not None:
            instance['query_string']['analyzer'] = analyzer
        if allow_leading_wildcard is not None:
            instance['query_string']['allow_leading_wildcard'] = allow_leading_wildcard
        if lowercase_expanded_terms is not None:
            instance['query_string']['lowercase_expanded_terms'] = lowercase_expanded_terms
        if enable_position_increments is not None:
            instance['query_string']['enable_position_increments'] = enable_position_increments
        if fuzzy_prefix_length is not None:
            instance['query_string']['fuzzy_prefix_length'] = fuzzy_prefix_length
        if fuzzy_min_sim is not None:
            instance['query_string']['fuzzy_min_sim'] = fuzzy_min_sim
        if phrase_slop is not None:
            instance['query_string']['phrase_slop'] = phrase_slop
        if boost is not None:
            instance['query_string']['boost'] = boost
        if analyze_wildcard is not None:
            instance['query_string']['analyze_wildcard'] = analyze_wildcard
        if auto_generate_phrase_queries is not None:
            instance['query_string']['auto_generate_phrase_queries'] = auto_generate_phrase_queries
        if minimum_should_match is not None:
            instance['query_string']['minimum_should_match'] = minimum_should_match
        return instance
236735
def get_default_config_help(self):
        
        config = super(RiemannHandler, self).get_default_config_help()

        config.update({
            'host': '',
            'port': '',
            'transport': 'tcp or udp',
        })

        return config
395286
def get_default_config_help(self):
        
        config = super(NullHandler, self).get_default_config_help()

        config.update({
        })

        return config