summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTrey Hunner <treyhunner@gmail.com>2012-04-15 11:38:01 -0700
committerTrey Hunner <treyhunner@gmail.com>2012-04-15 11:38:01 -0700
commit74f3c254347fae88453385199aea588ebf341a05 (patch)
treeb44038dac8a728ac8f707c5ee76bd799d25b1dc0
parent461e0e9145ce15b93bc1d5f0a16a0303de66d66e (diff)
downloadpycco-74f3c254347fae88453385199aea588ebf341a05.tar.gz
Remove unecessary Sources class
-rw-r--r--pycco/main.py4
-rw-r--r--pycco/utils.py16
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