Commit graph jw-python/src/python/jw/util/func_tools.py
Author SHA1 Message Date
0d3008d656
func_tools: Add module
Add the func_tools module for giving the private_method decorator a
home.

The decorator enforces that a method can only be called by methods
belonging to the same class. It inspects the call stack at runtime
and raises AttributeError if the caller is not a method of the owning
class.

When decorating a class, the decorator scans all other class members
for functions (including static, class, and other private methods) and
records their code objects as allowed callers. The __get__() method
returns a wrapper that checks the current frame's code object against
this set before dispatching to the actual method.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-08-12 23:10:12 +00:00