login page
This commit is contained in:
1
Lib/site-packages/filelock-3.0.12.dist-info/INSTALLER
Normal file
1
Lib/site-packages/filelock-3.0.12.dist-info/INSTALLER
Normal file
@@ -0,0 +1 @@
|
||||
pip
|
||||
24
Lib/site-packages/filelock-3.0.12.dist-info/LICENSE
Normal file
24
Lib/site-packages/filelock-3.0.12.dist-info/LICENSE
Normal file
@@ -0,0 +1,24 @@
|
||||
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>
|
||||
156
Lib/site-packages/filelock-3.0.12.dist-info/METADATA
Normal file
156
Lib/site-packages/filelock-3.0.12.dist-info/METADATA
Normal file
@@ -0,0 +1,156 @@
|
||||
Metadata-Version: 2.1
|
||||
Name: filelock
|
||||
Version: 3.0.12
|
||||
Summary: A platform independent file lock.
|
||||
Home-page: https://github.com/benediktschmitt/py-filelock
|
||||
Author: Benedikt Schmitt
|
||||
Author-email: benedikt@benediktschmitt.de
|
||||
License: Public Domain <http://unlicense.org>
|
||||
Download-URL: https://github.com/benediktschmitt/py-filelock/archive/master.zip
|
||||
Platform: UNKNOWN
|
||||
Classifier: License :: Public Domain
|
||||
Classifier: Development Status :: 5 - Production/Stable
|
||||
Classifier: Operating System :: OS Independent
|
||||
Classifier: Programming Language :: Python
|
||||
Classifier: Programming Language :: Python :: 2
|
||||
Classifier: Programming Language :: Python :: 2.7
|
||||
Classifier: Programming Language :: Python :: 3
|
||||
Classifier: Programming Language :: Python :: 3.4
|
||||
Classifier: Programming Language :: Python :: 3.5
|
||||
Classifier: Programming Language :: Python :: 3.6
|
||||
Classifier: Programming Language :: Python :: 3.7
|
||||
Classifier: Intended Audience :: Developers
|
||||
Classifier: Topic :: System
|
||||
Classifier: Topic :: Internet
|
||||
Classifier: Topic :: Software Development :: Libraries
|
||||
Description-Content-Type: text/markdown
|
||||
|
||||
# py-filelock
|
||||
|
||||

|
||||
|
||||
This package contains a single module, which implements a platform independent
|
||||
file lock in Python, which provides a simple way of inter-process communication:
|
||||
|
||||
```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.
|
||||
|
||||

|
||||
|
||||
|
||||
## 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:
|
||||
|
||||
```
|
||||
$ 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:
|
||||
|
||||
```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:
|
||||
|
||||
```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:
|
||||
|
||||
```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:
|
||||
|
||||
```Python
|
||||
def cite1():
|
||||
with lock:
|
||||
open(file_path, "a").write("I hate 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, please make sure they pass all tests before
|
||||
creating a pull request. Never hesitate to open a new issue, although it may
|
||||
take some time for me to respond.
|
||||
|
||||
|
||||
## License
|
||||
|
||||
This package is [public domain](./LICENSE.rst).
|
||||
|
||||
|
||||
8
Lib/site-packages/filelock-3.0.12.dist-info/RECORD
Normal file
8
Lib/site-packages/filelock-3.0.12.dist-info/RECORD
Normal file
@@ -0,0 +1,8 @@
|
||||
__pycache__/filelock.cpython-38.pyc,,
|
||||
filelock-3.0.12.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
|
||||
filelock-3.0.12.dist-info/LICENSE,sha256=iNm062BXnBkew5HKBMFhMFctfu3EqG2qWL8oxuFMm80,1210
|
||||
filelock-3.0.12.dist-info/METADATA,sha256=gjzbv9nxtD-Rj2ysjUuG7SLZCHUQl5hMy68Jij8soPw,4343
|
||||
filelock-3.0.12.dist-info/RECORD,,
|
||||
filelock-3.0.12.dist-info/WHEEL,sha256=S8S5VL-stOTSZDYxHyf0KP7eds0J72qrK0Evu3TfyAY,92
|
||||
filelock-3.0.12.dist-info/top_level.txt,sha256=NDrf9i5BNogz4hEdsr6Hi7Ws3TlSSKY4Q2Y9_-i2GwU,9
|
||||
filelock.py,sha256=5DQTtOaQq7-vgLkZzvOhqhVMh_umfydWgSA8Vuzmf8M,13229
|
||||
5
Lib/site-packages/filelock-3.0.12.dist-info/WHEEL
Normal file
5
Lib/site-packages/filelock-3.0.12.dist-info/WHEEL
Normal file
@@ -0,0 +1,5 @@
|
||||
Wheel-Version: 1.0
|
||||
Generator: bdist_wheel (0.33.4)
|
||||
Root-Is-Purelib: true
|
||||
Tag: py3-none-any
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
filelock
|
||||
Reference in New Issue
Block a user