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

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: Created 6 years, 11 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
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..a4f663ba1a148e5c006f7c2c6e76c33792a32341 100644
--- a/build/android/pylib/utils/reraiser_thread.py
+++ b/build/android/pylib/utils/reraiser_thread.py
@@ -7,10 +7,9 @@
import logging
import sys
import threading
-import time
import traceback
-import watchdog_timer
+from . import watchdog_timer
class TimeoutError(Exception):
@@ -38,7 +37,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 +47,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 +75,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):

Powered by Google App Engine
This is Rietveld 408576698