aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@google.com>2017-11-10 23:10:24 +0000
committerandroid-build-merger <android-build-merger@google.com>2017-11-10 23:10:24 +0000
commit6c6432d8f6d853c49f36807bf5f0e29e0c9ecd73 (patch)
tree3c4acd7c6776efce6987960bd8431ffb339bb508
parentd3758b6a752ef121a4a613a193e353c50cf20252 (diff)
parent552b1f92fdb604253115a494872e5ecc905b2051 (diff)
downloadrepohooks-6c6432d8f6d853c49f36807bf5f0e29e0c9ecd73.tar.gz
address lint warnings after pylint upgrade am: 2ef213ca32 am: a430574984
am: 552b1f92fd Change-Id: Iabae5543a09ced9adbe4c757e46d1901b8ea8c8b
-rwxr-xr-xpre-upload.py3
-rw-r--r--rh/config.py1
-rwxr-xr-xrh/config_unittest.py3
-rw-r--r--rh/git.py1
-rw-r--r--rh/hooks.py1
-rwxr-xr-xrh/hooks_unittest.py6
-rwxr-xr-xrh/shell_unittest.py3
-rw-r--r--rh/terminal.py1
-rw-r--r--rh/utils.py4
-rwxr-xr-xtools/clang-format.py3
-rwxr-xr-xtools/google-java-format.py3
11 files changed, 28 insertions, 1 deletions
diff --git a/pre-upload.py b/pre-upload.py
index fe4cdd8..86f6da0 100755
--- a/pre-upload.py
+++ b/pre-upload.py
@@ -37,6 +37,9 @@ if sys.path[0] != _path:
sys.path.insert(0, _path)
del _path
+# We have to import our local modules after the sys.path tweak. We can't use
+# relative imports because this is an executable program, not a module.
+# pylint: disable=wrong-import-position
import rh
import rh.results
import rh.config
diff --git a/rh/config.py b/rh/config.py
index 6a149d7..61f2ef0 100644
--- a/rh/config.py
+++ b/rh/config.py
@@ -28,6 +28,7 @@ if sys.path[0] != _path:
sys.path.insert(0, _path)
del _path
+# pylint: disable=wrong-import-position
import rh.hooks
import rh.shell
diff --git a/rh/config_unittest.py b/rh/config_unittest.py
index 9547b74..55d08e9 100755
--- a/rh/config_unittest.py
+++ b/rh/config_unittest.py
@@ -29,6 +29,9 @@ if sys.path[0] != _path:
sys.path.insert(0, _path)
del _path
+# We have to import our local modules after the sys.path tweak. We can't use
+# relative imports because this is an executable program, not a module.
+# pylint: disable=wrong-import-position
import rh.hooks
import rh.config
diff --git a/rh/git.py b/rh/git.py
index 8cf2557..fb3f0f4 100644
--- a/rh/git.py
+++ b/rh/git.py
@@ -26,6 +26,7 @@ if sys.path[0] != _path:
sys.path.insert(0, _path)
del _path
+# pylint: disable=wrong-import-position
import rh.utils
diff --git a/rh/hooks.py b/rh/hooks.py
index 5d60428..c0071ae 100644
--- a/rh/hooks.py
+++ b/rh/hooks.py
@@ -28,6 +28,7 @@ if sys.path[0] != _path:
sys.path.insert(0, _path)
del _path
+# pylint: disable=wrong-import-position
import rh.results
import rh.git
import rh.utils
diff --git a/rh/hooks_unittest.py b/rh/hooks_unittest.py
index ec4d0b3..38a7fc9 100755
--- a/rh/hooks_unittest.py
+++ b/rh/hooks_unittest.py
@@ -18,16 +18,20 @@
from __future__ import print_function
-import mock
import os
import sys
import unittest
+import mock
+
_path = os.path.realpath(__file__ + '/../..')
if sys.path[0] != _path:
sys.path.insert(0, _path)
del _path
+# We have to import our local modules after the sys.path tweak. We can't use
+# relative imports because this is an executable program, not a module.
+# pylint: disable=wrong-import-position
import rh
import rh.hooks
import rh.config
diff --git a/rh/shell_unittest.py b/rh/shell_unittest.py
index bd98ec1..7fc0f91 100755
--- a/rh/shell_unittest.py
+++ b/rh/shell_unittest.py
@@ -28,6 +28,9 @@ if sys.path[0] != _path:
sys.path.insert(0, _path)
del _path
+# We have to import our local modules after the sys.path tweak. We can't use
+# relative imports because this is an executable program, not a module.
+# pylint: disable=wrong-import-position
import rh.shell
diff --git a/rh/terminal.py b/rh/terminal.py
index 9eda0ec..686a7ca 100644
--- a/rh/terminal.py
+++ b/rh/terminal.py
@@ -28,6 +28,7 @@ if sys.path[0] != _path:
sys.path.insert(0, _path)
del _path
+# pylint: disable=wrong-import-position
import rh.shell
diff --git a/rh/utils.py b/rh/utils.py
index d892358..5328ea7 100644
--- a/rh/utils.py
+++ b/rh/utils.py
@@ -31,6 +31,7 @@ if sys.path[0] != _path:
sys.path.insert(0, _path)
del _path
+# pylint: disable=wrong-import-position
import rh.shell
import rh.signals
@@ -340,6 +341,8 @@ def run_command(cmd, error_message=None, redirect_stdout=False,
# Note that tempfiles must be unbuffered else attempts to read
# what a separate process did to that file can result in a bad
# view of the file.
+ # The Popen API accepts either an int or a file handle for stdout/stderr.
+ # pylint: disable=redefined-variable-type
if log_stdout_to_file:
stdout = open(log_stdout_to_file, 'w+')
elif stdout_to_pipe:
@@ -351,6 +354,7 @@ def run_command(cmd, error_message=None, redirect_stdout=False,
stderr = subprocess.STDOUT
elif redirect_stderr:
stderr = _get_tempfile()
+ # pylint: enable=redefined-variable-type
# If subprocesses have direct access to stdout or stderr, they can bypass
# our buffers, so we need to flush to ensure that output is not interleaved.
diff --git a/tools/clang-format.py b/tools/clang-format.py
index 998eb49..55b3f3b 100755
--- a/tools/clang-format.py
+++ b/tools/clang-format.py
@@ -27,6 +27,9 @@ if sys.path[0] != _path:
sys.path.insert(0, _path)
del _path
+# We have to import our local modules after the sys.path tweak. We can't use
+# relative imports because this is an executable program, not a module.
+# pylint: disable=wrong-import-position
import rh.shell
import rh.utils
diff --git a/tools/google-java-format.py b/tools/google-java-format.py
index 6796cfc..3e88358 100755
--- a/tools/google-java-format.py
+++ b/tools/google-java-format.py
@@ -28,6 +28,9 @@ if sys.path[0] != _path:
sys.path.insert(0, _path)
del _path
+# We have to import our local modules after the sys.path tweak. We can't use
+# relative imports because this is an executable program, not a module.
+# pylint: disable=wrong-import-position
import rh.shell
import rh.utils