semvec/pypi-packages huggingface dataset:
ilabs.brs 1.0.1
Innodata BRS schema and utilities
License: MIT
Keywords: inline tagging xml schema

# Innodata BRS schema and related utils

BRS schema (Block-Record-Span) is used to mark inline entities in text and XML documents.

Namespace is:
```
http://innodatalabs.com/brs
```

## BRS parser (validates XML agains BRS schema)

```python
from ilabs.brs import parse_brs

xml_text = b'''\
<i:b xmlns:i="http://innodatalabs.com/brs">
<i:r>Hello, <i:s l="name">Mike</i:s></i:r>
</i:b>
'''

xml = parse_brs(xml_text)  # this will throw if input is not a valid BRS
...
```

## Developing

```
pip install -r requirements.txt wheel pytest
PYTHONPATH=. pytest .

python setup.py bdist_wheel
```
schematizer 0.9.4
A lightweight library for data marshalling/unmarshalling in Python
License: MIT
Requires Python: >=3.6

Schematizer
===========

Schematizer is a lightweight library for data marshalling/unmarshalling in Python.

It helps you:

- **Validate** input and output data
- **Marshal** primitive data into a form you would like to interact with
- **Unmarshal** native data so that it can be rendered to JSON, YAML, MsgPack, etc.

Examples
--------

Simple.

.. code:: python

    >>> from schematizer.exceptions import BaseValidationError
    >>> from schematizer.schemas.compound import Dict, List
    >>> from schematizer.schemas.simple import Date, Str
    >>> from schematizer.validators import Length
    >>>
    >>> album_schema = Dict({
    ...    'title': Str(),
    ...    'released_at': Date(),
    ... })
    >>>
    >>> artist_schema = Dict({
    ...     'name': Str(),
    ...     'albums': List(album_schema),
    ... })
    >>>
    >>> artist_schema.to_native({
    ...     'name': 'Burzum',
    ...     'albums': [
    ...         {
    ...             'title': 'Filosofem',
    ...             'released_at': '1996-01-01',
    ...         },
    ...     ],
    ... })
    {'name': 'Burzum', 'albums': [{'title': 'Filosofem', 'released_at': datetime.date(1996, 1, 1)}]}

With invalid data.

.. code:: python

    >>> try:
    ...     artist_schema.to_native({
    ...         'albums': [
    ...             {'released_at': '19960101'},
    ...         ],
    ...     })
    ... except BaseValidationError as exc:
    ...     exc.flatten()
    ...
    [
        SimpleValidationError('MISSING', path=['name'], extra=None),
        SimpleValidationError('MISSING', path=['albums', 0, 'title'], extra=None),
        SimpleValidationError('INVALID', path=['albums', 0, 'released_at'], extra={'message': "time data '19960101' does not match format '%Y-%m-%d'"}),
    ]

Installation
------------

::

    $ pip install schematizer

Documentation
-------------

Coming soon...