Mercurial > hg
comparison contrib/import-checker.py @ 20200:532fa12033e1
import-checker: use any() and a genexp to avoid awkward for/else construction
author | Augie Fackler <raf@durin42.com> |
---|---|
date | Tue, 24 Dec 2013 19:10:04 -0500 |
parents | f5393a9dc4e5 |
children | bc3b48b0f5c8 |
comparison
equal
deleted
inserted
replaced
20199:d87ed25733a1 | 20200:532fa12033e1 |
---|---|
71 else: | 71 else: |
72 stdlib_prefixes.add(dirname) | 72 stdlib_prefixes.add(dirname) |
73 for libpath in sys.path: | 73 for libpath in sys.path: |
74 # We want to walk everything in sys.path that starts with something | 74 # We want to walk everything in sys.path that starts with something |
75 # in stdlib_prefixes. | 75 # in stdlib_prefixes. |
76 for prefix in stdlib_prefixes: | 76 if not any(libpath.startswith(p) for p in stdlib_prefixes): |
77 if libpath.startswith(prefix): | |
78 break | |
79 else: | |
80 continue | 77 continue |
81 if 'site-packages' in libpath: | 78 if 'site-packages' in libpath: |
82 continue | 79 continue |
83 for top, dirs, files in os.walk(libpath): | 80 for top, dirs, files in os.walk(libpath): |
84 for name in files: | 81 for name in files: |