Skip to content

Commit 906c038

Browse files
committed
refactor(version): Paremetrize InvalidVersion
src/libtmux/_vendor/version.py:198:19: TRY003 Avoid specifying long messages outside the exception class"
1 parent 0aebe47 commit 906c038

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/libtmux/_vendor/version.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ class InvalidVersion(ValueError):
6262
libtmux._vendor.version.InvalidVersion: Invalid version: 'invalid'
6363
"""
6464

65+
def __init__(self, version: str, *args: object):
66+
return super().__init__(f"Invalid version: '{version}'")
67+
6568

6669
class _BaseVersion:
6770
_key: CmpKey
@@ -195,7 +198,7 @@ def __init__(self, version: str) -> None:
195198
# Validate the version and parse it into pieces
196199
match = self._regex.search(version)
197200
if not match:
198-
raise InvalidVersion(f"Invalid version: '{version}'")
201+
raise InvalidVersion(version=version)
199202

200203
# Store the parsed out pieces of the version
201204
self._version = _Version(

0 commit comments

Comments
 (0)