]> git.ipfire.org Git - thirdparty/dnspython.git/commitdiff
linting + have asyncio HTTP code actually connect to right address
authorBob Halley <halley@dnspython.org>
Sun, 19 Mar 2023 16:49:25 +0000 (09:49 -0700)
committerBob Halley <halley@dnspython.org>
Sun, 19 Mar 2023 16:49:25 +0000 (09:49 -0700)
dns/_asyncio_backend.py
dns/_trio_backend.py
dns/query.py

index 98971be9e9fe584a0fb815d61f1700fe97bc8297..bce6e4d3ac10bcceec57e2885148d02e30838995 100644 (file)
@@ -135,9 +135,11 @@ try:
                     "the asyncio transport for HTTPX cannot set the local port"
                 )
 
-        async def connect_tcp(self, host, port, timeout, local_address):
+        async def connect_tcp(
+            self, host, port, timeout, local_address
+        ):  # pylint: disable=signature-differs
             addresses = []
-            now, expiration = _compute_times(timeout)
+            _, expiration = _compute_times(timeout)
             if dns.inet.is_address(host):
                 addresses.append(host)
             elif self._bootstrap_address is not None:
@@ -157,7 +159,7 @@ try:
                     timeout = _remaining(attempt_expiration)
                     with anyio.fail_after(timeout):
                         stream = await anyio.connect_tcp(
-                            remote_host=host,
+                            remote_host=address,
                             remote_port=port,
                             local_host=local_address,
                         )
@@ -166,6 +168,14 @@ try:
                     pass
             raise httpcore.ConnectError
 
+        async def connect_unix_socket(
+            self, path, timeout
+        ):  # pylint: disable=signature-differs
+            raise NotImplementedError
+
+        async def sleep(self, seconds):  # pylint: disable=signature-differs
+            await anyio.sleep(seconds)
+
     class _HTTPTransport(httpx.AsyncHTTPTransport):
         def __init__(
             self,
@@ -177,6 +187,7 @@ try:
             **kwargs,
         ):
             if resolver is None:
+                # pylint: disable=import-outside-toplevel,redefined-outer-name
                 import dns.asyncresolver
 
                 resolver = dns.asyncresolver.Resolver()
index 08101f9abb240ca18e5878fb1a80053170443220..3652195ce85beae11ea7ad09b91e1d6d295dab5a 100644 (file)
@@ -100,9 +100,11 @@ try:
             self._bootstrap_address = bootstrap_address
             self._family = family
 
-        async def connect_tcp(self, host, port, timeout, local_address):
+        async def connect_tcp(
+            self, host, port, timeout, local_address
+        ):  # pylint: disable=signature-differs
             addresses = []
-            now, expiration = _compute_times(timeout)
+            _, expiration = _compute_times(timeout)
             if dns.inet.is_address(host):
                 addresses.append(host)
             elif self._bootstrap_address is not None:
@@ -134,6 +136,14 @@ try:
                     continue
             raise httpcore.ConnectError
 
+        async def connect_unix_socket(
+            self, path, timeout
+        ):  # pylint: disable=signature-differs
+            raise NotImplementedError
+
+        async def sleep(self, seconds):  # pylint: disable=signature-differs
+            await trio.sleep(seconds)
+
     class _HTTPTransport(httpx.AsyncHTTPTransport):
         def __init__(
             self,
@@ -145,6 +155,7 @@ try:
             **kwargs,
         ):
             if resolver is None:
+                # pylint: disable=import-outside-toplevel,redefined-outer-name
                 import dns.asyncresolver
 
                 resolver = dns.asyncresolver.Resolver()
index 517bab02eaf4c0954f9a26cb96f0941b54887feb..f34330ff9082045d3b2d74873fa7696db0cea3d1 100644 (file)
@@ -28,7 +28,6 @@ import selectors
 import socket
 import struct
 import time
-import urllib.parse
 
 import dns.exception
 import dns.inet
@@ -84,9 +83,11 @@ try:
             self._bootstrap_address = bootstrap_address
             self._family = family
 
-        def connect_tcp(self, host, port, timeout, local_address):
+        def connect_tcp(
+            self, host, port, timeout, local_address
+        ):  # pylint: disable=signature-differs
             addresses = []
-            now, expiration = _compute_times(timeout)
+            _, expiration = _compute_times(timeout)
             if dns.inet.is_address(host):
                 addresses.append(host)
             elif self._bootstrap_address is not None:
@@ -121,6 +122,11 @@ try:
                     pass
             raise httpcore.ConnectError
 
+        def connect_unix_socket(
+            self, path, timeout
+        ):  # pylint: disable=signature-differs
+            raise NotImplementedError
+
     class _HTTPTransport(httpx.HTTPTransport):
         def __init__(
             self,
@@ -132,6 +138,7 @@ try:
             **kwargs,
         ):
             if resolver is None:
+                # pylint: disable=import-outside-toplevel,redefined-outer-name
                 import dns.resolver
 
                 resolver = dns.resolver.Resolver()