def _export_python_sample_ast():
    # Get what to export
    if sys.version_info > (3, ):
        filenames = filename1, filename3
    else:
        filenames = filename2,
    # Write
    for filename in filenames:
        filename_bz2 = filename[:-2] + 'bz2'
        code = open(filename, 'rb').read().decode()
        root = commonast.parse(code)
        ast_bin = bz2.compress(root.tojson(indent=None).encode())
        with open(filename_bz2, 'wb') as f:
            n = f.write(ast_bin) or 'some'
        print('wrote %s bytes to %s' % (n, filename_bz2))
dataset/ETHPy150Open zoofIO/flexx/flexx/pyscript/tests/test_commonast.py/_export_python_sample_ast/original