]> git.ipfire.org Git - thirdparty/dnspython.git/commitdiff
more things to make mypy happier
authorBob Halley <halley@dnspython.org>
Sun, 3 May 2020 13:59:34 +0000 (06:59 -0700)
committerBob Halley <halley@dnspython.org>
Sun, 3 May 2020 13:59:34 +0000 (06:59 -0700)
dns/dnssec.py
dns/exception.pyi
dns/inet.py
dns/name.py
dns/query.py
dns/resolver.py

index 8e3621a2a6577b334d9b248fb77e65c2282693ae..171a55da003e8b73cfb8e19360be1cdd8b6a9757 100644 (file)
@@ -589,6 +589,6 @@ except ImportError:
     validate_rrsig = _need_pyca
     _have_pyca = False
 else:
-    validate = _validate
-    validate_rrsig = _validate_rrsig
+    validate = _validate                # type: ignore
+    validate_rrsig = _validate_rrsig    # type: ignore
     _have_pyca = True
index 4b346cc4d1f83059f8b91b0ab7344a26f4d4c56e..b29bfbea1b1cd02cca3f522becab3a87adebe79f 100644 (file)
@@ -3,6 +3,7 @@ from typing import Set, Optional, Dict
 class DNSException(Exception):
     supp_kwargs : Set[str]
     kwargs : Optional[Dict]
+    fmt : Optional[str]
 
 class SyntaxError(DNSException): ...
 class FormError(DNSException): ...
index e7729f2f68a816f6b3c6f8be96953065eb080ad8..d7d500568b1c990e29108269643eb07f41cebd8d 100644 (file)
@@ -33,7 +33,7 @@ AF_INET = socket.AF_INET
 try:
     AF_INET6 = socket.AF_INET6
 except AttributeError:
-    AF_INET6 = 9999
+    AF_INET6 = 9999    # type: ignore
 
 
 def inet_pton(family, text):
index 72d2852fced91922bae7a1adbc08873681ee218e..4fb067cf6a0ab5fa3d9ffb6a2387b36bc2016f7b 100644 (file)
@@ -23,9 +23,9 @@ import io
 import struct
 import sys
 
-import encodings.idna
+import encodings.idna    # type: ignore
 try:
-    import idna
+    import idna          # type: ignore
     have_idna_2008 = True
 except ImportError:
     have_idna_2008 = False
@@ -33,11 +33,7 @@ except ImportError:
 import dns.exception
 import dns.wiredata
 
-try:
-    maxint = sys.maxint  # pylint: disable=sys-max-int
-except AttributeError:
-    maxint = (1 << (8 * struct.calcsize("P"))) // 2 - 1
-
+maxint = sys.maxsize
 
 # fullcompare() result values
 
index 152937743451e8d2068150c6700db7698b0087cc..b995003f418ed056f741352bc68f71e32c4a1613 100644 (file)
@@ -49,7 +49,7 @@ except ImportError:
 try:
     import ssl
 except ImportError:
-    class ssl(object):
+    class ssl(object):    # type: ignore
         class WantReadException(Exception):
             pass
         class WantWriteException(Exception):
index 805c5bd597a0e4378e732b1f87486259ba4c844c..bc865633df4c45d77b4db06b6d9c9e2aebfc4b16 100644 (file)
@@ -25,7 +25,7 @@ import random
 try:
     import threading as _threading
 except ImportError:
-    import dummy_threading as _threading
+    import dummy_threading as _threading    # type: ignore
 
 import dns.exception
 import dns.flags
@@ -991,10 +991,10 @@ class Resolver(object):
                     port_answered = port
                     rcode = response.rcode()
                     if rcode == dns.rcode.YXDOMAIN:
-                        ex = YXDOMAIN()
-                        errors.append((nameserver, tcp_attempt, port, ex,
+                        yex = YXDOMAIN()
+                        errors.append((nameserver, tcp_attempt, port, yex,
                                        response))
-                        raise ex
+                        raise yex
                     if rcode == dns.rcode.NOERROR or \
                             rcode == dns.rcode.NXDOMAIN:
                         break