Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 15 additions & 7 deletions zeroconf/_dns.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def __hash__(self) -> int:

def __eq__(self, other: Any) -> bool:
"""Tests equality on dns question."""
return isinstance(other, DNSQuestion) and DNSEntry.__eq__(self, other)
return isinstance(other, DNSQuestion) and dns_entry_matches(other, self.key, self.type, self.class_)

@property
def max_size(self) -> int:
Expand Down Expand Up @@ -260,7 +260,7 @@ def __eq__(self, other: Any) -> bool:
isinstance(other, DNSAddress)
and self.address == other.address
and self.scope_id == other.scope_id
and DNSEntry.__eq__(self, other)
and dns_entry_matches(other, self.key, self.type, self.class_)
)

def __hash__(self) -> int:
Expand Down Expand Up @@ -304,7 +304,7 @@ def __eq__(self, other: Any) -> bool:
isinstance(other, DNSHinfo)
and self.cpu == other.cpu
and self.os == other.os
and DNSEntry.__eq__(self, other)
and dns_entry_matches(other, self.key, self.type, self.class_)
)

def __hash__(self) -> int:
Expand Down Expand Up @@ -345,7 +345,11 @@ def write(self, out: 'DNSOutgoing') -> None:

def __eq__(self, other: Any) -> bool:
"""Tests equality on alias"""
return isinstance(other, DNSPointer) and self.alias == other.alias and DNSEntry.__eq__(self, other)
return (
isinstance(other, DNSPointer)
and self.alias == other.alias
and dns_entry_matches(other, self.key, self.type, self.class_)
)

def __hash__(self) -> int:
"""Hash to compare like DNSPointer."""
Expand Down Expand Up @@ -380,7 +384,11 @@ def __hash__(self) -> int:

def __eq__(self, other: Any) -> bool:
"""Tests equality on text"""
return isinstance(other, DNSText) and self.text == other.text and DNSEntry.__eq__(self, other)
return (
isinstance(other, DNSText)
and self.text == other.text
and dns_entry_matches(other, self.key, self.type, self.class_)
)

def __repr__(self) -> str:
"""String representation"""
Expand Down Expand Up @@ -429,7 +437,7 @@ def __eq__(self, other: Any) -> bool:
and self.weight == other.weight
and self.port == other.port
and self.server == other.server
and DNSEntry.__eq__(self, other)
and dns_entry_matches(other, self.key, self.type, self.class_)
)

def __hash__(self) -> int:
Expand Down Expand Up @@ -484,7 +492,7 @@ def __eq__(self, other: Any) -> bool:
isinstance(other, DNSNsec)
and self.next_name == other.next_name
and self.rdtypes == other.rdtypes
and DNSEntry.__eq__(self, other)
and dns_entry_matches(other, self.key, self.type, self.class_)
)

def __hash__(self) -> int:
Expand Down