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

Function replace_in_file

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

Source from the content-addressed store, hash-verified

150
151
152def 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
162def 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