Skip to content

Commit bfe5306

Browse files
committed
Fixed typing issue.
- Declared SourceCodeManager attributes as `ClassVar[List[str]]` - `_TEST_USABLE_COMMAND`, `_COMMIT_COMMAND`, and `_ALL_TAGS_COMMAND` affected
1 parent 2096c92 commit bfe5306

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

bumpversion/scm.py

+10-10
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from dataclasses import dataclass
88
from pathlib import Path
99
from tempfile import NamedTemporaryFile
10-
from typing import TYPE_CHECKING, List, MutableMapping, Optional, Type, Union
10+
from typing import TYPE_CHECKING, ClassVar, List, MutableMapping, Optional, Type, Union
1111

1212
if TYPE_CHECKING: # pragma: no-coverage
1313
from bumpversion.config import Config
@@ -44,9 +44,9 @@ def __repr__(self):
4444
class SourceCodeManager:
4545
"""Base class for version control systems."""
4646

47-
_TEST_USABLE_COMMAND: List[str] = []
48-
_COMMIT_COMMAND: List[str] = []
49-
_ALL_TAGS_COMMAND: List[str] = []
47+
_TEST_USABLE_COMMAND: ClassVar[List[str]] = []
48+
_COMMIT_COMMAND: ClassVar[List[str]] = []
49+
_ALL_TAGS_COMMAND: ClassVar[List[str]] = []
5050

5151
@classmethod
5252
def commit(cls, message: str, current_version: str, new_version: str, extra_args: Optional[list] = None) -> None:
@@ -201,9 +201,9 @@ def __repr__(self):
201201
class Git(SourceCodeManager):
202202
"""Git implementation."""
203203

204-
_TEST_USABLE_COMMAND = ["git", "rev-parse", "--git-dir"]
205-
_COMMIT_COMMAND = ["git", "commit", "-F"]
206-
_ALL_TAGS_COMMAND = ["git", "tag", "--list"]
204+
_TEST_USABLE_COMMAND: ClassVar[List[str]] = ["git", "rev-parse", "--git-dir"]
205+
_COMMIT_COMMAND: ClassVar[List[str]] = ["git", "commit", "-F"]
206+
_ALL_TAGS_COMMAND: ClassVar[List[str]] = ["git", "tag", "--list"]
207207

208208
@classmethod
209209
def assert_nondirty(cls) -> None:
@@ -295,9 +295,9 @@ def tag(cls, name: str, sign: bool = False, message: Optional[str] = None) -> No
295295
class Mercurial(SourceCodeManager):
296296
"""Mercurial implementation."""
297297

298-
_TEST_USABLE_COMMAND = ["hg", "root"]
299-
_COMMIT_COMMAND = ["hg", "commit", "--logfile"]
300-
_ALL_TAGS_COMMAND = ["hg", "log", '--rev="tag()"', '--template="{tags}\n"']
298+
_TEST_USABLE_COMMAND: ClassVar[List[str]] = ["hg", "root"]
299+
_COMMIT_COMMAND: ClassVar[List[str]] = ["hg", "commit", "--logfile"]
300+
_ALL_TAGS_COMMAND: ClassVar[List[str]] = ["hg", "log", '--rev="tag()"', '--template="{tags}\n"']
301301

302302
@classmethod
303303
def latest_tag_info(cls, tag_pattern: str) -> SCMInfo:

0 commit comments

Comments
 (0)