Mercurial > hg > config
comparison python/tree.py @ 377:b1c43c980b05
nottin to see here
| author | Jeff Hammel <jhammel@mozilla.com> |
|---|---|
| date | Wed, 24 Jul 2013 15:41:52 -0700 |
| parents | 3f84a96cccf6 |
| children | 397d0ac832b6 |
comparison
equal
deleted
inserted
replaced
| 376:3f84a96cccf6 | 377:b1c43c980b05 |
|---|---|
| 25 retval = [] | 25 retval = [] |
| 26 level = depth(directory) | 26 level = depth(directory) |
| 27 directories = {} | 27 directories = {} |
| 28 lvlndctr = [] | 28 lvlndctr = [] |
| 29 last = {} | 29 last = {} |
| 30 passed_last = {} | |
| 30 columns = [] | 31 columns = [] |
| 31 lastdepth = depth | 32 lastdepth = depth |
| 32 for dirpath, dirnames, filenames in os.walk(directory, topdown=True): | 33 for dirpath, dirnames, filenames in os.walk(directory, topdown=True): |
| 33 basename = os.path.basename(dirpath) | 34 basename = os.path.basename(dirpath) |
| 34 parent = os.path.abspath(os.path.dirname(dirpath)) | 35 parent = os.path.abspath(os.path.dirname(dirpath)) |
| 35 indent = depth(dirpath) - level | 36 indent = depth(dirpath) - level |
| 36 dirnames[:] = sorted(dirnames, key=lambda x: x.lower()) | 37 dirnames[:] = sorted(dirnames, key=lambda x: x.lower()) |
| 37 last[os.path.abspath(dirpath)] = dirnames and dirnames[-1] or None | 38 last[os.path.abspath(dirpath)] = dirnames and dirnames[-1] or None |
| 38 directories[dirpath] = dirnames | 39 directories[dirpath] = dirnames |
| 40 | |
| 39 retval.append('%s%s%s' % ('│' * (indent-1), | 41 retval.append('%s%s%s' % ('│' * (indent-1), |
| 40 ('├' if basename == basename else '└') if indent else '', | 42 ('├' if basename == basename else '└') if indent else '', |
| 41 basename)) | 43 basename)) |
| 42 filenames = sorted(filenames, key=lambda x: x.lower()) | 44 filenames = sorted(filenames, key=lambda x: x.lower()) |
| 43 retval.extend(['%s%s%s' % ('│' * (indent), | 45 retval.extend(['%s%s%s' % ('│' * (indent), |
