Esempio n. 1
0
def modify_number_pattern(number_pattern, **kwargs):
    """Modifies a number pattern by specified keyword arguments."""
    params = [
        'pattern', 'prefix', 'suffix', 'grouping', 'int_prec', 'frac_prec',
        'exp_prec', 'exp_plus'
    ]
    for param in params:
        if param in kwargs:
            continue
        kwargs[param] = getattr(number_pattern, param)
    return NumberPattern(**kwargs)
Esempio n. 2
0
def clone_pattern(pattern):
    return NumberPattern(pattern.pattern, pattern.prefix, pattern.suffix,
                         pattern.grouping, pattern.int_prec, pattern.frac_prec,
                         pattern.exp_prec, pattern.exp_plus)