

def gen_string(str_type, length=None):
    'A simple wrapper that calls other string generation methods.\n\n    :param str str_type: The type of string which should be generated.\n    :param int length: The length of the generated string. Must be 1 or\n        greater.\n    :raises: ``ValueError`` if an invalid ``str_type`` is specified.\n    :returns: A string.\n    :rtype: str\n\n    Valid values for ``str_type`` are as follows:\n\n    * alpha\n    * alphanumeric\n    * cjk\n    * cyrillic\n    * html\n    * latin1\n    * numeric\n    * utf8\n\n    '
    str_types_functions = {
        'alpha': gen_alpha,
        'alphanumeric': gen_alphanumeric,
        'cjk': gen_cjk,
        'cyrillic': gen_cyrillic,
        'html': gen_html,
        'latin1': gen_latin1,
        'numeric': gen_numeric_string,
        'utf8': gen_utf8,
    }
    str_type_lower = str_type.lower()
    if (str_type_lower not in str_types_functions.keys()):
        raise ValueError('{0} is not a supported string type. Valid string types are {1}.'.format(str_type_lower, ','.join(str_types_functions.keys())))
    method = str_types_functions[str_type_lower]
    if (length is None):
        return method()
    return method(length)

dataset/ETHPy150Open omaciel/fauxfactory/fauxfactory/__init__.py gen_string/original