FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

revert: remove the 2009 record display formats by bdraco · Pull Request #1878 · python-zeroconf/python-zeroconf · GitHub

Repository navigation

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (2) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
32 changes: 2 additions & 30 deletions src/zeroconf/_dns.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@

import enum
import socket
from typing import TYPE_CHECKING, Any, cast
from typing import TYPE_CHECKING, Any

from ._exceptions import AbstractMethodException
from ._utils.net import _is_v6_address
from ._utils.time import current_time_millis
from .const import _CLASS_MASK, _CLASS_UNIQUE, _CLASSES, _TYPE_ANY, _TYPES
from .const import _CLASS_MASK, _CLASS_UNIQUE, _TYPE_ANY

_LEN_BYTE = 1
_LEN_SHORT = 2
Expand Down Expand Up @@ -58,24 +58,6 @@ def __eq__(self, other: Any) -> bool:
"""Equal when key, type and class match."""
return isinstance(other, DNSEntry) and self._dns_entry_matches(other)

def entry_to_string(self, hdr: str, other: bytes | str | None) -> str:
return "{}[{},{}{},{}]{}".format(
hdr,
self.get_type(self.type),
self.get_class_(self.class_),
"-unique" if self.unique else "",
self.name,
f"={cast(Any, other)}" if other is not None else "",
)

@staticmethod
def get_class_(class_: int) -> str:
return _CLASSES.get(class_, f"?({class_})")

@staticmethod
def get_type(t: int) -> str:
return _TYPES.get(t, f"?({t})")

def _dns_entry_matches(self, other: DNSEntry) -> bool:
return self.key == other.key and self.type == other.type and self.class_ == other.class_

Expand Down Expand Up @@ -190,10 +172,6 @@ def suppressed_by(self, msg: DNSIncoming) -> bool:
return True
return False

def to_string(self, other: bytes | str) -> str:
arg = f"{self.ttl}/{int(self.get_remaining_ttl(current_time_millis()))},{cast(Any, other)}"
return DNSEntry.entry_to_string(self, "record", arg)

def write(self, out: DNSOutgoing) -> None:
raise AbstractMethodException(f"{type(self).__name__} is missing write")

Expand Down Expand Up @@ -303,9 +281,6 @@ def __hash__(self) -> int:
"""Hash to compare like DNSHinfo."""
return self._hash

def __repr__(self) -> str:
return self.to_string(self.cpu + " " + self.os)

def write(self, out: DNSOutgoing) -> None:
"""Write the rdata to an outgoing packet."""
out.write_character_string(self.cpu.encode("utf-8"))
Expand Down Expand Up @@ -478,9 +453,6 @@ def __hash__(self) -> int:
"""Hash to compare like DNSService."""
return self._hash

def __repr__(self) -> str:
return self.to_string(f"{self.server}:{self.port}")

def write(self, out: DNSOutgoing) -> None:
out.write_short(self.priority)
out.write_short(self.weight)
Expand Down
2 changes: 0 additions & 2 deletions src/zeroconf/_protocol/outgoing.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -415,8 +415,6 @@ def _write_int(self, value: float | int) -> None:
self.size += 4

def _write_link_to_name(self, index: int_) -> None:
# If part of the name already exists in the packet,
# create a pointer to it
self._write_byte((index >> 8) | 0xC0)
self._write_byte(index & 0xFF)

Expand Down
Loading

Back | FazBrowse Home | New Git URL