diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-02-27 18:25:24 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-02-27 18:25:24 +0300 |
commit | fc0c0169401909ca1118012bfbf9cf613964a632 (patch) | |
tree | 8e12c4270e8744673dabeeff24144a03c032df34 /source/tests/pep8.py | |
parent | 52f92b4cb18b24c44c42bfecc55c19e4ed2eb90d (diff) |
replace import *'s with named imports (using * is convenient for some scripts but considered bad practice by python devs)
Diffstat (limited to 'source/tests/pep8.py')
-rw-r--r-- | source/tests/pep8.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/source/tests/pep8.py b/source/tests/pep8.py index ee71c877533..c4c2da3f185 100644 --- a/source/tests/pep8.py +++ b/source/tests/pep8.py @@ -87,7 +87,15 @@ def main(): for f in files_skip: print(" %s" % f) - # pyflakes + # strict imports + print("\n\n\n# running pep8...") + import re + import_check = re.compile(r"\s*from\s+[A-z\.]+\s+import \*\s*") + for f, pep8_type in files: + for i, l in enumerate(open(f, 'r', encoding='utf8')): + if import_check.match(l): + print("%s:%d:0: global import bad practice" % (f, i + 1)) + print("\n\n\n# running pep8...") for f, pep8_type in files: if pep8_type == 1: @@ -96,6 +104,7 @@ def main(): else: os.system("pep8 --repeat '%s'" % (f)) + # pyflakes print("\n\n\n# running pyflakes...") for f, pep8_type in files: os.system("pyflakes '%s'" % f) |