Mercurial > repos > guerler > springsuite
comparison planemo/lib/python3.7/site-packages/prov/serializers/provn.py @ 1:56ad4e20f292 draft
"planemo upload commit 6eee67778febed82ddd413c3ca40b3183a3898f1"
| author | guerler | 
|---|---|
| date | Fri, 31 Jul 2020 00:32:28 -0400 | 
| parents | |
| children | 
   comparison
  equal
  deleted
  inserted
  replaced
| 0:d30785e31577 | 1:56ad4e20f292 | 
|---|---|
| 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 | 
