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

chore: name the txt repr inline limit by bdraco · Pull Request #1883 · python-zeroconf/python-zeroconf · GitHub

Repository navigation

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (1) 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
7 changes: 6 additions & 1 deletion 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 @@ -29,6 +29,11 @@
_int = int


# Longest TXT payload rendered inline by repr; larger payloads are
# summarized as a byte count to keep debug logs readable.
_TEXT_REPR_INLINE_LIMIT = 16


def _type_label(type_: int) -> str:
return _TYPES.get(type_, f"unknown-type-{type_}")

Expand Down Expand Up @@ -572,7 +577,7 @@ def __hash__(self) -> int:
return self._hash

def __repr__(self) -> str:
data = f"{len(self.text)} bytes" if len(self.text) > 16 else str(self.text)
data = f"{len(self.text)} bytes" if len(self.text) > _TEXT_REPR_INLINE_LIMIT else str(self.text)
return self._repr_with(("data", data))

def write(self, out: DNSOutgoing) -> None:
Expand Down
Loading

Back | FazBrowse Home | New Git URL