Mercurial > repos > shellac > guppy_basecaller
comparison env/lib/python3.7/site-packages/filelock-3.0.12.dist-info/METADATA @ 0:26e78fe6e8c4 draft
"planemo upload commit c699937486c35866861690329de38ec1a5d9f783"
author | shellac |
---|---|
date | Sat, 02 May 2020 07:14:21 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:26e78fe6e8c4 |
---|---|
1 Metadata-Version: 2.1 | |
2 Name: filelock | |
3 Version: 3.0.12 | |
4 Summary: A platform independent file lock. | |
5 Home-page: https://github.com/benediktschmitt/py-filelock | |
6 Author: Benedikt Schmitt | |
7 Author-email: benedikt@benediktschmitt.de | |
8 License: Public Domain <http://unlicense.org> | |
9 Download-URL: https://github.com/benediktschmitt/py-filelock/archive/master.zip | |
10 Platform: UNKNOWN | |
11 Classifier: License :: Public Domain | |
12 Classifier: Development Status :: 5 - Production/Stable | |
13 Classifier: Operating System :: OS Independent | |
14 Classifier: Programming Language :: Python | |
15 Classifier: Programming Language :: Python :: 2 | |
16 Classifier: Programming Language :: Python :: 2.7 | |
17 Classifier: Programming Language :: Python :: 3 | |
18 Classifier: Programming Language :: Python :: 3.4 | |
19 Classifier: Programming Language :: Python :: 3.5 | |
20 Classifier: Programming Language :: Python :: 3.6 | |
21 Classifier: Programming Language :: Python :: 3.7 | |
22 Classifier: Intended Audience :: Developers | |
23 Classifier: Topic :: System | |
24 Classifier: Topic :: Internet | |
25 Classifier: Topic :: Software Development :: Libraries | |
26 Description-Content-Type: text/markdown | |
27 | |
28 # py-filelock | |
29 | |
30 ![travis-ci](https://travis-ci.org/benediktschmitt/py-filelock.svg?branch=master) | |
31 | |
32 This package contains a single module, which implements a platform independent | |
33 file lock in Python, which provides a simple way of inter-process communication: | |
34 | |
35 ```Python | |
36 from filelock import Timeout, FileLock | |
37 | |
38 lock = FileLock("high_ground.txt.lock") | |
39 with lock: | |
40 open("high_ground.txt", "a").write("You were the chosen one.") | |
41 ``` | |
42 | |
43 **Don't use** a *FileLock* to lock the file you want to write to, instead create | |
44 a separate *.lock* file as shown above. | |
45 | |
46 ![animated example](https://raw.githubusercontent.com/benediktschmitt/py-filelock/master/example/example.gif) | |
47 | |
48 | |
49 ## Similar libraries | |
50 | |
51 Perhaps you are looking for something like | |
52 | |
53 * https://pypi.python.org/pypi/pid/2.1.1 | |
54 * https://docs.python.org/3.6/library/msvcrt.html#msvcrt.locking | |
55 * or https://docs.python.org/3/library/fcntl.html#fcntl.flock | |
56 | |
57 | |
58 ## Installation | |
59 | |
60 *py-filelock* is available via PyPi: | |
61 | |
62 ``` | |
63 $ pip3 install filelock | |
64 ``` | |
65 | |
66 | |
67 ## Documentation | |
68 | |
69 The documentation for the API is available on | |
70 [readthedocs.org](https://filelock.readthedocs.io/). | |
71 | |
72 | |
73 ### Examples | |
74 | |
75 A *FileLock* is used to indicate another process of your application that a | |
76 resource or working | |
77 directory is currently used. To do so, create a *FileLock* first: | |
78 | |
79 ```Python | |
80 from filelock import Timeout, FileLock | |
81 | |
82 file_path = "high_ground.txt" | |
83 lock_path = "high_ground.txt.lock" | |
84 | |
85 lock = FileLock(lock_path, timeout=1) | |
86 ``` | |
87 | |
88 The lock object supports multiple ways for acquiring the lock, including the | |
89 ones used to acquire standard Python thread locks: | |
90 | |
91 ```Python | |
92 with lock: | |
93 open(file_path, "a").write("Hello there!") | |
94 | |
95 lock.acquire() | |
96 try: | |
97 open(file_path, "a").write("General Kenobi!") | |
98 finally: | |
99 lock.release() | |
100 ``` | |
101 | |
102 The *acquire()* method accepts also a *timeout* parameter. If the lock cannot be | |
103 acquired within *timeout* seconds, a *Timeout* exception is raised: | |
104 | |
105 ```Python | |
106 try: | |
107 with lock.acquire(timeout=10): | |
108 open(file_path, "a").write("I have a bad feeling about this.") | |
109 except Timeout: | |
110 print("Another instance of this application currently holds the lock.") | |
111 ``` | |
112 | |
113 The lock objects are recursive locks, which means that once acquired, they will | |
114 not block on successive lock requests: | |
115 | |
116 ```Python | |
117 def cite1(): | |
118 with lock: | |
119 open(file_path, "a").write("I hate it when he does that.") | |
120 | |
121 def cite2(): | |
122 with lock: | |
123 open(file_path, "a").write("You don't want to sell me death sticks.") | |
124 | |
125 # The lock is acquired here. | |
126 with lock: | |
127 cite1() | |
128 cite2() | |
129 | |
130 # And released here. | |
131 ``` | |
132 | |
133 | |
134 ## FileLock vs SoftFileLock | |
135 | |
136 The *FileLock* is platform dependent while the *SoftFileLock* is not. Use the | |
137 *FileLock* if all instances of your application are running on the same host and | |
138 a *SoftFileLock* otherwise. | |
139 | |
140 The *SoftFileLock* only watches the existence of the lock file. This makes it | |
141 ultra portable, but also more prone to dead locks if the application crashes. | |
142 You can simply delete the lock file in such cases. | |
143 | |
144 | |
145 ## Contributions | |
146 | |
147 Contributions are always welcome, please make sure they pass all tests before | |
148 creating a pull request. Never hesitate to open a new issue, although it may | |
149 take some time for me to respond. | |
150 | |
151 | |
152 ## License | |
153 | |
154 This package is [public domain](./LICENSE.rst). | |
155 | |
156 |