-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathConfiguration.py
119 lines (97 loc) · 2.99 KB
/
Configuration.py
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# -*- coding: utf-8 -*-
# cython: language_level = 3
"""
定义了一些配置文件
"""
class GlobalConfiguration:
DECIMAL_PRECISION: int = 3
ResultExt: str = ".?Result"
class _ScoreBoards:
"""
这个类存储了必要计分项的名称
"""
Args = "Py.Args"
Temp = "Py.Temp"
Flags = "Py.Flags"
Input = "Py.Input"
Vars = "Py.Vars"
FuncResult = "Py.FuncResult"
class _Flags:
"""
这个类存储了一些常用的标记位名称
"""
TRUE = "True"
FALSE = "False"
NEG = "Neg"
DEBUG = "DEBUG"
class _DataStorages:
"""
这个类存储了必要 data storage 的名称
"""
Root = "python"
Temp = "temporary"
LocalVars = "LocalVars"
LocalTemp = "LocalTemp"
class _RawJsons:
"""
这个类存储了一些常用的原始JSON文本
"""
Prefix = {
"text": "[Python]",
"clickEvent": {
"action": "open_url", "value": "https://github.com/C418-11/MinecraftFunctionCompiler"
},
"hoverEvent": {
"action": "show_text", "value": "GitHub"
},
"color": "gold",
"bold": False,
"italic": False,
"underlined": False,
"strikethrough": False,
"obfuscated": False,
"font": "minecraft:default",
}
class HoverEvents:
"""
这个类存储了一些常用的hoverEvent原始JSON
"""
Author = {
"hoverEvent": {"action": "show_text", "value": "Made By: C418____11"}
}
def __init__(self):
self.Flags = self._Flags()
self.ScoreBoards = self._ScoreBoards()
self.SB_ARGS = self.ScoreBoards.Args
self.SB_TEMP = self.ScoreBoards.Temp
self.SB_FLAGS = self.ScoreBoards.Flags
self.SB_INPUT = self.ScoreBoards.Input
self.SB_VARS = self.ScoreBoards.Vars
self.SB_FUNC_RESULT = self.ScoreBoards.FuncResult
self.DataStorages = self._DataStorages()
self.DS_ROOT = self.DataStorages.Root
self.DS_TEMP = self.DataStorages.Temp
self.DS_LOCAL_VARS = self.DataStorages.LocalVars
self.DS_LOCAL_TEMP = self.DataStorages.LocalTemp
self.RawJsons = self._RawJsons()
class CompileConfiguration:
Encoding = "utf-8"
TEMPLATE_PATH = "./template"
def __init__(
self,
base_namespace: str,
read_path: str,
save_path: str = "./.output",
*,
debug_mode: bool = False,
generate_comments: bool = True,
) -> None:
self.base_namespace = base_namespace
self.READ_PATH = read_path
self.SAVE_PATH: str = save_path
self.DEBUG_MODE = debug_mode
self.GENERATE_COMMENTS = generate_comments
__all__ = (
"CompileConfiguration",
"GlobalConfiguration",
)