@@ -318,7 +318,7 @@ def __repr__(self) -> str:
318318 """
319319 return str (f"({ str (self .lower_bound )} , { str (self .upper_bound )} )" )
320320
321- def __eq__ (self , other ) -> bool :
321+ def __eq__ (self , other : object ) -> bool :
322322 """
323323 Equality operator
324324
@@ -332,7 +332,7 @@ def __eq__(self, other) -> bool:
332332 return False
333333 return bool (self .lower_bound == other .lower_bound and self .upper_bound == other .upper_bound )
334334
335- def __ne__ (self , other ) -> bool :
335+ def __ne__ (self , other : object ) -> bool :
336336 """
337337 Non-equality operator
338338
@@ -476,7 +476,7 @@ def simplify(self) -> None:
476476
477477 self .intervals = final_intervals
478478
479- def contains (self , value ) -> bool :
479+ def contains (self , value : float | int ) -> bool :
480480 """
481481 Check if the interval contains the value
482482
@@ -488,7 +488,7 @@ def contains(self, value) -> bool:
488488 """
489489 return any (interval .contains (value ) for interval in self .intervals )
490490
491- def intersection (self , other ) :
491+ def intersection (self , other : "Interval | IntervalUnion" ) -> "IntervalUnion" :
492492 """
493493 Returns the intersection of two intervals
494494
@@ -521,7 +521,7 @@ def integer(self) -> bool:
521521
522522 return any (interval .integer () for interval in self .intervals )
523523
524- def shrink_to_integers (self ):
524+ def shrink_to_integers (self ) -> "IntervalUnion" :
525525 """
526526 Shrinking the interval to integer boundaries
527527
@@ -550,7 +550,7 @@ def is_empty(self) -> bool:
550550 return True
551551 return all (interval .is_empty () for interval in self .intervals )
552552
553- def __add__ (self , other ) :
553+ def __add__ (self , other : "int | float | Interval | IntervalUnion" ) -> "IntervalUnion" :
554554 """
555555 The addition operator
556556
@@ -569,7 +569,7 @@ def __add__(self, other):
569569
570570 return IntervalUnion (intervals )
571571
572- def __radd__ (self , other ) :
572+ def __radd__ (self , other : "int | float | Interval | IntervalUnion" ) -> "IntervalUnion" :
573573 """
574574 The right hand addition
575575
@@ -581,7 +581,7 @@ def __radd__(self, other):
581581 """
582582 return self + other
583583
584- def __sub__ (self , other ) :
584+ def __sub__ (self , other : "int | float | Interval | IntervalUnion" ) -> "IntervalUnion" :
585585 """
586586 The subtraction operator
587587
@@ -601,7 +601,7 @@ def __sub__(self, other):
601601
602602 return IntervalUnion (intervals )
603603
604- def __rsub__ (self , other ) :
604+ def __rsub__ (self , other : "int | float | Interval | IntervalUnion" ) -> "IntervalUnion" :
605605 """
606606 The right hand subtraction
607607
@@ -613,7 +613,7 @@ def __rsub__(self, other):
613613 """
614614 return - 1 * self + other
615615
616- def __mul__ (self , other ) :
616+ def __mul__ (self , other : "int | float | Interval | IntervalUnion" ) -> "IntervalUnion" :
617617 """
618618 The multiplication operator
619619
@@ -634,7 +634,7 @@ def __mul__(self, other):
634634
635635 return IntervalUnion (intervals )
636636
637- def __rmul__ (self , other ) :
637+ def __rmul__ (self , other : "int | float | Interval | IntervalUnion" ) -> "IntervalUnion" :
638638 """
639639 The right hand multiplication operator
640640
@@ -646,7 +646,7 @@ def __rmul__(self, other):
646646 """
647647 return self .__mul__ (other )
648648
649- def __truediv__ (self , other ) :
649+ def __truediv__ (self , other : "int | float | Interval | IntervalUnion" ) -> "IntervalUnion" :
650650 """
651651 The division operator
652652
@@ -678,7 +678,7 @@ def __truediv__(self, other):
678678
679679 return IntervalUnion (intervals )
680680
681- def __rtruediv__ (self , other ) :
681+ def __rtruediv__ (self , other : "int | float | Interval | IntervalUnion" ) -> "IntervalUnion" :
682682 """
683683 The right hand division operator
684684
@@ -696,7 +696,7 @@ def __rtruediv__(self, other):
696696
697697 return other / self
698698
699- def __neg__ (self ):
699+ def __neg__ (self ) -> "IntervalUnion" :
700700 """
701701 The negation operator
702702
@@ -716,7 +716,7 @@ def __repr__(self) -> str:
716716 [f"({ interval .lower_bound } , { interval .upper_bound } )" for interval in self .intervals ]
717717 )
718718
719- def __eq__ (self , other ) -> bool :
719+ def __eq__ (self , other : object ) -> bool :
720720 """
721721 Equality operator
722722
@@ -740,7 +740,7 @@ def __eq__(self, other) -> bool:
740740
741741 return True
742742
743- def __ne__ (self , other ) -> bool :
743+ def __ne__ (self , other : object ) -> bool :
744744 """
745745 Non-equality operator
746746
@@ -752,7 +752,7 @@ def __ne__(self, other) -> bool:
752752 """
753753 return not self .__eq__ (other )
754754
755- def __pow__ (self , other ) :
755+ def __pow__ (self , other : float | int ) -> "IntervalUnion" :
756756 """
757757 The power operation on the interval union
758758
@@ -764,7 +764,7 @@ def __pow__(self, other):
764764 """
765765 return IntervalUnion ([interval ** other for interval in self .intervals ])
766766
767- def representing_int (self ):
767+ def representing_int (self ) -> int | None :
768768 """
769769 Returns a representative integer
770770
0 commit comments