From 1db18b95597fb0fb70081d394246a1c73a2cc3ae Mon Sep 17 00:00:00 2001 From: Brian Wellington Date: Tue, 11 Apr 2023 11:05:16 -0700 Subject: [PATCH] Remove unnecessary string concatenation. --- dns/asyncbackend.py | 4 +--- dns/dnssec.py | 2 +- dns/query.py | 2 +- dns/resolver.py | 2 +- dns/transaction.py | 4 ++-- dns/tsig.py | 4 +--- 6 files changed, 7 insertions(+), 11 deletions(-) diff --git a/dns/asyncbackend.py b/dns/asyncbackend.py index e889ce7b..b6d3211d 100644 --- a/dns/asyncbackend.py +++ b/dns/asyncbackend.py @@ -69,9 +69,7 @@ def sniff() -> str: try: return sniffio.current_async_library() except sniffio.AsyncLibraryNotFoundError: - raise AsyncLibraryNotFoundError( - "sniffio cannot determine " + "async library" - ) + raise AsyncLibraryNotFoundError("sniffio cannot determine async library") except ImportError: import asyncio diff --git a/dns/dnssec.py b/dns/dnssec.py index c219965d..0c19ee80 100644 --- a/dns/dnssec.py +++ b/dns/dnssec.py @@ -1444,7 +1444,7 @@ def _sign_zone_nsec( def _need_pyca(*args, **kwargs): raise ImportError( - "DNSSEC validation requires " + "python cryptography" + "DNSSEC validation requires python cryptography" ) # pragma: no cover diff --git a/dns/query.py b/dns/query.py index c4bd75e3..1a1b566d 100644 --- a/dns/query.py +++ b/dns/query.py @@ -317,7 +317,7 @@ def _destination_and_source( # We know the destination af, so source had better agree! if saf != af: raise ValueError( - "different address families for source " + "and destination" + "different address families for source and destination" ) else: # We didn't know the destination af, but we know the source, diff --git a/dns/resolver.py b/dns/resolver.py index 5788c95a..c28c137c 100644 --- a/dns/resolver.py +++ b/dns/resolver.py @@ -187,7 +187,7 @@ Timeout = LifetimeTimeout class NoAnswer(dns.exception.DNSException): """The DNS response does not contain an answer to the question.""" - fmt = "The DNS response does not contain an answer " + "to the question: {query}" + fmt = "The DNS response does not contain an answer to the question: {query}" supp_kwargs = {"response"} # We do this as otherwise mypy complains about unexpected keyword argument diff --git a/dns/transaction.py b/dns/transaction.py index 91ed7329..37aa37a8 100644 --- a/dns/transaction.py +++ b/dns/transaction.py @@ -437,7 +437,7 @@ class Transaction: rdataset = rrset.to_rdataset() else: raise TypeError( - f"{method} requires a name or RRset " + "as the first argument" + f"{method} requires a name or RRset as the first argument" ) if rdataset.rdclass != self.manager.get_class(): raise ValueError(f"{method} has objects of wrong RdataClass") @@ -496,7 +496,7 @@ class Transaction: name = rdataset.name else: raise TypeError( - f"{method} requires a name or RRset " + "as the first argument" + f"{method} requires a name or RRset as the first argument" ) self._raise_if_not_empty(method, args) if rdataset: diff --git a/dns/tsig.py b/dns/tsig.py index 2476fdfb..ca3be590 100644 --- a/dns/tsig.py +++ b/dns/tsig.py @@ -187,9 +187,7 @@ class HMACTSig: try: hashinfo = self._hashes[algorithm] except KeyError: - raise NotImplementedError( - f"TSIG algorithm {algorithm} " + "is not supported" - ) + raise NotImplementedError(f"TSIG algorithm {algorithm} is not supported") # create the HMAC context if isinstance(hashinfo, tuple): -- 2.47.3