1- from collections import OrderedDict
2- from typing import Any , List , Optional , Tuple , TypedDict
3-
1+ import collections
2+ import pathlib
3+ from typing import (
4+ Any ,
5+ Iterable ,
6+ List ,
7+ MutableMapping ,
8+ Optional ,
9+ OrderedDict ,
10+ Tuple ,
11+ TypedDict ,
12+ Union ,
13+ )
414
515# Type
16+ Questions = Iterable [MutableMapping [str , Any ]]
17+
18+
19+ class CzSettings (TypedDict , total = False ):
20+ bump_pattern : str
21+ bump_map : OrderedDict [str , str ]
22+ change_type_order : List [str ]
23+
24+ questions : Questions
25+ example : Optional [str ]
26+ schema_pattern : Optional [str ]
27+ schema : Optional [str ]
28+ info_path : Union [str , pathlib .Path ]
29+ info : str
30+ message_template : str
31+
32+
633class Settings (TypedDict , total = False ):
734 name : str
835 version : Optional [str ]
@@ -15,7 +42,7 @@ class Settings(TypedDict, total=False):
1542 update_changelog_on_bump : bool
1643 use_shortcuts : bool
1744 style : Optional [List [Tuple [str , str ]]]
18- customize : Any
45+ customize : CzSettings
1946
2047
2148name : str = "cz_conventional_commits"
@@ -46,7 +73,7 @@ class Settings(TypedDict, total=False):
4673PATCH = "PATCH"
4774
4875bump_pattern = r"^(BREAKING[\-\ ]CHANGE|feat|fix|refactor|perf)(\(.+\))?(!)?"
49- bump_map = OrderedDict (
76+ bump_map = collections . OrderedDict (
5077 (
5178 (r"^.+!$" , MAJOR ),
5279 (r"^BREAKING[\-\ ]CHANGE" , MAJOR ),
@@ -56,9 +83,10 @@ class Settings(TypedDict, total=False):
5683 (r"^perf" , PATCH ),
5784 )
5885)
86+ change_type_order = ["BREAKING CHANGE" , "feat" , "fix" , "refactor" , "perf" ]
87+
5988bump_message = "bump: version $current_version → $new_version"
6089
61- change_type_order = ["BREAKING CHANGE" , "feat" , "fix" , "refactor" , "perf" ]
6290
6391commit_parser = r"^(?P<change_type>feat|fix|refactor|perf|BREAKING CHANGE)(?:\((?P<scope>[^()\r\n]*)\)|\()?(?P<breaking>!)?:\s(?P<message>.*)?" # noqa
6492version_parser = r"(?P<version>([0-9]+)\.([0-9]+)\.([0-9]+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+)?(\w+)?)"
0 commit comments