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

Side by Side Diff: Tools/Scripts/webkitpy/thirdparty/unittest2/signals.py

Issue 20652002: Fix trailing whitespace in scripts and misc. files (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Don't change literal diff. Created 7 years, 5 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 import signal 1 import signal
2 import weakref 2 import weakref
3 3
4 from unittest2.compatibility import wraps 4 from unittest2.compatibility import wraps
5 5
6 __unittest = True 6 __unittest = True
7 7
8 8
9 class _InterruptHandler(object): 9 class _InterruptHandler(object):
10 def __init__(self, default_handler): 10 def __init__(self, default_handler):
11 self.called = False 11 self.called = False
12 self.default_handler = default_handler 12 self.default_handler = default_handler
13 13
14 def __call__(self, signum, frame): 14 def __call__(self, signum, frame):
15 installed_handler = signal.getsignal(signal.SIGINT) 15 installed_handler = signal.getsignal(signal.SIGINT)
16 if installed_handler is not self: 16 if installed_handler is not self:
17 # if we aren't the installed handler, then delegate immediately 17 # if we aren't the installed handler, then delegate immediately
18 # to the default handler 18 # to the default handler
19 self.default_handler(signum, frame) 19 self.default_handler(signum, frame)
20 20
21 if self.called: 21 if self.called:
22 self.default_handler(signum, frame) 22 self.default_handler(signum, frame)
23 self.called = True 23 self.called = True
24 for result in _results.keys(): 24 for result in _results.keys():
25 result.stop() 25 result.stop()
26 26
27 _results = weakref.WeakKeyDictionary() 27 _results = weakref.WeakKeyDictionary()
28 def registerResult(result): 28 def registerResult(result):
29 _results[result] = 1 29 _results[result] = 1
30 30
(...skipping 17 matching lines...) Expand all
48 removeHandler() 48 removeHandler()
49 try: 49 try:
50 return method(*args, **kwargs) 50 return method(*args, **kwargs)
51 finally: 51 finally:
52 signal.signal(signal.SIGINT, initial) 52 signal.signal(signal.SIGINT, initial)
53 return inner 53 return inner
54 54
55 global _interrupt_handler 55 global _interrupt_handler
56 if _interrupt_handler is not None: 56 if _interrupt_handler is not None:
57 signal.signal(signal.SIGINT, _interrupt_handler.default_handler) 57 signal.signal(signal.SIGINT, _interrupt_handler.default_handler)
OLDNEW
« no previous file with comments | « Tools/Scripts/webkitpy/thirdparty/unittest2/runner.py ('k') | Tools/Scripts/webkitpy/thirdparty/unittest2/suite.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698