From ee23d9bcde333772c8d93fd8be2f0936c3b06b61 Mon Sep 17 00:00:00 2001 From: "Marshall T. Vandegrift" Date: Thu, 11 Dec 2008 08:03:51 -0500 Subject: [PATCH] CamelCase class names the PEP-8 way. --- src/calibre/ebooks/lit/oeb.py | 16 ++++++++-------- src/calibre/ebooks/lit/writer.py | 8 ++++---- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/calibre/ebooks/lit/oeb.py b/src/calibre/ebooks/lit/oeb.py index aa26107e0e..fc1aaeef90 100644 --- a/src/calibre/ebooks/lit/oeb.py +++ b/src/calibre/ebooks/lit/oeb.py @@ -417,7 +417,7 @@ class Guide(object): return elem -class Toc(object): +class TOC(object): def __init__(self, title=None, href=None, klass=None, id=None): self.title = title self.href = urlnormalize(href) if href else href @@ -426,7 +426,7 @@ class Toc(object): self.nodes = [] def add(self, title, href, klass=None, id=None): - node = Toc(title, href, klass, id) + node = TOC(title, href, klass, id) self.nodes.append(node) return node @@ -468,7 +468,7 @@ class Toc(object): return parent -class Oeb(object): +class OEBBook(object): def __init__(self, opfpath, container=None): if not container: container = DirContainer(os.path.dirname(opfpath)) @@ -571,7 +571,7 @@ class Oeb(object): ncx = self.manifest[id].data self.manifest.remove(id) title = xpath(ncx, 'ncx:docTitle/ncx:text/text()')[0] - self.toc = toc = Toc(title) + self.toc = toc = TOC(title) navmaps = xpath(ncx, 'ncx:navMap') for navmap in navmaps: self._toc_from_navpoint(toc, navmap) @@ -582,7 +582,7 @@ class Oeb(object): if not result: return False tour = result[0] - self.toc = toc = Toc(tour.get('title')) + self.toc = toc = TOC(tour.get('title')) sites = xpath(tour, 'o2:site') for site in sites: toc.add(site.get('title'), site.get('href')) @@ -591,7 +591,7 @@ class Oeb(object): def _toc_from_html(self, opf): if 'toc' not in self.guide: return False - self.toc = toc = Toc() + self.toc = toc = TOC() itempath, frag = urldefrag(self.guide['toc'].href) item = self.manifest.hrefs[itempath] html = item.data @@ -620,7 +620,7 @@ class Oeb(object): return True def _toc_from_spine(self, opf): - self.toc = toc = Toc() + self.toc = toc = TOC() titles = [] headers = [] for item in self.spine: @@ -720,7 +720,7 @@ class Oeb(object): def main(argv=sys.argv): for arg in argv[1:]: - oeb = Oeb(arg) + oeb = OEBBook(arg) for name, doc in oeb.to_opf1().values(): print etree.tostring(doc, pretty_print=True) for name, doc in oeb.to_opf2().values(): diff --git a/src/calibre/ebooks/lit/writer.py b/src/calibre/ebooks/lit/writer.py index 52e70b9805..f374d49ddf 100644 --- a/src/calibre/ebooks/lit/writer.py +++ b/src/calibre/ebooks/lit/writer.py @@ -15,10 +15,10 @@ from urllib import unquote as urlunquote from lxml import etree from calibre.ebooks.lit.reader import msguid, DirectoryEntry import calibre.ebooks.lit.maps as maps -from calibre.ebooks.lit.oeb import OEB_CSS_MIME, CSS_MIME, XHTML_MIME, \ - OPF_MIME, OEB_STYLES, OEB_DOCS, XML_NS, XML +from calibre.ebooks.lit.oeb import OEB_STYLES, OEB_CSS_MIME, CSS_MIME, \ + XHTML_MIME, OPF_MIME, XML_NS, XML from calibre.ebooks.lit.oeb import namespace, barename, urlnormalize -from calibre.ebooks.lit.oeb import Oeb +from calibre.ebooks.lit.oeb import OEBBook from calibre.ebooks.lit.stylizer import Stylizer from calibre.ebooks.lit.lzxcomp import Compressor import calibre @@ -676,7 +676,7 @@ def main(argv=sys.argv): if litpath is None: litpath = os.path.basename(opfpath) litpath = os.path.splitext(litpath)[0] + '.lit' - lit = LitWriter(Oeb(opfpath)) + lit = LitWriter(OEBBook(opfpath)) with open(litpath, 'wb') as f: lit.dump(f) print _('LIT ebook created at'), litpath