Lines Matching defs:fileName
20 def replaceInFileRegex(fileName: str, sFrom: str, sTo: str) -> None:
29 with io.open(fileName, "r", encoding="utf8") as f:
33 print("Replacing '%s' -> '%s' in '%s'..." % (sFrom, sTo, fileName))
34 with io.open(fileName, "w", encoding="utf8") as f:
38 def replaceInFile(fileName: str, sFrom: str, sTo: str) -> None:
42 with io.open(fileName, "r", encoding="utf8") as f:
49 print("Replacing '%s' -> '%s' in '%s'..." % (sFrom, sTo, fileName))
50 with io.open(fileName, "w", encoding="utf8") as f:
78 def fileRename(fileName: str, sFrom: str, sTo: str) -> str:
79 if sFrom not in fileName or sFrom == sTo:
80 return fileName
81 newFileName = fileName.replace(sFrom, sTo)
82 print("Renaming '%s' -> '%s'..." % (fileName, newFileName))
83 os.rename(fileName, newFileName)
87 def deleteMatchingLines(fileName: str, pattern: str) -> bool:
89 with io.open(fileName, "r", encoding="utf8") as f:
96 print("Removing lines matching '%s' in '%s'..." % (pattern, fileName))
98 with io.open(fileName, "w", encoding="utf8") as f: