Skip to content

Commit 8063e1c

Browse files
author
Zarcher
authored
initial commit
1 parent d201277 commit 8063e1c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+1993
-0
lines changed

ConfigCheck.py

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import os
2+
from typing import Any, List, Dict, Tuple, Optional
3+
4+
5+
def yes_or_no(input_content: str, default: Optional[bool] = None) -> Optional[bool]:
6+
"""
7+
according to input content return True or False
8+
:param input_content: input content
9+
:param default: if input is None, using default as choice
10+
:return: bool, choice
11+
"""
12+
yes_list = ['Y', 'y', 'Yes', 'yes', 'YES']
13+
no_list = ['N', 'n', 'No', 'no', 'NO']
14+
15+
if default is True:
16+
yes_list.append('')
17+
elif default is False:
18+
no_list.append('')
19+
else:
20+
pass
21+
22+
if input_content in yes_list:
23+
return True
24+
elif input_content in no_list:
25+
return False
26+
else:
27+
print('输入无效,请重试!')
28+
return None
29+
30+
31+
def quit_() -> None:
32+
"""
33+
custom exit
34+
:return: None
35+
"""
36+
ipt = input('按回车键退出...')
37+
exit()
38+
39+
40+
41+
42+
43+
44+
45+
46+
47+
48+
49+
50+
51+
52+
53+
54+
55+
56+

0 commit comments

Comments
 (0)