lebrice / SimpleParsing

Simple, Elegant, Typed Argument Parsing with argparse
MIT License
386 stars 47 forks source link

Modify forward_refs_to_types to fix issue #181 #182

Closed zhiruiluo closed 1 year ago

zhiruiluo commented 1 year ago

The error was happend in get_field_type_from_annotations in get_field_annotations.py.

The comments under get_field_type_from_annotations said: "NOTE: If you get errors of this kind from the function below, then you might want to add an entry to the forward_refs_to_types dict above."

I added {"D": TypeVar("D")" to the forward_refs_to_types. If add D = TypeVar("D", bound="SerializableMixin") to it, this will cause circle import error.

I also added a test_issue_181 for this issue #181 .

All tests have passed with this commit.

zhiruiluo commented 1 year ago

I'll dig into this later too. Thanks @lebrice!