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 b42a676

Browse files
committed
style: refine coding style based on reviews
1 parent fc3c1e9 commit b42a676

File tree

3 files changed

+6
-11
lines changed

3 files changed

+6
-11
lines changed

‎commitizen/commands/commit.py‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
from __future__ import annotations
2+
13
import contextlib
24
import os
35

4-
from typing import Optional
56

67
import questionary
78

@@ -35,7 +36,7 @@ def __init__(self, config: BaseConfig, arguments: dict):
3536
self.arguments = arguments
3637
self.temp_file: str = get_backup_file_path()
3738

38-
def read_backup_message(self) -> Optional[str]:
39+
def read_backup_message(self) -> str|None:
3940
# Check the commit backup file exists
4041
if not os.path.isfile(self.temp_file):
4142
return None

‎commitizen/cz/utils.py‎

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,5 @@ def get_backup_file_path() -> str:
2828
else:
2929
project = project_root.as_posix().replace("/", "%")
3030

31-
return os.path.join(
32-
tempfile.gettempdir(),
33-
"cz.commit%{user}%{project}.backup".format(
34-
user=os.environ.get("USER", ""),
35-
project=project,
36-
),
37-
)
31+
user = os.environ.get("USER", "")
32+
return os.path.join(tempfile.gettempdir(), f"cz.commit%{user}%{project}.backup")

‎hooks/post-commit.py‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
try:
55
from commitizen.cz.utils import get_backup_file_path
66
except ImportError as error:
7-
print("could not import commitizen:")
8-
print(error)
7+
print(f"could not import commitizen:\n{error}")
98
exit(1)
109

1110

0 commit comments

Comments
(0)

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