-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Move common python code into a library.
We'll use this for other scripts.
- Loading branch information
Showing
19 changed files
with
1,474 additions
and
634 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,7 @@ _[Bb]uild*/ | |
_obj | ||
_test | ||
libs | ||
__pycache__ | ||
|
||
# Git | ||
*.orig | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# SPDX-License-Identifier: GPL-3.0-or-later | ||
# Copyright © 2024 The TokTok team | ||
import re | ||
|
||
|
||
def parse() -> dict[str, str]: | ||
messages: dict[str, str] = {} | ||
|
||
with open("CHANGELOG.md", "r") as f: | ||
version = None | ||
message: list[str] = [] | ||
for line in f.read().splitlines(): | ||
version_found = re.search(r"^##\s*(v[^ ]+)", line) | ||
if version_found: | ||
version = version_found.group(1) | ||
continue | ||
if version: | ||
if line.startswith("####") or line.startswith("<a name="): | ||
while message and not message[-1].strip(): | ||
message.pop() | ||
while message and not message[0].strip(): | ||
message.pop(0) | ||
messages[version] = "\n".join(message) | ||
version = None | ||
message = [] | ||
else: | ||
message.append(line) | ||
|
||
return messages | ||
|
||
|
||
def get_message(version: str) -> str: | ||
messages = parse() | ||
return messages[version] |
Oops, something went wrong.