Commit 9db48d23 authored by Matthew Pounsett's avatar Matthew Pounsett

PEP8 cleanup

parent 6ed107c8
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
############################################################################ ############################################################################
from collections import OrderedDict from collections import OrderedDict
from exceptions import TypeError
import time import time
import struct import struct
import hashlib import hashlib
...@@ -30,12 +29,14 @@ import socket ...@@ -30,12 +29,14 @@ import socket
class rndc(object): class rndc(object):
"""RNDC protocol client library""" """RNDC protocol client library"""
__algos = {'md5': 157, __algos = {
'sha1': 161, 'md5': 157,
'sha224': 162, 'sha1': 161,
'sha256': 163, 'sha224': 162,
'sha384': 164, 'sha256': 163,
'sha512': 165} 'sha384': 164,
'sha512': 165
}
def __init__(self, host, algo, secret): def __init__(self, host, algo, secret):
"""Creates a persistent connection to RNDC and logs in """Creates a persistent connection to RNDC and logs in
...@@ -83,7 +84,7 @@ class rndc(object): ...@@ -83,7 +84,7 @@ class rndc(object):
d['_ctrl'] = OrderedDict() d['_ctrl'] = OrderedDict()
d['_ctrl']['_ser'] = str(self.ser) d['_ctrl']['_ser'] = str(self.ser)
d['_ctrl']['_tim'] = str(now) d['_ctrl']['_tim'] = str(now)
d['_ctrl']['_exp'] = str(now+60) d['_ctrl']['_exp'] = str(now + 60)
if self.nonce is not None: if self.nonce is not None:
d['_ctrl']['_nonce'] = self.nonce d['_ctrl']['_nonce'] = self.nonce
d['_data'] = data d['_data'] = data
...@@ -147,13 +148,13 @@ class rndc(object): ...@@ -147,13 +148,13 @@ class rndc(object):
pos = 0 pos = 0
labellen = ord(input[pos]) labellen = ord(input[pos])
pos += 1 pos += 1
label = input[pos:pos+labellen] label = input[pos:pos + labellen]
pos += labellen pos += labellen
type = ord(input[pos]) type = ord(input[pos])
pos += 1 pos += 1
datalen = struct.unpack('>I', input[pos:pos+4])[0] datalen = struct.unpack('>I', input[pos:pos + 4])[0]
pos += 4 pos += 4
data = input[pos:pos+datalen] data = input[pos:pos + datalen]
pos += datalen pos += datalen
rest = input[pos:] rest = input[pos:]
...@@ -171,7 +172,6 @@ class rndc(object): ...@@ -171,7 +172,6 @@ class rndc(object):
def __parse_message(self, input): def __parse_message(self, input):
rv = OrderedDict() rv = OrderedDict()
hdata = None
while len(input) > 0: while len(input) > 0:
label, value, input = self.__parse_element(input) label, value, input = self.__parse_element(input)
rv[label] = value rv[label] = value
......
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