generators.py
def generate_string(max_length=MAX_STRLEN,
                    min_length=MIN_STRLEN,
                    pattern=None,
                    **kwargs):
    '''Generate a valid random string.

    Ref:
    https://json-schema.org/draft/2019-09/json-schema-validation.html#string

    Args:
        max_length (int): Upper limit of string length.
        min_length (int): Lowet limit of string length.
        pattern (str): A regular expression pattern.

    Returns:
        A valid random string.

    '''
    if pattern is not None:
        s = exrex.getone(pattern)
        if len(s) < min_length:
            s += ' ' * (min_length - len(s))
        if len(s) > max_length:
            s = s[:max_length]
        return s
    length = random.randint(min_length, max_length)
    return ''.join(random.choice(CHARACTERS) for _ in range(length))
Generate a valid random string.

    Ref:
    https://json-schema.org/draft/2019-09/json-schema-validation.html#string

    Args:
        max_length (int): Upper limit of string length.
        min_length (int): Lowet limit of string length.
        pattern (str): A regular expression pattern.

    Returns:
        A valid random string.

    
Generate a valid random string.
Generate a valid random string .
def generate_string(max_length=MAX_STRLEN,
                    min_length=MIN_STRLEN,
                    pattern=None,
                    **kwargs):
    if pattern is not None:
        s = exrex.getone(pattern)
        if len(s) < min_length:
            s += ' ' * (min_length - len(s))
        if len(s) > max_length:
            s = s[:max_length]
        return s
    length = random.randint(min_length, max_length)
    return ''.join(random.choice(CHARACTERS) for _ in range(length))
def generate_string ( max_length = MAX_STRLEN , min_length = MIN_STRLEN , pattern = None , ** kwargs ) : if pattern is not None : s = exrex . getone ( pattern ) if len ( s ) < min_length : s += ' ' * ( min_length - len ( s ) ) if len ( s ) > max_length : s = s [ : max_length ] return s length = random . randint ( min_length , max_length ) return '' . join ( random . choice ( CHARACTERS ) for _ in range ( length ) )
Generate a valid random string.
Generate a valid random string .
'''Generate a valid random string.

    Ref:
    https://json-schema.org/draft/2019-09/json-schema-validation.html#string

    Args:
        max_length (int): Upper limit of string length.
        min_length (int): Lowet limit of string length.
        pattern (str): A regular expression pattern.

    Returns:
        A valid random string.

    '''
A valid random string.
A valid random string .
max_length
Upper limit of string length.
Upper limit of string length .
min_length
Lowet limit of string length.
Lowet limit of string length .
pattern
A regular expression pattern.
A regular expression pattern .