Introduce __validate__: User feedback for lf.query on autofix.
Example:
class Foo(pg.Object):
x: int
def __validate__(self):
# This triggers autofix.
if self.x > 1:
raise ValueError('value should be less or equal than 1.')
# This triggers rule-based fix (user modification)
if self.x < 0:
self.rebind(x=0, skip_notification=True)
foo = lf.query('Generate a Foo object', Foo, lm=lm, autofix=2)
assert foo.x in (0, 1)
Introduce
__validate__
: User feedback forlf.query
on autofix.Example: