2020import builtins
2121from abc import ABC , abstractmethod
2222from functools import cached_property
23- from typing import Any , Callable , Generic , Iterable , Sequence , cast
23+ from typing import Any , Callable , Iterable , Sequence , cast
2424from typing import Literal as TypingLiteral
2525
2626from pydantic import ConfigDict , Field
@@ -489,7 +489,7 @@ def __getnewargs__(self) -> tuple[BoundTerm]:
489489
490490
491491class BoundIsNull (BoundUnaryPredicate ):
492- def __new__ (cls , term : BoundTerm ) -> BooleanExpression : # type: ignore # pylint: disable=W0221
492+ def __new__ (cls , term : BoundTerm ) -> BooleanExpression : # type: ignore[misc] # pylint: disable=W0221
493493 if term .ref ().field .required :
494494 return AlwaysFalse ()
495495 return super ().__new__ (cls )
@@ -504,7 +504,7 @@ def as_unbound(self) -> type[IsNull]:
504504
505505
506506class BoundNotNull (BoundUnaryPredicate ):
507- def __new__ (cls , term : BoundTerm ): # type: ignore # pylint: disable=W0221
507+ def __new__ (cls , term : BoundTerm ) -> BooleanExpression : # type: ignore[misc] # pylint: disable=W0221
508508 if term .ref ().field .required :
509509 return AlwaysTrue ()
510510 return super ().__new__ (cls )
@@ -543,7 +543,7 @@ def as_bound(self) -> builtins.type[BoundNotNull]:
543543
544544
545545class BoundIsNaN (BoundUnaryPredicate ):
546- def __new__ (cls , term : BoundTerm ) -> BooleanExpression : # type: ignore # pylint: disable=W0221
546+ def __new__ (cls , term : BoundTerm ) -> BooleanExpression : # type: ignore[misc] # pylint: disable=W0221
547547 bound_type = term .ref ().field .field_type
548548 if isinstance (bound_type , (FloatType , DoubleType )):
549549 return super ().__new__ (cls )
@@ -559,7 +559,7 @@ def as_unbound(self) -> type[IsNaN]:
559559
560560
561561class BoundNotNaN (BoundUnaryPredicate ):
562- def __new__ (cls , term : BoundTerm ) -> BooleanExpression : # type: ignore # pylint: disable=W0221
562+ def __new__ (cls , term : BoundTerm ) -> BooleanExpression : # type: ignore[misc] # pylint: disable=W0221
563563 bound_type = term .ref ().field .field_type
564564 if isinstance (bound_type , (FloatType , DoubleType )):
565565 return super ().__new__ (cls )
@@ -673,7 +673,7 @@ def as_unbound(self) -> type[SetPredicate]: ...
673673
674674
675675class BoundIn (BoundSetPredicate ):
676- def __new__ (cls , term : BoundTerm , literals : set [LiteralValue ]) -> BooleanExpression : # type: ignore # pylint: disable=W0221
676+ def __new__ (cls , term : BoundTerm , literals : set [LiteralValue ]) -> BooleanExpression : # type: ignore[misc] # pylint: disable=W0221
677677 count = len (literals )
678678 if count == 0 :
679679 return AlwaysFalse ()
@@ -696,7 +696,7 @@ def as_unbound(self) -> type[In]:
696696
697697
698698class BoundNotIn (BoundSetPredicate ):
699- def __new__ ( # type: ignore # pylint: disable=W0221
699+ def __new__ ( # type: ignore[misc] # pylint: disable=W0221
700700 cls ,
701701 term : BoundTerm ,
702702 literals : set [LiteralValue ],
@@ -721,7 +721,7 @@ def as_unbound(self) -> type[NotIn]:
721721class In (SetPredicate ):
722722 type : TypingLiteral ["in" ] = Field (default = "in" , alias = "type" )
723723
724- def __new__ ( # type: ignore # pylint: disable=W0221
724+ def __new__ ( # type: ignore[misc] # pylint: disable=W0221
725725 cls , term : str | UnboundTerm , literals : Iterable [Any ] | Iterable [LiteralValue ]
726726 ) -> BooleanExpression :
727727 literals_set : set [LiteralValue ] = _to_literal_set (literals )
@@ -745,7 +745,7 @@ def as_bound(self) -> builtins.type[BoundIn]:
745745class NotIn (SetPredicate , ABC ):
746746 type : TypingLiteral ["not-in" ] = Field (default = "not-in" , alias = "type" )
747747
748- def __new__ ( # type: ignore # pylint: disable=W0221
748+ def __new__ ( # type: ignore[misc] # pylint: disable=W0221
749749 cls , term : str | UnboundTerm , literals : Iterable [Any ] | Iterable [LiteralValue ]
750750 ) -> BooleanExpression :
751751 literals_set : set [LiteralValue ] = _to_literal_set (literals )
@@ -766,17 +766,17 @@ def as_bound(self) -> builtins.type[BoundNotIn]:
766766 return BoundNotIn
767767
768768
769- class LiteralPredicate (IcebergBaseModel , UnboundPredicate , Generic [ L ], ABC ):
769+ class LiteralPredicate (IcebergBaseModel , UnboundPredicate , ABC ):
770770 type : TypingLiteral ["lt" , "lt-eq" , "gt" , "gt-eq" , "eq" , "not-eq" , "starts-with" , "not-starts-with" ] = Field (alias = "type" )
771771 term : UnboundTerm
772- value : Literal [ L ] = Field ()
772+ value : LiteralValue = Field ()
773773 model_config = ConfigDict (populate_by_name = True , frozen = True , arbitrary_types_allowed = True )
774774
775- def __init__ (self , term : str | UnboundTerm , literal : L | Literal [ L ] ):
775+ def __init__ (self , term : str | UnboundTerm , literal : Any | LiteralValue ):
776776 super ().__init__ (term = _to_unbound_term (term ), value = _to_literal (literal )) # type: ignore[call-arg]
777777
778778 @property
779- def literal (self ) -> Literal [ L ] :
779+ def literal (self ) -> LiteralValue :
780780 return self .value
781781
782782 def bind (self , schema : Schema , case_sensitive : bool = True ) -> BoundLiteralPredicate :
@@ -816,9 +816,9 @@ def as_bound(self) -> builtins.type[BoundLiteralPredicate]: ...
816816
817817
818818class BoundLiteralPredicate (BoundPredicate , ABC ):
819- literal : Literal [ Any ]
819+ literal : LiteralValue
820820
821- def __init__ (self , term : BoundTerm , literal : Literal [ Any ] ): # pylint: disable=W0621
821+ def __init__ (self , term : BoundTerm , literal : LiteralValue ): # pylint: disable=W0621
822822 super ().__init__ (term )
823823 self .literal = literal # pylint: disable=W0621
824824
@@ -834,7 +834,7 @@ def __repr__(self) -> str:
834834
835835 @property
836836 @abstractmethod
837- def as_unbound (self ) -> type [LiteralPredicate [ Any ] ]: ...
837+ def as_unbound (self ) -> type [LiteralPredicate ]: ...
838838
839839
840840class BoundEqualTo (BoundLiteralPredicate ):
@@ -843,7 +843,7 @@ def __invert__(self) -> BoundNotEqualTo:
843843 return BoundNotEqualTo (self .term , self .literal )
844844
845845 @property
846- def as_unbound (self ) -> type [EqualTo [ Any ] ]:
846+ def as_unbound (self ) -> type [EqualTo ]:
847847 return EqualTo
848848
849849
@@ -853,7 +853,7 @@ def __invert__(self) -> BoundEqualTo:
853853 return BoundEqualTo (self .term , self .literal )
854854
855855 @property
856- def as_unbound (self ) -> type [NotEqualTo [ Any ] ]:
856+ def as_unbound (self ) -> type [NotEqualTo ]:
857857 return NotEqualTo
858858
859859
@@ -863,7 +863,7 @@ def __invert__(self) -> BoundLessThan:
863863 return BoundLessThan (self .term , self .literal )
864864
865865 @property
866- def as_unbound (self ) -> type [GreaterThanOrEqual [ Any ] ]:
866+ def as_unbound (self ) -> type [GreaterThanOrEqual ]:
867867 return GreaterThanOrEqual
868868
869869
@@ -873,7 +873,7 @@ def __invert__(self) -> BoundLessThanOrEqual:
873873 return BoundLessThanOrEqual (self .term , self .literal )
874874
875875 @property
876- def as_unbound (self ) -> type [GreaterThan [ Any ] ]:
876+ def as_unbound (self ) -> type [GreaterThan ]:
877877 return GreaterThan
878878
879879
@@ -883,7 +883,7 @@ def __invert__(self) -> BoundGreaterThanOrEqual:
883883 return BoundGreaterThanOrEqual (self .term , self .literal )
884884
885885 @property
886- def as_unbound (self ) -> type [LessThan [ Any ] ]:
886+ def as_unbound (self ) -> type [LessThan ]:
887887 return LessThan
888888
889889
@@ -893,7 +893,7 @@ def __invert__(self) -> BoundGreaterThan:
893893 return BoundGreaterThan (self .term , self .literal )
894894
895895 @property
896- def as_unbound (self ) -> type [LessThanOrEqual [ Any ] ]:
896+ def as_unbound (self ) -> type [LessThanOrEqual ]:
897897 return LessThanOrEqual
898898
899899
@@ -903,7 +903,7 @@ def __invert__(self) -> BoundNotStartsWith:
903903 return BoundNotStartsWith (self .term , self .literal )
904904
905905 @property
906- def as_unbound (self ) -> type [StartsWith [ Any ] ]:
906+ def as_unbound (self ) -> type [StartsWith ]:
907907 return StartsWith
908908
909909
@@ -913,14 +913,14 @@ def __invert__(self) -> BoundStartsWith:
913913 return BoundStartsWith (self .term , self .literal )
914914
915915 @property
916- def as_unbound (self ) -> type [NotStartsWith [ Any ] ]:
916+ def as_unbound (self ) -> type [NotStartsWith ]:
917917 return NotStartsWith
918918
919919
920- class EqualTo (LiteralPredicate [ L ] ):
920+ class EqualTo (LiteralPredicate ):
921921 type : TypingLiteral ["eq" ] = Field (default = "eq" , alias = "type" )
922922
923- def __invert__ (self ) -> NotEqualTo [ Any ] :
923+ def __invert__ (self ) -> NotEqualTo :
924924 """Transform the Expression into its negated version."""
925925 return NotEqualTo (self .term , self .literal )
926926
@@ -929,10 +929,10 @@ def as_bound(self) -> builtins.type[BoundEqualTo]:
929929 return BoundEqualTo
930930
931931
932- class NotEqualTo (LiteralPredicate [ L ] ):
932+ class NotEqualTo (LiteralPredicate ):
933933 type : TypingLiteral ["not-eq" ] = Field (default = "not-eq" , alias = "type" )
934934
935- def __invert__ (self ) -> EqualTo [ Any ] :
935+ def __invert__ (self ) -> EqualTo :
936936 """Transform the Expression into its negated version."""
937937 return EqualTo (self .term , self .literal )
938938
@@ -941,10 +941,10 @@ def as_bound(self) -> builtins.type[BoundNotEqualTo]:
941941 return BoundNotEqualTo
942942
943943
944- class LessThan (LiteralPredicate [ L ] ):
944+ class LessThan (LiteralPredicate ):
945945 type : TypingLiteral ["lt" ] = Field (default = "lt" , alias = "type" )
946946
947- def __invert__ (self ) -> GreaterThanOrEqual [ Any ] :
947+ def __invert__ (self ) -> GreaterThanOrEqual :
948948 """Transform the Expression into its negated version."""
949949 return GreaterThanOrEqual (self .term , self .literal )
950950
@@ -953,10 +953,10 @@ def as_bound(self) -> builtins.type[BoundLessThan]:
953953 return BoundLessThan
954954
955955
956- class GreaterThanOrEqual (LiteralPredicate [ L ] ):
956+ class GreaterThanOrEqual (LiteralPredicate ):
957957 type : TypingLiteral ["gt-eq" ] = Field (default = "gt-eq" , alias = "type" )
958958
959- def __invert__ (self ) -> LessThan [ Any ] :
959+ def __invert__ (self ) -> LessThan :
960960 """Transform the Expression into its negated version."""
961961 return LessThan (self .term , self .literal )
962962
@@ -965,10 +965,10 @@ def as_bound(self) -> builtins.type[BoundGreaterThanOrEqual]:
965965 return BoundGreaterThanOrEqual
966966
967967
968- class GreaterThan (LiteralPredicate [ L ] ):
968+ class GreaterThan (LiteralPredicate ):
969969 type : TypingLiteral ["gt" ] = Field (default = "gt" , alias = "type" )
970970
971- def __invert__ (self ) -> LessThanOrEqual [ Any ] :
971+ def __invert__ (self ) -> LessThanOrEqual :
972972 """Transform the Expression into its negated version."""
973973 return LessThanOrEqual (self .term , self .literal )
974974
@@ -977,10 +977,10 @@ def as_bound(self) -> builtins.type[BoundGreaterThan]:
977977 return BoundGreaterThan
978978
979979
980- class LessThanOrEqual (LiteralPredicate [ L ] ):
980+ class LessThanOrEqual (LiteralPredicate ):
981981 type : TypingLiteral ["lt-eq" ] = Field (default = "lt-eq" , alias = "type" )
982982
983- def __invert__ (self ) -> GreaterThan [ Any ] :
983+ def __invert__ (self ) -> GreaterThan :
984984 """Transform the Expression into its negated version."""
985985 return GreaterThan (self .term , self .literal )
986986
@@ -989,10 +989,10 @@ def as_bound(self) -> builtins.type[BoundLessThanOrEqual]:
989989 return BoundLessThanOrEqual
990990
991991
992- class StartsWith (LiteralPredicate [ L ] ):
992+ class StartsWith (LiteralPredicate ):
993993 type : TypingLiteral ["starts-with" ] = Field (default = "starts-with" , alias = "type" )
994994
995- def __invert__ (self ) -> NotStartsWith [ Any ] :
995+ def __invert__ (self ) -> NotStartsWith :
996996 """Transform the Expression into its negated version."""
997997 return NotStartsWith (self .term , self .literal )
998998
@@ -1001,10 +1001,10 @@ def as_bound(self) -> builtins.type[BoundStartsWith]:
10011001 return BoundStartsWith
10021002
10031003
1004- class NotStartsWith (LiteralPredicate [ L ] ):
1004+ class NotStartsWith (LiteralPredicate ):
10051005 type : TypingLiteral ["not-starts-with" ] = Field (default = "not-starts-with" , alias = "type" )
10061006
1007- def __invert__ (self ) -> StartsWith [ Any ] :
1007+ def __invert__ (self ) -> StartsWith :
10081008 """Transform the Expression into its negated version."""
10091009 return StartsWith (self .term , self .literal )
10101010
0 commit comments