Iterate through files under `path` to find out all operator names, and update code links to file_func_map_list by file_func_map.
(path)
| 81 | |
| 82 | |
| 83 | def get_profile_func(path): |
| 84 | """ |
| 85 | Iterate through files under `path` to find out all operator names, |
| 86 | and update code links to file_func_map_list by file_func_map. |
| 87 | """ |
| 88 | files = os.listdir(path) |
| 89 | commit_bytes = subprocess.check_output(["git", "rev-parse", "HEAD"]) |
| 90 | commit_str = commit_bytes.decode("utf-8").replace("\n", "") |
| 91 | result_profile_func_list = [] |
| 92 | for file in files: |
| 93 | if file != "log" and not os.path.isdir(file) and file.find("__pycache__") == -1: |
| 94 | f = open(os.path.join(path, file)) |
| 95 | last_line = "" |
| 96 | iter_f = iter(f) |
| 97 | line_num = 1 |
| 98 | for line in iter_f: |
| 99 | line = line.strip() |
| 100 | match = re.fullmatch(r"^@profile\((.+)\)$", line) |
| 101 | if match: |
| 102 | tem_profile = match.group(1) |
| 103 | tem_profile_name = tem_profile.split(".")[-1] |
| 104 | result_profile_func_list.append(tem_profile_name) |
| 105 | |
| 106 | return result_profile_func_list |
| 107 | |
| 108 | |
| 109 | def get_test_func(path): |
no test coverage detected