]> git.ipfire.org Git - thirdparty/dnspython.git/commitdiff
delint
authorBob Halley <halley@dnspython.org>
Wed, 11 Mar 2020 16:31:15 +0000 (09:31 -0700)
committerBob Halley <halley@dnspython.org>
Wed, 11 Mar 2020 16:31:15 +0000 (09:31 -0700)
dns/dnssec.py
dns/resolver.py
tests/test_doh.py

index f2b453c70b03613172e29978bf4a1c210d51839c..43f9b4b4f3c80e82479f0a205603a035f73e739e 100644 (file)
@@ -170,13 +170,18 @@ def make_ds(name, key, algorithm, origin=None):
     :type name: string
     :param key: a DNSKEY
     :type key: :py:data:`dns.rdtypes.ANY.DNSKEY`
-    :param algorithm: a string describing which hash algorithm to use.The currently supported hashes are "SHA1" and "SHA256". Case does not matter for these strings.
+    :param algorithm: a string describing which hash algorithm to
+    use.  The currently supported hashes are "SHA1" and "SHA256". Case
+    does not matter for these strings.
     :type algorithm: string
-    :param origin: Will be used as origin if `key` is a relative name, defaults to None
+    :param origin: Will be used as origin if `key` is a relative name,
+    defaults to None
     :type origin: :py:data:`dns.name.Name`, optional
-    :raises UnsupportedAlgorithm: If the algorithm is not either "SHA1" or "SHA256" exception will be thrown
+    :raises UnsupportedAlgorithm: If the algorithm is not either
+    "SHA1" or "SHA256" exception will be thrown
     :return: a DS record
     :rtype: :py:data:`dns.rdtypes.ANY.DS`
+
     """
 
     if algorithm.upper() == 'SHA1':
@@ -280,14 +285,19 @@ def _validate_rrsig(rrset, rrsig, keys, origin=None, now=None):
     """Validate an RRset against a single signature rdata
 
     :param rrset: The RRset to validate
-    :type rrset: :py:data:`dns.rrset.RRset` or (:py:data:`dns.name.Name`, :py:data:`dns.rdataset.Rdataset`)
+    :type rrset: :py:data:`dns.rrset.RRset` or
+    (:py:data:`dns.name.Name`, :py:data:`dns.rdataset.Rdataset`)
     :param rrsig: Signature to validate
     :type rrsig: :py:data:`dns.rdata.Rdata`
-    :param keys: Key dictionary, used to find the DNSKEY associated with a given name.  The dictionary is keyed by a :py:data:`dns.name.Name`, and has :py:data:`dns.node.Node` or :py:data:`dns.rdataset.Rdataset` values.
+    :param keys: Key dictionary, used to find the DNSKEY associated
+    with a given name.  The dictionary is keyed by a
+    :py:data:`dns.name.Name`, and has :py:data:`dns.node.Node` or
+    :py:data:`dns.rdataset.Rdataset` values.
     :type keys: dictionary
     :param origin: Origin to use for relative name, defaults to None
     :type origin: :py:data:`dns.name.Name`, optional
-    :param now: time to use when validating the signatures, in seconds since the UNIX epoch, defaults to current time
+    :param now: time to use when validating the signatures, in seconds
+    since the UNIX epoch, defaults to current time
     :type now: integer, optional
     :raises ValidationFailure: RRSig expired
     :raises ValidationFailure: RRSig not yet valid
@@ -301,6 +311,7 @@ def _validate_rrsig(rrset, rrsig, keys, origin=None, now=None):
     :rtype: none
 
     .. todo:: Fill in missing infos
+
     """
 
     if isinstance(origin, str):
@@ -372,9 +383,9 @@ def _validate_rrsig(rrset, rrsig, keys, origin=None, now=None):
             ecdsa_x = keyptr[0:octets]
             ecdsa_y = keyptr[octets:octets * 2]
             pubkey = CryptoECC.construct(
-                curve = curve,
-                point_x = number.bytes_to_long(ecdsa_x),
-                point_y = number.bytes_to_long(ecdsa_y))
+                curve=curve,
+                point_x=number.bytes_to_long(ecdsa_x),
+                point_y=number.bytes_to_long(ecdsa_y))
             sig = rrsig.signature
 
         elif _is_eddsa(rrsig.algorithm) or _is_gost(rrsig.algorithm):
@@ -428,18 +439,25 @@ def _validate(rrset, rrsigset, keys, origin=None, now=None):
     """Validate an RRset.
 
     :param rrset: RRset to validate
-    :type rrset: :py:data:`dns.rrset.RRset` or (:py:data:`dns.name.Name`, :py:data:`dns.rdataset.Rdataset`) tuple
+    :type rrset: :py:data:`dns.rrset.RRset` or
+    (:py:data:`dns.name.Name`, :py:data:`dns.rdataset.Rdataset`) tuple
     :param rrsigset: Signature RRset to be validated
-    :type rrsigset: :py:data`dns.rrset.RRset` or (:py:data:`dns.name.Name`, :py:data:`dns.rdataset.Rdataset`) tuple
-    :param keys: Key dictionary, used to find the DNSKEY associated with a given name.  The dictionary is keyed by a :py:data:`dns.name.Name`, and has :py:data:`dns.node.Node` or :py:data:`dns.rdataset.Rdataset` values.
+    :type rrsigset: :py:data`dns.rrset.RRset` or
+    (:py:data:`dns.name.Name`, :py:data:`dns.rdataset.Rdataset`) tuple
+    :param keys: Key dictionary, used to find the DNSKEY associated
+    with a given name.  The dictionary is keyed by a
+    :py:data:`dns.name.Name`, and has :py:data:`dns.node.Node` or
+    :py:data:`dns.rdataset.Rdataset` values.
     :type keys: dictionary
     :param origin: Origin to use for relative name, defaults to None
     :type origin: :py:data:`dns.name.Name`, optional
-    :param now: time to use when validating the signatures, in seconds since the UNIX epoch, defaults to current time
+    :param now: time to use when validating the signatures, in seconds
+    since the UNIX epoch, defaults to current time
     :type now: integer, optional
     :raises ValidationFailure: Owner names do not match
     :raises ValidationFailure: No RRSIGs validated
     :raises UnsupportedAlgorithm: Algorithm isn't supported by dnspython
+
     """
 
     if isinstance(origin, str):
index 359eb9bbf90c727c277e051f223d0c3f59f19479..3709f4694d289a63f599ee3d661807bb9feec1b4 100644 (file)
@@ -1032,17 +1032,17 @@ class Resolver(object):
 
     def reverse_query(self, ipaddr, *args, **kwargs):
         """Use a resolver to run a Reverse IP Query for PTR records.
-        
-        This utilizes the in-built query function to perform a PTR lookup on the 
+
+        This utilizes the in-built query function to perform a PTR lookup on the
         specified IP address.
-        
+
         *ipaddr*, a ``str``, the IP address you want to get the PTR record for.
-        
+
         All other arguments that can be passed to the query function except for
         rdtype and rdclass are also supported by this function.
         """
-                
-        return self.query(dns.reversename.from_address(ipaddr), 
+
+        return self.query(dns.reversename.from_address(ipaddr),
                           rdtype=dns.rdatatype.PTR,
                           rdclass=dns.rdataclass.IN,
                           *args, **kwargs)
@@ -1114,7 +1114,7 @@ class Resolver(object):
         :raise ValueError: if `nameservers` is anything other than a ``list``.
         """
         if isinstance(nameservers, list):
-            self._nameservers = nameservers
+            self._nameservers = nameservers # pylint: disable=attribute-defined-outside-init
         else:
             raise ValueError('nameservers must be a list'
                              ' (not a {})'.format(type(nameservers)))
index acda5af64ffc03d06b46b691aec87472a9cb3f7f..41d8331cc8258246a09d8d0ee289f512a04ef2fb 100644 (file)
@@ -73,7 +73,9 @@ class DNSOverHTTPSTestCase(unittest.TestCase):
         q = dns.message.make_query('example.com.', dns.rdatatype.A)
         wire = q.to_wire()
         query_string = '?dns={}'.format(base64.urlsafe_b64encode(wire).decode('utf-8').strip("="))
-        request = requests.models.Request('GET', 'https://cloudflare-dns.com/dns-query{}'.format(query_string))
+        request = requests.models.Request(
+            'GET',
+            'https://cloudflare-dns.com/dns-query{}'.format(query_string))
         r = request.prepare()
         response = dns.query.send_https(self.session, r)
         dns_resp = dns.message.from_wire(response.content)