(self, documents, stream, _kw=enforce, transform=None)
return None
Serialize a sequence of Python objects into a YAML stream.
Serialize a sequence of Python objects into a YAML stream.
Serialize a sequence of Python objects into a YAML stream .
def Xdump_all(self, documents, stream, _kw=enforce, transform=None):
        # type: (Any, Union[Path, StreamType], Any, Any) -> Any
        """
        Serialize a sequence of Python objects into a YAML stream.
        """
        if not hasattr(stream, "write") and hasattr(stream, "open"):
            # pathlib.Path() instance
            with stream.open("w") as fp:
                return self.dump_all(documents, fp, _kw, transform=transform)
        if _kw is not enforce:
            raise TypeError(
                "{}.dump(_all) takes two positional argument but at least "
                "three were given ({!r})".format(self.__class__.__name__, _kw)
            )
        # The stream should have the methods `write` and possibly `flush`.
        if self.top_level_colon_align is True:
            tlca = max([len(str(x)) for x in documents[0]])  # type: Any
        else:
            tlca = self.top_level_colon_align
        if transform is not None:
            fstream = stream
            if self.encoding is None:
                stream = StringIO()
            else:
                stream = BytesIO()
        serializer, representer, emitter = self.get_serializer_representer_emitter(
            stream, tlca
        )
        try:
            self.serializer.open()
            for data in documents:
                try:
                    self.representer.represent(data)
                except AttributeError:
                    # nprint(dir(dumper._representer))
                    raise
            self.serializer.close()
        finally:
            try:
                self.emitter.dispose()
            except AttributeError:
                raise
                # self.dumper.dispose()  # cyaml
            delattr(self, "_serializer")
            delattr(self, "_emitter")
        if transform:
            val = stream.getvalue()
            if self.encoding:
                val = val.decode(self.encoding)
            if fstream is None:
                transform(val)
            else:
                fstream.write(transform(val))
        return None
def Xdump_all ( self , documents , stream , _kw = enforce , transform = None ) : # type: (Any, Union[Path, StreamType], Any, Any) -> Any if not hasattr ( stream , "write" ) and hasattr ( stream , "open" ) : # pathlib.Path() instance with stream . open ( "w" ) as fp : return self . dump_all ( documents , fp , _kw , transform = transform ) if _kw is not enforce : raise TypeError ( "{}.dump(_all) takes two positional argument but at least " "three were given ({!r})" . format ( self . __class__ . __name__ , _kw ) ) # The stream should have the methods `write` and possibly `flush`. if self . top_level_colon_align is True : tlca = max ( [ len ( str ( x ) ) for x in documents [ 0 ] ] ) # type: Any else : tlca = self . top_level_colon_align if transform is not None : fstream = stream if self . encoding is None : stream = StringIO ( ) else : stream = BytesIO ( ) serializer , representer , emitter = self . get_serializer_representer_emitter ( stream , tlca ) try : self . serializer . open ( ) for data in documents : try : self . representer . represent ( data ) except AttributeError : # nprint(dir(dumper._representer)) raise self . serializer . close ( ) finally : try : self . emitter . dispose ( ) except AttributeError : raise # self.dumper.dispose()  # cyaml delattr ( self , "_serializer" ) delattr ( self , "_emitter" ) if transform : val = stream . getvalue ( ) if self . encoding : val = val . decode ( self . encoding ) if fstream is None : transform ( val ) else : fstream . write ( transform ( val ) ) return None