def explain_code():
code = request.form.get("code", "")
error = ""
try:
hexified = (codecs.encode(bytes([byte]), "hex_codec") for byte in explainer.optimise(bytearray(code, "utf-8")))
except:
error = "Error whilst optimising hex"
hexified = (codecs.encode(bytes([byte]), "hex_codec") for byte in bytearray(code, "utf-8"))
hex_code = b" ".join(hexified).decode("ascii").upper()
try:
return "\n{}\n{}\n{}".format(explainer.Explainer(bytearray(code, "utf-8"), []), error, hex_code).replace("\n", "\n ")
except:
return "\n Error formatting explanation\n {}\n {}".format(error, hex_code)
评论列表
文章目录