Skip to main content

Work with PairTree file system convention

Project description

ptree

Build Status

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for ptree, version 0.3
Filename, size File type Python version Upload date Hashes
Filename, size ptree-0.3.tar.gz (2.8 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page