Skip to content

Commit 3b2aa3a

Browse files
committed
Refactor: move itertools.product import to top level
1 parent dfb0d70 commit 3b2aa3a

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

pypinyin/core.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
from __future__ import unicode_literals
55

6-
from itertools import chain
6+
from itertools import chain, product
77

88
from pypinyin.compat import text_type
99
from pypinyin.constants import (
@@ -231,7 +231,6 @@ def pinyin_group(self, hans, style=Style.TONE, heteronym=False,
231231
for j in range(len(pys) - 2):
232232
prev_pinyins.append(pys[j])
233233
# 为前面的拼音生成所有组合
234-
from itertools import product
235234
if prev_pinyins:
236235
prev_combinations = [
237236
' '.join(p) for p in product(*prev_pinyins)]
@@ -262,7 +261,6 @@ def pinyin_group(self, hans, style=Style.TONE, heteronym=False,
262261
# 非儿化音处理
263262
if heteronym:
264263
# 多音字模式:生成所有组合
265-
from itertools import product
266264
# 检查是否需要添加隔音符
267265
combinations = []
268266
for combo in product(*pys):

0 commit comments

Comments
 (0)