Skip to content

match_object() - Improve serialization for properties/iterators/enums #17

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

bblommers
Copy link
Contributor

Improves the serialization for more complex objects.

In it's current state, we correctly serialize simple attributes in an object:

class CustomObject:
    def __init__():
        self.attr1 = "a"
        self.attr2 = ["b", True]

This PR also adds support for:

  1. Properties (methods denoted with @property)
  2. Iterators (which are automatically iterated on, i.e. converted to a list)
  3. Enums (which now serialize the value itself, instead of whatever the result of str(enum) returns

Testing

I've tried this out with our own emulator and tried to convert various (complex) objects, and have encountered no problems.

Copy link

@bryansan-local bryansan-local left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Finalllyyyyyyy ahhhhhhh

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.

2 participants