@@ -346,24 +346,23 @@ def __getnewargs__(self) -> Tuple[BooleanExpression, BooleanExpression]:
346346class Not (IcebergBaseModel , BooleanExpression ):
347347 """NOT operation expression - logical negation."""
348348
349- child : BooleanExpression
349+ model_config = ConfigDict (arbitrary_types_allowed = True )
350+
351+ type : TypingLiteral ["not" ] = Field (default = "not" )
352+ child : BooleanExpression = Field ()
350353
351- @model_validator (mode = "before" )
352- def _before (cls , values : Any ) -> Any :
353- if isinstance (values , BooleanExpression ):
354- return {"child" : values }
355- return values
354+ def __init__ (self , child : BooleanExpression , ** _ ) -> None :
355+ super ().__init__ (child = child )
356356
357- @model_validator (mode = "after" )
358- def _normalize (cls , model : Any ) -> Any :
359- child = model .child
357+ def __new__ (cls , child : BooleanExpression , ** _ ) -> BooleanExpression : # type: ignore
360358 if child is AlwaysTrue ():
361359 return AlwaysFalse ()
362360 elif child is AlwaysFalse ():
363361 return AlwaysTrue ()
364362 elif isinstance (child , Not ):
365363 return child .child
366- return model
364+ obj = super ().__new__ (cls )
365+ return obj
367366
368367 def __repr__ (self ) -> str :
369368 """Return the string representation of the Not class."""
0 commit comments