comparison env/lib/python3.7/site-packages/prov/serializers/provn.py @ 0:26e78fe6e8c4 draft

"planemo upload commit c699937486c35866861690329de38ec1a5d9f783"
author shellac
date Sat, 02 May 2020 07:14:21 -0400
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:26e78fe6e8c4
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