跳转到主要内容

PRISMH文件解析和验证库

项目描述

Build Status Documentation Status https://img.shields.io/pypi/v/prismh.core.svg https://img.shields.io/pypi/l/prismh.core.svg

PRISMH.CORE概述

PRISMH.CORE是一个Python软件包,为遵循PRISMH规范的数据库结构提供基本的验证和格式化功能。

示例用法

本包公开了一组简单的函数,用于验证和格式化标准PRISMH数据结构。

>>> from prismh.core import validate_instrument, get_instrument_json

>>> instrument = {"foo": "bar", "id": "urn:my-instrument", "title": "An Instrument Title", "record": [{"id": "field1","type": "text"}], "version": "1.0"}
>>> validate_instrument(instrument)
Traceback (most recent call last):
    ...
colander.Invalid: {'': u'Unrecognized keys in mapping: "{\'foo\': \'bar\'}"'}

>>> del instrument['foo']
>>> validate_instrument(instrument)

>>> print get_instrument_json(instrument)
{
  "id": "urn:my-instrument",
  "version": "1.0",
  "title": "An Instrument Title",
  "record": [
    {
      "id": "field1",
      "type": "text"
    }
  ]
}

有关可用功能的更多信息,请阅读API文档。

贡献

欢迎对这款包进行贡献和/或修复。请通过分叉此存储库并创建一个包含您的更改的拉取请求来提交它们。我们要求您在代码更改的同时,请包括单元测试和任何适当的文档更新。

尽可能遵循语义化版本控制方法,因此在构建依赖项目时,请使用适当的版本限制。

可以通过以下步骤设置开发环境来对这款包进行工作:

$ virtualenv prismh
$ cd prismh
$ . bin/activate
$ hg clone ssh://hg@bitbucket.org/prometheus/prismh.core
$ pip install -e ./prismh.core[dev]

项目详情


下载文件

下载您平台上的文件。如果您不确定选择哪个,请了解更多关于安装包的信息。

源分布

prismh.core-0.4.0.tar.gz (32.9 kB 查看哈希值)

上传时间

构建分布

prismh.core-0.4.0-py2.py3-none-any.whl (30.0 kB 查看哈希值)

上传时间 Python 2 Python 3

支持者

AWSAWS云计算和安全赞助商DatadogDatadog监控FastlyFastlyCDNGoogleGoogle下载分析MicrosoftMicrosoftPSF赞助商PingdomPingdom监控SentrySentry错误记录StatusPageStatusPage状态页面