Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-02-27 18:25:24 +0300
committerCampbell Barton <ideasman42@gmail.com>2011-02-27 18:25:24 +0300
commitfc0c0169401909ca1118012bfbf9cf613964a632 (patch)
tree8e12c4270e8744673dabeeff24144a03c032df34 /source/tests
parent52f92b4cb18b24c44c42bfecc55c19e4ed2eb90d (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')
-rw-r--r--source/tests/pep8.py11
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)