diff options
author | Trey Hunner <treyhunner@gmail.com> | 2012-04-15 11:40:59 -0700 |
---|---|---|
committer | Trey Hunner <treyhunner@gmail.com> | 2012-04-15 11:40:59 -0700 |
commit | f11250168f24b6fb06c5f547a8f71dcabfc07cf6 (patch) | |
tree | 9ed81784b3b57d7d3fc914a274861a30fcc59356 /pycco/utils.py | |
parent | 3daf6c368cb0807756309904098812ab1688d71a (diff) | |
download | pycco-topic/jump-to.tar.gz |
Fix style (PEP8 mostly)topic/jump-to
Diffstat (limited to 'pycco/utils.py')
-rw-r--r-- | pycco/utils.py | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/pycco/utils.py b/pycco/utils.py index 287f401..82854dc 100644 --- a/pycco/utils.py +++ b/pycco/utils.py @@ -18,18 +18,18 @@ def get_all_files(path, extension): class Source: def __init__(self, name, start): - self.name = name - self.title = os.path.basename(self.name) - self.dirpath = os.path.dirname(self.name) or '.' - self.dirname = os.path.relpath(self.dirpath, start) - self.start = start + self.name = name + self.title = os.path.basename(self.name) + self.dirpath = os.path.dirname(self.name) or '.' + self.dirname = os.path.relpath(self.dirpath, start) + self.start = start def save_path(self): return "docs/%s/%s" % (self.dirname, self.title) def relative_path(self, source): html = lambda x: "%s.html" % os.path.splitext(x)[0] - rel = os.path.relpath(source.dirpath, self.dirpath) + rel = os.path.relpath(source.dirpath, self.dirpath) return "%s/%s" % (rel, html(source.title)) def __cmp__(self, other): @@ -40,16 +40,16 @@ class Source: list_ = [] dict_ = {} id_ = 1 - title = lambda s: {'title': s.title, 'url': self.relative_path(s)} + title = lambda s: {'title': s.title, 'url': self.relative_path(s)} new_dict = lambda s: {'id': id_, 'dirname': s.dirname, 'display': 'none', 'titles': [title(s)]} for source in sources: if source.dirpath != root_: if dict_: list_.append(dict_) - root_ = source.dirpath - dict_ = new_dict(source) - id_ += 1 + root_ = source.dirpath + dict_ = new_dict(source) + id_ += 1 else: dict_['titles'].append(title(source)) |