Facilities for shared access to files.
Function lockfile(path, ext=None, poll_interval=None, timeout=None)
A context manager which takes and holds a lock file.
Parameters:
path: the base associated with the lock file.ext: the extension to the base used to construct the lock file name. Default:".lock"timeout: maximum time to wait before failing, default None (wait forever).poll_interval: polling frequency when timeout is not 0.
Class SharedAppendFile
A base class to share a modifiable file between multiple users.
The use case was driven from the shared CSV files used by
cs.nodedb.csvdb.Backend_CSVFile, where multiple users can
read from a common CSV file, and coordinate updates with a
lock file.
This presents the following interfaces:
-
__iter__: yields data chunks from the underlying file up to EOF; it blocks no more than reading from the file does. Note that multiple iterators share the same read pointer. -
open: a context manager returning a writable file for writing updates to the file; it blocks reads from this instance (though not, of course, by other users of the file) and arranges that users of__iter__do not receive their own written data, thus arranging that__iter__returns only foreign file updates.
Subclasses would normally override __iter__ to parse the
received data into their natural records.
Class SharedAppendLines
MRO: SharedAppendFile
A line oriented subclass of SharedAppendFile.
Class SharedCSVFile
MRO: SharedAppendLines, SharedAppendFile
Shared access to a CSV file in UTF-8 encoding.
Metadata
Release files for cs.sharedfile 20190102
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cs.sharedfile-20190102.tar.gz | 5.5 kB | Without provenance | Details for cs.sharedfile-20190102.tar.gz |
Security for cs.sharedfile 20190102
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.