Skip to content

Commit

Permalink
handle strings vs bytes from rdflib
Browse files Browse the repository at this point in the history
  • Loading branch information
saggu committed Jan 29, 2021
1 parent 68355e2 commit 3f68979
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion etk/knowledge_graph/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ def serialize(self, format='ttl', namespace_manager=None, **kwargs):
b_string = self._g.serialize(format=format, contexts=namespace_manager, **kwargs)
else:
b_string = self._g.serialize(format=format, **kwargs)
return b_string.decode('UTF-8')
if isinstance(b_string, bytes):
b_string.decode('UTF-8')
return b_string

@lru_cache()
def _resolve_uri(self, uri: URI) -> rdflib.URIRef:
Expand Down

0 comments on commit 3f68979

Please sign in to comment.