Reformat offlineimap/ui/debuglock.py

Add some spaces, remove lines,... now format is better (lintian).
This commit is contained in:
Rodolfo García Peñas (kix) 2020-08-29 19:55:52 +02:00
parent 1b385dfafb
commit 9aa2344fd4

View File

@ -17,19 +17,21 @@
from threading import Lock, currentThread
import traceback
logfile = open("/tmp/logfile", "wt")
loglock = Lock()
class DebuggingLock:
def __init__(self, name):
self.lock = Lock()
self.name = name
def acquire(self, blocking = 1):
def acquire(self, blocking=1):
self.print_tb("Acquire lock")
self.lock.acquire(blocking)
self.logmsg("===== %s: Thread %s acquired lock\n"%
(self.name, currentThread().getName()))
self.logmsg("===== %s: Thread %s acquired lock\n" %
(self.name, currentThread().getName()))
def release(self):
self.print_tb("Release lock")
@ -42,8 +44,6 @@ class DebuggingLock:
loglock.release()
def print_tb(self, msg):
self.logmsg(".... %s: Thread %s attempting to %s\n"% \
self.logmsg(".... %s: Thread %s attempting to %s\n" % \
(self.name, currentThread().getName(), msg) + \
"\n".join(traceback.format_list(traceback.extract_stack())))