Commit 6019754f authored by Petr Špaček's avatar Petr Špaček

PEP8 fixes

parent 36377a24
Pipeline #2003 failed with stage
in 45 seconds
......@@ -79,6 +79,7 @@ def compare_rrs(expected, got):
% (len(expected), len(got)))
return True
def compare_val(expected, got):
""" Compare values, throw exception if different. """
if expected != got:
......@@ -258,7 +259,7 @@ class Entry:
answer = dns.message.from_wire(self.message.to_wire(),
xfr=self.message.xfr,
one_rr_per_rrset=True)
answer.use_edns(query.edns, query.ednsflags, options = self.message.options)
answer.use_edns(query.edns, query.ednsflags, options=self.message.options)
if 'copy_id' in self.adjust_fields:
answer.id = query.id
# Copy letter-case if the template has QD
......@@ -362,11 +363,11 @@ class Entry:
else:
raise Exception('bad section %s' % self.section)
def use_tsig(self,fields):
def use_tsig(self, fields):
tsig_keyname = fields[0]
tsig_secret = fields[1]
keyring = dns.tsigkeyring.from_text({tsig_keyname : tsig_secret})
self.message.use_tsig(keyring=keyring,keyname=tsig_keyname)
keyring = dns.tsigkeyring.from_text({tsig_keyname: tsig_secret})
self.message.use_tsig(keyring=keyring, keyname=tsig_keyname)
def __rr_add(self, section, rr):
""" Merge record to existing RRSet, or append to given section. """
......@@ -606,8 +607,8 @@ class Step:
self.raw_answer = answer
ctx.last_raw_answer = answer
if self.raw_answer is not None:
self.answer = dns.message.from_wire(self.raw_answer,one_rr_per_rrset=True)
log_packet(sock, answer, query = False)
self.answer = dns.message.from_wire(self.raw_answer, one_rr_per_rrset=True)
log_packet(sock, answer, query=False)
else:
self.answer = None
ctx.last_answer = self.answer
......
......@@ -32,15 +32,16 @@ def recvfrom_msg(stream, raw = False):
if len(next_chunk) == 0:
return None, None
data += next_chunk
received += len (next_chunk)
received += len(next_chunk)
addr = stream.getpeername()[0]
else:
raise Exception ("[recvfrom_msg]: unknown socket type '%i'" % stream.type)
raise Exception("[recvfrom_msg]: unknown socket type '%i'" % stream.type)
if not raw:
data = dns.message.from_wire(data, one_rr_per_rrset=True)
return data, addr
def sendto_msg(stream, message, addr = None):
def sendto_msg(stream, message, addr=None):
""" Send DNS/UDP/TCP message. """
try:
if stream.type == socket.SOCK_DGRAM:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment