1717
1818from __future__ import annotations
1919
20- import typing
2120from abc import ABC , abstractmethod
2221from functools import cached_property
2322from typing import (
3433)
3534from typing import Literal as TypingLiteral
3635
37- from pydantic import Field
38-
3936from pydantic import ConfigDict , Field , field_serializer
4037
4138from pyiceberg .expressions .literals import (
@@ -310,12 +307,13 @@ class Or(IcebergBaseModel, BooleanExpression):
310307
311308 model_config = ConfigDict (arbitrary_types_allowed = True )
312309
313- type : str = Field (default = "or" , repr = False )
310+ type : TypingLiteral [ " str" ] = Field (default = "or" , alias = "type" )
314311 left : BooleanExpression
315312 right : BooleanExpression
316313
317- def __init__ (self , left : typing .Union [BooleanExpression , Or ], right : typing .Union [BooleanExpression , Or ], * rest : Any ):
318- return super ().__init__ (left = left , right = right )
314+ def __init__ (self , left : BooleanExpression , right : BooleanExpression , * rest : BooleanExpression ) -> None :
315+ if isinstance (self , Or ) and not hasattr (self , "left" ) and not hasattr (self , "right" ):
316+ super ().__init__ (left = left , right = right )
319317
320318 def __new__ (cls , left : BooleanExpression , right : BooleanExpression , * rest : BooleanExpression ) -> BooleanExpression : # type: ignore
321319 if rest :
@@ -328,7 +326,6 @@ def __new__(cls, left: BooleanExpression, right: BooleanExpression, *rest: Boole
328326 return left
329327 else :
330328 obj = super ().__new__ (cls )
331- super (Or , obj ).__init__ (left = left , right = right )
332329 return obj
333330
334331 @field_serializer ("left" )
0 commit comments