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
Metadata
Release files for ptree 0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ptree-0.3.tar.gz | 2.8 kB | Details |
Release files / ptree-0.3.tar.gz
| Download URL | ptree-0.3.tar.gz |
|---|---|
| Size | 2.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5a2d4fd5be74f76271bd0a22d68e77d0ad6ba5299b73f598559f88b1039b88bc
|
|
BLAKE2b-256 checksum How to use checksums |
12603581de1cac5fc529ac1cf6e027428b150b6cf230cf0d0e5684a4ca0560f5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|