Skip to content

Commit 45d5f37

Browse files
formatting
1 parent cdabc45 commit 45d5f37

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ flake8 = "^7"
3434
mypy = "^1.5"
3535
pytest-cov = "^5.0.0"
3636

37+
[tool.black]
38+
line-length = 88
39+
3740
[build-system]
3841
requires = ["poetry>=0.12"]
3942
build-backend = "poetry.masonry.api"

tagbot/action/changelog.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,21 +67,22 @@ def _previous_release(self, version_tag: str) -> Optional[GitRelease]:
6767
prev_ver = ver
6868
return prev_rel
6969

70-
VERSION_PATTERN = re.compile(r"^(.*?)[-v]?(\d+\.\d+\.\d+(?:\.\d+)*)(?:[-+].+)?$")
71-
7270
def _is_backport(self, version: str) -> bool:
7371
"""Determine whether or not the version is a backport."""
7472
try:
75-
# Extract the version number from the input
76-
match = VERSION_PATTERN.match(version)
73+
version_pattern = re.compile(
74+
r"^(.*?)[-v]?(\d+\.\d+\.\d+(?:\.\d+)*)(?:[-+].+)?$"
75+
)
76+
77+
# Extract any package name prefix and version number from the input
78+
match = version_pattern.match(version)
7779
if not match:
7880
raise ValueError(f"Invalid version format: {version}")
79-
8081
package_name = match.group(1)
8182
cur_ver = VersionInfo.parse(match.group(2))
8283

8384
for r in self._repo._repo.get_releases():
84-
tag_match = VERSION_PATTERN.match(r.tag_name)
85+
tag_match = version_pattern.match(r.tag_name)
8586
if not tag_match:
8687
continue
8788

0 commit comments

Comments
 (0)