adaptix icon indicating copy to clipboard operation
adaptix copied to clipboard

Implement re.Pattern serializing/deserializing

Open kvxmmu opened this issue 3 years ago • 0 comments

Implement regex serializing/deserializing. E.g.

@dataclass
class SomePattern:
    prefix: Pattern

factory = Factory()
deserialized = SomePattern(prefix=compile(r'prefixed'))

print(factory.load({"prefix": "prefixed"}, SomePattern))  # SomePattern(prefix=re.compile('prefixed'))
print(factory.dump(deserialized))  # {"prefix": "prefixed"}

kvxmmu avatar Mar 25 '22 18:03 kvxmmu