diff options
| author | Brian Wellington <bwelling@xbill.org> | 2022-03-18 12:48:08 -0700 |
|---|---|---|
| committer | Brian Wellington <bwelling@xbill.org> | 2022-03-18 12:48:08 -0700 |
| commit | 836abcdecc1b081f7fdf2bee3b2153b40d8eb3d7 (patch) | |
| tree | 9396c6e570a23b3681589301fdb7299133456d5d /dns | |
| parent | 3210e504fd992b8b88c17503b960b9f60e1b424d (diff) | |
| download | dnspython-836abcdecc1b081f7fdf2bee3b2153b40d8eb3d7.tar.gz | |
Add typing info.
Diffstat (limited to 'dns')
| -rw-r--r-- | dns/message.py | 2 | ||||
| -rw-r--r-- | dns/query.py | 6 | ||||
| -rw-r--r-- | dns/resolver.py | 2 | ||||
| -rw-r--r-- | dns/zone.py | 4 |
4 files changed, 7 insertions, 7 deletions
diff --git a/dns/message.py b/dns/message.py index de34744..9541df6 100644 --- a/dns/message.py +++ b/dns/message.py @@ -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: diff --git a/dns/query.py b/dns/query.py index 04eaca4..7dec23e 100644 --- a/dns/query.py +++ b/dns/query.py @@ -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 diff --git a/dns/resolver.py b/dns/resolver.py index 74fbd33..350cc33 100644 --- a/dns/resolver.py +++ b/dns/resolver.py @@ -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}") diff --git a/dns/zone.py b/dns/zone.py index 76386b6..fe6c16a 100644 --- a/dns/zone.py +++ b/dns/zone.py @@ -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: |
