py3: decode uuid4().hex using python3-compatible syntax

Also skip the additional uuid import, as it is already imported at the
top of the file.
This commit is contained in:
Eli Schwartz 2019-04-10 13:20:50 -04:00
parent 75d3542287
commit 8c6698abf7
No known key found for this signature in database
GPG Key ID: CEB167EFB5722BD6

View File

@ -85,7 +85,7 @@ class Mobi8Reader(object):
def __call__(self): def __call__(self):
self.mobi6_reader.check_for_drm() self.mobi6_reader.check_for_drm()
self.aid_anchor_suffix = bytes(uuid4().hex) self.aid_anchor_suffix = uuid4().hex.encode('utf-8')
bh = self.mobi6_reader.book_header bh = self.mobi6_reader.book_header
if self.mobi6_reader.kf8_type == 'joint': if self.mobi6_reader.kf8_type == 'joint':
offset = self.mobi6_reader.kf8_boundary + 2 offset = self.mobi6_reader.kf8_boundary + 2
@ -225,8 +225,7 @@ class Mobi8Reader(object):
self.parts.append(skeleton) self.parts.append(skeleton)
if divcnt < 1: if divcnt < 1:
# Empty file # Empty file
import uuid aidtext = str(uuid4())
aidtext = str(uuid.uuid4())
filename = aidtext + '.html' filename = aidtext + '.html'
self.partinfo.append(Part(skelnum, 'text', filename, skelpos, self.partinfo.append(Part(skelnum, 'text', filename, skelpos,
baseptr, aidtext)) baseptr, aidtext))