Commit 7182bd82 by nzy

Fix print_array & Work around ChatGPT's error

parent d21b14ac
......@@ -28,7 +28,15 @@ def syn_anpl(anpl: ANPL):
if newanpl:
logger.log("system", "parse_gpt", "success")
if not hole.startswith("_hole"):
newanpl.clean(hole)
if hole in newanpl.funs:
newanpl.clean(hole)
else:
logger.log("system", "parse_gpt", "do not synthesis the specific hole")
continue
else:
if newanpl.entry in anpl.funs:
logger.log("system", "parse_gpt", "synthesis codes with a used name")
continue
anpl.fill_fun(hole, newanpl)
break
logger.log("system", "parse_gpt", "error")
......
......@@ -14,19 +14,19 @@ colors = ["#000000", "#0000FF", "#FF0000", "#008000", "#FFFF00",
"#808080", "#FFC0CB", "#FFA500", "#008080", "#800000"]
def array_to_str(matrix):
if matrix.ndim == 2:
if np.issubdtype(matrix.dtype, np.integer):
text = Text()
for row in list(matrix):
for pixel in row:
if matrix.ndim == 2:
for row in list(matrix):
for pixel in row:
text.append("⬛", style=colors[pixel])
text.append("\n")
elif matrix.ndim == 1:
for pixel in list(matrix):
text.append("⬛", style=colors[pixel])
text.append("\n")
elif matrix.ndim == 1:
text = Text()
for pixel in list(matrix):
text.append("⬛", style=colors[pixel])
return text
else:
text = Text(str(matrix))
return text
return Text(str(matrix))
def rich_dumps(obj):
def _dump_recursive(obj):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment