From 74f3c254347fae88453385199aea588ebf341a05 Mon Sep 17 00:00:00 2001 From: Trey Hunner Date: Sun, 15 Apr 2012 11:38:01 -0700 Subject: Remove unecessary Sources class --- pycco/main.py | 4 ++-- pycco/utils.py | 16 +++------------- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/pycco/main.py b/pycco/main.py index 9eb73dd..6843f69 100644 --- a/pycco/main.py +++ b/pycco/main.py @@ -497,8 +497,8 @@ def main(): sources = [i for i in get_all_files(filepath or '.', filetype)] global SOURCES - SOURCES = Sources(sources, start) - + SOURCES = [Source(name, start) for name in sources] + process(SOURCES, outdir=opts.outdir, preserve_paths=opts.paths) # If the -w / --watch option was present, monitor the source directories diff --git a/pycco/utils.py b/pycco/utils.py index 4cfb9f3..287f401 100644 --- a/pycco/utils.py +++ b/pycco/utils.py @@ -32,6 +32,9 @@ class Source: rel = os.path.relpath(source.dirpath, self.dirpath) return "%s/%s" % (rel, html(source.title)) + def __cmp__(self, other): + return cmp(self.name, other.name) + def relative_paths(self, sources): root_ = '' list_ = [] @@ -54,16 +57,3 @@ class Source: if len(list_) == 1: list_[0]['display'] = 'block' return list_ - - -class Sources: - def __init__(self, sources, start): - self.list = [Source(name, start) for name in sources] - self.get = lambda x: self.list[index] - - def names(self): - return [i.name for i in self.list] - - def __iter__(self): - for i in self.list: - yield i -- cgit v1.2.1