Work with PairTree file system convention
Project description
ptree
PairTree is a technique from the digital preservation community for safely mapping identifiers to file paths, and back again. It can be helpful when writing resources to disk so that they can be identified later on by merely looking at the file system layout.
The ptree module has two functions to help you work with PairTree identifiers
and file paths: id2ptree
and ptree2id
.
>>> import ptree
>>> ptree.id2ptree("info:lccn/12345678")
'/in/fo/+l/cc/n=/12/34/56/78/'
>>> ptree.ptree2id('/in/fo/+l/cc/n=/12/34/56/78/')
u'info:lccn/12345678'
Thanks
ptree draws from Ben O'Steen's PairTree Python module, which provides a lot more functionality for storing bitstreams on disk. For better or worse ptree focuses solely on the identifier/path mapping, and leaves IO operations up to you. The unit tests were shamelessly stolen from John Kunze's File::PairTree.
License
- CC0
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file ptree-0.3.tar.gz
.
File metadata
- Download URL: ptree-0.3.tar.gz
- Upload date:
- Size: 2.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5a2d4fd5be74f76271bd0a22d68e77d0ad6ba5299b73f598559f88b1039b88bc |
|
MD5 | b6705d03da7fd4c080fa67e9857f30eb |
|
BLAKE2b-256 | 12603581de1cac5fc529ac1cf6e027428b150b6cf230cf0d0e5684a4ca0560f5 |