Skip to content

Commit

Permalink
chore: resolve lint issue
Browse files Browse the repository at this point in the history
  • Loading branch information
shiftinv committed Oct 20, 2023
1 parent d56c570 commit 7aeb024
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions scripts/ci/versiontool.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from typing import NamedTuple, NoReturn

TARGET_FILE = Path("disnake/__init__.py")
INIT = TARGET_FILE.read_text("utf-8")
ORIG_INIT_CONTENTS = TARGET_FILE.read_text("utf-8")

version_re = re.compile(r"(\d+)\.(\d+)\.(\d+)(?:(a|b|rc)(\d+)?)?")

Expand Down Expand Up @@ -60,7 +60,7 @@ def to_versioninfo(self) -> str:


def get_current_version() -> VersionInfo:
match = re.search(r"^__version__\b.*\"(.+?)\"$", INIT, re.MULTILINE)
match = re.search(r"^__version__\b.*\"(.+?)\"$", ORIG_INIT_CONTENTS, re.MULTILINE)
assert match, "could not find current version in __init__.py"
return VersionInfo.from_str(match[1])

Expand Down Expand Up @@ -113,13 +113,13 @@ def main() -> None:
else:
new_version = VersionInfo.from_str(new_version_str)

text = INIT
text = replace_line(text, r"^__version__\b", f'__version__ = "{str(new_version)}"')
text = ORIG_INIT_CONTENTS
text = replace_line(text, r"^__version__\b", f'__version__ = "{new_version!s}"')
text = replace_line(
text, r"^version_info\b", f"version_info: VersionInfo = {new_version.to_versioninfo()}"
)

if text != INIT:
if text != ORIG_INIT_CONTENTS:
TARGET_FILE.write_text(text, "utf-8")

print(str(new_version))
Expand Down

0 comments on commit 7aeb024

Please sign in to comment.