Mercurial > hg > config
annotate python/directories.py @ 694:ebca6d85213a
File "/usr/lib/python3/dist-packages/IPython/config/__init__.py", line 16, in <module>
from .application import *
File "/usr/lib/python3/dist-packages/IPython/config/application.py", line 31, in <module>
from IPython.config.configurable import SingletonConfigurable
File "/usr/lib/python3/dist-packages/IPython/config/configurable.py", line 33, in <module>
from IPython.utils.text import indent, wrap_paragraphs
File "/usr/lib/python3/dist-packages/IPython/utils/text.py", line 28, in <module>
from IPython.external.path import path
File "/usr/lib/python3/dist-packages/IPython/external/path/__init__.py", line 2, in <module>
from path import *
File "/home/jhammel/python/path.py", line 25
print root(path)
^
author | Jeff Hammel <k0scist@gmail.com> |
---|---|
date | Wed, 09 Jul 2014 16:26:49 -0700 |
parents | a8982ae84a9b |
children |
rev | line source |
---|---|
407 | 1 #!/usr/bin/env python |
2 | |
3 """ | |
4 ls unique file paths | |
5 """ | |
6 | |
7 import optparse | |
8 import os | |
9 import sys | |
10 | |
11 here = os.path.dirname(os.path.realpath(__file__)) | |
12 | |
13 def main(args=sys.argv[1:]): | |
14 | |
15 usage = '%prog [options]' | |
16 parser = optparse.OptionParser(usage=usage, description=__doc__) | |
17 parser.add_option('--strip', default='? ') | |
18 options, args = parser.parse_args(args) | |
19 | |
20 _input = sys.stdin.read() | |
21 lines = [i.strip() for i in _input.splitlines() | |
22 if i.strip()] | |
23 lines = [i[len(options.strip):] if i.startswith(options.strip) else i | |
24 for i in lines] | |
25 paths = set([i.split(os.path.sep)[0] for i in lines]) | |
26 for i in sorted(paths): | |
27 print i | |
28 | |
29 if __name__ == '__main__': | |
30 main() |