From 735cf2e6e35087b209c5cfb553d82948ac267f13 Mon Sep 17 00:00:00 2001 From: Nathan Stender Date: Sat, 19 Oct 2024 10:12:51 -0400 Subject: [PATCH 1/3] Remove changelog section title --- scripts/update_version.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/scripts/update_version.py b/scripts/update_version.py index 75d7e46d0..6cfe223ec 100755 --- a/scripts/update_version.py +++ b/scripts/update_version.py @@ -40,8 +40,8 @@ def _get_changes() -> dict[str, list[str]]: return dict(changes) -def _write_new_section(version: str, changes: dict[str, list[str]]) -> str: - body = f"## [{version}] - {datetime.now(tz.gettz('EST')).strftime('%Y-%m-%d')}\n" +def _get_new_section(changes: dict[str, list[str]]) -> str: + body = "" for prefix, section in SECTION_TO_PREFIX.items(): if prefix not in changes: continue @@ -49,7 +49,6 @@ def _write_new_section(version: str, changes: dict[str, list[str]]) -> str: for change in changes[prefix]: body += f"- {change}\n" - body += "\n" return body @@ -62,8 +61,10 @@ def _update_changelog(version: str) -> str: with open(changelog_file, "w") as f: for line in contents: if line.startswith("## ") and not body: - body = _write_new_section(version, _get_changes()) + body = _get_new_section(version, _get_changes()) + f.write(f"## [{version}] - {datetime.now(tz.gettz('EST')).strftime('%Y-%m-%d')}\n") f.write(body) + f.write("\n") f.write(line) return body From 19d954faf3955c0bb7786fc2e0d4cdae3cda6194 Mon Sep 17 00:00:00 2001 From: Nathan Stender Date: Sat, 19 Oct 2024 10:13:42 -0400 Subject: [PATCH 2/3] Fix lint --- scripts/update_version.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/update_version.py b/scripts/update_version.py index 6cfe223ec..da864d4d8 100755 --- a/scripts/update_version.py +++ b/scripts/update_version.py @@ -62,7 +62,9 @@ def _update_changelog(version: str) -> str: for line in contents: if line.startswith("## ") and not body: body = _get_new_section(version, _get_changes()) - f.write(f"## [{version}] - {datetime.now(tz.gettz('EST')).strftime('%Y-%m-%d')}\n") + f.write( + f"## [{version}] - {datetime.now(tz.gettz('EST')).strftime('%Y-%m-%d')}\n" + ) f.write(body) f.write("\n") f.write(line) From 7fd6e7602afc506e7054f7e5551dcd8534270fbd Mon Sep 17 00:00:00 2001 From: Nathan Stender Date: Sat, 19 Oct 2024 10:15:11 -0400 Subject: [PATCH 3/3] Fix lint --- scripts/update_version.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/update_version.py b/scripts/update_version.py index da864d4d8..c91e29da2 100755 --- a/scripts/update_version.py +++ b/scripts/update_version.py @@ -40,7 +40,8 @@ def _get_changes() -> dict[str, list[str]]: return dict(changes) -def _get_new_section(changes: dict[str, list[str]]) -> str: +def _get_new_section() -> str: + changes = _get_changes() body = "" for prefix, section in SECTION_TO_PREFIX.items(): if prefix not in changes: @@ -61,7 +62,7 @@ def _update_changelog(version: str) -> str: with open(changelog_file, "w") as f: for line in contents: if line.startswith("## ") and not body: - body = _get_new_section(version, _get_changes()) + body = _get_new_section() f.write( f"## [{version}] - {datetime.now(tz.gettz('EST')).strftime('%Y-%m-%d')}\n" )