py3 wip
Showing
-
mentioned in merge request nexedi/zodbtools!10 (closed)
... | ... | @@ -18,16 +18,19 @@ |
# See COPYING file for full licensing terms. | ||
# See https://www.nexedi.com/licensing for rationale and options. | ||
import hashlib, struct, codecs | ||
import hashlib, struct, codecs, binascii | ||
import zodburi | ||
from six.moves.urllib_parse import urlsplit, urlunsplit | ||
from zlib import crc32, adler32 | ||
def ashex(s): | ||
return binascii.hexlify(s).decode() | ||
return s.encode('hex') | ||
#ashex = binascii.hexlify | ||
def fromhex(s): | ||
return codecs.decode(s, 'hex') | ||
fromhex = binascii.unhexlify | ||
Please
register
or
sign in
to reply
|
||
def sha1(data): | ||
m = hashlib.sha1() | ||
... | ... | @@ -74,8 +77,8 @@ def parse_tidrange(tidrange): |
raise TidRangeInvalid(tidrange) | ||
try: | ||
tidmin = tidmin.decode("hex") | ||
tidmax = tidmax.decode("hex") | ||
tidmin = binascii.unhexlify(tidmin) | ||
tidmax = binascii.unhexlify(tidmax) | ||
except TypeError: # hex decoding error | ||
raise TidRangeInvalid(tidrange) | ||
... | ... | @@ -131,7 +134,7 @@ class Adler32Hasher: |
digest_size = 4 | ||
def __init__(self): | ||
self._h = adler32('') | ||
self._h = adler32(b'') | ||
def update(self, data): | ||
self._h = adler32(data, self._h) | ||
... | ... | @@ -148,7 +151,7 @@ class CRC32Hasher: |
digest_size = 4 | ||
def __init__(self): | ||
self._h = crc32('') | ||
self._h = crc32(b'') | ||
def update(self, data): | ||
self._h = crc32(data, self._h) | ||
... | ... |
mentioned in merge request nexedi/zodbtools!10 (closed)
·mentioned in merge request nexedi/zodbtools!10 (closed)
@jerome, thanks, I suggest we extract non-controversial bits from here (e.g. ashex, fromhex, BytesIO) and merge them to master without waiting for full py3 testing coverage. Would you please prepare the patches? Thanks beforehand, Kirill.