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:
@@ -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))
|
||||
|
Reference in New Issue
Block a user