-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.py
More file actions
29 lines (24 loc) · 1.23 KB
/
example.py
File metadata and controls
29 lines (24 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import argparse
from matplotlib import font_manager
from miching.horoscope import Prophet
from miching.version import __version__
from miching.visualize import show_hexagrams
from miching.sexagenary import sizhu
def usage():
parser = argparse.ArgumentParser(description = "Any vital question you may have, ask it here.")
group = parser.add_mutually_exclusive_group()
group.add_argument('-q', dest= 'question', help = "the question you are going to ask for")
group.add_argument('-t', dest= 'topic', help = "the topic about your question")
parser.add_argument('-s', dest = 'seed', type=int, help = "the random seed (not recommended)")
parser.add_argument('-v', dest = 'visual', action="store_true", help = "visualizing the prophesy process")
parser.add_argument('-o', dest = 'output', help = "write to file instead of stdout")
parser.add_argument('-V', '--version', action = 'version', version = __version__, help = "show this version message and exit")
args = parser.parse_args()
# 易经预测
prophet = Prophet(event = args.topic, seed = args.seed)
prophet.prophesy()
prophet.explain()
if args.visual: prophet.visualize()
if __name__ == '__main__':
usage()
# print(sizhu(1991, 1, 15, 12))