Skip to content

Commit 386abd0

Browse files
EdwardBettsaerkalov
authored andcommitted
tidy the code a bit
1 parent 75932ec commit 386abd0

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

ebooklib/epub.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1157,7 +1157,7 @@ def _create_section(itm, items, uid):
11571157
_parent = itm
11581158
_content = _parent.find('content')
11591159

1160-
if _content != None:
1160+
if _content is not None:
11611161
if _content.get('src') == '':
11621162
_content.set('src', item.href)
11631163

@@ -1171,7 +1171,7 @@ def _create_section(itm, items, uid):
11711171
_parent = itm
11721172
_content = _parent.find('content')
11731173

1174-
if _content != None:
1174+
if _content is not None:
11751175
if _content.get('src') == '':
11761176
_content.set('src', item.file_name)
11771177

@@ -1349,7 +1349,7 @@ def _load_manifest(self):
13491349
elif 'cover' in properties:
13501350
ei = EpubCoverHtml()
13511351

1352-
ei.content = self.read_file(os_path.join(self.opf_dir, unquote(r.get('href'))))
1352+
ei.content = self.read_file(zip_path.join(self.opf_dir, unquote(r.get('href'))))
13531353
else:
13541354
ei = EpubHtml()
13551355

@@ -1393,7 +1393,6 @@ def _parse_ncx(self, data):
13931393
def _get_children(elems, n, nid):
13941394
label, content = '', ''
13951395
children = []
1396-
_id = ''
13971396

13981397
for a in elems.getchildren():
13991398
if a.tag == '{%s}navLabel' % NAMESPACES['DAISY']:
@@ -1458,7 +1457,7 @@ def _load_spine(self):
14581457
try:
14591458
ncxFile = self.read_file(zip_path.join(self.opf_dir, self.book.get_item_with_id(toc).get_name()))
14601459
except KeyError:
1461-
raise EpubError(-1, 'Can not find ncx file.')
1460+
raise EpubException(-1, 'Can not find ncx file.')
14621461

14631462
self._parse_ncx(ncxFile)
14641463

@@ -1471,7 +1470,7 @@ def _load_opf_file(self):
14711470
try:
14721471
s = self.read_file(self.opf_file)
14731472
except KeyError:
1474-
raise EpubError(-1, 'Can not find container file')
1473+
raise EpubException(-1, 'Can not find container file')
14751474

14761475
self.container = parse_string(s)
14771476

0 commit comments

Comments
 (0)