Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(709)

Unified Diff: build/android/pylib/utils/reraiser_thread.py

Issue 132463007: Enable presubmit pylint in build/android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase vs tot and only disabling F0401 in specific spots Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « build/android/pylib/utils/report_results.py ('k') | build/android/pylib/utils/reraiser_thread_unittest.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/pylib/utils/reraiser_thread.py
diff --git a/build/android/pylib/utils/reraiser_thread.py b/build/android/pylib/utils/reraiser_thread.py
index d4ba781a32d856def495f44499ce123cd94d9fc0..eed72c173ead636d8397a174ef3a92757f43e596 100644
--- a/build/android/pylib/utils/reraiser_thread.py
+++ b/build/android/pylib/utils/reraiser_thread.py
@@ -3,14 +3,14 @@
# found in the LICENSE file.
"""Thread and ThreadGroup that reraise exceptions on the main thread."""
+# pylint: disable=W0212
import logging
import sys
import threading
-import time
import traceback
-import watchdog_timer
+from pylib.utils import watchdog_timer
class TimeoutError(Exception):
@@ -38,7 +38,7 @@ def LogThreadStack(thread):
class ReraiserThread(threading.Thread):
"""Thread class that can reraise exceptions."""
- def __init__(self, func, args=[], kwargs={}, name=None):
+ def __init__(self, func, args=None, kwargs=None, name=None):
"""Initialize thread.
Args:
@@ -48,6 +48,10 @@ class ReraiserThread(threading.Thread):
name: thread name, defaults to Thread-N.
"""
super(ReraiserThread, self).__init__(name=name)
+ if not args:
+ args = []
+ if not kwargs:
+ kwargs = {}
self.daemon = True
self._func = func
self._args = args
@@ -72,12 +76,14 @@ class ReraiserThread(threading.Thread):
class ReraiserThreadGroup(object):
"""A group of ReraiserThread objects."""
- def __init__(self, threads=[]):
+ def __init__(self, threads=None):
"""Initialize thread group.
Args:
threads: a list of ReraiserThread objects; defaults to empty.
"""
+ if not threads:
+ threads = []
self._threads = threads
def Add(self, thread):
« no previous file with comments | « build/android/pylib/utils/report_results.py ('k') | build/android/pylib/utils/reraiser_thread_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698