Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved Decoding Mechanism 🔬 #11

Merged
merged 5 commits into from
Mar 14, 2022
Merged

Improved Decoding Mechanism 🔬 #11

merged 5 commits into from
Mar 14, 2022

Conversation

eladrich
Copy link
Owner

@eladrich eladrich commented Mar 4, 2022

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), with_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)

@eladrich eladrich merged commit 980656b into master Mar 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant