python: Remove the x pattern. Rename X to `x'.

This commit is contained in:
2021-11-14 09:10:12 +01:00
parent 8f0a1a5c4b
commit 56d4b3fc13

View File

@ -81,10 +81,8 @@ class Passgeny:
return PASSGENY_SPECIAL[bh.modulo(len(PASSGENY_SPECIAL))] return PASSGENY_SPECIAL[bh.modulo(len(PASSGENY_SPECIAL))]
def gen_decimal(match): def gen_decimal(match):
return "{}".format(bh.modulo(int(match[1]))) dlen = 1 if match[1] == "" else int(match[1])
return "{}".format(bh.modulo(dlen))
def gen_hex(match):
return "{:x}".format(bh.modulo(int(match[1])))
def gen_hexstr(match): def gen_hexstr(match):
x = "" x = ""
@ -103,8 +101,7 @@ class Passgeny:
[ '([0-9]*)p', gen_phogen ], [ '([0-9]*)p', gen_phogen ],
[ '([0-9]*)s', gen_special ], [ '([0-9]*)s', gen_special ],
[ '([0-9]+)d', gen_decimal ], [ '([0-9]+)d', gen_decimal ],
[ '([0-9]+)x', gen_hex ], [ '([0-9]+)x', gen_hexstr ],
[ '([0-9]+)X', gen_hexstr ],
[ '\^', gen_capitalize ], [ '\^', gen_capitalize ],
] ]