OSDN Git Service

[lit] Remove (or allow specific) unused imports
authorBrian Gesiak <modocache@gmail.com>
Mon, 10 Oct 2016 01:22:06 +0000 (01:22 +0000)
committerBrian Gesiak <modocache@gmail.com>
Mon, 10 Oct 2016 01:22:06 +0000 (01:22 +0000)
Summary:
Using Python linter flake8 on the utils/lit reveals several linter
warnings designated "F401: Unused import". Fix or silence these
warnings.

Some of these unused imports are legitimate, while some are part of lit's API.
For example, users of lit expect to be able to access `lit.formats.ShTest` in
their `lit.cfg`, despite the module hierarchy for that symbol actually being
`lit.formats.shtest.ShTest`. To silence linter errors for these lines,
include a "noqa" directive.

Reviewers: echristo, delcypher, beanz, ddunbar

Subscribers: mehdi_amini, llvm-commits

Differential Revision: https://reviews.llvm.org/D25407

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283710 91177308-0d34-0410-b5e6-96231b3b80d8

utils/lit/lit.py
utils/lit/lit/LitConfig.py
utils/lit/lit/__init__.py
utils/lit/lit/formats/__init__.py

index 851063b..2c5ecfe 100755 (executable)
@@ -1,5 +1,6 @@
 #!/usr/bin/env python
 
+from lit.main import main
+
 if __name__=='__main__':
-    import lit
-    lit.main()
+    main()
index c26c08e..fc50ffc 100644 (file)
@@ -83,7 +83,7 @@ class LitConfig(object):
             # a timeout per test. Check it's available.
             # See lit.util.killProcessAndChildren()
             try:
-                import psutil
+                import psutil  # noqa: F401
             except ImportError:
                 self.fatal("Setting a timeout per test requires the"
                            " Python psutil module but it could not be"
index 024a259..42aad83 100644 (file)
@@ -1,8 +1,5 @@
 """'lit' Testing Tool"""
 
-from __future__ import absolute_import
-from .main import main
-
 __author__ = 'Daniel Dunbar'
 __email__ = 'daniel@minormatter.com'
 __versioninfo__ = (0, 6, 0)
index 6862708..3ff46e9 100644 (file)
@@ -1,4 +1,8 @@
-from __future__ import absolute_import
-from lit.formats.base import TestFormat, FileBasedTest, OneCommandPerFileTest
-from lit.formats.googletest import GoogleTest
-from lit.formats.shtest import ShTest
+from lit.formats.base import (  # noqa: F401
+    TestFormat,
+    FileBasedTest,
+    OneCommandPerFileTest
+)
+
+from lit.formats.googletest import GoogleTest  # noqa: F401
+from lit.formats.shtest import ShTest  # noqa: F401