Closed frankenjoe closed 2 years ago
The following is working as expected:
class MyObjectWithFunction(audobject.Object): @audobject.init_decorator( resolvers={ 'func': audobject.resolver.Function, } ) def __init__( self, func: typing.Callable, ): self.func = func def __call__(self, *args, **kwargs): return self.func(*args, **kwargs) def add(a, b=1): return a + b o = MyObjectWithFunction(add) o(1) # uses b=1
2
But after serialization the default argument for b is lost:
b
o_yaml = o.to_yaml_s() o2 = audobject.from_yaml_s(o_yaml) o2(1)
TypeError: add() missing 1 required positional argument: 'b'
The following is working as expected:
But after serialization the default argument for
b
is lost: