/usr/lib/python2.7/dist-packages/filelock-3.0.4.egg-info is in python-filelock 3.0.4-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 | Metadata-Version: 1.1
Name: filelock
Version: 3.0.4
Summary: A platform independent file lock.
Home-page: https://github.com/benediktschmitt/py-filelock
Author: Benedikt Schmitt
Author-email: benedikt@benediktschmitt.de
License: License
=======
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to <http://unlicense.org>
Download-URL: https://github.com/benediktschmitt/py-filelock/archive/master.zip
Description: py-filelock
===========
`Similar Libraries <#similar-libraries>`_
~ `Installation <#installation>`_
~ `Documentation <#documentation>`_
~ `Contributions <#contributions>`_
~ `License <#license>`_
This package contains a single module, which implements a platform independent
file lock in Python, which provides a simple way of inter-process communication:
.. code-block:: python
from filelock import Timeout, FileLock
lock = FileLock("high_ground.txt.lock")
with lock:
open("high_ground.txt", "a").write("You were the chosen one.")
**Don't use** a *FileLock* to lock the file you want to write to, instead create a separate
*.lock* file as shown above.
.. image:: https://raw.githubusercontent.com/benediktschmitt/py-filelock/master/example/example.gif
`Animated example <https://github.com/benediktschmitt/py-filelock/blob/master/example/example.gif>`_
Similar libraries
-----------------
Perhaps you are looking for something like
* https://pypi.python.org/pypi/pid/2.1.1
* https://docs.python.org/3.6/library/msvcrt.html#msvcrt.locking
* or https://docs.python.org/3/library/fcntl.html#fcntl.flock
Installation
------------
*py-filelock* is available via PyPi:
.. code-block:: bash
$ pip3 install filelock
Documentation
-------------
The documentation for the API is available on
`readthedocs.org <https://filelock.readthedocs.io/>`_.
Examples
^^^^^^^^
A *FileLock* is used to indicate another process of your application that a resource or working
directory is currently used. To do so, create a *FileLock* first:
.. code-block:: python
from filelock import Timeout, FileLock
file_path = "high_ground.txt"
lock_path = "high_ground.txt.lock"
lock = FileLock(lock_path, timeout=1)
The lock object supports multiple ways for acquiring the lock, including the ones used to acquire
standard Python thread locks:
.. code-block:: python
with lock:
open(file_path, "a").write("Hello there!")
lock.acquire()
try:
open(file_path, "a").write("General Kenobi!")
finally:
lock.release()
The *acquire()* method accepts also a *timeout* parameter. If the lock cannot be acquired
within *timeout* seconds, a *Timeout* exception is raised.:
.. code-block:: python
try:
with lock.acquire(timeout=10):
open(file_path, "a").write("I have a bad feeling about this.")
except Timeout:
print("Another instance of this application currently holds the lock.")
The lock objects are recursive locks, which means that once acquired, they will not block on
successive lock requests:
.. code-block:: python
def cite1():
with lock:
open(file_path, "a").write("I hat it when he does that.")
def cite2():
with lock:
open(file_path, "a").write("You don't want to sell me death sticks.")
# The lock is acquired here.
with lock:
cite1()
cite2()
# And released here.
FileLock vs SoftFileLock
^^^^^^^^^^^^^^^^^^^^^^^^
The *FileLock* is platform dependent while the *SoftFileLock* is not. Use the *FileLock* if all
instances of your application are running on the same host and a *SoftFileLock* otherwise.
The *SoftFileLock* only watches the existence of the lock file. This makes it ultra portable, but
also more prone to dead locks if the application crashes. You can simply delete the lock file in
such cases.
Contributions
-------------
Contributions are always welcome. Never hesitate to open a new issue.
License
-------
This package is `public domain <LICENSE.rst>`_.
Platform: UNKNOWN
Classifier: License :: Public Domain
Classifier: Development Status :: 5 - Production/Stable
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Intended Audience :: Developers
Classifier: Topic :: System
Classifier: Topic :: Internet
Classifier: Topic :: Software Development :: Libraries
|