Skip to content

Commit ea22ca4

Browse files
committed
style: better type
1 parent b999189 commit ea22ca4

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

commitizen/cli.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from functools import partial
99
from pathlib import Path
1010
from types import TracebackType
11-
from typing import TYPE_CHECKING, Any, cast
11+
from typing import TYPE_CHECKING, cast
1212

1313
import argcomplete
1414
from decli import cli
@@ -48,7 +48,7 @@ def __call__(
4848
self,
4949
parser: argparse.ArgumentParser,
5050
namespace: argparse.Namespace,
51-
kwarg: str | Sequence[Any] | None,
51+
kwarg: str | Sequence[object] | None,
5252
option_string: str | None = None,
5353
) -> None:
5454
if not isinstance(kwarg, str):

commitizen/providers/base_provider.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import json
44
from abc import ABC, abstractmethod
5+
from collections.abc import Mapping
56
from pathlib import Path
67
from typing import Any, ClassVar
78

@@ -63,8 +64,8 @@ def set_version(self, version: str) -> None:
6364
self.set(document, version)
6465
self.file.write_text(json.dumps(document, indent=self.indent) + "\n")
6566

66-
def get(self, document: dict[str, Any]) -> str:
67-
return document["version"] # type: ignore
67+
def get(self, document: Mapping[str, str]) -> str:
68+
return document["version"]
6869

6970
def set(self, document: dict[str, Any], version: str) -> None:
7071
document["version"] = version

commitizen/providers/npm_provider.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from __future__ import annotations
22

33
import json
4+
from collections.abc import Mapping
45
from pathlib import Path
56
from typing import Any, ClassVar
67

@@ -58,8 +59,8 @@ def set_version(self, version: str) -> None:
5859
json.dumps(shrinkwrap_document, indent=self.indent) + "\n"
5960
)
6061

61-
def get_package_version(self, document: dict[str, Any]) -> str:
62-
return document["version"] # type: ignore
62+
def get_package_version(self, document: Mapping[str, str]) -> str:
63+
return document["version"]
6364

6465
def set_package_version(
6566
self, document: dict[str, Any], version: str

0 commit comments

Comments
 (0)