Exemple #1
0
 def parsestring(self, s):
     """Parse s as an N-Triples string."""
     if not isinstance(s, basestring):
         raise ParseError("Item to parse must be a string instance.")
     try:
         from io import BytesIO
     except ImportError:
         from cStringIO import StringIO as BytesIO
     f = BytesIO()
     f.write(cast_bytes(s))
     f.seek(0)
     self.parse(f)
Exemple #2
0
 def parsestring(self, s):
     """Parse s as an N-Triples string."""
     if not isinstance(s, basestring):
         raise ParseError("Item to parse must be a string instance.")
     try:
         from io import BytesIO
     except ImportError:
         from cStringIO import StringIO as BytesIO
     f = BytesIO()
     f.write(cast_bytes(s))
     f.seek(0)
     self.parse(f)