spydrnet
spydrnet copied to clipboard
Clean up the namespace managers' implementations
Currently the namespace managers are somewhat confusingly implemented.
- They use static methods that are difficult to override but the EdifNamespace and DefaultNamespace share most of the same code.
- The class that inherits from the callback class to implement the callback portion is created in __init__.py
There are some things that could be easily refactored to help future contributors and make maintaining the namespace managers much easier. Some suggestions:
- Convert all the static methods to class methods. These appear to be easier to override in an inheriting class.
- Break the callback override out of the __init__.py (this would just make finding everything easier)
- Make the EdifNamespace class inherit from the DefaultNamespace class.
I think with these clean ups the namespace manager could be come a better example of how to implement a plugin using the callback framework.
Just made the static methods class methods.
Then I made the EdifNamespace inherit from the default namespace and removed unchanged methods.
The inheritance could be further cleaned up by replacing large sections of logic with calls to super()