Improve class generation across namespace dependencies #557
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
Proposed modification of #555 to handle the failing test and improve cross-namespace class generation. Merging would be into the enh/get_class_fix branch used by #555.
Scenario:
Namespace N1 contains group type A.
Namespace N2 contains group type B extends A. If class A for type A in namespace N1 does not exist, then the TypeMap now generates this class A, maps type A in namespace N1 to this class A, and maps type A in namespace N2 to the same class A.
Namespace N3 contains group type C which includes subgroup type A. The TypeMap now uses the same class A for all three namespaces.
The order of calling get_class on classes and their dependencies thus does not matter.
Note: If get_class is called such that a class is dynamically generated for class A, and later a custom API class is mapped to class A, then the two class As will not be the same, which could lead to unexpected behavior. This is not new behavior -- I just mention that this could happen.
Checklist
flake8
from the source directory.