From be479d0f89a0f3fa1e9a4ced7c4a756b346f4075 Mon Sep 17 00:00:00 2001 From: Bob Halley Date: Sat, 10 Jul 2021 15:28:59 -0700 Subject: [PATCH] avoid compatibility warnings for python 3.12 --- dns/rdata.py | 2 +- dns/rdtypes/svcbbase.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dns/rdata.py b/dns/rdata.py index 18e93cf6..2da314b4 100644 --- a/dns/rdata.py +++ b/dns/rdata.py @@ -687,7 +687,7 @@ def from_wire(rdclass, rdtype, wire, current, rdlen, origin=None): class RdatatypeExists(dns.exception.DNSException): """DNS rdatatype already exists.""" supp_kwargs = {'rdclass', 'rdtype'} - fmt = "The rdata type with class {rdclass} and rdtype {rdtype} " + \ + fmt = "The rdata type with class {rdclass:d} and rdtype {rdtype:d} " + \ "already exists." diff --git a/dns/rdtypes/svcbbase.py b/dns/rdtypes/svcbbase.py index 2c76a58e..09d7a52b 100644 --- a/dns/rdtypes/svcbbase.py +++ b/dns/rdtypes/svcbbase.py @@ -198,7 +198,7 @@ class MandatoryParam(Param): prior_k = None for k in keys: if k == prior_k: - raise ValueError(f'duplicate key {k}') + raise ValueError(f'duplicate key {k:d}') prior_k = k if k == ParamKey.MANDATORY: raise ValueError('listed the mandatory key as mandatory') @@ -402,7 +402,7 @@ _class_for_key = { def _validate_and_define(params, key, value): (key, force_generic) = _validate_key(_unescape(key)) if key in params: - raise SyntaxError(f'duplicate key "{key}"') + raise SyntaxError(f'duplicate key "{key:d}"') cls = _class_for_key.get(key, GenericParam) emptiness = cls.emptiness() if value is None: @@ -443,7 +443,7 @@ class SVCBBase(dns.rdata.Rdata): # 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} declared mandatory but not ' + 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: -- 2.47.3