Closed zhiruiluo closed 1 year ago
@lebrice
The current commit changed the way of updating global namespaces. Updating the global_ns from the deepest base until where the field_annotation is defined will address the overwriting issue. It passed the Subclass test and all others.
Why is the flake8 repo for pre-commit on gitlab? And the link is 404.
Done with the pre-commit check. But, I didn't change the .pre-commit-config.yaml
. I am not sure why using gitlab for this, but I did switch to github version of flake8 to continue pre-commit check.
This PR is to address the issue #168. The PR #182 is revoked based on that this fix can also address issue #181.
The bases of dataclasses in a different module from the module of the child dataclass defined were raising
NameError: name "xxx" is not defined
for the postponed annotations.I added a
get_global_ns
to recursively get the definition of its bases. Also, addedtest_postponed_annotation.py
mentioned in #168.