Skip to content

Commit

Permalink
Fixed typing issue.
Browse files Browse the repository at this point in the history
- Declared SourceCodeManager attributes as `ClassVar[List[str]]`
- `_TEST_USABLE_COMMAND`, `_COMMIT_COMMAND`, and `_ALL_TAGS_COMMAND` affected
  • Loading branch information
coordt committed Jun 30, 2023
1 parent 2096c92 commit bfe5306
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions bumpversion/scm.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from dataclasses import dataclass
from pathlib import Path
from tempfile import NamedTemporaryFile
from typing import TYPE_CHECKING, List, MutableMapping, Optional, Type, Union
from typing import TYPE_CHECKING, ClassVar, List, MutableMapping, Optional, Type, Union

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

_TEST_USABLE_COMMAND: List[str] = []
_COMMIT_COMMAND: List[str] = []
_ALL_TAGS_COMMAND: List[str] = []
_TEST_USABLE_COMMAND: ClassVar[List[str]] = []
_COMMIT_COMMAND: ClassVar[List[str]] = []
_ALL_TAGS_COMMAND: ClassVar[List[str]] = []

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

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

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

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

@classmethod
def latest_tag_info(cls, tag_pattern: str) -> SCMInfo:
Expand Down

0 comments on commit bfe5306

Please sign in to comment.