MCPcopy
hub / github.com/psf/black / cleanup_changes_template_for_release

Method cleanup_changes_template_for_release

scripts/release.py:143–163  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

141 return 0
142
143 def cleanup_changes_template_for_release(self) -> None:
144 LOG.info(f"Cleaning up {self.changes_path}")
145
146 with self.changes_path.open("r", encoding="utf-8") as cfp:
147 changes_string = cfp.read()
148
149 # Change Unreleased to next version
150 changes_string = changes_string.replace(
151 "## Unreleased", f"## Version {self.next_version}"
152 )
153
154 # Remove all comments
155 changes_string = re.sub(r"(?m)^<!--(?>(?:.|\n)*?-->)\n+", "", changes_string)
156
157 # Remove empty subheadings
158 changes_string = re.sub(r"(?m)^###.+\n+(?=#)", "", changes_string)
159
160 with self.changes_path.open("w", encoding="utf-8") as cfp:
161 cfp.write(changes_string)
162
163 LOG.debug(f"Finished Cleaning up {self.changes_path}")
164
165 def get_current_version(self) -> str:
166 """Get the latest git (version) tag as latest version"""

Callers 1

Calls 3

readMethod · 0.80
replaceMethod · 0.80
writeMethod · 0.80

Tested by

no test coverage detected