#
# Autogenerated by Thrift Compiler (0.9.3)
#
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
#
#  options string: py
#

from talos.thrift.Thrift import TType, TMessageType, TException, TApplicationException
import talos.thrift.common.ttypes
import talos.thrift.topic.ttypes

from talos.thrift.transport import TTransport
from talos.thrift.protocol import TBinaryProtocol, TProtocol
try:
  from talos.thrift.protocol import fastbinary
except:
  fastbinary = None



class PartitionConsumeUnit:
  """
  Attributes:
   - partitionId: The partitionId

   - ipAddr: The specified ipAddr

   - consumerCommitOffset: The consumer commit offset

   - consumerOffsetLag: The consumer offset lag

  """

  thrift_spec = (
    None, # 0
    (1, TType.I32, 'partitionId', None, None, ), # 1
    (2, TType.STRING, 'ipAddr', None, None, ), # 2
    (3, TType.I64, 'consumerCommitOffset', None, None, ), # 3
    (4, TType.I64, 'consumerOffsetLag', None, None, ), # 4
  )

  def __init__(self, partitionId=None, ipAddr=None, consumerCommitOffset=None, consumerOffsetLag=None,):
    self.partitionId = partitionId
    self.ipAddr = ipAddr
    self.consumerCommitOffset = consumerCommitOffset
    self.consumerOffsetLag = consumerOffsetLag

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 1:
        if ftype == TType.I32:
          self.partitionId = iprot.readI32()
        else:
          iprot.skip(ftype)
      elif fid == 2:
        if ftype == TType.STRING:
          self.ipAddr = iprot.readString()
        else:
          iprot.skip(ftype)
      elif fid == 3:
        if ftype == TType.I64:
          self.consumerCommitOffset = iprot.readI64()
        else:
          iprot.skip(ftype)
      elif fid == 4:
        if ftype == TType.I64:
          self.consumerOffsetLag = iprot.readI64()
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('PartitionConsumeUnit')
    if self.partitionId is not None:
      oprot.writeFieldBegin('partitionId', TType.I32, 1)
      oprot.writeI32(self.partitionId)
      oprot.writeFieldEnd()
    if self.ipAddr is not None:
      oprot.writeFieldBegin('ipAddr', TType.STRING, 2)
      oprot.writeString(self.ipAddr)
      oprot.writeFieldEnd()
    if self.consumerCommitOffset is not None:
      oprot.writeFieldBegin('consumerCommitOffset', TType.I64, 3)
      oprot.writeI64(self.consumerCommitOffset)
      oprot.writeFieldEnd()
    if self.consumerOffsetLag is not None:
      oprot.writeFieldBegin('consumerOffsetLag', TType.I64, 4)
      oprot.writeI64(self.consumerOffsetLag)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    if self.partitionId is None:
      raise TProtocol.TProtocolException(message='Required field partitionId is unset!')
    if self.ipAddr is None:
      raise TProtocol.TProtocolException(message='Required field ipAddr is unset!')
    if self.consumerCommitOffset is None:
      raise TProtocol.TProtocolException(message='Required field consumerCommitOffset is unset!')
    if self.consumerOffsetLag is None:
      raise TProtocol.TProtocolException(message='Required field consumerOffsetLag is unset!')
    return


  def __hash__(self):
    value = 17
    value = (value * 31) ^ hash(self.partitionId)
    value = (value * 31) ^ hash(self.ipAddr)
    value = (value * 31) ^ hash(self.consumerCommitOffset)
    value = (value * 31) ^ hash(self.consumerOffsetLag)
    return value

  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.items()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class ConsumerGroupAndTopic:
  """
  Attributes:
   - consumerGroupName: The specified ConsumerGroupName

   - topicTalosResourceName: The specified topicTalosResourceName

  """

  thrift_spec = (
    None, # 0
    (1, TType.STRING, 'consumerGroupName', None, None, ), # 1
    (2, TType.STRUCT, 'topicTalosResourceName', (talos.thrift.topic.ttypes.TopicTalosResourceName, talos.thrift.topic.ttypes.TopicTalosResourceName.thrift_spec), None, ), # 2
  )

  def __init__(self, consumerGroupName=None, topicTalosResourceName=None,):
    self.consumerGroupName = consumerGroupName
    self.topicTalosResourceName = topicTalosResourceName

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 1:
        if ftype == TType.STRING:
          self.consumerGroupName = iprot.readString()
        else:
          iprot.skip(ftype)
      elif fid == 2:
        if ftype == TType.STRUCT:
          self.topicTalosResourceName = talos.thrift.topic.ttypes.TopicTalosResourceName()
          self.topicTalosResourceName.read(iprot)
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('ConsumerGroupAndTopic')
    if self.consumerGroupName is not None:
      oprot.writeFieldBegin('consumerGroupName', TType.STRING, 1)
      oprot.writeString(self.consumerGroupName)
      oprot.writeFieldEnd()
    if self.topicTalosResourceName is not None:
      oprot.writeFieldBegin('topicTalosResourceName', TType.STRUCT, 2)
      self.topicTalosResourceName.write(oprot)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    if self.consumerGroupName is None:
      raise TProtocol.TProtocolException(message='Required field consumerGroupName is unset!')
    if self.topicTalosResourceName is None:
      raise TProtocol.TProtocolException(message='Required field topicTalosResourceName is unset!')
    return


  def __hash__(self):
    value = 17
    value = (value * 31) ^ hash(self.consumerGroupName)
    value = (value * 31) ^ hash(self.topicTalosResourceName)
    return value

  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.items()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class QueryConsumerGroupRequest:
  """
  Attributes:
   - topicTalosResourceName: The specified topicTalosResourceName

  """

  thrift_spec = (
    None, # 0
    (1, TType.STRUCT, 'topicTalosResourceName', (talos.thrift.topic.ttypes.TopicTalosResourceName, talos.thrift.topic.ttypes.TopicTalosResourceName.thrift_spec), None, ), # 1
  )

  def __init__(self, topicTalosResourceName=None,):
    self.topicTalosResourceName = topicTalosResourceName

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 1:
        if ftype == TType.STRUCT:
          self.topicTalosResourceName = talos.thrift.topic.ttypes.TopicTalosResourceName()
          self.topicTalosResourceName.read(iprot)
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('QueryConsumerGroupRequest')
    if self.topicTalosResourceName is not None:
      oprot.writeFieldBegin('topicTalosResourceName', TType.STRUCT, 1)
      self.topicTalosResourceName.write(oprot)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    if self.topicTalosResourceName is None:
      raise TProtocol.TProtocolException(message='Required field topicTalosResourceName is unset!')
    return


  def __hash__(self):
    value = 17
    value = (value * 31) ^ hash(self.topicTalosResourceName)
    return value

  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.items()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class QueryConsumerGroupResponse:
  """
  Attributes:
   - consumerGroupList: The consumerGroupName List

  """

  thrift_spec = (
    None, # 0
    (1, TType.SET, 'consumerGroupList', (TType.STRING,None), None, ), # 1
  )

  def __init__(self, consumerGroupList=None,):
    self.consumerGroupList = consumerGroupList

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 1:
        if ftype == TType.SET:
          self.consumerGroupList = set()
          (_etype3, _size0) = iprot.readSetBegin()
          for _i4 in range(_size0):
            _elem5 = iprot.readString()
            self.consumerGroupList.add(_elem5)
          iprot.readSetEnd()
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('QueryConsumerGroupResponse')
    if self.consumerGroupList is not None:
      oprot.writeFieldBegin('consumerGroupList', TType.SET, 1)
      oprot.writeSetBegin(TType.STRING, len(self.consumerGroupList))
      for iter6 in self.consumerGroupList:
        oprot.writeString(iter6)
      oprot.writeSetEnd()
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    if self.consumerGroupList is None:
      raise TProtocol.TProtocolException(message='Required field consumerGroupList is unset!')
    return


  def __hash__(self):
    value = 17
    value = (value * 31) ^ hash(self.consumerGroupList)
    return value

  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.items()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class GetTopicConsumeUnitRequest:
  """
  Attributes:
   - consumerGroupAndTopic: The specified consumerGroup and topic

  """

  thrift_spec = (
    None, # 0
    (1, TType.STRUCT, 'consumerGroupAndTopic', (ConsumerGroupAndTopic, ConsumerGroupAndTopic.thrift_spec), None, ), # 1
  )

  def __init__(self, consumerGroupAndTopic=None,):
    self.consumerGroupAndTopic = consumerGroupAndTopic

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 1:
        if ftype == TType.STRUCT:
          self.consumerGroupAndTopic = ConsumerGroupAndTopic()
          self.consumerGroupAndTopic.read(iprot)
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('GetTopicConsumeUnitRequest')
    if self.consumerGroupAndTopic is not None:
      oprot.writeFieldBegin('consumerGroupAndTopic', TType.STRUCT, 1)
      self.consumerGroupAndTopic.write(oprot)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    if self.consumerGroupAndTopic is None:
      raise TProtocol.TProtocolException(message='Required field consumerGroupAndTopic is unset!')
    return


  def __hash__(self):
    value = 17
    value = (value * 31) ^ hash(self.consumerGroupAndTopic)
    return value

  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.items()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class GetTopicConsumeUnitResponse:
  """
  Attributes:
   - partitionConsumeUnitList: The partitionConsumeUnitList

  """

  thrift_spec = (
    None, # 0
    (1, TType.LIST, 'partitionConsumeUnitList', (TType.STRUCT,(PartitionConsumeUnit, PartitionConsumeUnit.thrift_spec)), None, ), # 1
  )

  def __init__(self, partitionConsumeUnitList=None,):
    self.partitionConsumeUnitList = partitionConsumeUnitList

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 1:
        if ftype == TType.LIST:
          self.partitionConsumeUnitList = []
          (_etype10, _size7) = iprot.readListBegin()
          for _i11 in range(_size7):
            _elem12 = PartitionConsumeUnit()
            _elem12.read(iprot)
            self.partitionConsumeUnitList.append(_elem12)
          iprot.readListEnd()
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('GetTopicConsumeUnitResponse')
    if self.partitionConsumeUnitList is not None:
      oprot.writeFieldBegin('partitionConsumeUnitList', TType.LIST, 1)
      oprot.writeListBegin(TType.STRUCT, len(self.partitionConsumeUnitList))
      for iter13 in self.partitionConsumeUnitList:
        iter13.write(oprot)
      oprot.writeListEnd()
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    if self.partitionConsumeUnitList is None:
      raise TProtocol.TProtocolException(message='Required field partitionConsumeUnitList is unset!')
    return


  def __hash__(self):
    value = 17
    value = (value * 31) ^ hash(self.partitionConsumeUnitList)
    return value

  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.items()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class QueryTopicConsumeUnitRequest:
  """
  Attributes:
   - topicTalosResourceName: The specified topicTalosResourceName

  """

  thrift_spec = (
    None, # 0
    (1, TType.STRUCT, 'topicTalosResourceName', (talos.thrift.topic.ttypes.TopicTalosResourceName, talos.thrift.topic.ttypes.TopicTalosResourceName.thrift_spec), None, ), # 1
  )

  def __init__(self, topicTalosResourceName=None,):
    self.topicTalosResourceName = topicTalosResourceName

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 1:
        if ftype == TType.STRUCT:
          self.topicTalosResourceName = talos.thrift.topic.ttypes.TopicTalosResourceName()
          self.topicTalosResourceName.read(iprot)
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('QueryTopicConsumeUnitRequest')
    if self.topicTalosResourceName is not None:
      oprot.writeFieldBegin('topicTalosResourceName', TType.STRUCT, 1)
      self.topicTalosResourceName.write(oprot)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    if self.topicTalosResourceName is None:
      raise TProtocol.TProtocolException(message='Required field topicTalosResourceName is unset!')
    return


  def __hash__(self):
    value = 17
    value = (value * 31) ^ hash(self.topicTalosResourceName)
    return value

  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.items()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class QueryTopicConsumeUnitResponse:
  """
  Attributes:
   - topicConsumeUnitMap: The topicConsumeUnitMap

  """

  thrift_spec = (
    None, # 0
    (1, TType.MAP, 'topicConsumeUnitMap', (TType.STRING,None,TType.LIST,(TType.STRUCT,(PartitionConsumeUnit, PartitionConsumeUnit.thrift_spec))), None, ), # 1
  )

  def __init__(self, topicConsumeUnitMap=None,):
    self.topicConsumeUnitMap = topicConsumeUnitMap

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 1:
        if ftype == TType.MAP:
          self.topicConsumeUnitMap = {}
          (_ktype15, _vtype16, _size14 ) = iprot.readMapBegin()
          for _i18 in range(_size14):
            _key19 = iprot.readString()
            _val20 = []
            (_etype24, _size21) = iprot.readListBegin()
            for _i25 in range(_size21):
              _elem26 = PartitionConsumeUnit()
              _elem26.read(iprot)
              _val20.append(_elem26)
            iprot.readListEnd()
            self.topicConsumeUnitMap[_key19] = _val20
          iprot.readMapEnd()
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('QueryTopicConsumeUnitResponse')
    if self.topicConsumeUnitMap is not None:
      oprot.writeFieldBegin('topicConsumeUnitMap', TType.MAP, 1)
      oprot.writeMapBegin(TType.STRING, TType.LIST, len(self.topicConsumeUnitMap))
      for kiter27,viter28 in self.topicConsumeUnitMap.items():
        oprot.writeString(kiter27)
        oprot.writeListBegin(TType.STRUCT, len(viter28))
        for iter29 in viter28:
          iter29.write(oprot)
        oprot.writeListEnd()
      oprot.writeMapEnd()
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    if self.topicConsumeUnitMap is None:
      raise TProtocol.TProtocolException(message='Required field topicConsumeUnitMap is unset!')
    return


  def __hash__(self):
    value = 17
    value = (value * 31) ^ hash(self.topicConsumeUnitMap)
    return value

  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.items()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)
