-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path__init__.py
86 lines (75 loc) · 2.75 KB
/
__init__.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
from PythonVoiceCodingPlugin.queries.abstract import *
from PythonVoiceCodingPlugin.queries.argument import SelectArgument
from PythonVoiceCodingPlugin.queries.alternatives import SelectAlternative
from PythonVoiceCodingPlugin.queries.big_roi import SelectBigRoi
from PythonVoiceCodingPlugin.queries.paste_back import PasteBack
from PythonVoiceCodingPlugin.queries.collect_variable import CollectVariable
from PythonVoiceCodingPlugin.queries.collect_parameter import CollectParameter
from PythonVoiceCodingPlugin.queries.collect_module import CollectModule
from PythonVoiceCodingPlugin.queries.collect_function_name import CollectFunctionName
from PythonVoiceCodingPlugin.queries.collect_imported_value import CollectImportedValue
from PythonVoiceCodingPlugin.queries.collect_decorator import CollectDecorator
from PythonVoiceCodingPlugin.queries.collect_class_name import CollectClassName
from PythonVoiceCodingPlugin.queries.insert_item import InsertItem
from PythonVoiceCodingPlugin.queries.delete_alternatives import DeleteAlternatives
from PythonVoiceCodingPlugin.queries.swap_back import SwapBack
from PythonVoiceCodingPlugin.queries.select_part import SelectPart
from PythonVoiceCodingPlugin.queries.select_back import SelectBack
from PythonVoiceCodingPlugin.queries.remember_here import RememberHere
def get_query(query_description):
index = query_description["command"]
if index in ["collect_indexable"]:
index = {
"variable":"collect_variable",
"parameter":"collect_parameter",
"module":"collect_module",
"import value":"collect_imported_value",
"function name":"collect_function_name",
"class name":"collect_class_name",
"decorator":"collect_decorator",
}[query_description["collectable"]]
h = {
"argument": SelectArgument,
"alternative": SelectAlternative,
"big_roi": SelectBigRoi,
"paste_back": PasteBack,
"collect_variable": CollectVariable,
"collect_parameter":CollectParameter,
"collect_module":CollectModule,
"collect_imported_value": CollectImportedValue,
"collect_function_name": CollectFunctionName,
"collect_decorator":CollectDecorator,
"collect_class_name":CollectClassName,
"insert_item": InsertItem,
"delete_alternatives":DeleteAlternatives,
"swap_back": SwapBack,
"select_part": SelectPart,
"select_back": SelectBack,
"remember_here": RememberHere,
}
return h[index]
def get_secondary_query(query_description):
if "operation" not in query_description:
return {}
else:
h={
"paste":{
"command":"paste_back",
"format":1,
},
"delete":{
"command":"delete_alternatives",
"format":1,
"color":0,
},
"swap":{
"command":"swap_back",
"format":1,
},
"edit":{
"command":"alternative",
"format":3,
"color":0,
},
}
return h[query_description["operation"]]