maqet 0.0.1.4__py3-none-any.whl → 0.0.5__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- maqet/__init__.py +50 -6
- maqet/__main__.py +96 -0
- maqet/__version__.py +3 -0
- maqet/api/__init__.py +35 -0
- maqet/api/decorators.py +184 -0
- maqet/api/metadata.py +147 -0
- maqet/api/registry.py +182 -0
- maqet/cli.py +71 -0
- maqet/config/__init__.py +26 -0
- maqet/config/merger.py +237 -0
- maqet/config/parser.py +198 -0
- maqet/config/validators.py +519 -0
- maqet/config_handlers.py +684 -0
- maqet/constants.py +200 -0
- maqet/exceptions.py +226 -0
- maqet/formatters.py +294 -0
- maqet/generators/__init__.py +12 -0
- maqet/generators/base_generator.py +101 -0
- maqet/generators/cli_generator.py +635 -0
- maqet/generators/python_generator.py +247 -0
- maqet/generators/rest_generator.py +58 -0
- maqet/handlers/__init__.py +12 -0
- maqet/handlers/base.py +108 -0
- maqet/handlers/init.py +147 -0
- maqet/handlers/stage.py +196 -0
- maqet/ipc/__init__.py +29 -0
- maqet/ipc/retry.py +265 -0
- maqet/ipc/runner_client.py +285 -0
- maqet/ipc/unix_socket_server.py +239 -0
- maqet/logger.py +160 -55
- maqet/machine.py +884 -0
- maqet/managers/__init__.py +7 -0
- maqet/managers/qmp_manager.py +333 -0
- maqet/managers/snapshot_coordinator.py +327 -0
- maqet/managers/vm_manager.py +683 -0
- maqet/maqet.py +1120 -0
- maqet/os_interactions.py +46 -0
- maqet/process_spawner.py +395 -0
- maqet/qemu_args.py +76 -0
- maqet/qmp/__init__.py +10 -0
- maqet/qmp/commands.py +92 -0
- maqet/qmp/keyboard.py +311 -0
- maqet/qmp/qmp.py +17 -0
- maqet/snapshot.py +473 -0
- maqet/state.py +958 -0
- maqet/storage.py +702 -162
- maqet/validation/__init__.py +9 -0
- maqet/validation/config_validator.py +170 -0
- maqet/vm_runner.py +523 -0
- maqet-0.0.5.dist-info/METADATA +237 -0
- maqet-0.0.5.dist-info/RECORD +55 -0
- {maqet-0.0.1.4.dist-info → maqet-0.0.5.dist-info}/WHEEL +1 -1
- maqet-0.0.5.dist-info/entry_points.txt +2 -0
- maqet-0.0.5.dist-info/licenses/LICENSE +21 -0
- {maqet-0.0.1.4.dist-info → maqet-0.0.5.dist-info}/top_level.txt +0 -1
- maqet/core.py +0 -411
- maqet/functions.py +0 -104
- maqet-0.0.1.4.dist-info/METADATA +0 -6
- maqet-0.0.1.4.dist-info/RECORD +0 -33
- qemu/machine/__init__.py +0 -36
- qemu/machine/console_socket.py +0 -142
- qemu/machine/machine.py +0 -954
- qemu/machine/py.typed +0 -0
- qemu/machine/qtest.py +0 -191
- qemu/qmp/__init__.py +0 -59
- qemu/qmp/error.py +0 -50
- qemu/qmp/events.py +0 -717
- qemu/qmp/legacy.py +0 -319
- qemu/qmp/message.py +0 -209
- qemu/qmp/models.py +0 -146
- qemu/qmp/protocol.py +0 -1057
- qemu/qmp/py.typed +0 -0
- qemu/qmp/qmp_client.py +0 -655
- qemu/qmp/qmp_shell.py +0 -618
- qemu/qmp/qmp_tui.py +0 -655
- qemu/qmp/util.py +0 -219
- qemu/utils/__init__.py +0 -162
- qemu/utils/accel.py +0 -84
- qemu/utils/py.typed +0 -0
- qemu/utils/qemu_ga_client.py +0 -323
- qemu/utils/qom.py +0 -273
- qemu/utils/qom_common.py +0 -175
- qemu/utils/qom_fuse.py +0 -207
maqet/qmp/keyboard.py
ADDED
@@ -0,0 +1,311 @@
|
|
1
|
+
"""
|
2
|
+
QMP Keyboard Emulator
|
3
|
+
|
4
|
+
Provides keyboard input functionality for QMP commands.
|
5
|
+
Ported from old maqet implementation to work with the unified API system.
|
6
|
+
"""
|
7
|
+
|
8
|
+
from typing import Any, Dict, List
|
9
|
+
|
10
|
+
|
11
|
+
class KeyboardEmulatorError(Exception):
|
12
|
+
"""Keyboard Emulator Error"""
|
13
|
+
|
14
|
+
|
15
|
+
class KeyboardEmulator:
|
16
|
+
"""
|
17
|
+
QMP keyboard emulation utilities.
|
18
|
+
|
19
|
+
Provides methods to generate QMP commands for keyboard input,
|
20
|
+
including key presses and text typing.
|
21
|
+
"""
|
22
|
+
|
23
|
+
@classmethod
|
24
|
+
def get_keys(cls) -> List[str]:
|
25
|
+
"""Get list of available key names."""
|
26
|
+
return KEYS
|
27
|
+
|
28
|
+
@classmethod
|
29
|
+
def press_keys(cls, *keys: str, hold_time: int = 100) -> Dict[str, Any]:
|
30
|
+
"""
|
31
|
+
Generate QMP command for pressing specified keys.
|
32
|
+
|
33
|
+
Args:
|
34
|
+
*keys: Key names to press (e.g., 'ctrl', 'alt', 'f2')
|
35
|
+
hold_time: How long to hold keys in milliseconds
|
36
|
+
|
37
|
+
Returns:
|
38
|
+
QMP command dictionary
|
39
|
+
"""
|
40
|
+
return {
|
41
|
+
"command": "send-key",
|
42
|
+
"arguments": {
|
43
|
+
"keys": [{"type": "qcode", "data": key} for key in keys],
|
44
|
+
"hold-time": hold_time,
|
45
|
+
},
|
46
|
+
}
|
47
|
+
|
48
|
+
@classmethod
|
49
|
+
def type_string(
|
50
|
+
cls, string: str, hold_time: int = 100
|
51
|
+
) -> List[Dict[str, Any]]:
|
52
|
+
"""
|
53
|
+
Generate sequence of QMP commands to type a string.
|
54
|
+
|
55
|
+
Args:
|
56
|
+
string: Text to type
|
57
|
+
hold_time: How long to hold each key in milliseconds
|
58
|
+
|
59
|
+
Returns:
|
60
|
+
List of QMP command dictionaries
|
61
|
+
"""
|
62
|
+
if not isinstance(string, str):
|
63
|
+
raise KeyboardEmulatorError(
|
64
|
+
f"Got {type(string)} instead of string"
|
65
|
+
)
|
66
|
+
|
67
|
+
return [
|
68
|
+
cls.press_keys(*cls._char_to_keys(char), hold_time=hold_time)
|
69
|
+
for char in string
|
70
|
+
]
|
71
|
+
|
72
|
+
@classmethod
|
73
|
+
def _char_to_keys(cls, char: str) -> List[str]:
|
74
|
+
"""Convert character to key sequence."""
|
75
|
+
if len(char) != 1:
|
76
|
+
raise KeyboardEmulatorError("Got string instead of one char")
|
77
|
+
|
78
|
+
if char in KEYS:
|
79
|
+
return [char]
|
80
|
+
elif char.lower() in KEYS:
|
81
|
+
return ["shift", char.lower()]
|
82
|
+
elif char in BASIC_KEYS:
|
83
|
+
return BASIC_KEYS[char]
|
84
|
+
elif char in CHAR_KEYS:
|
85
|
+
return [CHAR_KEYS[char]]
|
86
|
+
elif char in SHIFT_CHAR_KEYS:
|
87
|
+
return ["shift", SHIFT_CHAR_KEYS[char]]
|
88
|
+
else:
|
89
|
+
raise KeyboardEmulatorError(
|
90
|
+
f"Character {char} cannot be translated into keys"
|
91
|
+
)
|
92
|
+
|
93
|
+
|
94
|
+
# QMP key names from QEMU documentation
|
95
|
+
# https://qemu-project.gitlab.io/qemu/interop/qemu-qmp-ref.html#qapidoc-0
|
96
|
+
KEYS = [
|
97
|
+
"unmapped",
|
98
|
+
"pause",
|
99
|
+
"ro",
|
100
|
+
"kp_comma",
|
101
|
+
"kp_equals",
|
102
|
+
"power",
|
103
|
+
"hiragana",
|
104
|
+
"henkan",
|
105
|
+
"yen",
|
106
|
+
"sleep",
|
107
|
+
"wake",
|
108
|
+
"audionext",
|
109
|
+
"audioprev",
|
110
|
+
"audiostop",
|
111
|
+
"audioplay",
|
112
|
+
"audiomute",
|
113
|
+
"volumeup",
|
114
|
+
"volumedown",
|
115
|
+
"mediaselect",
|
116
|
+
"mail",
|
117
|
+
"calculator",
|
118
|
+
"computer",
|
119
|
+
"ac_home",
|
120
|
+
"ac_back",
|
121
|
+
"ac_forward",
|
122
|
+
"ac_refresh",
|
123
|
+
"ac_bookmarks",
|
124
|
+
"muhenkan",
|
125
|
+
"katakanahiragana",
|
126
|
+
"lang1",
|
127
|
+
"lang2",
|
128
|
+
"f13",
|
129
|
+
"f14",
|
130
|
+
"f15",
|
131
|
+
"f16",
|
132
|
+
"f17",
|
133
|
+
"f18",
|
134
|
+
"f19",
|
135
|
+
"f20",
|
136
|
+
"f21",
|
137
|
+
"f22",
|
138
|
+
"f23",
|
139
|
+
"f24",
|
140
|
+
"shift",
|
141
|
+
"shift_r",
|
142
|
+
"alt",
|
143
|
+
"alt_r",
|
144
|
+
"ctrl",
|
145
|
+
"ctrl_r",
|
146
|
+
"menu",
|
147
|
+
"esc",
|
148
|
+
"1",
|
149
|
+
"2",
|
150
|
+
"3",
|
151
|
+
"4",
|
152
|
+
"5",
|
153
|
+
"6",
|
154
|
+
"7",
|
155
|
+
"8",
|
156
|
+
"9",
|
157
|
+
"0",
|
158
|
+
"minus",
|
159
|
+
"equal",
|
160
|
+
"backspace",
|
161
|
+
"tab",
|
162
|
+
"q",
|
163
|
+
"w",
|
164
|
+
"e",
|
165
|
+
"r",
|
166
|
+
"t",
|
167
|
+
"y",
|
168
|
+
"u",
|
169
|
+
"i",
|
170
|
+
"o",
|
171
|
+
"p",
|
172
|
+
"bracket_left",
|
173
|
+
"bracket_right",
|
174
|
+
"ret",
|
175
|
+
"a",
|
176
|
+
"s",
|
177
|
+
"d",
|
178
|
+
"f",
|
179
|
+
"g",
|
180
|
+
"h",
|
181
|
+
"j",
|
182
|
+
"k",
|
183
|
+
"l",
|
184
|
+
"semicolon",
|
185
|
+
"apostrophe",
|
186
|
+
"grave_accent",
|
187
|
+
"backslash",
|
188
|
+
"z",
|
189
|
+
"x",
|
190
|
+
"c",
|
191
|
+
"v",
|
192
|
+
"b",
|
193
|
+
"n",
|
194
|
+
"m",
|
195
|
+
"comma",
|
196
|
+
"dot",
|
197
|
+
"slash",
|
198
|
+
"asterisk",
|
199
|
+
"spc",
|
200
|
+
"caps_lock",
|
201
|
+
"f1",
|
202
|
+
"f2",
|
203
|
+
"f3",
|
204
|
+
"f4",
|
205
|
+
"f5",
|
206
|
+
"f6",
|
207
|
+
"f7",
|
208
|
+
"f8",
|
209
|
+
"f9",
|
210
|
+
"f10",
|
211
|
+
"num_lock",
|
212
|
+
"scroll_lock",
|
213
|
+
"kp_divide",
|
214
|
+
"kp_multiply",
|
215
|
+
"kp_subtract",
|
216
|
+
"kp_add",
|
217
|
+
"kp_enter",
|
218
|
+
"kp_decimal",
|
219
|
+
"sysrq",
|
220
|
+
"kp_0",
|
221
|
+
"kp_1",
|
222
|
+
"kp_2",
|
223
|
+
"kp_3",
|
224
|
+
"kp_4",
|
225
|
+
"kp_5",
|
226
|
+
"kp_6",
|
227
|
+
"kp_7",
|
228
|
+
"kp_8",
|
229
|
+
"kp_9",
|
230
|
+
"less",
|
231
|
+
"f11",
|
232
|
+
"f12",
|
233
|
+
"print",
|
234
|
+
"home",
|
235
|
+
"pgup",
|
236
|
+
"pgdn",
|
237
|
+
"end",
|
238
|
+
"left",
|
239
|
+
"up",
|
240
|
+
"down",
|
241
|
+
"right",
|
242
|
+
"insert",
|
243
|
+
"delete",
|
244
|
+
"stop",
|
245
|
+
"again",
|
246
|
+
"props",
|
247
|
+
"undo",
|
248
|
+
"front",
|
249
|
+
"copy",
|
250
|
+
"open",
|
251
|
+
"paste",
|
252
|
+
"find",
|
253
|
+
"cut",
|
254
|
+
"lf",
|
255
|
+
"help",
|
256
|
+
"meta_l",
|
257
|
+
"meta_r",
|
258
|
+
"compose",
|
259
|
+
]
|
260
|
+
|
261
|
+
BASIC_KEYS = {
|
262
|
+
"\r": ["ret"],
|
263
|
+
"\n": ["ret"],
|
264
|
+
" ": ["spc"],
|
265
|
+
}
|
266
|
+
|
267
|
+
CHAR_KEYS = {
|
268
|
+
# Row 1
|
269
|
+
"`": "grave_accent",
|
270
|
+
"=": "equal",
|
271
|
+
"-": "minus",
|
272
|
+
# Row 2
|
273
|
+
"[": "bracket_left",
|
274
|
+
"]": "bracket_right",
|
275
|
+
"\\": "backslash",
|
276
|
+
# Row 3
|
277
|
+
";": "semicolon",
|
278
|
+
"'": "apostrophe",
|
279
|
+
# Row 4
|
280
|
+
",": "comma",
|
281
|
+
".": "dot",
|
282
|
+
"/": "slash",
|
283
|
+
}
|
284
|
+
|
285
|
+
SHIFT_CHAR_KEYS = {
|
286
|
+
# Row 1
|
287
|
+
"~": "grave_accent",
|
288
|
+
"!": "1",
|
289
|
+
"@": "2",
|
290
|
+
"#": "3",
|
291
|
+
"$": "4",
|
292
|
+
"%": "5",
|
293
|
+
"^": "6",
|
294
|
+
"&": "7",
|
295
|
+
"*": "8",
|
296
|
+
"(": "9",
|
297
|
+
")": "0",
|
298
|
+
"_": "minus",
|
299
|
+
"+": "equal",
|
300
|
+
# Row 2
|
301
|
+
"{": "bracket_left",
|
302
|
+
"}": "bracket_right",
|
303
|
+
"|": "backslash",
|
304
|
+
# Row 3
|
305
|
+
":": "semicolon",
|
306
|
+
'"': "apostrophe",
|
307
|
+
# Row 4
|
308
|
+
"<": "comma",
|
309
|
+
">": "dot",
|
310
|
+
"?": "slash",
|
311
|
+
}
|
maqet/qmp/qmp.py
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
"""
|
2
|
+
QMP Module - Future Enhancements Placeholder
|
3
|
+
|
4
|
+
This module is reserved for future QMP abstractions and utilities.
|
5
|
+
Currently, QMP functionality is implemented in:
|
6
|
+
- maqet/machine.py: Core QMP command execution
|
7
|
+
- maqet/qmp/keyboard.py: Keyboard emulation utilities
|
8
|
+
|
9
|
+
Future enhancements to consider:
|
10
|
+
- QMP command abstractions and builder pattern
|
11
|
+
- QMP event handling and monitoring
|
12
|
+
- Async QMP support for non-blocking operations
|
13
|
+
- QMP capabilities negotiation
|
14
|
+
- QMP command queueing and rate limiting
|
15
|
+
- QMP response validation and error handling
|
16
|
+
- High-level QMP abstractions (device management, migration, etc.)
|
17
|
+
"""
|