1212# See the License for the specific language governing permissions and
1313# limitations under the License.
1414
15- from typing import List , Optional
15+ from typing import List , Optional , Any
1616from enum import Enum
1717from .. import cimpl
1818from ..cimpl import TopicPartition
@@ -62,7 +62,7 @@ class ConsumerGroupTopicPartitions:
6262 List of topic partitions information.
6363 """
6464
65- def __init__ (self , group_id : str , topic_partitions : Optional [List [TopicPartition ]] = None ) -> None :
65+ def __init__ (self , group_id : str , topic_partitions : Optional [List ['cimpl. TopicPartition' ]] = None ) -> None :
6666 self .group_id = group_id
6767 self .topic_partitions = topic_partitions
6868
@@ -91,8 +91,8 @@ class ConsumerGroupState(Enum):
9191 #: Consumer Group is empty.
9292 EMPTY = cimpl .CONSUMER_GROUP_STATE_EMPTY
9393
94- def __lt__ (self , other : object ) -> bool :
95- if not isinstance ( other , ConsumerGroupState ) :
94+ def __lt__ (self , other : 'ConsumerGroupState' ) -> Any :
95+ if self . __class__ != other . __class__ :
9696 return NotImplemented
9797 return self .value < other .value
9898
@@ -111,8 +111,8 @@ class ConsumerGroupType(Enum):
111111 #: Classic Type
112112 CLASSIC = cimpl .CONSUMER_GROUP_TYPE_CLASSIC
113113
114- def __lt__ (self , other : object ) -> bool :
115- if not isinstance ( other , ConsumerGroupType ) :
114+ def __lt__ (self , other : 'ConsumerGroupType' ) -> Any :
115+ if self . __class__ != other . __class__ :
116116 return NotImplemented
117117 return self .value < other .value
118118
@@ -167,8 +167,8 @@ class IsolationLevel(Enum):
167167 READ_UNCOMMITTED = cimpl .ISOLATION_LEVEL_READ_UNCOMMITTED #: Receive all the offsets.
168168 READ_COMMITTED = cimpl .ISOLATION_LEVEL_READ_COMMITTED #: Skip offsets belonging to an aborted transaction.
169169
170- def __lt__ (self , other : object ) -> bool :
171- if not isinstance ( other , IsolationLevel ) :
170+ def __lt__ (self , other : 'IsolationLevel' ) -> Any :
171+ if self . __class__ != other . __class__ :
172172 return NotImplemented
173173 return self .value < other .value
174174
@@ -186,7 +186,7 @@ class ElectionType(Enum):
186186 #: Unclean election
187187 UNCLEAN = cimpl .ELECTION_TYPE_UNCLEAN
188188
189- def __lt__ (self , other : object ) -> bool :
190- if not isinstance ( other , ElectionType ) :
189+ def __lt__ (self , other : 'ElectionType' ) -> Any :
190+ if self . __class__ != other . __class__ :
191191 return NotImplemented
192192 return self .value < other .value
0 commit comments