-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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) ``` PiperOrigin-RevId: 672124993
- Loading branch information
Showing
2 changed files
with
55 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters