MCPcopy Create free account
hub / github.com/rthalley/dnspython / __eq__

Method __eq__

dns/message.py:253–274  ·  view source on GitHub ↗

Two messages are equal if they have the same content in the header, question, answer, and authority sections. Returns a ``bool``.

(self, other)

Source from the content-addressed store, hash-verified

251 return s.getvalue()[:-1]
252
253 def __eq__(self, other):
254 """Two messages are equal if they have the same content in the
255 header, question, answer, and authority sections.
256
257 Returns a ``bool``.
258 """
259
260 if not isinstance(other, Message):
261 return False
262 if self.id != other.id:
263 return False
264 if self.flags != other.flags:
265 return False
266 for i, section in enumerate(self.sections):
267 other_section = other.sections[i]
268 for n in section:
269 if n not in other_section:
270 return False
271 for n in other_section:
272 if n not in section:
273 return False
274 return True
275
276 def __ne__(self, other):
277 return not self.__eq__(other)

Callers 1

__ne__Method · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected