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,18 +17,20 @@
from threading import Lock, currentThread from threading import Lock, currentThread
import traceback import traceback
logfile = open("/tmp/logfile", "wt") logfile = open("/tmp/logfile", "wt")
loglock = Lock() loglock = Lock()
class DebuggingLock: class DebuggingLock:
def __init__(self, name): def __init__(self, name):
self.lock = Lock() self.lock = Lock()
self.name = name self.name = name
def acquire(self, blocking = 1): def acquire(self, blocking=1):
self.print_tb("Acquire lock") self.print_tb("Acquire lock")
self.lock.acquire(blocking) self.lock.acquire(blocking)
self.logmsg("===== %s: Thread %s acquired lock\n"% self.logmsg("===== %s: Thread %s acquired lock\n" %
(self.name, currentThread().getName())) (self.name, currentThread().getName()))
def release(self): def release(self):
@ -42,8 +44,6 @@ class DebuggingLock:
loglock.release() loglock.release()
def print_tb(self, msg): 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) + \ (self.name, currentThread().getName(), msg) + \
"\n".join(traceback.format_list(traceback.extract_stack()))) "\n".join(traceback.format_list(traceback.extract_stack())))