Easily pack and unpack metadata in a filename.
Project description
keyname
Easily pack and unpack metadata in a filename.
Free software: MIT license
Documentation: https://keyname.readthedocs.io.
Usage
Keyname is built around the following file name convention:
key/value pairs are constructed with
=
between the key and valuekey/value pairs are joined by
+
key/value pairs are ordered alphanumerically by key
keys beginning with
_
are ordered after keys not beginning with_
the
ext
(extension) key is always placed lastthe key
_
is reserved for the original filename
For example, key1=val1+key2=val2+_key3=val3+ext=.txt
.
from keyname import keyname as kn
# returns 'key1=val1+key2=val2+_key3=val3+ext=.txt'
kn.pack({
'key2' : 'val2',
'ext' : '.txt',
'key1' : 'val1',
'_key3' : 'val3',
})
# returns {'key' : 'val', 'ext' : '.txt', '_' : 'path/to/key=val+ext=.txt'}
kf.unpack('path/to/key=val+ext=.txt')
Credits
This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.
History
0.0.0 (2019-03-16)
First release on PyPI.
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
Built Distribution
Hashes for keyname-0.1.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f3d1ab6252189931ef28088590ee44636d8a09a9873e3265c7af8a55c314d01b |
|
MD5 | 6d3729c0177af2d8ff1c80b37aaecef5 |
|
BLAKE2b-256 | d0b02a5d22c6cfef244551874d3256551f24d8edbb167b594e1a6fb2f0d69f16 |