Skip to content

Improved Decoding Mechanism :microscope:

Latest
Compare
Choose a tag to compare
@eladrich eladrich released this 14 Mar 08:22
· 2 commits to master since this release

Improved decoding mechanism to support inherited types, one can still use the existing register functionality

pyrallis.decode.register(SomeClass, lambda x: SomeClass(x))

But can also register parent classes as well

pyrallis.decode.register(BaseClass, lambda t, x: t(x), include_subclasses=True)

Also revised the dispatch mechanism from singledispatch to a new dedicated wrapper (singledispatch tries to dispatch by class instead of value which isn't suited for decoding, but worked only thanks to the default behavior)