Commit 0ceb3e6e authored by Daniel Kahn Gillmor's avatar Daniel Kahn Gillmor Committed by Daniel Salzman

pykeymgr: change "endianess" argument to "endianness"

This fixes a simple spelling mistake.

Changing the name of an optional parameter is potentially dicey, but
in python3, int.to_bytes calls this parameter "byteorder" so i doubt
that anyone is using the misspelled "endianess" anywhere outside of
pykeymgr anyway.
parent 25d7b825
......@@ -34,7 +34,7 @@ def lmdb_requirement():
# workarounding that python 2 doesn't have int.to_bytes()
def to_bytes(n, length, endianess='big'):
def to_bytes(n, length, endianness='big'):
h = '%x' % n
assert len(h) <= length * 2
s = ('0'*(len(h) % 2) + h).zfill(length * 2)
......@@ -42,10 +42,10 @@ def to_bytes(n, length, endianess='big'):
sb = codecs.decode(s, 'hex')
sb = s.decode('hex')
return bytearray(sb) if endianess == 'big' else bytearray(sb[::-1])
return bytearray(sb) if endianness == 'big' else bytearray(sb[::-1])
def from_bytes(ba, endianess='big'):
x = ba if endianess == 'big' else bytearray(s[::-1])
def from_bytes(ba, endianness='big'):
x = ba if endianness == 'big' else bytearray(s[::-1])
if sys.version_info >= (3,0):
hx = codecs.encode(x, 'hex')
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