import socket
import struct
import time
-import urllib
import dns.asyncbackend
import dns.exception
import dns.rdatatype
from dns.query import _compute_times, _matches_destination, BadResponse, ssl, \
- UDPMode, have_doh, _have_httpx, _have_http2, NoDOH
+ UDPMode, _have_httpx, _have_http2, NoDOH
if _have_httpx:
import httpx
m = _v4_ending.match(text)
if m is not None:
b = dns.ipv4.inet_aton(m.group(2))
- text = (u"{}:{:02x}{:02x}:{:02x}{:02x}".format(m.group(1).decode(),
- b[0], b[1], b[2],
- b[3])).encode()
+ text = ("{}:{:02x}{:02x}:{:02x}{:02x}".format(m.group(1).decode(),
+ b[0], b[1], b[2],
+ b[3])).encode()
#
# Try to turn '::<whatever>' into ':<whatever>'; if no match try to
# turn '<whatever>::' into '<whatever>:'
what *= -1
else:
sign = 1
- what = round(what * 3600000) # pylint: disable=round-builtin
+ what = round(what * 3600000)
degrees = int(what // 3600000)
what -= degrees * 3600000
minutes = int(what // 60000)
def to_text(self, origin=None, relativize=True, **kw):
bits = []
- for i in range(0, len(self.bitmap)):
- byte = self.bitmap[i]
+ for i, byte in enumerate(self.bitmap):
for j in range(0, 8):
if byte & (0x80 >> j):
bits.append(str(i * 8 + j))
if len(formatted) != num_chunks * (chunk_size + 1) - 1:
raise ValueError('invalid formatted hex string')
value = b''
- for n in range(num_chunks):
+ for _ in range(num_chunks):
chunk = formatted[0:chunk_size]
value += int(chunk, 16).to_bytes(chunk_size // 2, 'big')
formatted = formatted[chunk_size:]
if isinstance(e, dns.resolver.NXDOMAIN):
response = e.responses().get(name)
else:
- response = e.response()
+ response = e.response() # pylint: disable=no-value-for-parameter
if response:
for rrs in response.authority:
if rrs.rdtype == dns.rdatatype.SOA and \
- rrs.rdclass == rdclass:
- (nr, _, _) = rrs.name.fullcompare(name)
- if nr == dns.name.NAMERELN_SUPERDOMAIN:
- # We're doing a proper superdomain check as
- # if the name were equal we ought to have gotten
- # it in the answer section! We are ignoring the
- # possibility that the authority is insane and
- # is including multiple SOA RRs for different
- # authorities.
- return rrs.name
+ rrs.rdclass == rdclass:
+ (nr, _, _) = rrs.name.fullcompare(name)
+ if nr == dns.name.NAMERELN_SUPERDOMAIN:
+ # We're doing a proper superdomain check as
+ # if the name were equal we ought to have gotten
+ # it in the answer section! We are ignoring the
+ # possibility that the authority is insane and
+ # is including multiple SOA RRs for different
+ # authorities.
+ return rrs.name
# we couldn't extract anything useful from the response (e.g. it's
# a type 3 NXDOMAIN)
try:
return self.nodes.__iter__()
def keys(self):
- return self.nodes.keys() # pylint: disable=dict-keys-not-iterating
+ return self.nodes.keys()
def values(self):
- return self.nodes.values() # pylint: disable=dict-values-not-iterating
+ return self.nodes.values()
def items(self):
- return self.nodes.items() # pylint: disable=dict-items-not-iterating
+ return self.nodes.items()
def get(self, key):
key = self._validate_name(key)
def _end_write(self, txn):
pass
- def _commit_version(self, txn, version, origin):
+ def _commit_version(self, _, version, origin):
self.nodes = version.nodes
if self.origin is None:
self.origin = origin
return node.get_rdataset(self.zone.rdclass, rdtype, covers)
def items(self):
- return self.nodes.items() # pylint: disable=dict-items-not-iterating
+ return self.nodes.items()
class WritableVersion(Version):
self.rrsets = []
def writer(self, replacement=False):
- assert replacement == True
+ assert replacement is True
return RRsetsReaderTransaction(self, True, False)
def get_class(self):
force_rdtype=rdtype, default_ttl=default_ttl)
reader.read()
return manager.rrsets
-
redefined-builtin,
too-many-lines,
raise-missing-from, # we should start doing this, but too noisy for now
+ consider-using-f-string,
+ unspecified-encoding,
[REPORTS]