代码拉取完成,页面将自动刷新
""" This script is needed to convert gdb scripts from commands to documentation
"""
import os
def convert_commands_to_docs():
commands_dir = os.getcwd() + "/numba_dpex/examples/debug/commands"
examples = os.listdir(commands_dir)
os.chdir(commands_dir + "/docs")
for file in examples:
if file != "docs":
with open(commands_dir + "/" + file, "r") as open_file:
read_lines = open_file.readlines()
if os.path.exists(file):
os.remove(file)
with open(file, "a") as write_file:
for line in read_lines:
if (
line.startswith("# Expected")
or line.startswith("echo Done")
or line.startswith("quit")
or line.startswith("set trace-commands")
or line.startswith("set pagination")
):
continue
if line.startswith("# Run: "):
line = line.replace("# Run:", "$")
words = line.split()
for i in range(len(words)):
if words[i] == "-command" or words[
i
].startswith("commands"):
words[i] = ""
line = " ".join(words)
line = " ".join(line.split()) + "\n"
elif line.startswith("# "):
line = line.replace("# ", "")
else:
line = "(gdb) " + line
write_file.write(line)
if __name__ == "__main__":
convert_commands_to_docs()
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。