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

Method write_update_notice

scripts/update_copyright.py:62–77  ·  view source on GitHub ↗
(self, file, lines, shebang=())

Source from the content-addressed store, hash-verified

60 return [f"{self._comment_characters} {line}".rstrip() + "\n" for line in self.NOTICE.split("\n")]
61
62 def write_update_notice(self, file, lines, shebang=()):
63 # Build new content
64 new_content = "".join(shebang) + self.copyright_notice(file) + "\n"
65 if lines and lines[0] != "\n":
66 new_content += "\n"
67 new_content += "".join(line.rstrip() + "\n" for line in lines)
68
69 # Only write if different
70 with open(file, encoding="utf-8-sig") as f:
71 old_content = f.read()
72 if new_content == old_content:
73 return
74
75 print(f"Adding notice to {file}")
76 with open(file, "w") as f:
77 f.write(new_content)
78
79
80ROOT = Path(os.path.realpath(__file__)).parent.parent

Callers 1

updateMethod · 0.95

Calls 3

copyright_noticeMethod · 0.95
readMethod · 0.65
writeMethod · 0.45

Tested by

no test coverage detected