项目作者: untzag

项目描述 :
easy headers, inspired by the tidy data specification
高级语言: Python
项目地址: git://github.com/untzag/tidy_headers.git
创建时间: 2017-11-10T01:37:34Z
项目社区:https://github.com/untzag/tidy_headers

开源协议:MIT License

下载


tidy_headers

tidy_headers stores metadata in beautifully readable plain text headers.

example

For some filepath,

  1. import collections
  2. import tidy_headers
  3. meta = collections.OrderedDict()
  4. meta['date'] = '2017-11-10'
  5. meta['location'] = 'Madison, Wisconsin, USA'
  6. meta['name'] = ['batch', 'apples', 'pineapple', 'oregano', 'tomatoes']
  7. tidy_headers.write(filepath, meta)

To get the dictionary back, simply read:

  1. meta = tidy_headers.read(filepath)

:tada:

See the examples directory for more:

installation

using pip

  1. pip install tidy_headers

using conda

  1. conda config --add channels conda-forge
  2. conda install tidy_headers

allowed values

tidy_headers strives to write plain text headers in an unambiguous way such that an identical metadata dictionary can be generated using read. This process is only reliable for the following subset of python types:

  • str
  • int
  • float
  • list containing any combination of the above
  • numpy.ndarray (arbitrary size and dimensionality)

Metadata dictionaries containing only these types are guaranteed to read and write succesfully.