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

Generic <dict_to_object> converter is not used for custom types decorated with pytypes #8

Closed
smarie opened this issue Jan 30, 2018 · 2 comments

Comments

@smarie
Copy link
Owner

smarie commented Jan 30, 2018

from parsyfiles import RootParser
from pytypes import typechecked

@typechecked
class Foo:
    def __init__(self, bar: str):
        self.bar = bar


rp = RootParser()
print(rp.get_all_conversion_chains_to_type(to_type=Foo))  # $<dict_to_object>$ not in list

Whereas if we remove the @typechecked annotation it works fine.

@smarie smarie added the bug label Jan 30, 2018
@smarie smarie changed the title Generic <dict_to_object> generic converter is not used for custom types Generic <dict_to_object> generic converter is not used for custom types decorated with pytypes Jan 30, 2018
@smarie
Copy link
Owner Author

smarie commented Jan 30, 2018

The culprit is the @typechecked annotation: removing it makes everything go back to normal. The issue is that pytypes does not preserve signatures, so all parsers/converters from parsyfiles that rely on the objects constructor signatures to discover how to build them, declare that they cannot handle these.

@smarie
Copy link
Owner Author

smarie commented Jan 30, 2018

Closing as this issue is not in parsyfiles.

@smarie smarie closed this as completed Jan 30, 2018
@smarie smarie changed the title Generic <dict_to_object> generic converter is not used for custom types decorated with pytypes Generic <dict_to_object> converter is not used for custom types decorated with pytypes Jan 30, 2018
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

No branches or pull requests

1 participant