Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[minor] Factories instead of meta nodes, and use them for transformer…
… nodes (#293) * Replace evaluated code to-/from-list nodes with actual classes Leveraging custom constructors * Develop meta abstraction and make a new home for transforming meta nodes * Accept node args too * Introduce a decorator for building the class-IO * Change paradigm to whether or not the node uses __reduced__ and a constructor Instead of "Meta" nodes * Allow direct use of Constructed children * Move and update constructed stuff * Add new singleton behaviour so factory-produced classes can pass is-tests * Apply constructed and class registration updates to the transformers * Remove (now unused) meta module * PEP8 newline * Remove unnecessary __getstate__ The object isn't holding instance level state and older versions of python bork here. * Add constructed __*state__ compatibility for older versions * 🐛 add missing `return` * Format black * Introduce a new factory pattern At the cost of requiring factory functions to forgo kwargs, we get object matching for factories and classes, and picklability for instances. Still need to check some edge cases around the use of stuff with a non-trivial qualname. * Test factories as methods * Test local scoping * Add docstrings and hide a function * Simplify super * Give demo class in tests have a more generic __init__ * Test and document multiple inheritance * Stop storing __init__ args By leveraging `__new__` and `__getnewargs_ex__` * Add clearing methods In case you want to change some constructor behaviour and clear the access cache. Not sure what should be cached at the end of the day, but for now just give users a shortcut for clearing it. * Use snippets.factory.classfactory and typing.ClassVar for transformers * Revert singleton * Format black * Remove constructed It's superceded by the snippets.factory stuff * Gently rename things for when the factory comes from a decorator * Allow factory made classes to also come from decorators * Format black --------- Co-authored-by: pyiron-runner <[email protected]>
- Loading branch information