def parse(stream, Loader=Loader): """ Parse a YAML stream and produce parsing events. """ loader = Loader(stream) try: while loader.check_event(): yield loader.get_event() finally: loader.dispose()
def compose(stream, Loader=Loader): """ Parse the first YAML document in a stream and produce the corresponding representation tree. """ loader = Loader(stream) try: return loader.get_single_node() finally: loader.dispose()
def scan(stream, Loader=Loader): """ Scan a YAML stream and produce scanning tokens. """ loader = Loader(stream) try: while loader.check_token(): yield loader.get_token() finally: loader.dispose()
def load_all(stream, Loader=Loader, version=None, preserve_quotes=None): """ Parse all YAML documents in a stream and produce corresponding Python objects. """ loader = Loader(stream, version, preserve_quotes=preserve_quotes) try: while loader.check_data(): yield loader.get_data() finally: loader.dispose()
def load(stream, Loader=Loader, version=None, preserve_quotes=None): # type: (StreamType, Any, VersionType, Any) -> Any """ Parse the first YAML document in a stream and produce the corresponding Python object. """ loader = Loader(stream, version, preserve_quotes=preserve_quotes) try: return loader.get_single_data() finally: loader.dispose()
def compose_all(stream, Loader=Loader): """ Parse all YAML documents in a stream and produce corresponding representation trees. """ loader = Loader(stream) try: while loader.check_node(): yield loader.get_node() finally: loader.dispose()
def load_all(stream, Loader=Loader, version=None): """ Parse all YAML documents in a stream and produce corresponding Python objects. """ loader = Loader(stream, version) try: while loader.check_data(): yield loader.get_data() finally: loader.dispose()
def load_all(stream, Loader=None, version=None, preserve_quotes=None): """ Parse all YAML documents in a stream and produce corresponding Python objects. """ if Loader is None: from ruamel.yaml.loader import Loader as UnsafeLoader import warnings warnings.warn(UnsafeLoaderWarning.text, UnsafeLoaderWarning, stacklevel=2) Loader = UnsafeLoader loader = Loader(stream, version, preserve_quotes=preserve_quotes) try: while loader.check_data(): yield loader.get_data() finally: loader.dispose()
def load(stream, Loader=None, version=None, preserve_quotes=None): # type: (StreamType, Any, VersionType, Any) -> Any """ Parse the first YAML document in a stream and produce the corresponding Python object. """ if Loader is None: from ruamel.yaml.loader import Loader as UnsafeLoader import warnings warnings.warn(UnsafeLoaderWarning.text, UnsafeLoaderWarning, stacklevel=2) Loader = UnsafeLoader loader = Loader(stream, version, preserve_quotes=preserve_quotes) try: return loader.get_single_data() finally: loader.dispose()