text_prompt stringlengths 157 13.1k | code_prompt stringlengths 7 19.8k ⌀ |
|---|---|
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def read(self, to_read, timeout_ms):
"""Reads data from this file. in to_read of type int Number of bytes to read. in timeout_ms of type int Timeout (in ms) to wait for the operation to complete. Pass 0 for an infinite timeout. return data of type str Array of data read. raises :class:`OleErrorNotimpl` The method is not implemented yet. """ |
if not isinstance(to_read, baseinteger):
raise TypeError("to_read can only be an instance of type baseinteger")
if not isinstance(timeout_ms, baseinteger):
raise TypeError("timeout_ms can only be an instance of type baseinteger")
data = self._call("read",
in_p=[to_read, timeout_ms])
return data |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def read_at(self, offset, to_read, timeout_ms):
"""Reads data from an offset of this file. in offset of type int Offset in bytes to start reading. in to_read of type int Number of bytes to read. in timeout_ms of type int Timeout (in ms) to wait for the operation to complete. Pass 0 for an infinite timeout. return data of type str Array of data read. raises :class:`OleErrorNotimpl` The method is not implemented yet. """ |
if not isinstance(offset, baseinteger):
raise TypeError("offset can only be an instance of type baseinteger")
if not isinstance(to_read, baseinteger):
raise TypeError("to_read can only be an instance of type baseinteger")
if not isinstance(timeout_ms, baseinteger):
raise TypeError("timeout_ms can only be an instance of type baseinteger")
data = self._call("readAt",
in_p=[offset, to_read, timeout_ms])
return data |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def set_acl(self, acl, mode):
"""Sets the ACL of this file. in acl of type str The ACL specification string. To-be-defined. in mode of type int UNIX-style mode mask to use if @a acl is empty. As mention in :py:func:`IGuestSession.directory_create` this is realized on a best effort basis and the exact behavior depends on the Guest OS. raises :class:`OleErrorNotimpl` The method is not implemented yet. """ |
if not isinstance(acl, basestring):
raise TypeError("acl can only be an instance of type basestring")
if not isinstance(mode, baseinteger):
raise TypeError("mode can only be an instance of type baseinteger")
self._call("setACL",
in_p=[acl, mode]) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def set_size(self, size):
"""Changes the file size. in size of type int The new file size. raises :class:`OleErrorNotimpl` The method is not implemented yet. """ |
if not isinstance(size, baseinteger):
raise TypeError("size can only be an instance of type baseinteger")
self._call("setSize",
in_p=[size]) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def internal_get_statistics(self):
"""Internal method; do not use as it might change at any time. out cpu_user of type int Percentage of processor time spent in user mode as seen by the guest. out cpu_kernel of type int Percentage of processor time spent in kernel mode as seen by the guest. out cpu_idle of type int Percentage of processor time spent idling as seen by the guest. out mem_total of type int Total amount of physical guest RAM. out mem_free of type int Free amount of physical guest RAM. out mem_balloon of type int Amount of ballooned physical guest RAM. out mem_shared of type int Amount of shared physical guest RAM. out mem_cache of type int Total amount of guest (disk) cache memory. out paged_total of type int Total amount of space in the page file. out mem_alloc_total of type int Total amount of memory allocated by the hypervisor. out mem_free_total of type int Total amount of free memory available in the hypervisor. out mem_balloon_total of type int Total amount of memory ballooned by the hypervisor. out mem_shared_total of type int Total amount of shared memory in the hypervisor. """ |
(cpu_user, cpu_kernel, cpu_idle, mem_total, mem_free, mem_balloon, mem_shared, mem_cache, paged_total, mem_alloc_total, mem_free_total, mem_balloon_total, mem_shared_total) = self._call("internalGetStatistics")
return (cpu_user, cpu_kernel, cpu_idle, mem_total, mem_free, mem_balloon, mem_shared, mem_cache, paged_total, mem_alloc_total, mem_free_total, mem_balloon_total, mem_shared_total) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def get_facility_status(self, facility):
"""Get the current status of a Guest Additions facility. in facility of type :class:`AdditionsFacilityType` Facility to check status for. out timestamp of type int Timestamp (in ms) of last status update seen by the host. return status of type :class:`AdditionsFacilityStatus` The current (latest) facility status. """ |
if not isinstance(facility, AdditionsFacilityType):
raise TypeError("facility can only be an instance of type AdditionsFacilityType")
(status, timestamp) = self._call("getFacilityStatus",
in_p=[facility])
status = AdditionsFacilityStatus(status)
return (status, timestamp) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def get_additions_status(self, level):
"""Retrieve the current status of a certain Guest Additions run level. in level of type :class:`AdditionsRunLevelType` Status level to check return active of type bool Flag whether the status level has been reached or not raises :class:`VBoxErrorNotSupported` Wrong status level specified. """ |
if not isinstance(level, AdditionsRunLevelType):
raise TypeError("level can only be an instance of type AdditionsRunLevelType")
active = self._call("getAdditionsStatus",
in_p=[level])
return active |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def set_credentials(self, user_name, password, domain, allow_interactive_logon):
"""Store login credentials that can be queried by guest operating systems with Additions installed. The credentials are transient to the session and the guest may also choose to erase them. Note that the caller cannot determine whether the guest operating system has queried or made use of the credentials. in user_name of type str User name string, can be empty in password of type str Password string, can be empty in domain of type str Domain name (guest logon scheme specific), can be empty in allow_interactive_logon of type bool Flag whether the guest should alternatively allow the user to interactively specify different credentials. This flag might not be supported by all versions of the Additions. raises :class:`VBoxErrorVmError` VMM device is not available. """ |
if not isinstance(user_name, basestring):
raise TypeError("user_name can only be an instance of type basestring")
if not isinstance(password, basestring):
raise TypeError("password can only be an instance of type basestring")
if not isinstance(domain, basestring):
raise TypeError("domain can only be an instance of type basestring")
if not isinstance(allow_interactive_logon, bool):
raise TypeError("allow_interactive_logon can only be an instance of type bool")
self._call("setCredentials",
in_p=[user_name, password, domain, allow_interactive_logon]) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def find_session(self, session_name):
"""Finds guest sessions by their friendly name and returns an interface array with all found guest sessions. in session_name of type str The session's friendly name to find. Wildcards like ? and * are allowed. return sessions of type :class:`IGuestSession` Array with all guest sessions found matching the name specified. """ |
if not isinstance(session_name, basestring):
raise TypeError("session_name can only be an instance of type basestring")
sessions = self._call("findSession",
in_p=[session_name])
sessions = [IGuestSession(a) for a in sessions]
return sessions |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def set_ids(self, set_image_id, image_id, set_parent_id, parent_id):
"""Changes the UUID and parent UUID for a hard disk medium. in set_image_id of type bool Select whether a new image UUID is set or not. in image_id of type str New UUID for the image. If an empty string is passed, then a new UUID is automatically created, provided that @a setImageId is @c true. Specifying a zero UUID is not allowed. in set_parent_id of type bool Select whether a new parent UUID is set or not. in parent_id of type str New parent UUID for the image. If an empty string is passed, then a new UUID is automatically created, provided @a setParentId is @c true. A zero UUID is valid. raises :class:`OleErrorInvalidarg` Invalid parameter combination. raises :class:`VBoxErrorNotSupported` Medium is not a hard disk medium. """ |
if not isinstance(set_image_id, bool):
raise TypeError("set_image_id can only be an instance of type bool")
if not isinstance(image_id, basestring):
raise TypeError("image_id can only be an instance of type basestring")
if not isinstance(set_parent_id, bool):
raise TypeError("set_parent_id can only be an instance of type bool")
if not isinstance(parent_id, basestring):
raise TypeError("parent_id can only be an instance of type basestring")
self._call("setIds",
in_p=[set_image_id, image_id, set_parent_id, parent_id]) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def check_encryption_password(self, password):
"""Checks whether the supplied password is correct for the medium. in password of type str The password to check. raises :class:`VBoxErrorNotSupported` Encryption is not configured for this medium. raises :class:`VBoxErrorPasswordIncorrect` The given password is incorrect. """ |
if not isinstance(password, basestring):
raise TypeError("password can only be an instance of type basestring")
self._call("checkEncryptionPassword",
in_p=[password]) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def write(self, offset, data):
"""Write data to the medium. in offset of type int The byte offset into the medium to start reading at. in data of type str Array of data to write. return written of type int How many bytes were actually written. """ |
if not isinstance(offset, baseinteger):
raise TypeError("offset can only be an instance of type baseinteger")
if not isinstance(data, list):
raise TypeError("data can only be an instance of type list")
for a in data[:10]:
if not isinstance(a, basestring):
raise TypeError(
"array can only contain objects of type basestring")
written = self._call("write",
in_p=[offset, data])
return written |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def format_fat(self, quick):
"""Formats the medium as FAT. Generally only useful for floppy images as no partition table will be created. in quick of type bool Quick format it when set. """ |
if not isinstance(quick, bool):
raise TypeError("quick can only be an instance of type bool")
self._call("formatFAT",
in_p=[quick]) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def initialize_partition_table(self, format_p, whole_disk_in_one_entry):
"""Writes an empty partition table to the disk. in format_p of type :class:`PartitionTableType` The partition table format. in whole_disk_in_one_entry of type bool When @c true a partition table entry for the whole disk is created. Otherwise the partition table is empty. """ |
if not isinstance(format_p, PartitionTableType):
raise TypeError("format_p can only be an instance of type PartitionTableType")
if not isinstance(whole_disk_in_one_entry, bool):
raise TypeError("whole_disk_in_one_entry can only be an instance of type bool")
self._call("initializePartitionTable",
in_p=[format_p, whole_disk_in_one_entry]) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def put_scancode(self, scancode):
"""Sends a scancode to the keyboard. in scancode of type int raises :class:`VBoxErrorIprtError` Could not send scan code to virtual keyboard. """ |
if not isinstance(scancode, baseinteger):
raise TypeError("scancode can only be an instance of type baseinteger")
self._call("putScancode",
in_p=[scancode]) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def put_scancodes(self, scancodes):
"""Sends an array of scancodes to the keyboard. in scancodes of type int return codes_stored of type int raises :class:`VBoxErrorIprtError` Could not send all scan codes to virtual keyboard. """ |
if not isinstance(scancodes, list):
raise TypeError("scancodes can only be an instance of type list")
for a in scancodes[:10]:
if not isinstance(a, baseinteger):
raise TypeError(
"array can only contain objects of type baseinteger")
codes_stored = self._call("putScancodes",
in_p=[scancodes])
return codes_stored |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def put_mouse_event(self, dx, dy, dz, dw, button_state):
"""Initiates a mouse event using relative pointer movements along x and y axis. in dx of type int Amount of pixels the mouse should move to the right. Negative values move the mouse to the left. in dy of type int Amount of pixels the mouse should move downwards. Negative values move the mouse upwards. in dz of type int Amount of mouse wheel moves. Positive values describe clockwise wheel rotations, negative values describe counterclockwise rotations. in dw of type int Amount of horizontal mouse wheel moves. Positive values describe a movement to the left, negative values describe a movement to the right. in button_state of type int The current state of mouse buttons. Every bit represents a mouse button as follows: Bit 0 (0x01)left mouse button Bit 1 (0x02)right mouse button Bit 2 (0x04)middle mouse button A value of 1 means the corresponding button is pressed. otherwise it is released. raises :class:`OleErrorAccessdenied` Console not powered up. raises :class:`VBoxErrorIprtError` Could not send mouse event to virtual mouse. """ |
if not isinstance(dx, baseinteger):
raise TypeError("dx can only be an instance of type baseinteger")
if not isinstance(dy, baseinteger):
raise TypeError("dy can only be an instance of type baseinteger")
if not isinstance(dz, baseinteger):
raise TypeError("dz can only be an instance of type baseinteger")
if not isinstance(dw, baseinteger):
raise TypeError("dw can only be an instance of type baseinteger")
if not isinstance(button_state, baseinteger):
raise TypeError("button_state can only be an instance of type baseinteger")
self._call("putMouseEvent",
in_p=[dx, dy, dz, dw, button_state]) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def query_bitmap_info(self):
"""Information about the screen bitmap. out address of type str out width of type int out height of type int out bits_per_pixel of type int out bytes_per_line of type int out bitmap_format of type :class:`BitmapFormat` """ |
(address, width, height, bits_per_pixel, bytes_per_line, bitmap_format) = self._call("queryBitmapInfo")
bitmap_format = BitmapFormat(bitmap_format)
return (address, width, height, bits_per_pixel, bytes_per_line, bitmap_format) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def notify_update(self, x, y, width, height):
"""Informs about an update. Gets called by the display object where this buffer is registered. in x of type int in y of type int in width of type int in height of type int """ |
if not isinstance(x, baseinteger):
raise TypeError("x can only be an instance of type baseinteger")
if not isinstance(y, baseinteger):
raise TypeError("y can only be an instance of type baseinteger")
if not isinstance(width, baseinteger):
raise TypeError("width can only be an instance of type baseinteger")
if not isinstance(height, baseinteger):
raise TypeError("height can only be an instance of type baseinteger")
self._call("notifyUpdate",
in_p=[x, y, width, height]) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def notify_update_image(self, x, y, width, height, image):
"""Informs about an update and provides 32bpp bitmap. in x of type int in y of type int in width of type int in height of type int in image of type str Array with 32BPP image data. """ |
if not isinstance(x, baseinteger):
raise TypeError("x can only be an instance of type baseinteger")
if not isinstance(y, baseinteger):
raise TypeError("y can only be an instance of type baseinteger")
if not isinstance(width, baseinteger):
raise TypeError("width can only be an instance of type baseinteger")
if not isinstance(height, baseinteger):
raise TypeError("height can only be an instance of type baseinteger")
if not isinstance(image, list):
raise TypeError("image can only be an instance of type list")
for a in image[:10]:
if not isinstance(a, basestring):
raise TypeError(
"array can only contain objects of type basestring")
self._call("notifyUpdateImage",
in_p=[x, y, width, height, image]) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def notify_change(self, screen_id, x_origin, y_origin, width, height):
"""Requests a size change. in screen_id of type int Logical guest screen number. in x_origin of type int Location of the screen in the guest. in y_origin of type int Location of the screen in the guest. in width of type int Width of the guest display, in pixels. in height of type int Height of the guest display, in pixels. """ |
if not isinstance(screen_id, baseinteger):
raise TypeError("screen_id can only be an instance of type baseinteger")
if not isinstance(x_origin, baseinteger):
raise TypeError("x_origin can only be an instance of type baseinteger")
if not isinstance(y_origin, baseinteger):
raise TypeError("y_origin can only be an instance of type baseinteger")
if not isinstance(width, baseinteger):
raise TypeError("width can only be an instance of type baseinteger")
if not isinstance(height, baseinteger):
raise TypeError("height can only be an instance of type baseinteger")
self._call("notifyChange",
in_p=[screen_id, x_origin, y_origin, width, height]) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def notify3_d_event(self, type_p, data):
"""Notifies framebuffer about 3D backend event. in type_p of type int event type. Currently only VBOX3D_NOTIFY_EVENT_TYPE_VISIBLE_3DDATA is supported. in data of type str event-specific data, depends on the supplied event type """ |
if not isinstance(type_p, baseinteger):
raise TypeError("type_p can only be an instance of type baseinteger")
if not isinstance(data, list):
raise TypeError("data can only be an instance of type list")
for a in data[:10]:
if not isinstance(a, basestring):
raise TypeError(
"array can only contain objects of type basestring")
self._call("notify3DEvent",
in_p=[type_p, data]) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def move(self, x, y):
"""Changes the overlay's position relative to the IFramebuffer. in x of type int in y of type int """ |
if not isinstance(x, baseinteger):
raise TypeError("x can only be an instance of type baseinteger")
if not isinstance(y, baseinteger):
raise TypeError("y can only be an instance of type baseinteger")
self._call("move",
in_p=[x, y]) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def attach_framebuffer(self, screen_id, framebuffer):
"""Sets the graphics update target for a screen. in screen_id of type int in framebuffer of type :class:`IFramebuffer` return id_p of type str """ |
if not isinstance(screen_id, baseinteger):
raise TypeError("screen_id can only be an instance of type baseinteger")
if not isinstance(framebuffer, IFramebuffer):
raise TypeError("framebuffer can only be an instance of type IFramebuffer")
id_p = self._call("attachFramebuffer",
in_p=[screen_id, framebuffer])
return id_p |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def detach_framebuffer(self, screen_id, id_p):
"""Removes the graphics updates target for a screen. in screen_id of type int in id_p of type str """ |
if not isinstance(screen_id, baseinteger):
raise TypeError("screen_id can only be an instance of type baseinteger")
if not isinstance(id_p, basestring):
raise TypeError("id_p can only be an instance of type basestring")
self._call("detachFramebuffer",
in_p=[screen_id, id_p]) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def query_framebuffer(self, screen_id):
"""Queries the graphics updates targets for a screen. in screen_id of type int return framebuffer of type :class:`IFramebuffer` """ |
if not isinstance(screen_id, baseinteger):
raise TypeError("screen_id can only be an instance of type baseinteger")
framebuffer = self._call("queryFramebuffer",
in_p=[screen_id])
framebuffer = IFramebuffer(framebuffer)
return framebuffer |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def take_screen_shot_to_array(self, screen_id, width, height, bitmap_format):
"""Takes a guest screen shot of the requested size and format and returns it as an array of bytes. in screen_id of type int The guest monitor to take screenshot from. in width of type int Desired image width. in height of type int Desired image height. in bitmap_format of type :class:`BitmapFormat` The requested format. return screen_data of type str Array with resulting screen data. """ |
if not isinstance(screen_id, baseinteger):
raise TypeError("screen_id can only be an instance of type baseinteger")
if not isinstance(width, baseinteger):
raise TypeError("width can only be an instance of type baseinteger")
if not isinstance(height, baseinteger):
raise TypeError("height can only be an instance of type baseinteger")
if not isinstance(bitmap_format, BitmapFormat):
raise TypeError("bitmap_format can only be an instance of type BitmapFormat")
screen_data = self._call("takeScreenShotToArray",
in_p=[screen_id, width, height, bitmap_format])
return screen_data |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def draw_to_screen(self, screen_id, address, x, y, width, height):
"""Draws a 32-bpp image of the specified size from the given buffer to the given point on the VM display. in screen_id of type int Monitor to take the screenshot from. in address of type str Address to store the screenshot to in x of type int Relative to the screen top left corner. in y of type int Relative to the screen top left corner. in width of type int Desired image width. in height of type int Desired image height. raises :class:`OleErrorNotimpl` Feature not implemented. raises :class:`VBoxErrorIprtError` Could not draw to screen. """ |
if not isinstance(screen_id, baseinteger):
raise TypeError("screen_id can only be an instance of type baseinteger")
if not isinstance(address, basestring):
raise TypeError("address can only be an instance of type basestring")
if not isinstance(x, baseinteger):
raise TypeError("x can only be an instance of type baseinteger")
if not isinstance(y, baseinteger):
raise TypeError("y can only be an instance of type baseinteger")
if not isinstance(width, baseinteger):
raise TypeError("width can only be an instance of type baseinteger")
if not isinstance(height, baseinteger):
raise TypeError("height can only be an instance of type baseinteger")
self._call("drawToScreen",
in_p=[screen_id, address, x, y, width, height]) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def invalidate_and_update_screen(self, screen_id):
"""Redraw the specified VM screen. in screen_id of type int The guest screen to redraw. """ |
if not isinstance(screen_id, baseinteger):
raise TypeError("screen_id can only be an instance of type baseinteger")
self._call("invalidateAndUpdateScreen",
in_p=[screen_id]) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def complete_vhwa_command(self, command):
"""Signals that the Video HW Acceleration command has completed. in command of type str Pointer to VBOXVHWACMD containing the completed command. """ |
if not isinstance(command, basestring):
raise TypeError("command can only be an instance of type basestring")
self._call("completeVHWACommand",
in_p=[command]) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def viewport_changed(self, screen_id, x, y, width, height):
"""Signals that framebuffer window viewport has changed. in screen_id of type int Monitor to take the screenshot from. in x of type int Framebuffer x offset. in y of type int Framebuffer y offset. in width of type int Viewport width. in height of type int Viewport height. raises :class:`OleErrorInvalidarg` The specified viewport data is invalid. """ |
if not isinstance(screen_id, baseinteger):
raise TypeError("screen_id can only be an instance of type baseinteger")
if not isinstance(x, baseinteger):
raise TypeError("x can only be an instance of type baseinteger")
if not isinstance(y, baseinteger):
raise TypeError("y can only be an instance of type baseinteger")
if not isinstance(width, baseinteger):
raise TypeError("width can only be an instance of type baseinteger")
if not isinstance(height, baseinteger):
raise TypeError("height can only be an instance of type baseinteger")
self._call("viewportChanged",
in_p=[screen_id, x, y, width, height]) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def query_source_bitmap(self, screen_id):
"""Obtains the guest screen bitmap parameters. in screen_id of type int out display_source_bitmap of type :class:`IDisplaySourceBitmap` """ |
if not isinstance(screen_id, baseinteger):
raise TypeError("screen_id can only be an instance of type baseinteger")
display_source_bitmap = self._call("querySourceBitmap",
in_p=[screen_id])
display_source_bitmap = IDisplaySourceBitmap(display_source_bitmap)
return display_source_bitmap |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def notify_scale_factor_change(self, screen_id, u32_scale_factor_w_multiplied, u32_scale_factor_h_multiplied):
"""Notify OpenGL HGCM host service about graphics content scaling factor change. in screen_id of type int in u32_scale_factor_w_multiplied of type int in u32_scale_factor_h_multiplied of type int """ |
if not isinstance(screen_id, baseinteger):
raise TypeError("screen_id can only be an instance of type baseinteger")
if not isinstance(u32_scale_factor_w_multiplied, baseinteger):
raise TypeError("u32_scale_factor_w_multiplied can only be an instance of type baseinteger")
if not isinstance(u32_scale_factor_h_multiplied, baseinteger):
raise TypeError("u32_scale_factor_h_multiplied can only be an instance of type baseinteger")
self._call("notifyScaleFactorChange",
in_p=[screen_id, u32_scale_factor_w_multiplied, u32_scale_factor_h_multiplied]) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def notify_hi_dpi_output_policy_change(self, f_unscaled_hi_dpi):
"""Notify OpenGL HGCM host service about HiDPI monitor scaling policy change. in f_unscaled_hi_dpi of type bool """ |
if not isinstance(f_unscaled_hi_dpi, bool):
raise TypeError("f_unscaled_hi_dpi can only be an instance of type bool")
self._call("notifyHiDPIOutputPolicyChange",
in_p=[f_unscaled_hi_dpi]) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def set_screen_layout(self, screen_layout_mode, guest_screen_info):
"""Set video modes for the guest screens. in screen_layout_mode of type :class:`ScreenLayoutMode` in guest_screen_info of type :class:`IGuestScreenInfo` """ |
if not isinstance(screen_layout_mode, ScreenLayoutMode):
raise TypeError("screen_layout_mode can only be an instance of type ScreenLayoutMode")
if not isinstance(guest_screen_info, list):
raise TypeError("guest_screen_info can only be an instance of type list")
for a in guest_screen_info[:10]:
if not isinstance(a, IGuestScreenInfo):
raise TypeError(
"array can only contain objects of type IGuestScreenInfo")
self._call("setScreenLayout",
in_p=[screen_layout_mode, guest_screen_info]) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def detach_screens(self, screen_ids):
"""Unplugs monitors from the virtual graphics card. in screen_ids of type int """ |
if not isinstance(screen_ids, list):
raise TypeError("screen_ids can only be an instance of type list")
for a in screen_ids[:10]:
if not isinstance(a, baseinteger):
raise TypeError(
"array can only contain objects of type baseinteger")
self._call("detachScreens",
in_p=[screen_ids]) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def create_guest_screen_info(self, display, status, primary, change_origin, origin_x, origin_y, width, height, bits_per_pixel):
"""Make a IGuestScreenInfo object with the provided parameters. in display of type int The number of the guest display. in status of type :class:`GuestMonitorStatus` @c True, if this guest screen is enabled, @c False otherwise. in primary of type bool Whether this guest monitor must be primary. in change_origin of type bool @c True, if the origin of the guest screen should be changed, @c False otherwise. in origin_x of type int The X origin of the guest screen. in origin_y of type int The Y origin of the guest screen. in width of type int The width of the guest screen. in height of type int The height of the guest screen. in bits_per_pixel of type int The number of bits per pixel of the guest screen. return guest_screen_info of type :class:`IGuestScreenInfo` The created object. """ |
if not isinstance(display, baseinteger):
raise TypeError("display can only be an instance of type baseinteger")
if not isinstance(status, GuestMonitorStatus):
raise TypeError("status can only be an instance of type GuestMonitorStatus")
if not isinstance(primary, bool):
raise TypeError("primary can only be an instance of type bool")
if not isinstance(change_origin, bool):
raise TypeError("change_origin can only be an instance of type bool")
if not isinstance(origin_x, baseinteger):
raise TypeError("origin_x can only be an instance of type baseinteger")
if not isinstance(origin_y, baseinteger):
raise TypeError("origin_y can only be an instance of type baseinteger")
if not isinstance(width, baseinteger):
raise TypeError("width can only be an instance of type baseinteger")
if not isinstance(height, baseinteger):
raise TypeError("height can only be an instance of type baseinteger")
if not isinstance(bits_per_pixel, baseinteger):
raise TypeError("bits_per_pixel can only be an instance of type baseinteger")
guest_screen_info = self._call("createGuestScreenInfo",
in_p=[display, status, primary, change_origin, origin_x, origin_y, width, height, bits_per_pixel])
guest_screen_info = IGuestScreenInfo(guest_screen_info)
return guest_screen_info |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def modify_log_groups(self, settings):
"""Modifies the group settings of the debug or release logger. in settings of type str The group settings string. See iprt/log.h for details. To target the release logger, prefix the string with "release:". """ |
if not isinstance(settings, basestring):
raise TypeError("settings can only be an instance of type basestring")
self._call("modifyLogGroups",
in_p=[settings]) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def modify_log_flags(self, settings):
"""Modifies the debug or release logger flags. in settings of type str The flags settings string. See iprt/log.h for details. To target the release logger, prefix the string with "release:". """ |
if not isinstance(settings, basestring):
raise TypeError("settings can only be an instance of type basestring")
self._call("modifyLogFlags",
in_p=[settings]) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def modify_log_destinations(self, settings):
"""Modifies the debug or release logger destinations. in settings of type str The destination settings string. See iprt/log.h for details. To target the release logger, prefix the string with "release:". """ |
if not isinstance(settings, basestring):
raise TypeError("settings can only be an instance of type basestring")
self._call("modifyLogDestinations",
in_p=[settings]) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def load_plug_in(self, name):
"""Loads a DBGF plug-in. in name of type str The plug-in name or DLL. Special name 'all' loads all installed plug-ins. return plug_in_name of type str The name of the loaded plug-in. """ |
if not isinstance(name, basestring):
raise TypeError("name can only be an instance of type basestring")
plug_in_name = self._call("loadPlugIn",
in_p=[name])
return plug_in_name |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def unload_plug_in(self, name):
"""Unloads a DBGF plug-in. in name of type str The plug-in name or DLL. Special name 'all' unloads all plug-ins. """ |
if not isinstance(name, basestring):
raise TypeError("name can only be an instance of type basestring")
self._call("unloadPlugIn",
in_p=[name]) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def get_register(self, cpu_id, name):
"""Gets one register. in cpu_id of type int The identifier of the Virtual CPU. in name of type str The register name, case is ignored. return value of type str The register value. This is usually a hex value (always 0x prefixed) but other format may be used for floating point registers (TBD). """ |
if not isinstance(cpu_id, baseinteger):
raise TypeError("cpu_id can only be an instance of type baseinteger")
if not isinstance(name, basestring):
raise TypeError("name can only be an instance of type basestring")
value = self._call("getRegister",
in_p=[cpu_id, name])
return value |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def get_registers(self, cpu_id):
"""Gets all the registers for the given CPU. in cpu_id of type int The identifier of the Virtual CPU. out names of type str Array containing the lowercase register names. out values of type str Array parallel to the names holding the register values as if the register was returned by :py:func:`IMachineDebugger.get_register` . """ |
if not isinstance(cpu_id, baseinteger):
raise TypeError("cpu_id can only be an instance of type baseinteger")
(names, values) = self._call("getRegisters",
in_p=[cpu_id])
return (names, values) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def set_registers(self, cpu_id, names, values):
"""Sets zero or more registers atomically. This feature is not implemented in the 4.0.0 release but may show up in a dot release. in cpu_id of type int The identifier of the Virtual CPU. in names of type str Array containing the register names, case ignored. in values of type str Array paralell to the names holding the register values. See :py:func:`IMachineDebugger.set_register` for formatting guidelines. """ |
if not isinstance(cpu_id, baseinteger):
raise TypeError("cpu_id can only be an instance of type baseinteger")
if not isinstance(names, list):
raise TypeError("names can only be an instance of type list")
for a in names[:10]:
if not isinstance(a, basestring):
raise TypeError(
"array can only contain objects of type basestring")
if not isinstance(values, list):
raise TypeError("values can only be an instance of type list")
for a in values[:10]:
if not isinstance(a, basestring):
raise TypeError(
"array can only contain objects of type basestring")
self._call("setRegisters",
in_p=[cpu_id, names, values]) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def dump_guest_stack(self, cpu_id):
"""Produce a simple stack dump using the current guest state. This feature is not implemented in the 4.0.0 release but may show up in a dot release. in cpu_id of type int The identifier of the Virtual CPU. return stack of type str String containing the formatted stack dump. """ |
if not isinstance(cpu_id, baseinteger):
raise TypeError("cpu_id can only be an instance of type baseinteger")
stack = self._call("dumpGuestStack",
in_p=[cpu_id])
return stack |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def reset_stats(self, pattern):
"""Reset VM statistics. in pattern of type str The selection pattern. A bit similar to filename globbing. """ |
if not isinstance(pattern, basestring):
raise TypeError("pattern can only be an instance of type basestring")
self._call("resetStats",
in_p=[pattern]) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def dump_stats(self, pattern):
"""Dumps VM statistics. in pattern of type str The selection pattern. A bit similar to filename globbing. """ |
if not isinstance(pattern, basestring):
raise TypeError("pattern can only be an instance of type basestring")
self._call("dumpStats",
in_p=[pattern]) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def get_stats(self, pattern, with_descriptions):
"""Get the VM statistics in a XMLish format. in pattern of type str The selection pattern. A bit similar to filename globbing. in with_descriptions of type bool Whether to include the descriptions. return stats of type str The XML document containing the statistics. """ |
if not isinstance(pattern, basestring):
raise TypeError("pattern can only be an instance of type basestring")
if not isinstance(with_descriptions, bool):
raise TypeError("with_descriptions can only be an instance of type bool")
stats = self._call("getStats",
in_p=[pattern, with_descriptions])
return stats |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def on_network_adapter_change(self, network_adapter, change_adapter):
"""Triggered when settings of a network adapter of the associated virtual machine have changed. in network_adapter of type :class:`INetworkAdapter` in change_adapter of type bool raises :class:`VBoxErrorInvalidVmState` Session state prevents operation. raises :class:`VBoxErrorInvalidObjectState` Session type prevents operation. """ |
if not isinstance(network_adapter, INetworkAdapter):
raise TypeError("network_adapter can only be an instance of type INetworkAdapter")
if not isinstance(change_adapter, bool):
raise TypeError("change_adapter can only be an instance of type bool")
self._call("onNetworkAdapterChange",
in_p=[network_adapter, change_adapter]) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def on_audio_adapter_change(self, audio_adapter):
"""Triggerd when settings of the audio adapter of the associated virtual machine have changed. in audio_adapter of type :class:`IAudioAdapter` raises :class:`VBoxErrorInvalidVmState` Session state prevents operation. raises :class:`VBoxErrorInvalidObjectState` Session type prevents operation. """ |
if not isinstance(audio_adapter, IAudioAdapter):
raise TypeError("audio_adapter can only be an instance of type IAudioAdapter")
self._call("onAudioAdapterChange",
in_p=[audio_adapter]) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def on_serial_port_change(self, serial_port):
"""Triggered when settings of a serial port of the associated virtual machine have changed. in serial_port of type :class:`ISerialPort` raises :class:`VBoxErrorInvalidVmState` Session state prevents operation. raises :class:`VBoxErrorInvalidObjectState` Session type prevents operation. """ |
if not isinstance(serial_port, ISerialPort):
raise TypeError("serial_port can only be an instance of type ISerialPort")
self._call("onSerialPortChange",
in_p=[serial_port]) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def on_parallel_port_change(self, parallel_port):
"""Triggered when settings of a parallel port of the associated virtual machine have changed. in parallel_port of type :class:`IParallelPort` raises :class:`VBoxErrorInvalidVmState` Session state prevents operation. raises :class:`VBoxErrorInvalidObjectState` Session type prevents operation. """ |
if not isinstance(parallel_port, IParallelPort):
raise TypeError("parallel_port can only be an instance of type IParallelPort")
self._call("onParallelPortChange",
in_p=[parallel_port]) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def on_medium_change(self, medium_attachment, force):
"""Triggered when attached media of the associated virtual machine have changed. in medium_attachment of type :class:`IMediumAttachment` The medium attachment which changed. in force of type bool If the medium change was forced. raises :class:`VBoxErrorInvalidVmState` Session state prevents operation. raises :class:`VBoxErrorInvalidObjectState` Session type prevents operation. """ |
if not isinstance(medium_attachment, IMediumAttachment):
raise TypeError("medium_attachment can only be an instance of type IMediumAttachment")
if not isinstance(force, bool):
raise TypeError("force can only be an instance of type bool")
self._call("onMediumChange",
in_p=[medium_attachment, force]) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def on_storage_device_change(self, medium_attachment, remove, silent):
"""Triggered when attached storage devices of the associated virtual machine have changed. in medium_attachment of type :class:`IMediumAttachment` The medium attachment which changed. in remove of type bool TRUE if the device is removed, FALSE if it was added. in silent of type bool TRUE if the device is is silently reconfigured without notifying the guest about it. raises :class:`VBoxErrorInvalidVmState` Session state prevents operation. raises :class:`VBoxErrorInvalidObjectState` Session type prevents operation. """ |
if not isinstance(medium_attachment, IMediumAttachment):
raise TypeError("medium_attachment can only be an instance of type IMediumAttachment")
if not isinstance(remove, bool):
raise TypeError("remove can only be an instance of type bool")
if not isinstance(silent, bool):
raise TypeError("silent can only be an instance of type bool")
self._call("onStorageDeviceChange",
in_p=[medium_attachment, remove, silent]) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def on_vm_process_priority_change(self, priority):
"""Triggered when process priority of the associated virtual machine have changed. in priority of type :class:`VMProcPriority` The priority which set. raises :class:`VBoxErrorInvalidVmState` Session state prevents operation. raises :class:`VBoxErrorInvalidObjectState` Session type prevents operation. raises :class:`VBoxErrorVmError` Error from underlying level. See additional error info. """ |
if not isinstance(priority, VMProcPriority):
raise TypeError("priority can only be an instance of type VMProcPriority")
self._call("onVMProcessPriorityChange",
in_p=[priority]) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def on_clipboard_mode_change(self, clipboard_mode):
"""Notification when the shared clipboard mode changes. in clipboard_mode of type :class:`ClipboardMode` The new shared clipboard mode. """ |
if not isinstance(clipboard_mode, ClipboardMode):
raise TypeError("clipboard_mode can only be an instance of type ClipboardMode")
self._call("onClipboardModeChange",
in_p=[clipboard_mode]) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def on_dn_d_mode_change(self, dnd_mode):
"""Notification when the drag'n drop mode changes. in dnd_mode of type :class:`DnDMode` The new mode for drag'n drop. """ |
if not isinstance(dnd_mode, DnDMode):
raise TypeError("dnd_mode can only be an instance of type DnDMode")
self._call("onDnDModeChange",
in_p=[dnd_mode]) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def on_cpu_change(self, cpu, add):
"""Notification when a CPU changes. in cpu of type int The CPU which changed in add of type bool Flag whether the CPU was added or removed """ |
if not isinstance(cpu, baseinteger):
raise TypeError("cpu can only be an instance of type baseinteger")
if not isinstance(add, bool):
raise TypeError("add can only be an instance of type bool")
self._call("onCPUChange",
in_p=[cpu, add]) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def on_cpu_execution_cap_change(self, execution_cap):
"""Notification when the CPU execution cap changes. in execution_cap of type int The new CPU execution cap value. (1-100) """ |
if not isinstance(execution_cap, baseinteger):
raise TypeError("execution_cap can only be an instance of type baseinteger")
self._call("onCPUExecutionCapChange",
in_p=[execution_cap]) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def on_vrde_server_change(self, restart):
"""Triggered when settings of the VRDE server object of the associated virtual machine have changed. in restart of type bool Flag whether the server must be restarted raises :class:`VBoxErrorInvalidVmState` Session state prevents operation. raises :class:`VBoxErrorInvalidObjectState` Session type prevents operation. """ |
if not isinstance(restart, bool):
raise TypeError("restart can only be an instance of type bool")
self._call("onVRDEServerChange",
in_p=[restart]) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def on_recording_change(self, enable):
"""Triggered when recording settings have changed. in enable of type bool TODO """ |
if not isinstance(enable, bool):
raise TypeError("enable can only be an instance of type bool")
self._call("onRecordingChange",
in_p=[enable]) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def on_bandwidth_group_change(self, bandwidth_group):
"""Notification when one of the bandwidth groups change. in bandwidth_group of type :class:`IBandwidthGroup` The bandwidth group which changed. """ |
if not isinstance(bandwidth_group, IBandwidthGroup):
raise TypeError("bandwidth_group can only be an instance of type IBandwidthGroup")
self._call("onBandwidthGroupChange",
in_p=[bandwidth_group]) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def online_merge_medium(self, medium_attachment, source_idx, target_idx, progress):
"""Triggers online merging of a hard disk. Used internally when deleting a snapshot while a VM referring to the same hard disk chain is running. in medium_attachment of type :class:`IMediumAttachment` The medium attachment to identify the medium chain. in source_idx of type int The index of the source image in the chain. Redundant, but drastically reduces IPC. in target_idx of type int The index of the target image in the chain. Redundant, but drastically reduces IPC. in progress of type :class:`IProgress` Progress object for this operation. raises :class:`VBoxErrorInvalidVmState` Machine session is not open. raises :class:`VBoxErrorInvalidObjectState` Session type is not direct. """ |
if not isinstance(medium_attachment, IMediumAttachment):
raise TypeError("medium_attachment can only be an instance of type IMediumAttachment")
if not isinstance(source_idx, baseinteger):
raise TypeError("source_idx can only be an instance of type baseinteger")
if not isinstance(target_idx, baseinteger):
raise TypeError("target_idx can only be an instance of type baseinteger")
if not isinstance(progress, IProgress):
raise TypeError("progress can only be an instance of type IProgress")
self._call("onlineMergeMedium",
in_p=[medium_attachment, source_idx, target_idx, progress]) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def reconfigure_medium_attachments(self, attachments):
"""Reconfigure all specified medium attachments in one go, making sure the current state corresponds to the specified medium. in attachments of type :class:`IMediumAttachment` Array containing the medium attachments which need to be reconfigured. raises :class:`VBoxErrorInvalidVmState` Machine session is not open. raises :class:`VBoxErrorInvalidObjectState` Session type is not direct. """ |
if not isinstance(attachments, list):
raise TypeError("attachments can only be an instance of type list")
for a in attachments[:10]:
if not isinstance(a, IMediumAttachment):
raise TypeError(
"array can only contain objects of type IMediumAttachment")
self._call("reconfigureMediumAttachments",
in_p=[attachments]) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def enable_vmm_statistics(self, enable):
"""Enables or disables collection of VMM RAM statistics. in enable of type bool True enables statistics collection. raises :class:`VBoxErrorInvalidVmState` Machine session is not open. raises :class:`VBoxErrorInvalidObjectState` Session type is not direct. """ |
if not isinstance(enable, bool):
raise TypeError("enable can only be an instance of type bool")
self._call("enableVMMStatistics",
in_p=[enable]) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def set_network_settings(self, mtu, sock_snd, sock_rcv, tcp_wnd_snd, tcp_wnd_rcv):
"""Sets network configuration of the NAT engine. in mtu of type int MTU (maximum transmission unit) of the NAT engine in bytes. in sock_snd of type int Capacity of the socket send buffer in bytes when creating a new socket. in sock_rcv of type int Capacity of the socket receive buffer in bytes when creating a new socket. in tcp_wnd_snd of type int Initial size of the NAT engine's sending TCP window in bytes when establishing a new TCP connection. in tcp_wnd_rcv of type int Initial size of the NAT engine's receiving TCP window in bytes when establishing a new TCP connection. """ |
if not isinstance(mtu, baseinteger):
raise TypeError("mtu can only be an instance of type baseinteger")
if not isinstance(sock_snd, baseinteger):
raise TypeError("sock_snd can only be an instance of type baseinteger")
if not isinstance(sock_rcv, baseinteger):
raise TypeError("sock_rcv can only be an instance of type baseinteger")
if not isinstance(tcp_wnd_snd, baseinteger):
raise TypeError("tcp_wnd_snd can only be an instance of type baseinteger")
if not isinstance(tcp_wnd_rcv, baseinteger):
raise TypeError("tcp_wnd_rcv can only be an instance of type baseinteger")
self._call("setNetworkSettings",
in_p=[mtu, sock_snd, sock_rcv, tcp_wnd_snd, tcp_wnd_rcv]) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def add_redirect(self, name, proto, host_ip, host_port, guest_ip, guest_port):
"""Adds a new NAT port-forwarding rule. in name of type str The name of the rule. An empty name is acceptable, in which case the NAT engine auto-generates one using the other parameters. in proto of type :class:`NATProtocol` Protocol handled with the rule. in host_ip of type str IP of the host interface to which the rule should apply. An empty ip address is acceptable, in which case the NAT engine binds the handling socket to any interface. in host_port of type int The port number to listen on. in guest_ip of type str The IP address of the guest which the NAT engine will forward matching packets to. An empty IP address is acceptable, in which case the NAT engine will forward packets to the first DHCP lease (x.x.x.15). in guest_port of type int The port number to forward. """ |
if not isinstance(name, basestring):
raise TypeError("name can only be an instance of type basestring")
if not isinstance(proto, NATProtocol):
raise TypeError("proto can only be an instance of type NATProtocol")
if not isinstance(host_ip, basestring):
raise TypeError("host_ip can only be an instance of type basestring")
if not isinstance(host_port, baseinteger):
raise TypeError("host_port can only be an instance of type baseinteger")
if not isinstance(guest_ip, basestring):
raise TypeError("guest_ip can only be an instance of type basestring")
if not isinstance(guest_port, baseinteger):
raise TypeError("guest_port can only be an instance of type baseinteger")
self._call("addRedirect",
in_p=[name, proto, host_ip, host_port, guest_ip, guest_port]) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def remove_redirect(self, name):
"""Removes a port-forwarding rule that was previously registered. in name of type str The name of the rule to delete. """ |
if not isinstance(name, basestring):
raise TypeError("name can only be an instance of type basestring")
self._call("removeRedirect",
in_p=[name]) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def query_license(self, preferred_locale, preferred_language, format_p):
"""Full feature version of the license attribute. in preferred_locale of type str The preferred license locale. Pass an empty string to get the default license. in preferred_language of type str The preferred license language. Pass an empty string to get the default language for the locale. in format_p of type str The license format: html, rtf or txt. If a license is present there will always be an HTML of it, the rich text format (RTF) and plain text (txt) versions are optional. If return license_text of type str The license text. """ |
if not isinstance(preferred_locale, basestring):
raise TypeError("preferred_locale can only be an instance of type basestring")
if not isinstance(preferred_language, basestring):
raise TypeError("preferred_language can only be an instance of type basestring")
if not isinstance(format_p, basestring):
raise TypeError("format_p can only be an instance of type basestring")
license_text = self._call("queryLicense",
in_p=[preferred_locale, preferred_language, format_p])
return license_text |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def query_object(self, obj_uuid):
"""Queries the IUnknown interface to an object in the extension pack main module. This allows plug-ins and others to talk directly to an extension pack. in obj_uuid of type str The object ID. What exactly this is return return_interface of type Interface The queried interface. """ |
if not isinstance(obj_uuid, basestring):
raise TypeError("obj_uuid can only be an instance of type basestring")
return_interface = self._call("queryObject",
in_p=[obj_uuid])
return_interface = Interface(return_interface)
return return_interface |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def install(self, replace, display_info):
"""Install the extension pack. in replace of type bool Set this to automatically uninstall any existing extension pack with the same name as the one being installed. in display_info of type str Platform specific display information. Reserved for future hacks. return progess of type :class:`IProgress` Progress object for the operation. """ |
if not isinstance(replace, bool):
raise TypeError("replace can only be an instance of type bool")
if not isinstance(display_info, basestring):
raise TypeError("display_info can only be an instance of type basestring")
progess = self._call("install",
in_p=[replace, display_info])
progess = IProgress(progess)
return progess |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def find(self, name):
"""Returns the extension pack with the specified name if found. in name of type str The name of the extension pack to locate. return return_data of type :class:`IExtPack` The extension pack if found. raises :class:`VBoxErrorObjectNotFound` No extension pack matching @a name was found. """ |
if not isinstance(name, basestring):
raise TypeError("name can only be an instance of type basestring")
return_data = self._call("find",
in_p=[name])
return_data = IExtPack(return_data)
return return_data |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def open_ext_pack_file(self, path):
"""Attempts to open an extension pack file in preparation for installation. in path of type str The path of the extension pack tarball. This can optionally be followed by a "::SHA-256=hex-digit" of the tarball. return file_p of type :class:`IExtPackFile` The interface of the extension pack file object. """ |
if not isinstance(path, basestring):
raise TypeError("path can only be an instance of type basestring")
file_p = self._call("openExtPackFile",
in_p=[path])
file_p = IExtPackFile(file_p)
return file_p |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def uninstall(self, name, forced_removal, display_info):
"""Uninstalls an extension pack, removing all related files. in name of type str The name of the extension pack to uninstall. in forced_removal of type bool Forced removal of the extension pack. This means that the uninstall hook will not be called. in display_info of type str Platform specific display information. Reserved for future hacks. return progess of type :class:`IProgress` Progress object for the operation. """ |
if not isinstance(name, basestring):
raise TypeError("name can only be an instance of type basestring")
if not isinstance(forced_removal, bool):
raise TypeError("forced_removal can only be an instance of type bool")
if not isinstance(display_info, basestring):
raise TypeError("display_info can only be an instance of type basestring")
progess = self._call("uninstall",
in_p=[name, forced_removal, display_info])
progess = IProgress(progess)
return progess |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def query_all_plug_ins_for_frontend(self, frontend_name):
"""Gets the path to all the plug-in modules for a given frontend. This is a convenience method that is intended to simplify the plug-in loading process for a frontend. in frontend_name of type str The name of the frontend or component. return plug_in_modules of type str Array containing the plug-in modules (full paths). """ |
if not isinstance(frontend_name, basestring):
raise TypeError("frontend_name can only be an instance of type basestring")
plug_in_modules = self._call("queryAllPlugInsForFrontend",
in_p=[frontend_name])
return plug_in_modules |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def is_ext_pack_usable(self, name):
"""Check if the given extension pack is loaded and usable. in name of type str The name of the extension pack to check for. return usable of type bool Is the given extension pack loaded and usable. """ |
if not isinstance(name, basestring):
raise TypeError("name can only be an instance of type basestring")
usable = self._call("isExtPackUsable",
in_p=[name])
return usable |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def create_bandwidth_group(self, name, type_p, max_bytes_per_sec):
"""Creates a new bandwidth group. in name of type str Name of the bandwidth group. in type_p of type :class:`BandwidthGroupType` The type of the bandwidth group (network or disk). in max_bytes_per_sec of type int The maximum number of bytes which can be transfered by all entities attached to this group during one second. """ |
if not isinstance(name, basestring):
raise TypeError("name can only be an instance of type basestring")
if not isinstance(type_p, BandwidthGroupType):
raise TypeError("type_p can only be an instance of type BandwidthGroupType")
if not isinstance(max_bytes_per_sec, baseinteger):
raise TypeError("max_bytes_per_sec can only be an instance of type baseinteger")
self._call("createBandwidthGroup",
in_p=[name, type_p, max_bytes_per_sec]) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def delete_bandwidth_group(self, name):
"""Deletes a new bandwidth group. in name of type str Name of the bandwidth group to delete. """ |
if not isinstance(name, basestring):
raise TypeError("name can only be an instance of type basestring")
self._call("deleteBandwidthGroup",
in_p=[name]) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def get_bandwidth_group(self, name):
"""Get a bandwidth group by name. in name of type str Name of the bandwidth group to get. return bandwidth_group of type :class:`IBandwidthGroup` Where to store the bandwidth group on success. """ |
if not isinstance(name, basestring):
raise TypeError("name can only be an instance of type basestring")
bandwidth_group = self._call("getBandwidthGroup",
in_p=[name])
bandwidth_group = IBandwidthGroup(bandwidth_group)
return bandwidth_group |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def get_all_bandwidth_groups(self):
"""Get all managed bandwidth groups. return bandwidth_groups of type :class:`IBandwidthGroup` The array of managed bandwidth groups. """ |
bandwidth_groups = self._call("getAllBandwidthGroups")
bandwidth_groups = [IBandwidthGroup(a) for a in bandwidth_groups]
return bandwidth_groups |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def unregister_listener(self, listener):
"""Unregister an event listener. If listener is passive, and some waitable events are still in queue they are marked as processed automatically. in listener of type :class:`IEventListener` Listener to unregister. """ |
if not isinstance(listener, IEventListener):
raise TypeError("listener can only be an instance of type IEventListener")
self._call("unregisterListener",
in_p=[listener]) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def fire_event(self, event, timeout):
"""Fire an event for this source. in event of type :class:`IEvent` Event to deliver. in timeout of type int Maximum time to wait for event processing (if event is waitable), in ms; 0 = no wait, -1 = indefinite wait. return result of type bool true if an event was delivered to all targets, or is non-waitable. """ |
if not isinstance(event, IEvent):
raise TypeError("event can only be an instance of type IEvent")
if not isinstance(timeout, baseinteger):
raise TypeError("timeout can only be an instance of type baseinteger")
result = self._call("fireEvent",
in_p=[event, timeout])
return result |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def wait_processed(self, timeout):
"""Wait until time outs, or this event is processed. Event must be waitable for this operation to have described semantics, for non-waitable returns true immediately. in timeout of type int Maximum time to wait for event processing, in ms; 0 = no wait, -1 = indefinite wait. return result of type bool If this event was processed before timeout. """ |
if not isinstance(timeout, baseinteger):
raise TypeError("timeout can only be an instance of type baseinteger")
result = self._call("waitProcessed",
in_p=[timeout])
return result |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def add_veto(self, reason):
"""Adds a veto on this event. in reason of type str Reason for veto, could be null or empty string. """ |
if not isinstance(reason, basestring):
raise TypeError("reason can only be an instance of type basestring")
self._call("addVeto",
in_p=[reason]) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def add_approval(self, reason):
"""Adds an approval on this event. in reason of type str Reason for approval, could be null or empty string. """ |
if not isinstance(reason, basestring):
raise TypeError("reason can only be an instance of type basestring")
self._call("addApproval",
in_p=[reason]) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def export_launch_vm(self, description, progress, virtual_box):
"""Exports and optionally launch a VM described in description parameter in description of type :class:`IVirtualSystemDescription` VirtualSystemDescription object which is describing a machine and all required parameters. in progress of type :class:`IProgress` Progress object to track the operation completion. in virtual_box of type :class:`IVirtualBox` Reference to the server-side API root object. """ |
if not isinstance(description, IVirtualSystemDescription):
raise TypeError("description can only be an instance of type IVirtualSystemDescription")
if not isinstance(progress, IProgress):
raise TypeError("progress can only be an instance of type IProgress")
if not isinstance(virtual_box, IVirtualBox):
raise TypeError("virtual_box can only be an instance of type IVirtualBox")
self._call("exportLaunchVM",
in_p=[description, progress, virtual_box]) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def list_instances(self, machine_state):
"""Returns the list of the instances in the Cloud. in machine_state of type :class:`CloudMachineState` out return_names of type str VM names. return return_ids of type str VM ids. """ |
if not isinstance(machine_state, CloudMachineState):
raise TypeError("machine_state can only be an instance of type CloudMachineState")
(return_ids, return_names) = self._call("listInstances",
in_p=[machine_state])
return (return_ids, return_names) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def list_images(self, image_state):
"""Returns the list of the images in the Cloud. in image_state of type :class:`CloudImageState` out return_names of type str Images names. return return_ids of type str Images ids. """ |
if not isinstance(image_state, CloudImageState):
raise TypeError("image_state can only be an instance of type CloudImageState")
(return_ids, return_names) = self._call("listImages",
in_p=[image_state])
return (return_ids, return_names) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def get_property_description(self, name):
"""Property name. in name of type str Property name. return description of type str Property description. """ |
if not isinstance(name, basestring):
raise TypeError("name can only be an instance of type basestring")
description = self._call("getPropertyDescription",
in_p=[name])
return description |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def create_profile(self, profile_name, names, values):
"""Creates a new profile. in profile_name of type str The profile name. Must not exist, otherwise an error is raised. in names of type str Names of properties. in values of type str Values of set properties. """ |
if not isinstance(profile_name, basestring):
raise TypeError("profile_name can only be an instance of type basestring")
if not isinstance(names, list):
raise TypeError("names can only be an instance of type list")
for a in names[:10]:
if not isinstance(a, basestring):
raise TypeError(
"array can only contain objects of type basestring")
if not isinstance(values, list):
raise TypeError("values can only be an instance of type list")
for a in values[:10]:
if not isinstance(a, basestring):
raise TypeError(
"array can only contain objects of type basestring")
self._call("createProfile",
in_p=[profile_name, names, values]) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def register_on_guest_mouse(self, callback):
"""Set the callback function to consume on guest mouse events. Callback receives a IGuestMouseEvent object. Example: def callback(event):
print(("%s %s %s" % (event.x, event.y, event.z)) """ |
event_type = library.VBoxEventType.on_guest_mouse
return self.event_source.register_callback(callback, event_type) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def put_keys(self, press_keys=None, hold_keys=None, press_delay=50):
"""Put scancodes that represent keys defined in the sequences provided. Arguments: press_keys: Press a sequence of keys hold_keys: While pressing the sequence of keys, hold down the keys defined in hold_keys. press_delay: Number of milliseconds to delay between each press Note: Both press_keys and hold_keys are iterable objects that yield self.SCANCODE.keys() keys. """ |
if press_keys is None:
press_keys = []
if hold_keys is None:
hold_keys = []
release_codes = set()
put_codes = set()
try:
# hold the keys
for k in hold_keys:
put, release = self.SCANCODES[k]
# Avoid putting codes over and over
put = set(put) - put_codes
self.put_scancodes(list(put))
put_codes.update(put)
release_codes.update(release)
# press the keys
for k in press_keys:
put, release = self.SCANCODES[k]
# Avoid putting held codes
_put = set(put) - put_codes
if not _put:
continue
release = set(release) - release_codes
# Avoid releasing held codes
if not release:
continue
self.put_scancodes(list(put) + list(release))
time.sleep(press_delay / 1000.0)
finally:
# release the held keys
for code in release_codes:
self.put_scancode(code) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def register_on_guest_keyboard(self, callback):
"""Set the callback function to consume on guest keyboard events Callback receives a IGuestKeyboardEvent object. Example: def callback(event):
print(event.scancodes) """ |
return self.event_source.register_callback(callback,
library.VBoxEventType.on_guest_keyboard) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def execute(self, command, arguments=None, stdin="", environment=None, flags=None, priority=library.ProcessPriority.default, affinity=None, timeout_ms=0):
"""Execute a command in the Guest Arguments: command - Command to execute. arguments - List of arguments for the command stdin - A buffer to write to the stdin of the command. environment - See IGuestSession.create_process? flags - List of ProcessCreateFlag objects. Default value set to [wait_for_std_err, wait_for_stdout, ignore_orphaned_processes] timeout_ms - ms to wait for the process to complete. priority - Set the ProcessPriority priority to be used for execution. affinity - Process affinity to use for execution. Return IProcess, stdout, stderr """ |
if arguments is None:
arguments = []
if environment is None:
environment = []
if flags is None:
flags = [library.ProcessCreateFlag.wait_for_std_err,
library.ProcessCreateFlag.wait_for_std_out,
library.ProcessCreateFlag.ignore_orphaned_processes]
if affinity is None:
affinity = []
def read_out(process, flags, stdout, stderr):
if library.ProcessCreateFlag.wait_for_std_err in flags:
process.wait_for(int(library.ProcessWaitResult.std_err))
e = utils.to_bytes(process.read(2, 65000, 0))
stderr.append(e)
if library.ProcessCreateFlag.wait_for_std_out in flags:
process.wait_for(int(library.ProcessWaitResult.std_out))
o = utils.to_bytes(process.read(1, 65000, 0))
stdout.append(o)
process = self.process_create_ex(command,
[command] + arguments, environment,
flags,
timeout_ms,
priority,
affinity)
process.wait_for(int(library.ProcessWaitResult.start), 0)
# write stdin to the process
if stdin:
process.wait_for(int(library.ProcessWaitResult.std_in), 0)
index = 0
flag_none = [library.ProcessInputFlag.none]
flag_eof = [library.ProcessInputFlag.end_of_file]
while index < len(stdin):
array = map(lambda a: str(ord(a)), stdin[index:])
wrote = process.write_array(0, flag_none, array, 0)
if wrote == 0:
raise Exception("Failed to write ANY bytes to %s" % process)
index += wrote
process.write_array(0, flag_eof, [], 0)
# read the process output and wait for
stdout = []
stderr = []
while process.status == library.ProcessStatus.started:
read_out(process, flags, stdout, stderr)
time.sleep(0.2)
# make sure we have read the remainder of the out
read_out(process, flags, stdout, stderr)
return process, b"".join(stdout), b"".join(stderr) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
| def path_exists(self, path, follow_symlinks=True):
"test if path exists"
return (
self.file_exists(path, follow_symlinks)
or self.symlink_exists(path, follow_symlinks)
or self.directory_exists(path, follow_symlinks)
) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
| def read(self, ova_path):
"Read and interpret ova file into this Appliance object."
p = super(IAppliance, self).read(ova_path)
p.wait_for_completion()
self.interpret()
warnings = self.get_warnings()
if warnings:
warning = Warning("\n".join(warnings))
warning.warnings = warnings
raise warning |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
| def find_description(self, name):
"Find a description for the given appliance name."
for desc in self.virtual_system_descriptions:
values = desc.get_values_by_type(DescType.name,
DescValueType.original)
if name in values:
break
else:
raise Exception("Failed to find description for %s" % name)
return desc |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
| def get_vbox_version(config_kmk):
"Return the vbox config major, minor, build"
with open(config_kmk, 'rb') as f:
config = f.read()
major = b"6"#re.search(b"VBOX_VERSION_MAJOR = (?P<major>[\d])", config).groupdict()['major']
minor = b"0"#re.search(b"VBOX_VERSION_MINOR = (?P<minor>[\d])", config).groupdict()['minor']
build = b"4"#re.search(b"VBOX_VERSION_BUILD = (?P<build>[\d])", config).groupdict()['build']
return b".".join([major, minor, build]) |
<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
def register_on_machine_state_changed(self, callback):
"""Set the callback function to consume on machine state changed events. Callback receives a IMachineStateChangedEvent object. Returns the callback_id """ |
event_type = library.VBoxEventType.on_machine_state_changed
return self.event_source.register_callback(callback, event_type) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.