self.message.opt = dns.rrset.from_rdata(name, ttl, rd)
elif rdtype == dns.rdatatype.TSIG:
if self.keyring is None:
- raise UnknownTSIGKey("got signed message without " "keyring")
+ raise UnknownTSIGKey("got signed message without keyring")
if isinstance(self.keyring, dict):
key = self.keyring.get(absolute_name)
if isinstance(key, bytes):
elif af == socket.AF_INET6:
source = "::"
else:
- raise ValueError("source_port specified but address family is " "unknown")
+ raise ValueError("source_port specified but address family is unknown")
# Convert high-level (address, port) tuples into low-level address
# tuples.
if destination:
if not _httpx_ok and not _have_requests:
raise NoDOH(
- "Cannot use httpx for this operation, and " "requests is not available."
+ "Cannot use httpx for this operation, and requests is not available."
)
with contextlib.ExitStack() as stack:
# Note we have to say "not in" as we have None as a value
# so a get() and a not None test would be wrong.
if key not in params:
- raise ValueError(
- f"key {key:d} declared mandatory but not " "present"
- )
+ raise ValueError(f"key {key:d} declared mandatory but not present")
# The no-default-alpn parameter requires the alpn parameter.
if ParamKey.NO_DEFAULT_ALPN in params:
if ParamKey.ALPN not in params:
self._nameservers = nameservers
else:
raise ValueError(
- "nameservers must be a list" " (not a {})".format(type(nameservers))
+ "nameservers must be a list (not a {})".format(type(nameservers))
)
self._raise_if_not_empty(method, args)
if rdataset:
if rdataset.rdclass != self.manager.get_class():
- raise ValueError(f"{method} has objects of wrong " "RdataClass")
+ raise ValueError(f"{method} has objects of wrong RdataClass")
existing = self._get_rdataset(name, rdataset.rdtype, rdataset.covers)
if existing is not None:
if exact:
# the origin.
#
if not message.answer or message.answer[0].name != self.origin:
- raise dns.exception.FormError(
- "No answer or RRset not " "for zone origin"
- )
+ raise dns.exception.FormError("No answer or RRset not for zone origin")
rrset = message.answer[0]
rdataset = rrset
if rdataset.rdtype != dns.rdatatype.SOA:
self.rdtype == dns.rdatatype.IXFR
and self.serial != rdataset[0].serial
):
- raise dns.exception.FormError(
- "unexpected end of IXFR " "sequence"
- )
+ raise dns.exception.FormError("unexpected end of IXFR sequence")
self.txn.replace(name, rdataset)
self.txn.commit()
self.txn = None
self.txn.replace(name, rdataset)
else:
# We saw a non-final SOA for the origin in an AXFR.
- raise dns.exception.FormError(
- "unexpected origin SOA " "in AXFR"
- )
+ raise dns.exception.FormError("unexpected origin SOA in AXFR")
continue
if self.expecting_SOA:
#
if isinstance(origin, str):
origin = dns.name.from_text(origin)
elif not isinstance(origin, dns.name.Name):
- raise ValueError(
- "origin parameter must be convertible to a " "DNS name"
- )
+ raise ValueError("origin parameter must be convertible to a DNS name")
if not origin.is_absolute():
raise ValueError("origin parameter must be an absolute name")
self.origin = origin
node_kind == dns.node.NodeKind.CNAME
and rdataset_kind == dns.node.NodeKind.REGULAR
):
- raise CNAMEAndOtherData("rdataset type is not compatible with a " "CNAME node")
+ raise CNAMEAndOtherData("rdataset type is not compatible with a CNAME node")
elif (
node_kind == dns.node.NodeKind.REGULAR
and rdataset_kind == dns.node.NodeKind.CNAME
):
raise CNAMEAndOtherData(
- "CNAME rdataset is not compatible with a " "regular data node"
+ "CNAME rdataset is not compatible with a regular data node"
)
# Otherwise at least one of the node and the rdataset is neutral, so
# adding the rdataset is ok