From: Diane Trout Date: Tue, 18 Sep 2012 18:31:49 +0000 (-0700) Subject: Change rdfhelp.dump_model so you can specify a destination stream. X-Git-Url: http://woldlab.caltech.edu/gitweb/?p=htsworkflow.git;a=commitdiff_plain;h=2a09dbe25dd98a2cf1a06165d0b729c16b855aec Change rdfhelp.dump_model so you can specify a destination stream. --- diff --git a/htsworkflow/util/rdfhelp.py b/htsworkflow/util/rdfhelp.py index fda8772..cb445b6 100644 --- a/htsworkflow/util/rdfhelp.py +++ b/htsworkflow/util/rdfhelp.py @@ -418,6 +418,9 @@ def get_serializer(name='turtle'): return writer -def dump_model(model): +def dump_model(model, destination=None): + if destination is None: + destination = sys.stdout serializer = get_serializer() - print serializer.serialize_model_to_string(model) + destination.write(serializer.serialize_model_to_string(model)) + destination.write(os.linesep)