From 55a3172e37855f388b9ba0dfc91641a6c9ad1376 Mon Sep 17 00:00:00 2001 From: Scott Date: Wed, 12 Jan 2022 09:06:29 -0800 Subject: Scale back warnings.warn and add stacklevels= where appropriate. --- lockfile.py | 4 ---- 1 file changed, 4 deletions(-) (limited to 'lockfile.py') diff --git a/lockfile.py b/lockfile.py index 7f10cc1..8a71ca7 100644 --- a/lockfile.py +++ b/lockfile.py @@ -90,7 +90,6 @@ class LockFile(object): pass msg = f'Could not acquire {self.lockfile}.' logger.warning(msg) - warnings.warn(msg) return False def acquire_with_retries( @@ -127,7 +126,6 @@ class LockFile(object): return self msg = f"Couldn't acquire {self.lockfile}; giving up." logger.warning(msg) - warnings.warn(msg) raise LockFileException(msg) def __exit__(self, type, value, traceback): @@ -178,7 +176,6 @@ class LockFile(object): except OSError: msg = f'Lockfile {self.lockfile}\'s pid ({contents.pid}) is stale; force acquiring' logger.warning(msg) - warnings.warn(msg) self.release() # Has the lock expiration expired? @@ -187,7 +184,6 @@ class LockFile(object): if now > contents.expiration_datetime: msg = f'Lockfile {self.lockfile} expiration time has passed; force acquiring' logger.warning(msg) - warnings.warn(msg) self.release() except Exception: pass -- cgit v1.3