diff options
author | Bob Halley <halley@dnspython.org> | 2023-03-19 09:31:03 -0700 |
---|---|---|
committer | Bob Halley <halley@dnspython.org> | 2023-03-19 09:31:03 -0700 |
commit | 67daa993805b97ba1dc57245ecf3af2e55729df6 (patch) | |
tree | 74a4be91e0be4b1bf0f0d8420a3991fdcd1f5e5b | |
parent | cdf9a2c37fa45eac7a6de6a4c7f74a24d1c08389 (diff) | |
download | dnspython-67daa993805b97ba1dc57245ecf3af2e55729df6.tar.gz |
re-run black
-rw-r--r-- | dns/asyncresolver.py | 38 | ||||
-rw-r--r-- | dns/entropy.py | 1 | ||||
-rw-r--r-- | dns/message.py | 2 | ||||
-rw-r--r-- | dns/rdata.py | 1 | ||||
-rw-r--r-- | dns/tsigkeyring.py | 4 | ||||
-rw-r--r-- | dns/update.py | 1 | ||||
-rw-r--r-- | dns/win32util.py | 1 | ||||
-rw-r--r-- | tests/test_immutable.py | 2 | ||||
-rw-r--r-- | tests/test_nsec3_hash.py | 1 | ||||
-rw-r--r-- | tests/test_ntoaaton.py | 6 | ||||
-rw-r--r-- | tests/test_query.py | 2 | ||||
-rw-r--r-- | tests/test_rdtypeandclass.py | 1 | ||||
-rw-r--r-- | tests/test_zone.py | 2 |
13 files changed, 27 insertions, 35 deletions
diff --git a/dns/asyncresolver.py b/dns/asyncresolver.py index 55ef0fb..7b18b32 100644 --- a/dns/asyncresolver.py +++ b/dns/asyncresolver.py @@ -136,12 +136,11 @@ class Resolver(dns.resolver.BaseResolver): dns.reversename.from_address(ipaddr), *args, **modified_kwargs ) - async def resolve_name( self, name: Union[dns.name.Name, str], family: int = socket.AF_UNSPEC, - **kwargs: Any + **kwargs: Any, ) -> dns.resolver.HostAnswers: """Use an asynchronous resolver to query for address records. @@ -174,33 +173,36 @@ class Resolver(dns.resolver.BaseResolver): elif family != socket.AF_UNSPEC: raise NotImplementedError(f"unknown address family {family}") - raise_on_no_answer = modified_kwargs.pop('raise_on_no_answer', True) - lifetime = modified_kwargs.pop('lifetime', None) + raise_on_no_answer = modified_kwargs.pop("raise_on_no_answer", True) + lifetime = modified_kwargs.pop("lifetime", None) start = time.time() - v6 = await self.resolve(name, dns.rdatatype.AAAA, - raise_on_no_answer=False, - lifetime=self._compute_timeout(start, lifetime), - **modified_kwargs) + v6 = await self.resolve( + name, + dns.rdatatype.AAAA, + raise_on_no_answer=False, + lifetime=self._compute_timeout(start, lifetime), + **modified_kwargs, + ) # Note that setting name ensures we query the same name # for A as we did for AAAA. (This is just in case search lists # are active by default in the resolver configuration and # we might be talking to a server that says NXDOMAIN when it # wants to say NOERROR no data. name = v6.qname - v4 = await self.resolve(name, dns.rdatatype.A, - raise_on_no_answer=False, - lifetime=self._compute_timeout(start, lifetime), - **modified_kwargs) + v4 = await self.resolve( + name, + dns.rdatatype.A, + raise_on_no_answer=False, + lifetime=self._compute_timeout(start, lifetime), + **modified_kwargs, + ) answers = dns.resolver.HostAnswers.make( - v6=v6, - v4=v4, - add_empty=not raise_on_no_answer + v6=v6, v4=v4, add_empty=not raise_on_no_answer ) if not answers: raise NoAnswer(response=v6.response) return answers - # pylint: disable=redefined-outer-name async def canonical_name(self, name: Union[dns.name.Name, str]) -> dns.name.Name: @@ -295,9 +297,7 @@ async def resolve_address( async def resolve_name( - name: Union[dns.name.Name, str], - family: int = socket.AF_UNSPEC, - **kwargs: Any + name: Union[dns.name.Name, str], family: int = socket.AF_UNSPEC, **kwargs: Any ) -> dns.resolver.HostAnswers: """Use a resolver to asynchronously query for address records. diff --git a/dns/entropy.py b/dns/entropy.py index 5e1f5e2..3616818 100644 --- a/dns/entropy.py +++ b/dns/entropy.py @@ -25,7 +25,6 @@ import time class EntropyPool: - # This is an entropy pool for Python implementations that do not # have a working SystemRandom. I'm not sure there are any, but # leaving this code doesn't hurt anything as the library code diff --git a/dns/message.py b/dns/message.py index 8250db3..082fb7b 100644 --- a/dns/message.py +++ b/dns/message.py @@ -231,7 +231,7 @@ class Message: s.write("payload %d\n" % self.payload) for opt in self.options: s.write("option %s\n" % opt.to_text()) - for (name, which) in self._section_enum.__members__.items(): + for name, which in self._section_enum.__members__.items(): s.write(f";{name}\n") for rrset in self.section_from_number(which): s.write(rrset.to_text(origin, relativize, **kw)) diff --git a/dns/rdata.py b/dns/rdata.py index 1dd6ed9..d166b8a 100644 --- a/dns/rdata.py +++ b/dns/rdata.py @@ -358,7 +358,6 @@ class Rdata: or self.rdclass != other.rdclass or self.rdtype != other.rdtype ): - return NotImplemented return self._cmp(other) < 0 diff --git a/dns/tsigkeyring.py b/dns/tsigkeyring.py index 6adba28..1f8bc5f 100644 --- a/dns/tsigkeyring.py +++ b/dns/tsigkeyring.py @@ -33,7 +33,7 @@ def from_text(textring: Dict[str, Any]) -> Dict[dns.name.Name, dns.tsig.Key]: @rtype: dict""" keyring = {} - for (name, value) in textring.items(): + for name, value in textring.items(): kname = dns.name.from_text(name) if isinstance(value, str): keyring[kname] = dns.tsig.Key(kname, value).secret @@ -55,7 +55,7 @@ def to_text(keyring: Dict[dns.name.Name, Any]) -> Dict[str, Any]: def b64encode(secret): return base64.encodebytes(secret).decode().rstrip() - for (name, key) in keyring.items(): + for name, key in keyring.items(): tname = name.to_text() if isinstance(key, bytes): textring[tname] = b64encode(key) diff --git a/dns/update.py b/dns/update.py index 647e5b1..b10f6ac 100644 --- a/dns/update.py +++ b/dns/update.py @@ -43,7 +43,6 @@ class UpdateSection(dns.enum.IntEnum): class UpdateMessage(dns.message.Message): # lgtm[py/missing-equals] - # ignore the mypy error here as we mean to use a different enum _section_enum = UpdateSection # type: ignore diff --git a/dns/win32util.py b/dns/win32util.py index ac31475..f9fda98 100644 --- a/dns/win32util.py +++ b/dns/win32util.py @@ -1,7 +1,6 @@ import sys if sys.platform == "win32": - from typing import Any import dns.name diff --git a/tests/test_immutable.py b/tests/test_immutable.py index fa762d8..657d1b7 100644 --- a/tests/test_immutable.py +++ b/tests/test_immutable.py @@ -39,7 +39,6 @@ class ImmutableTestCase(unittest.TestCase): class DecoratorTestCase(unittest.TestCase): - immutable_module = dns._immutable_ctx def make_classes(self): @@ -125,7 +124,6 @@ class DecoratorTestCase(unittest.TestCase): self.assertFalse(hasattr(a, "b")) def test_no_collateral_damage(self): - # A and B are immutable but not related. The magic that lets # us write to immutable things while initializing B should not let # B mess with A. diff --git a/tests/test_nsec3_hash.py b/tests/test_nsec3_hash.py index 8cb6792..f16616e 100644 --- a/tests/test_nsec3_hash.py +++ b/tests/test_nsec3_hash.py @@ -6,7 +6,6 @@ from dns import dnssec, name class NSEC3Hash(unittest.TestCase): - DATA = [ # Source: https://tools.ietf.org/html/rfc5155#appendix-A ("example", "aabbccdd", 12, "0p9mhaveqvm6t7vbl5lop2u3t2rp3tom", 1), diff --git a/tests/test_ntoaaton.py b/tests/test_ntoaaton.py index 2468486..94386ce 100644 --- a/tests/test_ntoaaton.py +++ b/tests/test_ntoaaton.py @@ -205,7 +205,7 @@ class NtoAAtoNTestCase(unittest.TestCase): ("255.255.255.255", b"\xff\xff\xff\xff"), ("0.0.0.0", b"\x00\x00\x00\x00"), ] - for (t, b) in pairs: + for t, b in pairs: b1 = aton4(t) t1 = ntoa4(b1) self.assertEqual(b1, b) @@ -289,14 +289,14 @@ class NtoAAtoNTestCase(unittest.TestCase): self.assertRaises(dns.exception.SyntaxError, bad) def test_ptontop(self): - for (af, a) in [ + for af, a in [ (socket.AF_INET, "1.2.3.4"), (socket.AF_INET6, "2001:db8:0:1:1:1:1:1"), ]: self.assertEqual(dns.inet.inet_ntop(af, dns.inet.inet_pton(af, a)), a) def test_isaddress(self): - for (t, e) in [ + for t, e in [ ("1.2.3.4", True), ("2001:db8:0:1:1:1:1:1", True), ("hello world", False), diff --git a/tests/test_query.py b/tests/test_query.py index f9b9d42..7f41f34 100644 --- a/tests/test_query.py +++ b/tests/test_query.py @@ -330,7 +330,7 @@ class AXFRNanoNameserver(Server): response = dns.message.make_response(request.message) response.question = [] response.flags |= dns.flags.AA - for (name, rdataset) in self.zone.iterate_rdatasets(): + for name, rdataset in self.zone.iterate_rdatasets(): if rdataset.rdtype == dns.rdatatype.SOA and name == dns.name.empty: continue rrset = dns.rrset.RRset( diff --git a/tests/test_rdtypeandclass.py b/tests/test_rdtypeandclass.py index eeb9279..a96dd8f 100644 --- a/tests/test_rdtypeandclass.py +++ b/tests/test_rdtypeandclass.py @@ -22,7 +22,6 @@ import dns.rdatatype class RdTypeAndClassTestCase(unittest.TestCase): - # Classes def test_class_meta1(self): diff --git a/tests/test_zone.py b/tests/test_zone.py index 6b9e2b5..7873656 100644 --- a/tests/test_zone.py +++ b/tests/test_zone.py @@ -305,7 +305,7 @@ def make_xfr(zone): soa_name = zone.origin soa = zone.find_rdataset(soa_name, "SOA") add_rdataset(msg, soa_name, soa) - for (name, rds) in zone.iterate_rdatasets(): + for name, rds in zone.iterate_rdatasets(): if rds.rdtype == dns.rdatatype.SOA: continue add_rdataset(msg, name, rds) |