comparison tests/list-tree.py @ 43076:2372284d9457

formatting: blacken the codebase This is using my patch to black (https://github.com/psf/black/pull/826) so we don't un-wrap collection literals. Done with: hg files 'set:**.py - mercurial/thirdparty/** - "contrib/python-zstandard/**"' | xargs black -S # skip-blame mass-reformatting only # no-check-commit reformats foo_bar functions Differential Revision: https://phab.mercurial-scm.org/D6971
author Augie Fackler <augie@google.com>
date Sun, 06 Oct 2019 09:45:02 -0400
parents acff41957b34
children 6000f5b25c9b
comparison
equal deleted inserted replaced
43075:57875cf423c9 43076:2372284d9457
7 import os 7 import os
8 8
9 ap = argparse.ArgumentParser() 9 ap = argparse.ArgumentParser()
10 ap.add_argument('path', nargs='+') 10 ap.add_argument('path', nargs='+')
11 opts = ap.parse_args() 11 opts = ap.parse_args()
12
12 13
13 def gather(): 14 def gather():
14 for p in opts.path: 15 for p in opts.path:
15 if not os.path.exists(p): 16 if not os.path.exists(p):
16 return 17 return
22 for f in files: 23 for f in files:
23 yield os.path.join(dirpath, f) 24 yield os.path.join(dirpath, f)
24 else: 25 else:
25 yield p 26 yield p
26 27
28
27 print('\n'.join(sorted(gather(), key=lambda x: x.replace(os.path.sep, '/')))) 29 print('\n'.join(sorted(gather(), key=lambda x: x.replace(os.path.sep, '/'))))