Skip to content

Commit cd72fd1

Browse files
committed
refactor(defaults): add Settings typeddict
1 parent 8bd5d71 commit cd72fd1

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

commitizen/config/base_config.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
from pathlib import Path
2-
from typing import Any, Dict, Optional, Union
2+
from typing import Optional, Union
33

4-
from commitizen.defaults import DEFAULT_SETTINGS
4+
from commitizen.defaults import DEFAULT_SETTINGS, Settings
55

66

77
class BaseConfig:
88
def __init__(self):
9-
self._settings: Dict[str, Any] = DEFAULT_SETTINGS.copy()
9+
self._settings: Settings = DEFAULT_SETTINGS.copy()
1010
self._path: Optional[Path] = None
1111

1212
@property
13-
def settings(self) -> Dict[str, Any]:
13+
def settings(self) -> Settings:
1414
return self._settings
1515

1616
@property
@@ -25,7 +25,7 @@ def set_key(self, key, value):
2525
"""
2626
raise NotImplementedError()
2727

28-
def update(self, data: dict) -> None:
28+
def update(self, data: Settings) -> None:
2929
self._settings.update(data)
3030

3131
def add_path(self, path: Union[str, Path]) -> None:

commitizen/defaults.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
from collections import OrderedDict
2-
from typing import List, Optional, TypedDict
2+
from typing import Any, List, Optional, Tuple, TypedDict
33

44

55
# Type
6-
class Settings(TypedDict):
6+
class Settings(TypedDict, total=False):
77
name: str
88
version: Optional[str]
99
version_files: List[str]
@@ -14,6 +14,8 @@ class Settings(TypedDict):
1414
changelog_start_rev: Optional[str]
1515
update_changelog_on_bump: bool
1616
use_shortcuts: bool
17+
style: Optional[List[Tuple[str, str]]]
18+
customize: Any
1719

1820

1921
name: str = "cz_conventional_commits"

0 commit comments

Comments
 (0)