]> git.ipfire.org Git - thirdparty/dnspython.git/commitdiff
linting
authorBob Halley <halley@dnspython.org>
Sat, 21 Sep 2024 16:37:02 +0000 (09:37 -0700)
committerBob Halley <halley@dnspython.org>
Sat, 21 Sep 2024 16:37:02 +0000 (09:37 -0700)
14 files changed:
dns/asyncquery.py
dns/dnssec.py
dns/dnssecalgs/__init__.py
dns/dnssecalgs/dsa.py
dns/dnssecalgs/ecdsa.py
dns/dnssecalgs/eddsa.py
dns/dnssecalgs/rsa.py
dns/name.py
dns/query.py
dns/rdataset.py
dns/rdtypes/ANY/GPOS.py
dns/rdtypes/ANY/ISDN.py
dns/rdtypes/ANY/LOC.py
dns/win32util.py

index ce885a4ced0ee3400668365877ea92896e3e3537..e89f836bd2d92674a84bf6eb4faa3f22a6351e07 100644 (file)
@@ -562,6 +562,7 @@ async def https(
 
     extensions = {}
     if bootstrap_address is None:
+        # pylint: disable=possibly-used-before-assignment
         parsed = urllib.parse.urlparse(url)
         if parsed.hostname is None:
             raise ValueError("no hostname in URL")
@@ -595,8 +596,10 @@ async def https(
 
     if not have_doh:
         raise NoDOH  # pragma: no cover
+    # pylint: disable=possibly-used-before-assignment
     if client and not isinstance(client, httpx.AsyncClient):
         raise ValueError("session parameter must be an httpx.AsyncClient")
+    # pylint: enable=possibly-used-before-assignment
 
     wire = q.to_wire()
     headers = {"accept": "application/dns-message"}
@@ -899,7 +902,6 @@ async def inbound_xfr(
             except dns.xfr.UseTCP:
                 if udp_mode == UDPMode.ONLY:
                     raise
-                pass
 
     s = await backend.make_socket(
         af, socket.SOCK_STREAM, 0, stuple, dtuple, _timeout(expiration)
index 77edb202a99e83db8564ea24a06cc4b71d930a05..b69d0a1262ee28e4325c017e48d5188fb8961bbe 100644 (file)
@@ -325,6 +325,7 @@ def _get_rrname_rdataset(
 
 
 def _validate_signature(sig: bytes, data: bytes, key: DNSKEY) -> None:
+    # pylint: disable=possibly-used-before-assignment
     public_cls = get_algorithm_cls_from_dnskey(key).public_cls
     try:
         public_key = public_cls.from_dnskey(key)
@@ -389,6 +390,7 @@ def _validate_rrsig(
 
     data = _make_rrsig_signature_data(rrset, rrsig, origin)
 
+    # pylint: disable=possibly-used-before-assignment
     for candidate_key in candidate_keys:
         if not policy.ok_to_validate(candidate_key):
             continue
@@ -587,6 +589,7 @@ def _sign(
 
     data = dns.dnssec._make_rrsig_signature_data(rrset, rrsig_template, origin)
 
+    # pylint: disable=possibly-used-before-assignment
     if isinstance(private_key, GenericPrivateKey):
         signing_key = private_key
     else:
@@ -695,6 +698,7 @@ def _make_dnskey(
 
     algorithm = Algorithm.make(algorithm)
 
+    # pylint: disable=possibly-used-before-assignment
     if isinstance(public_key, GenericPublicKey):
         return public_key.to_dnskey(flags=flags, protocol=protocol)
     else:
index b017d3e3fd6f67c9841132c5a8f3c854a8ad0941..602367e3d200f308aa4ef5a4a480973af5713041 100644 (file)
@@ -26,6 +26,7 @@ AlgorithmPrefix = Optional[Union[bytes, dns.name.Name]]
 
 algorithms: Dict[Tuple[Algorithm, AlgorithmPrefix], Type[GenericPrivateKey]] = {}
 if _have_cryptography:
+    # pylint: disable=possibly-used-before-assignment
     algorithms.update(
         {
             (Algorithm.RSAMD5, None): PrivateRSAMD5,
index 1c84f49fd1ff184a319fc670bbeacefd6a1f9452..adca3def0151945093ed53a96d9c63d814d80534 100644 (file)
@@ -1,5 +1,4 @@
 import struct
-from typing import Optional
 
 from cryptography.hazmat.backends import default_backend
 from cryptography.hazmat.primitives import hashes
index 6845a039938d077ad380125f7b3d43705073d10f..86d5764c919e616ad412e7e718472c7c01f4cf2a 100644 (file)
@@ -1,5 +1,3 @@
-from typing import Optional
-
 from cryptography.hazmat.backends import default_backend
 from cryptography.hazmat.primitives import hashes
 from cryptography.hazmat.primitives.asymmetric import ec, utils
index d70923fc4fb48ff7459b4f3c3e0c33bb41718002..604bcbfeaf7938c781dbc1076c5758b03ab7b9ca 100644 (file)
@@ -1,4 +1,4 @@
-from typing import Optional, Type
+from typing import Type
 
 from cryptography.hazmat.primitives import serialization
 from cryptography.hazmat.primitives.asymmetric import ed448, ed25519
index 935edadc1a2d5c31af22ad641e13fba8718444ae..27537aad0c1857276d62c476f583a3e093e34e0f 100644 (file)
@@ -1,6 +1,5 @@
 import math
 import struct
-from typing import Optional
 
 from cryptography.hazmat.backends import default_backend
 from cryptography.hazmat.primitives import hashes
index 39c5474493b99d80e673d4395f8489fe87b3b421..f79f0d0f6f16f95228ae111b85d6a9e368b98345 100644 (file)
@@ -277,6 +277,7 @@ class IDNA2008Codec(IDNACodec):
             raise NoIDNA2008
         try:
             if self.uts_46:
+                # pylint: disable=possibly-used-before-assignment
                 label = idna.uts46_remap(label, False, self.transitional)
             return idna.alabel(label)
         except idna.IDNAError as e:
index 9060012c6625d5741a7f80bda429c00f1e0a9841..43535945da1a60cf288a27a86d25a5b23ee4e0ea 100644 (file)
@@ -451,6 +451,7 @@ def https(
 
     extensions = {}
     if bootstrap_address is None:
+        # pylint: disable=possibly-used-before-assignment
         parsed = urllib.parse.urlparse(url)
         if parsed.hostname is None:
             raise ValueError("no hostname in URL")
@@ -1158,6 +1159,7 @@ def tcp(
         cm = _make_socket(af, socket.SOCK_STREAM, source)
     with cm as s:
         if not sock:
+            # pylint: disable=possibly-used-before-assignment
             _connect(s, destination, expiration)
         send_tcp(s, wire, expiration)
         (r, received_time) = receive_tcp(
@@ -1654,7 +1656,6 @@ def inbound_xfr(
             except dns.xfr.UseTCP:
                 if udp_mode == UDPMode.ONLY:
                     raise
-                pass
 
     with _make_socket(af, socket.SOCK_STREAM, source) as s:
         _connect(s, destination, expiration)
index 52d2481d68371e204ccfd2669ab29e5d1058a7d1..39cab2365aee8757615cfe0113c53857cf29d184 100644 (file)
@@ -248,7 +248,8 @@ class Rdataset(dns.set.Set):
             # (which is meaningless anyway).
             #
             s.write(
-                f"{ntext}{pad}{dns.rdataclass.to_text(rdclass)} {dns.rdatatype.to_text(self.rdtype)}\n"
+                f"{ntext}{pad}{dns.rdataclass.to_text(rdclass)} "
+                f"{dns.rdatatype.to_text(self.rdtype)}\n"
             )
         else:
             for rd in self:
index 0aa33798a53400f38ea100abe84caefd230be119..d79f4a0669bb5a6afda6e8621c290d45a932a2d9 100644 (file)
@@ -75,7 +75,10 @@ class GPOS(dns.rdata.Rdata):
             raise dns.exception.FormError("bad longitude")
 
     def to_text(self, origin=None, relativize=True, **kw):
-        return f"{self.latitude.decode()} {self.longitude.decode()} {self.altitude.decode()}"
+        return (
+            f"{self.latitude.decode()} {self.longitude.decode()} "
+            f"{self.altitude.decode()}"
+        )
 
     @classmethod
     def from_text(
index ef8166ffbd4b85af8016ac7ae568b6be567555e3..6428a0a822f1808f3997a3253d24b815e56a21ec 100644 (file)
@@ -38,7 +38,10 @@ class ISDN(dns.rdata.Rdata):
 
     def to_text(self, origin=None, relativize=True, **kw):
         if self.subaddress:
-            return f'"{dns.rdata._escapify(self.address)}" "{dns.rdata._escapify(self.subaddress)}"'
+            return (
+                f'"{dns.rdata._escapify(self.address)}" '
+                f'"{dns.rdata._escapify(self.subaddress)}"'
+            )
         else:
             return f'"{dns.rdata._escapify(self.address)}"'
 
index cf70893315083826c0ff9f510e4c4a8256871de9..1153cf0399b39e150802b3f83a49963f66f41cc9 100644 (file)
@@ -184,7 +184,10 @@ class LOC(dns.rdata.Rdata):
             or self.horizontal_precision != _default_hprec
             or self.vertical_precision != _default_vprec
         ):
-            text += f" {self.size / 100.0:0.2f}m {self.horizontal_precision / 100.0:0.2f}m {self.vertical_precision / 100.0:0.2f}m"
+            text += (
+                f" {self.size / 100.0:0.2f}m {self.horizontal_precision / 100.0:0.2f}m"
+                f" {self.vertical_precision / 100.0:0.2f}m"
+            )
         return text
 
     @classmethod
index 7d8542de6f0d6b7399a9c1639a4be3f53ac326ba..9ed3f11bcba03fc57de939aca45a82a1d067bae0 100644 (file)
@@ -44,6 +44,7 @@ if sys.platform == "win32":
     if _have_wmi:
 
         class _WMIGetter(threading.Thread):
+            # pylint: disable=possibly-used-before-assignment
             def __init__(self):
                 super().__init__()
                 self.info = DnsInfo()