1PY-FILELOCK(1)                    py-filelock                   PY-FILELOCK(1)
2
3
4

NAME

6       py-filelock - py-filelock Documentation
7
8       A platform independent file lock that supports the with-statement.
9
10       exception filelock.Timeout(lock_file)
11              Bases: TimeoutError
12
13              Raised when the lock could not be acquired in timeout seconds.
14
15              lock_file = None
16                     The path of the file lock.
17
18       class filelock.BaseFileLock(lock_file, timeout=-1)
19              Bases: object
20
21              Implements the base class of a file lock.
22
23              acquire(timeout=None, poll_intervall=0.05)
24                     Acquires the file lock or fails with a Timeout error.
25
26                        # You can use this method in the context manager (recommended)
27                        with lock.acquire():
28                            pass
29
30                        # Or use an equivalent try-finally construct:
31                        lock.acquire()
32                        try:
33                            pass
34                        finally:
35                            lock.release()
36
37                     Parameters
38
39                            · timeout  (float)  -- The maximum time waited for
40                              the file lock.  If timeout  <  0,  there  is  no
41                              timeout  and  this  method  will block until the
42                              lock could be acquired.  If timeout is None, the
43                              default timeout is used.
44
45                            · poll_intervall  (float)  --  We  check  once  in
46                              poll_intervall seconds if  we  can  acquire  the
47                              file lock.
48
49                     Raises Timeout  --  if  the lock could not be acquired in
50                            timeout seconds.
51
52                     Changed in version 2.0.0: This method returns now a proxy
53                     object  instead of self, so that it can be used in a with
54                     statement without side effects.
55
56
57              property is_locked
58                     True, if the object holds the file lock.
59
60                     Changed in version 2.0.0: This was  previously  a  method
61                     and is now a property.
62
63
64              property lock_file
65                     The path to the lock file.
66
67              release(force=False)
68                     Releases the file lock.
69
70                     Please note, that the lock is only completly released, if
71                     the lock counter is 0.
72
73                     Also note, that the lock file itself is not automatically
74                     deleted.
75
76                     Parameters
77                            force  (bool)  --  If  true,  the  lock counter is
78                            ignored and the lock is released in every case.
79
80              property timeout
81                     You can set a default timeout for the filelock.  It  will
82                     be  used  as  fallback value in the acquire method, if no
83                     timeout value (None) is given.
84
85                     If you want to disable the timeout, set it to a  negative
86                     value.
87
88                     A  timeout  of 0 means, that there is exactly one attempt
89                     to acquire the file lock.
90
91                     New in version 2.0.0.
92
93
94       class filelock.WindowsFileLock(lock_file, timeout=-1)
95              Bases: filelock.BaseFileLock
96
97              Uses the msvcrt.locking() function to hard lock the lock file on
98              windows systems.
99
100       class filelock.UnixFileLock(lock_file, timeout=-1)
101              Bases: filelock.BaseFileLock
102
103              Uses  the  fcntl.flock() to hard lock the lock file on unix sys‐
104              tems.
105
106       class filelock.SoftFileLock(lock_file, timeout=-1)
107              Bases: filelock.BaseFileLock
108
109              Simply watches the existence of the lock file.
110
111       filelock.FileLock
112              Alias for the lock, which should be used for the  current  plat‐
113              form.  On Windows, this is an alias for WindowsFileLock, on Unix
114              for UnixFileLock and otherwise for SoftFileLock.
115
116              alias of filelock.UnixFileLock
117

LICENSE

119       py-filelock is public domain:
120
121          This is free and unencumbered software released into the public domain.
122
123          Anyone is free to copy, modify, publish, use, compile, sell, or
124          distribute this software, either in source code form or as a compiled
125          binary, for any purpose, commercial or non-commercial, and by any
126          means.
127
128          In jurisdictions that recognize copyright laws, the author or authors
129          of this software dedicate any and all copyright interest in the
130          software to the public domain. We make this dedication for the benefit
131          of the public at large and to the detriment of our heirs and
132          successors. We intend this dedication to be an overt act of
133          relinquishment in perpetuity of all present and future rights to this
134          software under copyright law.
135
136          THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
137          EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
138          MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
139          IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
140          OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
141          ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
142          OTHER DEALINGS IN THE SOFTWARE.
143
144          For more information, please refer to <http://unlicense.org>
145

GITHUB

147       This module is hosted on GitHub. If you have any questions  or  sugges‐
148       tions, don't hesitate to open a new issue :).
149

AUTHOR

151       Benedikt Schmitt
152
154       2019, Benedikt Schmitt
155
156
157
158
1593.0.12                           Jul 26, 2019                   PY-FILELOCK(1)
Impressum