Skip to content

Commit 19b9b73

Browse files
committed
style: replace dict with Mapping
1 parent 19ee8b3 commit 19b9b73

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

commitizen/cz/base.py

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

33
from abc import ABCMeta, abstractmethod
4-
from collections.abc import Iterable
4+
from collections.abc import Iterable, Mapping
55
from typing import Any, Callable, Protocol
66

77
from jinja2 import BaseLoader, PackageLoader
@@ -72,7 +72,7 @@ def questions(self) -> Questions:
7272
"""Questions regarding the commit message."""
7373

7474
@abstractmethod
75-
def message(self, answers: dict) -> str:
75+
def message(self, answers: Mapping[str, Any]) -> str:
7676
"""Format your git message."""
7777

7878
@property

commitizen/cz/customize/customize.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

3-
from typing import TYPE_CHECKING
3+
from collections.abc import Mapping
4+
from typing import TYPE_CHECKING, Any
45

56
if TYPE_CHECKING:
67
from jinja2 import Template
@@ -48,7 +49,7 @@ def __init__(self, config: BaseConfig):
4849
def questions(self) -> Questions:
4950
return self.custom_settings.get("questions", [{}])
5051

51-
def message(self, answers: dict) -> str:
52+
def message(self, answers: Mapping[str, Any]) -> str:
5253
message_template = Template(self.custom_settings.get("message_template", ""))
5354
if getattr(Template, "substitute", None):
5455
return message_template.substitute(**answers) # type: ignore

commitizen/cz/jira/jira.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import os
2+
from collections.abc import Mapping
23

34
from commitizen.cz.base import BaseCommitizen
45
from commitizen.defaults import Questions
@@ -43,7 +44,7 @@ def questions(self) -> Questions:
4344
},
4445
]
4546

46-
def message(self, answers: dict[str, str]) -> str:
47+
def message(self, answers: Mapping[str, str]) -> str:
4748
return " ".join(
4849
x
4950
for k in ("message", "issues", "workflow", "time", "comment")

0 commit comments

Comments
 (0)