MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / replace_in_file

Function replace_in_file

scripts/update_cdp.py:161–168  ·  view source on GitHub ↗
(file_path, old_string, new_string, is_regex=False)

Source from the content-addressed store, hash-verified

159
160
161def replace_in_file(file_path, old_string, new_string, is_regex=False):
162 with open(file_path, "r+") as file:
163 if not is_regex:
164 old_string = re.escape(old_string)
165 data = re.sub(old_string, new_string, file.read())
166 file.seek(0)
167 file.write(data)
168 file.truncate()
169
170
171def update_java(chrome_milestone):

Callers 6

create_new_chrome_filesFunction · 0.85
update_javaFunction · 0.85
update_dotnetFunction · 0.85
update_rubyFunction · 0.85
update_pythonFunction · 0.85
update_jsFunction · 0.85

Calls 3

readMethod · 0.65
escapeMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected