"""
rdata = _to_rdata(key, origin)
- rdata = bytearray(rdata)
if key.algorithm == RSAMD5:
return (rdata[-3] << 8) + rdata[-2]
else:
if len(address) != 4:
raise dns.exception.SyntaxError
- if not isinstance(address, bytearray):
- address = bytearray(address)
return ('%u.%u.%u.%u' % (address[0], address[1],
address[2], address[3]))
#
m = _v4_ending.match(text)
if not m is None:
- b = bytearray(dns.ipv4.inet_aton(m.group(2)))
+ 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()
except idna.IDNAError as e:
raise IDNAException(idna_exception=e)
-_escaped = bytearray(b'"().;\\@$')
+_escaped = b'"().;\\@$'
IDNA_2003_Practical = IDNA2003Codec(False)
IDNA_2003_Strict = IDNA2003Codec(True)
text = ''
if isinstance(label, str):
label = label.encode()
- for c in bytearray(label):
+ for c in label:
if c in _escaped:
text += '\\' + chr(c)
elif c > 0x20 and c < 0x7F:
h = 0
for label in self.labels:
- for c in bytearray(label.lower()):
+ for c in label.lower():
h += (h << 3) + c
return h % maxint
if text:
if text == b'.':
return Name([b''])
- for c in bytearray(text):
+ for c in text:
byte_ = struct.pack('!B', c)
if escaping:
if edigits == 0:
for i
in range(0, len(line), chunksize)]).decode()
-__escaped = bytearray(b'"\\')
+__escaped = b'"\\'
def _escapify(qstring):
"""Escape the characters in a quoted string which need it."""
origin = ipv6_reverse_domain
except Exception:
parts = ['%d' %
- byte for byte in bytearray(dns.ipv4.inet_aton(text))]
+ byte for byte in dns.ipv4.inet_aton(text)]
origin = ipv4_reverse_domain
parts.reverse()
return dns.name.from_text('.'.join(parts), origin=origin)
return WireData(super(WireData, self).__getitem__(
slice(start, stop)))
- return bytearray(self.unwrap())[key]
+ return self.unwrap()[key]
except IndexError:
raise dns.exception.FormError
u"1 0 100 ABCD SCBCQHKU35969L2A68P3AD59LHF30715 A CAA TYPE65534")
bitmap = bytearray(b'\0' * 32)
bitmap[31] = bitmap[31] | 2
- self.assertEqual(rdata.windows, [(0, bytearray(b'@')),
- (1, bytearray(b'@')), # CAA = 257
+ self.assertEqual(rdata.windows, [(0, b'@'),
+ (1, b'@'), # CAA = 257
(255, bitmap)
])
"""Get data one by one item"""
data = b'0123456789'
inst = WireData(data)
- for i, byte in enumerate(bytearray(data)):
+ for i, byte in enumerate(data):
self.assertEqual(inst[i], byte)
for i in range(-1, len(data) * -1, -1):
- self.assertEqual(inst[i], bytearray(data)[i])
+ self.assertEqual(inst[i], data[i])
def testEmptySlice(self):
"""Test empty slice"""