]> git.ipfire.org Git - thirdparty/dnspython.git/commitdiff
Add typing info. 793/head
authorBrian Wellington <bwelling@xbill.org>
Fri, 18 Mar 2022 19:48:08 +0000 (12:48 -0700)
committerBrian Wellington <bwelling@xbill.org>
Fri, 18 Mar 2022 19:48:08 +0000 (12:48 -0700)
dns/message.py
dns/query.py
dns/resolver.py
dns/zone.py

index de347441c924864640baf6eb98f6d876e45f5e9c..9541df68e54dc8854e0952fbef8dcbc060bc0c43 100644 (file)
@@ -1586,7 +1586,7 @@ def from_file(
     """
 
     if isinstance(f, str):
-        cm = open(f)
+        cm: contextlib.AbstractContextManager = open(f)
     else:
         cm = contextlib.nullcontext(f)
     with cm as f:
index 04eaca4a08a961bee0dfd1bfa67fcc8031a79a2b..7dec23e34f7efc8f0d0e7b470047e2938e5de8cd 100644 (file)
@@ -380,7 +380,7 @@ def https(
         )
 
     if session:
-        cm = contextlib.nullcontext(session)
+        cm: contextlib.AbstractContextManager = contextlib.nullcontext(session)
     elif _is_httpx:
         cm = httpx.Client(
             http1=True, http2=_have_http2, verify=verify, transport=transport
@@ -631,7 +631,7 @@ def udp(
     )
     (begin_time, expiration) = _compute_times(timeout)
     if sock:
-        cm = contextlib.nullcontext(sock)
+        cm: contextlib.AbstractContextManager = contextlib.nullcontext(sock)
     else:
         cm = _make_socket(af, socket.SOCK_DGRAM, source)
     with cm as s:
@@ -914,7 +914,7 @@ def tcp(
     wire = q.to_wire()
     (begin_time, expiration) = _compute_times(timeout)
     if sock:
-        cm = contextlib.nullcontext(sock)
+        cm: contextlib.AbstractContextManager = contextlib.nullcontext(sock)
     else:
         (af, destination, source) = _destination_and_source(
             where, port, source, source_port
index 74fbd336a164ab8dc62a52f2100f95acf12e4deb..350cc33b3e465bd459e716973cee5719e781eb92 100644 (file)
@@ -905,7 +905,7 @@ class BaseResolver:
 
         if isinstance(f, str):
             try:
-                cm = open(f)
+                cm: contextlib.AbstractContextManager = open(f)
             except OSError:
                 # /etc/resolv.conf doesn't exist, can't be read, etc.
                 raise NoResolverConfiguration(f"cannot open {f}")
index 76386b64f99b7be3f878633462c8949a41fbceb0..fe6c16af73566225955da9dd1c0d40d21b809f6d 100644 (file)
@@ -642,7 +642,7 @@ class Zone(dns.transaction.TransactionManager):
         """
 
         if isinstance(f, str):
-            cm = open(f, "wb")
+            cm: contextlib.AbstractContextManager = open(f, "wb")
         else:
             cm = contextlib.nullcontext(f)
         with cm as f:
@@ -1294,7 +1294,7 @@ def from_file(
     if isinstance(f, str):
         if filename is None:
             filename = f
-        cm = open(f)
+        cm: contextlib.AbstractContextManager = open(f)
     else:
         cm = contextlib.nullcontext(f)
     with cm as f: