Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit ba34852

Browse files
fix: correct type hinting
1 parent 41b329b commit ba34852

File tree

5 files changed

+11
-8
lines changed

5 files changed

+11
-8
lines changed

‎commitizen/bump.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def find_increment(
4747
def update_version_in_files(
4848
current_version: str,
4949
new_version: str,
50-
files: List[str],
50+
files: list[str],
5151
encoding: str,
5252
*,
5353
check_consistency=False,
@@ -92,7 +92,7 @@ def _bump_with_regex(
9292
new_version: str,
9393
regex: str,
9494
encoding: str,
95-
) -> Tuple[bool, str]:
95+
) -> tuple[bool, str]:
9696
current_version_found = False
9797
lines = []
9898
pattern = re.compile(regex)

‎commitizen/changelog.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ def get_metadata(filepath: str, scheme: VersionScheme = Pep440) -> dict:
227227
"latest_version_position": None,
228228
}
229229

230-
with open(filepath, "r", encoding=encoding) as changelog_file:
230+
with open(filepath, "r") as changelog_file:
231231
for index, line in enumerate(changelog_file):
232232
line = line.strip().lower()
233233

‎commitizen/commands/changelog.py‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,9 @@ def write_changelog(
101101
f"or the setting `changelog_file` in {self.config.path}"
102102
)
103103

104-
changelog_hook: Optional[Callable] = self.cz.changelog_hook
104+
changelog_hook: Callable|None = self.cz.changelog_hook
105105
with smart_open(self.file_name, "w", encoding=self.encoding) as changelog_file:
106-
partial_changelog: Optional[str] = None
106+
partial_changelog: str|None = None
107107
if self.incremental:
108108
new_lines = changelog.incremental_build(
109109
changelog_out, lines, changelog_meta
@@ -143,7 +143,9 @@ def __call__(self):
143143
end_rev = ""
144144
if self.incremental:
145145
changelog_meta = changelog.get_metadata(
146-
self.file_name, self.scheme, self.encoding
146+
self.file_name,
147+
self.scheme,
148+
self.encoding,
147149
)
148150
latest_version = changelog_meta.get("latest_version")
149151
if latest_version:

‎commitizen/config/base_config.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class BaseConfig:
99
def __init__(self):
1010
self._settings: Settings = DEFAULT_SETTINGS.copy()
1111
self.encoding = self.settings["encoding"]
12-
self._path: Optional[Path] = None
12+
self._path: Path|None = None
1313

1414
@property
1515
def settings(self) -> Settings:

‎commitizen/out.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
from termcolor import colored
44

55
if sys.platform == "win32":
6-
sys.stdout.reconfigure(encoding="utf-8")
6+
# See: https://github.com/python/typeshed/issues/3049
7+
sys.stdout.reconfigure(encoding="utf-8") # type: ignore
78

89

910
def write(value: str, *args) -> None:

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /