Skip to content

Conversation

mthuurne
Copy link
Member

Closes #17

mthuurne added 7 commits June 27, 2023 16:21
This should enable code simplifications in the future.

For now, there is one functional change: it is no longer allowed
to pass a dataclass which contains types or constructs that are
not supported by `Binder`. I don't think this will prevent any
likely real-world workflows.
This is preparation for adding more class info.
To fetch these we need to parse the source file, so that's an amount
of work that we'd rather do just once.
The `_format_value_for_field()` function had a lot of overlap with
`_get_fields()` and re-using `field_types` for formatting not only
removes the duplicate code but also saves work.
We have `parse_toml()`, so it's consistent to also be explicit in
output methods.

And if we ever add JSON support, it's necessary to be explicit.
@mthuurne mthuurne merged commit dc26705 into main Jun 29, 2023
@mthuurne mthuurne deleted the format-template-method branch June 29, 2023 09:48
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.

Allow instantiating a Binder from a dataclass instance

1 participant