Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
)
def add_bban_regex(country, spec):
bban_spec = spec["bban_spec"]
spec_re = r"(\d+)(!)?([{}])".format("".join(_spec_to_re.keys()))
def convert(match):
quantifier = ("{%s}" if match.group(2) else "{1,%s}") % match.group(1)
return _spec_to_re[match.group(3)] + quantifier
spec["regex"] = re.compile("^{}$".format(re.sub(spec_re, convert, bban_spec)))
return spec
registry.manipulate("iban", add_bban_regex)