Skip to content

Commit 1806fe8

Browse files
committed
style(mypy): rewrite import to avoid unnecessary type ignore
1 parent 82db67d commit 1806fe8

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

commitizen/cz/customize/customize.py

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
from __future__ import annotations
22

3-
try:
3+
from typing import TYPE_CHECKING
4+
5+
if TYPE_CHECKING:
46
from jinja2 import Template
5-
except ImportError:
6-
from string import Template # type: ignore
7+
else:
8+
try:
9+
from jinja2 import Template
10+
except ImportError:
11+
from string import Template
712

813

914
from commitizen import defaults

0 commit comments

Comments
 (0)