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

Handle Forward References #27

Merged
merged 5 commits into from
Jan 30, 2019
Merged

Handle Forward References #27

merged 5 commits into from
Jan 30, 2019

Conversation

bpeake-illuscio
Copy link
Contributor

New attempt to close issue #15
Last attempt: #25

This version is significantly less invasive. It still relies on passing a dict of forward references to the Config class, these are then passed to the globalns param of typing.get_type_hints(), cleaning each type hint of forward refs.

The resolved types are injected into the rest of the code by creating a copy of each dataclass.Field object in the main loop, and reassigning the .type attr to the cleaned type.

Each new field object then carries forward the correct type to the rest of the logic.

Let me know what you think!

@bpeake-illuscio bpeake-illuscio changed the title Forward ref graceful Handle Forward References Jan 22, 2019
@konradhalas
Copy link
Owner

@bpeake-illuscio this is exactly what we are looking for. Very good job!

Give me some time to proper review, nevertheless this change looks awesome.

@bpeake-illuscio
Copy link
Contributor Author

Thanks! Glad you like it at first glance. Let me know if you have any tweaks once you do a proper review.

@konradhalas konradhalas merged commit ff73ec3 into konradhalas:master Jan 30, 2019
@konradhalas
Copy link
Owner

@bpeake-illuscio looks very good, merged! :)

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