Mercurial > p > roundup > code
diff roundup/backends/portalocker.py @ 6035:a50712b6ad56
flake8 fixes whitespace
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Fri, 03 Jan 2020 21:26:26 -0500 |
| parents | 64b05e24dbd8 |
| children | 9c3ec0a5c7fc |
line wrap: on
line diff
--- a/roundup/backends/portalocker.py Fri Jan 03 21:24:09 2020 -0500 +++ b/roundup/backends/portalocker.py Fri Jan 03 21:26:26 2020 -0500 @@ -64,7 +64,7 @@ # --- the code is taken from pyserial project --- # - # detect size of ULONG_PTR + # detect size of ULONG_PTR def is_64bit(): return ctypes.sizeof(ctypes.c_ulong) != ctypes.sizeof(ctypes.c_void_p) if is_64bit(): @@ -102,7 +102,7 @@ UnlockFileEx = windll.kernel32.UnlockFileEx UnlockFileEx.restype = BOOL UnlockFileEx.argtypes = [HANDLE, DWORD, DWORD, DWORD, LPOVERLAPPED] - + elif os.name == 'posix': import fcntl LOCK_SH = fcntl.LOCK_SH # shared lock @@ -116,7 +116,8 @@ """ Return True on success, False otherwise """ hfile = msvcrt.get_osfhandle(file.fileno()) overlapped = OVERLAPPED() - if LockFileEx(hfile, flags, 0, 0, 0xFFFF0000, ctypes.byref(overlapped)): + if LockFileEx(hfile, flags, 0, 0, 0xFFFF0000, + ctypes.byref(overlapped)): return True else: return False @@ -129,7 +130,7 @@ else: return False -elif os.name =='posix': +elif os.name == 'posix': def lock(file, flags): if fcntl.flock(file.fileno(), flags) == 0: return True @@ -150,10 +151,9 @@ lock(log, LOCK_EX) timestamp = strftime("%m/%d/%Y %H:%M:%S\n", localtime(time())) - log.write( timestamp ) + log.write(timestamp) print("Wrote lines. Hit enter to release lock.") dummy = sys.stdin.readline() log.close() -
