Mercurial > repos > shellac > guppy_basecaller
comparison env/lib/python3.7/site-packages/prov/serializers/provn.py @ 5:9b1c78e6ba9c draft default tip
"planemo upload commit 6c0a8142489327ece472c84e558c47da711a9142"
| author | shellac |
|---|---|
| date | Mon, 01 Jun 2020 08:59:25 -0400 |
| parents | 79f47841a781 |
| children |
comparison
equal
deleted
inserted
replaced
| 4:79f47841a781 | 5:9b1c78e6ba9c |
|---|---|
| 1 from __future__ import (absolute_import, division, print_function, | |
| 2 unicode_literals) | |
| 3 | |
| 4 __author__ = 'Trung Dong Huynh' | |
| 5 __email__ = 'trungdong@donggiang.com' | |
| 6 | |
| 7 import io | |
| 8 import logging | |
| 9 logger = logging.getLogger(__name__) | |
| 10 | |
| 11 from prov.serializers import Serializer | |
| 12 | |
| 13 | |
| 14 class ProvNSerializer(Serializer): | |
| 15 """PROV-N serializer for ProvDocument | |
| 16 | |
| 17 """ | |
| 18 def serialize(self, stream, **kwargs): | |
| 19 """ | |
| 20 Serializes a :class:`prov.model.ProvDocument` instance to a | |
| 21 `PROV-N <http://www.w3.org/TR/prov-n/>`_. | |
| 22 | |
| 23 :param stream: Where to save the output. | |
| 24 """ | |
| 25 provn_content = self.document.get_provn() | |
| 26 if isinstance(stream, io.BytesIO): | |
| 27 provn_content = provn_content.encode('utf-8') | |
| 28 stream.write(provn_content) | |
| 29 | |
| 30 def deserialize(self, stream, **kwargs): | |
| 31 raise NotImplementedError |
