-
Notifications
You must be signed in to change notification settings - Fork 16
Refactor strategy instantiation for more extensitiliby #1254
Commits on Sep 7, 2022
-
Instantiate strategies via abstract Strategy base class
A generalized Strategy abstract base class provides generalized getter methods that instantiate strategy subclasses (implementations). These methods rely on the builtin __subclasses__() method to identify Strategy subclasses, which allows for more dynamic and extensible strategy implementation, removing the need for a hardcoded enumeration of supported Strategy implementations. Abstract strategy types inherit from this new abstract base class, and strategy subclasses (implementations) must provide `name` and `configuration_model` attributes that are leveraged by new instantiation mechanism in the abstract base class.
Adam Sachs authored and Adam Sachs committedSep 7, 2022 Configuration menu - View commit details
-
Copy full SHA for 88aec8f - Browse repository at this point
Copy the full SHA 88aec8fView commit details -
Update get_description() to be a class rather than static method
This allows the method to leverage the new `name` class variable rather than relying on a static constant variable.
Adam Sachs authored and Adam Sachs committedSep 7, 2022 Configuration menu - View commit details
-
Copy full SHA for 991a2e0 - Browse repository at this point
Copy the full SHA 991a2e0View commit details -
Remove strategy factories and update references
Strategy factories are no longer needed with refactored Strategy getters. Update the uses (references) of strategy factories throughout the codebase to now rely on the new Strategy getters. Strategy subclasses (implementations) now need to be imported explicitly in __init__.py's because they used to be imported in factory modules. Also remove the old MaskingStrategy registration/factory mechanisms.
Adam Sachs authored and Adam Sachs committedSep 7, 2022 Configuration menu - View commit details
-
Copy full SHA for 6cf919a - Browse repository at this point
Copy the full SHA 6cf919aView commit details -
Remove strategy name constants
Now that the abstract Strategy base class enforces implementation subclasses to have a `name` class attribute, this attribute should be relied upon rather than the arbitrary name constants declared previously. The get_strategy_name() abstract method is also superfluous, as the `name` class attribute can be used as a standardized way to retrieve the strategy name.
Adam Sachs authored and Adam Sachs committedSep 7, 2022 Configuration menu - View commit details
-
Copy full SHA for a8ceb2d - Browse repository at this point
Copy the full SHA a8ceb2dView commit details -
Remove get_configuration_model() abstract method
The generalized strategy getter now relies upon the `configuration_model` class variable that's on each Strategy. Therefore we no longer need the get_configuration_model() getter on each Strategy subclass.
Adam Sachs authored and Adam Sachs committedSep 7, 2022 Configuration menu - View commit details
-
Copy full SHA for 7204d11 - Browse repository at this point
Copy the full SHA 7204d11View commit details -
Update MaskingStrategy docs with new Strategy functionality
Adam Sachs authored and Adam Sachs committedSep 7, 2022 Configuration menu - View commit details
-
Copy full SHA for 244d67d - Browse repository at this point
Copy the full SHA 244d67dView commit details -
Adam Sachs authored and Adam Sachs committed
Sep 7, 2022 Configuration menu - View commit details
-
Copy full SHA for d3221ec - Browse repository at this point
Copy the full SHA d3221ecView commit details -
Improve recursion in _find_all_strategy_subclasses
Adam Sachs authored and Adam Sachs committedSep 7, 2022 Configuration menu - View commit details
-
Copy full SHA for 44ece6b - Browse repository at this point
Copy the full SHA 44ece6bView commit details -
Fix recursion bug when finding all strategies
Update associated tests to make sure the recursion is properly tested
Adam Sachs authored and Adam Sachs committedSep 7, 2022 Configuration menu - View commit details
-
Copy full SHA for c8001aa - Browse repository at this point
Copy the full SHA c8001aaView commit details -
Tweak conditional for falsy check
Adam Sachs authored and Adam Sachs committedSep 7, 2022 Configuration menu - View commit details
-
Copy full SHA for 6ed4701 - Browse repository at this point
Copy the full SHA 6ed4701View commit details -
Make get_strategies endpoint test more robust
Adam Sachs authored and Adam Sachs committedSep 7, 2022 Configuration menu - View commit details
-
Copy full SHA for 393814e - Browse repository at this point
Copy the full SHA 393814eView commit details -
Adam Sachs authored and Adam Sachs committed
Sep 7, 2022 Configuration menu - View commit details
-
Copy full SHA for 48ecfa0 - Browse repository at this point
Copy the full SHA 48ecfa0View commit details