def dumps(xs, model=None, properties=False, indent=True, **kwargs):
    """
    Serialize Xmrs (or subclass) objects to PENMAN notation

    Args:
        xs: iterator of :class:`~delphin.mrs.xmrs.Xmrs` objects to
            serialize
        model: Xmrs subclass used to get triples
        properties: if `True`, encode variable properties
        indent: if `True`, adaptively indent; if `False` or `None`,
            don't indent; if a non-negative integer N, indent N spaces
            per level
    Returns:
        the PENMAN serialization of *xs*
    """
    xs = list(xs)

    if not xs:
        return ''

    given_class = xs[0].__class__  # assume they are all the same
    if model is None:
        model = xs[0].__class__

    if not hasattr(model, 'to_triples'):
        raise TypeError(
            '{} class does not implement to_triples()'.format(model.__name__)
        )

    # convert MRS to DMRS if necessary; EDS cannot convert
    if given_class.__name__ in ('Mrs', 'Xmrs'):
        xs = [model.from_xmrs(x, **kwargs) for x in xs]
    elif given_class.__name__ == 'Eds' and model.__name__ != 'Eds':
        raise ValueError('Cannot convert EDS to non-EDS')

    codec = XMRSCodec()
    graphs = [
        codec.triples_to_graph(model.to_triples(x, properties=properties))
        for x in xs
    ]

    if 'pretty_print' in kwargs:
        indent = kwargs['pretty_print']

    return penman.dumps(graphs, cls=XMRSCodec, indent=indent)
def dumps ( xs , model = None , properties = False , indent = True , ** kwargs ) : xs = list ( xs ) if not xs : return '' given_class = xs [ 0 ] . __class__ if model is None : model = xs [ 0 ] . __class__ if not hasattr ( model , 'to_triples' ) : raise TypeError ( '{} class does not implement to_triples()' . format ( model . __name__ ) ) if given_class . __name__ in ( 'Mrs' , 'Xmrs' ) : xs = [ model . from_xmrs ( x , ** kwargs ) for x in xs ] elif given_class . __name__ == 'Eds' and model . __name__ != 'Eds' : raise ValueError ( 'Cannot convert EDS to non-EDS' ) codec = XMRSCodec ( ) graphs = [ codec . triples_to_graph ( model . to_triples ( x , properties = properties ) ) for x in xs ] if 'pretty_print' in kwargs : indent = kwargs [ 'pretty_print' ] return penman . dumps ( graphs , cls = XMRSCodec , indent = indent )
Serialize Xmrs (or subclass) objects to PENMAN notation

    Args:
        xs: iterator of :class:`~delphin.mrs.xmrs.Xmrs` objects to
            serialize
        model: Xmrs subclass used to get triples
        properties: if `True`, encode variable properties
        indent: if `True`, adaptively indent; if `False` or `None`,
            don't indent; if a non-negative integer N, indent N spaces
            per level
    Returns:
        the PENMAN serialization of *xs*