(
    events,
    stream=None,
    Dumper=Dumper,
    canonical=None,
    indent=None,
    width=None,
    allow_unicode=None,
    line_break=None,
)
Emit YAML parsing events into a stream.
    If stream is None, return the produced string instead.
Emit YAML parsing events into a stream.
    If stream is None, return the produced string instead.
Emit YAML parsing events into a stream . If stream is None return the produced string instead .
def emit(
    events,
    stream=None,
    Dumper=Dumper,
    canonical=None,
    indent=None,
    width=None,
    allow_unicode=None,
    line_break=None,
):
    # type: (Any, Optional[StreamType], Any, Optional[bool], Union[int, None], Optional[int], Optional[bool], Any) -> Any  # NOQA
    """
    Emit YAML parsing events into a stream.
    If stream is None, return the produced string instead.
    """
    getvalue = None
    if stream is None:
        stream = StringIO()
        getvalue = stream.getvalue
    dumper = Dumper(
        stream,
        canonical=canonical,
        indent=indent,
        width=width,
        allow_unicode=allow_unicode,
        line_break=line_break,
    )
    try:
        for event in events:
            dumper.emit(event)
    finally:
        try:
            dumper._emitter.dispose()
        except AttributeError:
            raise
            dumper.dispose()  # cyaml
    if getvalue is not None:
        return getvalue()
def emit ( events , stream = None , Dumper = Dumper , canonical = None , indent = None , width = None , allow_unicode = None , line_break = None , ) : # type: (Any, Optional[StreamType], Any, Optional[bool], Union[int, None], Optional[int], Optional[bool], Any) -> Any  # NOQA getvalue = None if stream is None : stream = StringIO ( ) getvalue = stream . getvalue dumper = Dumper ( stream , canonical = canonical , indent = indent , width = width , allow_unicode = allow_unicode , line_break = line_break , ) try : for event in events : dumper . emit ( event ) finally : try : dumper . _emitter . dispose ( ) except AttributeError : raise dumper . dispose ( ) # cyaml if getvalue is not None : return getvalue ( )