MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / sed_in_place

Function sed_in_place

configure.py:122–134  ·  view source on GitHub ↗

Replace old string with new string in file. Args: filename: string for filename. old: string to replace. new: new string to replace to.

(filename, old, new)

Source from the content-addressed store, hash-verified

120
121
122def sed_in_place(filename, old, new):
123 """Replace old string with new string in file.
124
125 Args:
126 filename: string for filename.
127 old: string to replace.
128 new: new string to replace to.
129 """
130 with open(filename, 'r') as f:
131 filedata = f.read()
132 newdata = filedata.replace(old, new)
133 with open(filename, 'w') as f:
134 f.write(newdata)
135
136
137def write_to_bazelrc(line):

Callers 1

set_other_mpi_varsFunction · 0.85

Calls 3

replaceMethod · 0.80
readMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected