Skip to content

Support class-based components #53

@pauleveritt

Description

@pauleveritt

I added this case statement in my context to proceed:

        case _ if is_dataclass(value):
            # This is an instance of a dataclass, call __call__ and return
            return result()

If you'd like, I can make a branch with some tests and a proposed implementation. We don't have to force dataclasses, we can do regular classes.

We can also move the condition outside of the match. For example, when making result, do a second test like this:

# Is result a callable?
if callable(result):
    result = result()

...though this might open the door to false positives.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions