How to use the shyaml.LineLoader function in shyaml

To help you get started, we’ve selected a few shyaml examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github 0k / shyaml / shyaml.py View on Github external
if arg in args:
            args.remove(arg)
            opts["dump"] = yaml_dump

    opts["quiet"] = False
    for arg in ["-q", "--quiet"]:
        if arg in args:
            args.remove(arg)
            opts["quiet"] = True

    for arg in ["-L", "--line-buffer"]:
        if arg not in args:
            continue
        args.remove(arg)

        opts["loader"] = LineLoader

    if len(args) == 0:
        stderr("Error: Bad number of arguments.\n")
        die(USAGE, errlvl=1, prefix="")

    if len(args) == 1 and args[0] in ("-h", "--help"):
        stdout(HELP)
        exit(0)

    if len(args) == 1 and args[0] in ("-V", "--version"):
        version_info = get_version_info()
        print("version: %s\nPyYAML: %s\nlibyaml available: %s\nlibyaml used: %s\nPython: %s"
              % version_info)
        exit(0)

    opts["action"] = args[0]
github 0k / shyaml / shyaml.py View on Github external
def __init__(self, stream):
        stream = ForcedLineStream(stream)
        super(LineLoader, self).__init__(stream)