import argparse import sys import ee.tools from ee.drawio import decompress parser = argparse.ArgumentParser() ee.tools.add_default_argparse_group(parser) parser.add_argument("--in", dest="in_path", metavar="DRAWIO") parser.add_argument("--out", metavar="XML") args = parser.parse_args() ee.tools.process_default_argparse_group(args) in_stream = out_stream = None try: in_stream = open(args.in_path, "rb") if args.in_path else sys.stdin out_stream = open(args.out, "w") if args.out else sys.stdout decompress(in_stream, out_stream) except IOError: if in_stream: in_stream.close() if out_stream: out_stream.close()