summaryrefslogtreecommitdiff
path: root/client/utils/locking.py
diff options
context:
space:
mode:
Diffstat (limited to 'client/utils/locking.py')
-rw-r--r--client/utils/locking.py24
1 files changed, 12 insertions, 12 deletions
diff --git a/client/utils/locking.py b/client/utils/locking.py
index dfc8f63..d3cbd64 100644
--- a/client/utils/locking.py
+++ b/client/utils/locking.py
@@ -3,19 +3,19 @@ import os
class FileLock():
- 'a simple wrapper around file lock'
+ 'a simple wrapper around file lock'
- def __init__(self, filename):
- self._file = open(filename, 'w')
+ def __init__(self, filename):
+ self._file = open(filename, 'w')
- def __enter__(self):
- 'locks the file and writes the PID of the current process into it'
- fcntl.flock(self._file, fcntl.LOCK_EX)
- self._file.write(str(os.getpid()))
- self._file.flush()
+ def __enter__(self):
+ 'locks the file and writes the PID of the current process into it'
+ fcntl.flock(self._file, fcntl.LOCK_EX)
+ self._file.write(str(os.getpid()))
+ self._file.flush()
- return self._file
+ return self._file
- def __exit__(self, type, value, traceback):
- 'unlock the file'
- fcntl.flock(self._file, fcntl.LOCK_UN)
+ def __exit__(self, type, value, traceback):
+ 'unlock the file'
+ fcntl.flock(self._file, fcntl.LOCK_UN)