(file_path, old_string, new_string, is_regex=False)
| 150 | |
| 151 | |
| 152 | def replace_in_file(file_path, old_string, new_string, is_regex=False): |
| 153 | with open(file_path, "r+") as file: |
| 154 | if not is_regex: |
| 155 | old_string = re.escape(old_string) |
| 156 | data = re.sub(old_string, new_string, file.read()) |
| 157 | file.seek(0) |
| 158 | file.write(data) |
| 159 | file.truncate() |
| 160 | |
| 161 | |
| 162 | def update_java(chrome_milestone): |
no test coverage detected