2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 14:35:26 +00:00

Shorten syntax to access Name object

dns.name all over the place does not make it easier to read the code at
all, and I'm going to add lot more code here.

(cherry picked from commit 3fb6b990af)
This commit is contained in:
Petr Špaček
2025-05-21 15:19:25 +02:00
parent fa9ca7f3ee
commit b6b6b6f45b

View File

@@ -9,12 +9,12 @@
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
import dns.name
from dns.name import Name
def prepend_label(label: str, name: dns.name.Name) -> dns.name.Name:
return dns.name.Name((label,) + name.labels)
def prepend_label(label: str, name: Name) -> Name:
return Name((label,) + name.labels)
def len_wire_uncompressed(name: dns.name.Name) -> int:
def len_wire_uncompressed(name: Name) -> int:
return len(name) + sum(map(len, name.labels))