idx
int64
0
63k
question
stringlengths
61
4.03k
target
stringlengths
6
1.23k
8,800
def get_upload_path ( instance , filename ) : if not instance . name : instance . name = filename date = timezone . now ( ) . date ( ) filename = '{name}.{ext}' . format ( name = uuid4 ( ) . hex , ext = filename . split ( '.' ) [ - 1 ] ) return os . path . join ( 'post_office_attachments' , str ( date . year ) , str ( ...
Overriding to store the original filename
8,801
def create ( sender , recipients = None , cc = None , bcc = None , subject = '' , message = '' , html_message = '' , context = None , scheduled_time = None , headers = None , template = None , priority = None , render_on_delivery = False , commit = True , backend = '' ) : priority = parse_priority ( priority ) status =...
Creates an email from supplied keyword arguments . If template is specified email subject and content will be rendered during delivery .
8,802
def send_queued ( processes = 1 , log_level = None ) : queued_emails = get_queued ( ) total_sent , total_failed = 0 , 0 total_email = len ( queued_emails ) logger . info ( 'Started sending %s emails with %s processes.' % ( total_email , processes ) ) if log_level is None : log_level = get_log_level ( ) if queued_emails...
Sends out all queued mails that has scheduled_time less than now or None
8,803
def send_messages ( self , email_messages ) : from . mail import create from . utils import create_attachments if not email_messages : return for email_message in email_messages : subject = email_message . subject from_email = email_message . from_email message = email_message . body headers = email_message . extra_hea...
Queue one or more EmailMessage objects and returns the number of email messages sent .
8,804
def valid_lock ( self ) : lock_pid = self . get_lock_pid ( ) if lock_pid is None : return False if self . _pid == lock_pid : return True try : os . kill ( lock_pid , 0 ) except OSError : self . release ( ) return False return True
See if the lock exists and is left over from an old process .
8,805
def release ( self ) : if self . lock_filename != self . pid_filename : try : os . unlink ( self . lock_filename ) except OSError : pass try : os . remove ( self . pid_filename ) except OSError : pass
Try to delete the lock files . Doesn t matter if we fail
8,806
def validate_email_with_name ( value ) : value = force_text ( value ) recipient = value if '<' and '>' in value : start = value . find ( '<' ) + 1 end = value . find ( '>' ) if start < end : recipient = value [ start : end ] validate_email ( recipient )
Validate email address .
8,807
def validate_comma_separated_emails ( value ) : if not isinstance ( value , ( tuple , list ) ) : raise ValidationError ( 'Email list must be a list/tuple.' ) for email in value : try : validate_email_with_name ( email ) except ValidationError : raise ValidationError ( 'Invalid email: %s' % email , code = 'invalid' )
Validate every email address in a comma separated list of emails .
8,808
def validate_template_syntax ( source ) : try : Template ( source ) except ( TemplateSyntaxError , TemplateDoesNotExist ) as err : raise ValidationError ( text_type ( err ) )
Basic Django Template syntax validation . This allows for robuster template authoring .
8,809
def send_mail ( subject , message , from_email , recipient_list , html_message = '' , scheduled_time = None , headers = None , priority = PRIORITY . medium ) : subject = force_text ( subject ) status = None if priority == PRIORITY . now else STATUS . queued emails = [ ] for address in recipient_list : emails . append (...
Add a new message to the mail queue . This is a replacement for Django s send_mail core email method .
8,810
def get_email_template ( name , language = '' ) : use_cache = getattr ( settings , 'POST_OFFICE_CACHE' , True ) if use_cache : use_cache = getattr ( settings , 'POST_OFFICE_TEMPLATE_CACHE' , True ) if not use_cache : return EmailTemplate . objects . get ( name = name , language = language ) else : composite_name = '%s:...
Function that returns an email template instance from cache or DB .
8,811
def create_attachments ( attachment_files ) : attachments = [ ] for filename , filedata in attachment_files . items ( ) : if isinstance ( filedata , dict ) : content = filedata . get ( 'file' , None ) mimetype = filedata . get ( 'mimetype' , None ) headers = filedata . get ( 'headers' , None ) else : content = filedata...
Create Attachment instances from files
8,812
def parse_emails ( emails ) : if isinstance ( emails , string_types ) : emails = [ emails ] elif emails is None : emails = [ ] for email in emails : try : validate_email_with_name ( email ) except ValidationError : raise ValidationError ( '%s is not a valid email address' % email ) return emails
A function that returns a list of valid email addresses . This function will also convert a single email address into a list of email addresses . None value is also converted into an empty list .
8,813
def VERSION ( self ) : return int ( re . match ( r'^(\D+)(\d+)$' , self . __class__ . __name__ ) . group ( 2 ) )
TAN mechanism version
8,814
def parse_message ( self , data : bytes ) -> SegmentSequence : if isinstance ( data , bytes ) : data = self . explode_segments ( data ) message = SegmentSequence ( ) for segment in data : seg = self . parse_segment ( segment ) message . segments . append ( seg ) return message
Takes a FinTS 3 . 0 message as byte array and returns a parsed segment sequence
8,815
def terminal_flicker_unix ( code , field_width = 3 , space_width = 3 , height = 1 , clear = False , wait = 0.05 ) : code = parse ( code ) . render ( ) data = swap_bytes ( code ) high = '\033[48;05;15m' low = '\033[48;05;0m' std = '\033[0m' stream = [ '10000' , '00000' , '11111' , '01111' , '11111' , '01111' , '11111' ]...
Re - encodes a flicker code and prints it on a unix terminal .
8,816
def find_segments ( self , query = None , version = None , callback = None , recurse = True , throw = False ) : found_something = False if query is None : query = [ ] elif isinstance ( query , str ) or not isinstance ( query , ( list , tuple , Iterable ) ) : query = [ query ] if version is None : version = [ ] elif not...
Yields an iterable of all matching segments .
8,817
def find_segment_first ( self , * args , ** kwargs ) : for m in self . find_segments ( * args , ** kwargs ) : return m return None
Finds the first matching segment .
8,818
def find_segment_highest_version ( self , query = None , version = None , callback = None , recurse = True , default = None ) : retval = None for s in self . find_segments ( query = query , version = version , callback = callback , recurse = recurse ) : if not retval or s . header . version > retval . header . version ...
Finds the highest matching segment .
8,819
def print_nested ( self , stream = None , level = 0 , indent = " " , prefix = "" , first_level_indent = True , trailer = "" , print_doc = True , first_line_suffix = "" ) : import sys stream = stream or sys . stdout stream . write ( ( ( prefix + level * indent ) if first_level_indent else "" ) + "{}.{}(" . format ( s...
Structured nested print of the object to the given stream .
8,820
def from_data ( cls , blob ) : version , data = decompress_datablob ( DATA_BLOB_MAGIC_RETRY , blob ) if version == 1 : for clazz in cls . _all_subclasses ( ) : if clazz . __name__ == data [ "_class_name" ] : return clazz . _from_data_v1 ( data ) raise Exception ( "Invalid data blob data or version" )
Restore an object instance from a compressed datablob .
8,821
def deconstruct ( self , including_private : bool = False ) -> bytes : data = self . _deconstruct_v1 ( including_private = including_private ) return compress_datablob ( DATA_BLOB_MAGIC , 1 , data )
Return state of this FinTSClient instance as an opaque datablob . You should not use this object after calling this method .
8,822
def get_information ( self ) : retval = { 'bank' : { } , 'accounts' : [ ] , 'auth' : { } , } if self . bpa : retval [ 'bank' ] [ 'name' ] = self . bpa . bank_name if self . bpd . segments : retval [ 'bank' ] [ 'supported_operations' ] = { op : any ( self . bpd . find_segment_first ( cmd [ 0 ] + 'I' + cmd [ 2 : ] + 'S' ...
Return information about the connected bank .
8,823
def get_sepa_accounts ( self ) : with self . _get_dialog ( ) as dialog : response = dialog . send ( HKSPA1 ( ) ) self . accounts = [ ] for seg in response . find_segments ( HISPA1 , throw = True ) : self . accounts . extend ( seg . accounts ) return [ a for a in [ acc . as_sepa_account ( ) for acc in self . accounts ] ...
Returns a list of SEPA accounts
8,824
def _find_highest_supported_command ( self , * segment_classes , ** kwargs ) : return_parameter_segment = kwargs . get ( "return_parameter_segment" , False ) parameter_segment_name = "{}I{}S" . format ( segment_classes [ 0 ] . TYPE [ 0 ] , segment_classes [ 0 ] . TYPE [ 2 : ] ) version_map = dict ( ( clazz . VERSION , ...
Search the BPD for the highest supported version of a segment .
8,825
def get_transactions ( self , account : SEPAAccount , start_date : datetime . date = None , end_date : datetime . date = None ) : with self . _get_dialog ( ) as dialog : hkkaz = self . _find_highest_supported_command ( HKKAZ5 , HKKAZ6 , HKKAZ7 ) logger . info ( 'Start fetching from {} to {}' . format ( start_date , end...
Fetches the list of transactions of a bank account in a certain timeframe .
8,826
def get_transactions_xml ( self , account : SEPAAccount , start_date : datetime . date = None , end_date : datetime . date = None ) -> list : with self . _get_dialog ( ) as dialog : hkcaz = self . _find_highest_supported_command ( HKCAZ1 ) logger . info ( 'Start fetching from {} to {}' . format ( start_date , end_date ...
Fetches the list of transactions of a bank account in a certain timeframe as camt . 052 . 001 . 02 XML files .
8,827
def get_balance ( self , account : SEPAAccount ) : with self . _get_dialog ( ) as dialog : hksal = self . _find_highest_supported_command ( HKSAL5 , HKSAL6 , HKSAL7 ) seg = hksal ( account = hksal . _fields [ 'account' ] . type . from_sepa_account ( account ) , all_accounts = False , ) response = dialog . send ( seg ) ...
Fetches an accounts current balance .
8,828
def get_holdings ( self , account : SEPAAccount ) : with self . _get_dialog ( ) as dialog : hkwpd = self . _find_highest_supported_command ( HKWPD5 , HKWPD6 ) responses = self . _fetch_with_touchdowns ( dialog , lambda touchdown : hkwpd ( account = hkwpd . _fields [ 'account' ] . type . from_sepa_account ( account ) , ...
Retrieve holdings of an account .
8,829
def simple_sepa_transfer ( self , account : SEPAAccount , iban : str , bic : str , recipient_name : str , amount : Decimal , account_name : str , reason : str , endtoend_id = 'NOTPROVIDED' ) : config = { "name" : account_name , "IBAN" : account . iban , "BIC" : account . bic , "batch" : False , "currency" : "EUR" , } s...
Simple SEPA transfer .
8,830
def sepa_transfer ( self , account : SEPAAccount , pain_message : str , multiple = False , control_sum = None , currency = 'EUR' , book_as_single = False , pain_descriptor = 'urn:iso:std:iso:20022:tech:xsd:pain.001.001.03' ) : with self . _get_dialog ( ) as dialog : if multiple : command_class = HKCCM1 else : command_c...
Custom SEPA transfer .
8,831
def sepa_debit ( self , account : SEPAAccount , pain_message : str , multiple = False , cor1 = False , control_sum = None , currency = 'EUR' , book_as_single = False , pain_descriptor = 'urn:iso:std:iso:20022:tech:xsd:pain.008.003.01' ) : with self . _get_dialog ( ) as dialog : if multiple : if cor1 : command_candidate...
Custom SEPA debit .
8,832
def send_tan ( self , challenge : NeedTANResponse , tan : str ) : with self . _get_dialog ( ) as dialog : tan_seg = self . _get_tan_segment ( challenge . command_seg , '2' , challenge . tan_request ) self . _pending_tan = tan response = dialog . send ( tan_seg ) resume_func = getattr ( self , challenge . resume_method ...
Sends a TAN to confirm a pending operation .
8,833
def get_tan_mechanisms ( self ) : retval = OrderedDict ( ) for version in sorted ( IMPLEMENTED_HKTAN_VERSIONS . keys ( ) ) : for seg in self . bpd . find_segments ( 'HITANS' , version ) : for parameter in seg . parameter . twostep_parameters : if parameter . security_function in self . allowed_security_functions : retv...
Get the available TAN mechanisms .
8,834
def _generate_MAC ( segments = 6 , segment_length = 2 , delimiter = ":" , charset = "0123456789abcdef" ) : addr = [ ] for _ in range ( segments ) : sub = '' . join ( random . choice ( charset ) for _ in range ( segment_length ) ) addr . append ( sub ) return delimiter . join ( addr )
generate a non - guaranteed - unique mac address
8,835
def recv ( self , packet , interface ) : for f in self . filters : if not packet : break packet = f . tr ( packet , interface ) if packet : self . inq [ interface ] . put ( packet )
run incoming packet through the filters then place it in its inq
8,836
def send ( self , packet , interfaces = None ) : interfaces = interfaces or self . interfaces interfaces = interfaces if hasattr ( interfaces , '__iter__' ) else [ interfaces ] for interface in interfaces : for f in self . filters : packet = f . tx ( packet , interface ) if packet : interface . send ( packet )
write packet to given interfaces default is broadcast to all interfaces
8,837
def match ( cls , pattern , inverse = False ) : string_pattern = pattern invert_search = inverse class DefinedStringFilter ( cls ) : pattern = string_pattern inverse = invert_search return DefinedStringFilter
Factory method to create a StringFilter which filters with the given pattern .
8,838
def run_cmd ( command , verbose = True , shell = '/bin/bash' ) : process = Popen ( command , shell = True , stdout = PIPE , stderr = STDOUT , executable = shell ) output = process . stdout . read ( ) . decode ( ) . strip ( ) . split ( '\n' ) if verbose : return output return [ line for line in output if line . strip ( ...
internal helper function to run shell commands and get output
8,839
def run_python ( cmd , timeout = 60 ) : try : try : buffer = StringIO ( ) sys . stdout = buffer exec ( cmd ) sys . stdout = sys . __stdout__ out = buffer . getvalue ( ) except Exception as error : out = error out = str ( out ) . strip ( ) if len ( out ) < 1 : try : out = "[eval]: " + str ( eval ( cmd ) ) except Excepti...
interactively interpret recieved python code
8,840
def run_shell ( cmd , timeout = 60 , verbose = False ) : retcode = None try : p = Popen ( cmd , shell = True , stdout = PIPE , stderr = STDOUT , executable = '/bin/bash' ) continue_running = True except Exception as e : yield ( "Failed: %s" % e ) continue_running = False while continue_running : try : line = p . stdout...
run a shell command and return the output verbose enables live command output via yield
8,841
def get_platform ( ) : mac_version = str ( platform . mac_ver ( ) [ 0 ] ) . strip ( ) if mac_version : return 'OS X %s' % mac_version return platform . platform ( ) . strip ( )
get Mac OS X version or kernel version if mac version is not found
8,842
def email ( to = 'medusa@sweeting.me' , _from = default_from , subject = 'BOT MSG' , message = "Info email" , attachments = None ) : for attachment in attachments or [ ] : filename = attachment . strip ( ) try : result = run_cmd ( 'uuencode %s %s | mailx -s "%s" %s' % ( filename , filename , subject , to ) ) [ 0 ] retu...
function to send mail to a specified address with the given attachments
8,843
def log ( self , * args ) : print ( "%s %s" % ( str ( self ) . ljust ( 8 ) , " " . join ( [ str ( x ) for x in args ] ) ) )
stdout and stderr for the link
8,844
def recv ( self , mac_addr = broadcast_addr , timeout = 0 ) : if self . keep_listening : try : return self . inq [ str ( mac_addr ) ] . get ( timeout = timeout ) except Empty : return "" else : self . log ( "is down." )
read packet off the recv queue for a given address optional timeout to block and wait for packet
8,845
def register_on_network_adapter_changed ( self , callback ) : event_type = library . VBoxEventType . on_network_adapter_changed return self . event_source . register_callback ( callback , event_type )
Set the callback function to consume on network adapter changed events .
8,846
def register_on_medium_changed ( self , callback ) : event_type = library . VBoxEventType . on_medium_changed return self . event_source . register_callback ( callback , event_type )
Set the callback function to consume on medium changed events .
8,847
def register_on_clipboard_mode_changed ( self , callback ) : event_type = library . VBoxEventType . on_clipboard_mode_changed return self . event_source . register_callback ( callback , event_type )
Set the callback function to consume on clipboard mode changed events .
8,848
def register_on_drag_and_drop_mode_changed ( self , callback ) : event_type = library . VBoxEventType . on_drag_and_drop_mode_changed return self . event_source . register_callback ( callback , event_type )
Set the callback function to consume on drag and drop mode changed events .
8,849
def register_on_shared_folder_changed ( self , callback ) : event_type = library . VBoxEventType . on_shared_folder_changed return self . event_source . register_callback ( callback , event_type )
Set the callback function to consume on shared folder changed events .
8,850
def register_on_additions_state_changed ( self , callback ) : event_type = library . VBoxEventType . on_additions_state_change return self . event_source . register_callback ( callback , event_type )
Set the callback function to consume on additions state changed events .
8,851
def register_on_state_changed ( self , callback ) : event_type = library . VBoxEventType . on_state_changed return self . event_source . register_callback ( callback , event_type )
Set the callback function to consume on state changed events which are generated when the state of the machine changes .
8,852
def register_on_event_source_changed ( self , callback ) : event_type = library . VBoxEventType . on_event_source_changed return self . event_source . register_callback ( callback , event_type )
Set the callback function to consume on event source changed events . This occurs when a listener is added or removed .
8,853
def register_on_can_show_window ( self , callback ) : event_type = library . VBoxEventType . on_can_show_window return self . event_source . register_callback ( callback , event_type )
Set the callback function to consume on can show window events . This occurs when the console window is to be activated and brought to the foreground of the desktop of the host PC . If this behaviour is not desired a call to event . add_veto will stop this from happening .
8,854
def register_on_show_window ( self , callback ) : event_type = library . VBoxEventType . on_show_window return self . event_source . register_callback ( callback , event_type )
Set the callback function to consume on show window events . This occurs when the console window is to be activated and brought to the foreground of the desktop of the host PC .
8,855
def manager ( self , value ) : "Set the manager object in the global _managers dict." pid = current_process ( ) . ident if _managers is None : raise RuntimeError ( "Can not set the manager following a system exit." ) if pid not in _managers : _managers [ pid ] = value else : raise Exception ( "Manager already set for p...
Set the manager object in the global _managers dict .
8,856
def get_session ( self ) : if hasattr ( self . manager , 'mgr' ) : manager = getattr ( self . manager , 'mgr' ) else : manager = self . manager return Session ( interface = manager . getSessionObject ( None ) )
Return a Session interface
8,857
def cast_object ( self , interface_object , interface_class ) : name = interface_class . __name__ i = self . manager . queryInterface ( interface_object . _i , name ) return interface_class ( interface = i )
Cast the obj to the interface class
8,858
def _lock ( self , timeout_ms = - 1 ) : vbox = VirtualBox ( ) machine = vbox . find_machine ( self . machine_name ) wait_time = 0 while True : session = Session ( ) try : machine . lock_machine ( session , LockType . write ) except Exception as exc : if timeout_ms != - 1 and wait_time > timeout_ms : raise ValueError ( ...
Exclusive lock over root machine
8,859
def _clones ( self ) : vbox = VirtualBox ( ) machines = [ ] for machine in vbox . machines : if machine . name == self . machine_name : continue if machine . name . startswith ( self . machine_name ) : machines . append ( machine ) return machines
Yield all machines under this pool
8,860
def acquire ( self , username , password , frontend = 'headless' ) : with self . _lock ( ) as root_session : for clone in self . _clones : session = Session ( ) try : clone . lock_machine ( session , LockType . write ) except Exception : continue else : try : p = session . machine . restore_snapshot ( ) p . wait_for_co...
Acquire a Machine resource .
8,861
def release ( self , session ) : if session . state != SessionState . locked : return with self . _lock ( ) : return self . _power_down ( session )
Release a machine session resource .
8,862
def add_port_forward_rule ( self , is_ipv6 , rule_name , proto , host_ip , host_port , guest_ip , guest_port ) : if not isinstance ( is_ipv6 , bool ) : raise TypeError ( "is_ipv6 can only be an instance of type bool" ) if not isinstance ( rule_name , basestring ) : raise TypeError ( "rule_name can only be an instance o...
Protocol handled with the rule .
8,863
def start ( self , trunk_type ) : if not isinstance ( trunk_type , basestring ) : raise TypeError ( "trunk_type can only be an instance of type basestring" ) self . _call ( "start" , in_p = [ trunk_type ] )
Type of internal network trunk .
8,864
def remove_vm_slot_options ( self , vmname , slot ) : if not isinstance ( vmname , basestring ) : raise TypeError ( "vmname can only be an instance of type basestring" ) if not isinstance ( slot , baseinteger ) : raise TypeError ( "slot can only be an instance of type baseinteger" ) self . _call ( "removeVmSlotOptions"...
removes all option for the specified adapter
8,865
def set_configuration ( self , ip_address , network_mask , from_ip_address , to_ip_address ) : if not isinstance ( ip_address , basestring ) : raise TypeError ( "ip_address can only be an instance of type basestring" ) if not isinstance ( network_mask , basestring ) : raise TypeError ( "network_mask can only be an inst...
configures the server
8,866
def start ( self , network_name , trunk_name , trunk_type ) : if not isinstance ( network_name , basestring ) : raise TypeError ( "network_name can only be an instance of type basestring" ) if not isinstance ( trunk_name , basestring ) : raise TypeError ( "trunk_name can only be an instance of type basestring" ) if not...
Starts DHCP server process .
8,867
def find_machine ( self , name_or_id ) : if not isinstance ( name_or_id , basestring ) : raise TypeError ( "name_or_id can only be an instance of type basestring" ) machine = self . _call ( "findMachine" , in_p = [ name_or_id ] ) machine = IMachine ( machine ) return machine
Attempts to find a virtual machine given its name or UUID . Inaccessible machines cannot be found by name only by UUID because their name cannot safely be determined .
8,868
def get_machines_by_groups ( self , groups ) : if not isinstance ( groups , list ) : raise TypeError ( "groups can only be an instance of type list" ) for a in groups [ : 10 ] : if not isinstance ( a , basestring ) : raise TypeError ( "array can only contain objects of type basestring" ) machines = self . _call ( "getM...
Gets all machine references which are in one of the specified groups .
8,869
def get_machine_states ( self , machines ) : if not isinstance ( machines , list ) : raise TypeError ( "machines can only be an instance of type list" ) for a in machines [ : 10 ] : if not isinstance ( a , IMachine ) : raise TypeError ( "array can only contain objects of type IMachine" ) states = self . _call ( "getMac...
Gets the state of several machines in a single operation .
8,870
def set_settings_secret ( self , password ) : if not isinstance ( password , basestring ) : raise TypeError ( "password can only be an instance of type basestring" ) self . _call ( "setSettingsSecret" , in_p = [ password ] )
Unlocks the secret data by passing the unlock password to the server . The server will cache the password for that machine .
8,871
def create_dhcp_server ( self , name ) : if not isinstance ( name , basestring ) : raise TypeError ( "name can only be an instance of type basestring" ) server = self . _call ( "createDHCPServer" , in_p = [ name ] ) server = IDHCPServer ( server ) return server
Creates a DHCP server settings to be used for the given internal network name
8,872
def remove_dhcp_server ( self , server ) : if not isinstance ( server , IDHCPServer ) : raise TypeError ( "server can only be an instance of type IDHCPServer" ) self . _call ( "removeDHCPServer" , in_p = [ server ] )
Removes the DHCP server settings
8,873
def check_firmware_present ( self , firmware_type , version ) : if not isinstance ( firmware_type , FirmwareType ) : raise TypeError ( "firmware_type can only be an instance of type FirmwareType" ) if not isinstance ( version , basestring ) : raise TypeError ( "version can only be an instance of type basestring" ) ( re...
Check if this VirtualBox installation has a firmware of the given type available either system - wide or per - user . Optionally this may return a hint where this firmware can be downloaded from .
8,874
def cd ( self , dir_p ) : if not isinstance ( dir_p , basestring ) : raise TypeError ( "dir_p can only be an instance of type basestring" ) progress = self . _call ( "cd" , in_p = [ dir_p ] ) progress = IProgress ( progress ) return progress
Change the current directory level .
8,875
def exists ( self , names ) : 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" ) exists = self . _call ( "exists" , in_p = [ names ]...
Checks if the given file list exists in the current directory level .
8,876
def remove ( self , names ) : 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" ) progress = self . _call ( "remove" , in_p = [ names...
Deletes the given files in the current directory level .
8,877
def query_info ( self , what ) : if not isinstance ( what , baseinteger ) : raise TypeError ( "what can only be an instance of type baseinteger" ) result = self . _call ( "queryInfo" , in_p = [ what ] ) return result
Way to extend the interface .
8,878
def get_medium_ids_for_password_id ( self , password_id ) : if not isinstance ( password_id , basestring ) : raise TypeError ( "password_id can only be an instance of type basestring" ) identifiers = self . _call ( "getMediumIdsForPasswordId" , in_p = [ password_id ] ) return identifiers
Returns a list of medium identifiers which use the given password identifier .
8,879
def add_passwords ( self , identifiers , passwords ) : if not isinstance ( identifiers , list ) : raise TypeError ( "identifiers can only be an instance of type list" ) for a in identifiers [ : 10 ] : if not isinstance ( a , basestring ) : raise TypeError ( "array can only contain objects of type basestring" ) if not i...
Adds a list of passwords required to import or export encrypted virtual machines .
8,880
def remove_description_by_type ( self , type_p ) : if not isinstance ( type_p , VirtualSystemDescriptionType ) : raise TypeError ( "type_p can only be an instance of type VirtualSystemDescriptionType" ) self . _call ( "removeDescriptionByType" , in_p = [ type_p ] )
Delete all records which are equal to the passed type from the list
8,881
def update_state ( self , state ) : if not isinstance ( state , MachineState ) : raise TypeError ( "state can only be an instance of type MachineState" ) self . _call ( "updateState" , in_p = [ state ] )
Updates the VM state . This operation will also update the settings file with the correct information about the saved state file and delete this file from disk when appropriate .
8,882
def on_session_end ( self , session ) : if not isinstance ( session , ISession ) : raise TypeError ( "session can only be an instance of type ISession" ) progress = self . _call ( "onSessionEnd" , in_p = [ session ] ) progress = IProgress ( progress ) return progress
Triggered by the given session object when the session is about to close normally .
8,883
def pull_guest_properties ( self ) : ( names , values , timestamps , flags ) = self . _call ( "pullGuestProperties" ) return ( names , values , timestamps , flags )
Get the list of the guest properties matching a set of patterns along with their values timestamps and flags and give responsibility for managing properties to the console .
8,884
def push_guest_property ( self , name , value , timestamp , flags ) : if not isinstance ( name , basestring ) : raise TypeError ( "name can only be an instance of type basestring" ) if not isinstance ( value , basestring ) : raise TypeError ( "value can only be an instance of type basestring" ) if not isinstance ( time...
Update a single guest property in IMachine .
8,885
def eject_medium ( self , attachment ) : if not isinstance ( attachment , IMediumAttachment ) : raise TypeError ( "attachment can only be an instance of type IMediumAttachment" ) new_attachment = self . _call ( "ejectMedium" , in_p = [ attachment ] ) new_attachment = IMediumAttachment ( new_attachment ) return new_atta...
Tells VBoxSVC that the guest has ejected the medium associated with the medium attachment .
8,886
def authenticate_external ( self , auth_params ) : if not isinstance ( auth_params , list ) : raise TypeError ( "auth_params can only be an instance of type list" ) for a in auth_params [ : 10 ] : if not isinstance ( a , basestring ) : raise TypeError ( "array can only contain objects of type basestring" ) result = sel...
Verify credentials using the external auth library .
8,887
def is_feature_enabled ( self , feature ) : if not isinstance ( feature , RecordingFeature ) : raise TypeError ( "feature can only be an instance of type RecordingFeature" ) enabled = self . _call ( "isFeatureEnabled" , in_p = [ feature ] ) return enabled
Returns whether a particular recording feature is enabled for this screen or not .
8,888
def get_screen_settings ( self , screen_id ) : if not isinstance ( screen_id , baseinteger ) : raise TypeError ( "screen_id can only be an instance of type baseinteger" ) record_screen_settings = self . _call ( "getScreenSettings" , in_p = [ screen_id ] ) record_screen_settings = IRecordingScreenSettings ( record_scree...
Returns the recording settings for a particular screen .
8,889
def from_long ( self , number ) : if not isinstance ( number , baseinteger ) : raise TypeError ( "number can only be an instance of type baseinteger" ) self . _call ( "fromLong" , in_p = [ number ] )
Make PCI address from long .
8,890
def get_medium_attachments_of_controller ( self , name ) : if not isinstance ( name , basestring ) : raise TypeError ( "name can only be an instance of type basestring" ) medium_attachments = self . _call ( "getMediumAttachmentsOfController" , in_p = [ name ] ) medium_attachments = [ IMediumAttachment ( a ) for a in me...
Returns an array of medium attachments which are attached to the the controller with the given name .
8,891
def get_medium_attachment ( self , name , controller_port , device ) : if not isinstance ( name , basestring ) : raise TypeError ( "name can only be an instance of type basestring" ) if not isinstance ( controller_port , baseinteger ) : raise TypeError ( "controller_port can only be an instance of type baseinteger" ) i...
Returns a medium attachment which corresponds to the controller with the given name on the given port and device slot .
8,892
def get_storage_controller_by_name ( self , name ) : if not isinstance ( name , basestring ) : raise TypeError ( "name can only be an instance of type basestring" ) storage_controller = self . _call ( "getStorageControllerByName" , in_p = [ name ] ) storage_controller = IStorageController ( storage_controller ) return ...
Returns a storage controller with the given name .
8,893
def get_storage_controller_by_instance ( self , connection_type , instance ) : if not isinstance ( connection_type , StorageBus ) : raise TypeError ( "connection_type can only be an instance of type StorageBus" ) if not isinstance ( instance , baseinteger ) : raise TypeError ( "instance can only be an instance of type ...
Returns a storage controller of a specific storage bus with the given instance number .
8,894
def remove_storage_controller ( self , name ) : if not isinstance ( name , basestring ) : raise TypeError ( "name can only be an instance of type basestring" ) self . _call ( "removeStorageController" , in_p = [ name ] )
Removes a storage controller from the machine with all devices attached to it .
8,895
def set_storage_controller_bootable ( self , name , bootable ) : if not isinstance ( name , basestring ) : raise TypeError ( "name can only be an instance of type basestring" ) if not isinstance ( bootable , bool ) : raise TypeError ( "bootable can only be an instance of type bool" ) self . _call ( "setStorageControlle...
Sets the bootable flag of the storage controller with the given name .
8,896
def remove_usb_controller ( self , name ) : if not isinstance ( name , basestring ) : raise TypeError ( "name can only be an instance of type basestring" ) self . _call ( "removeUSBController" , in_p = [ name ] )
Removes a USB controller from the machine .
8,897
def get_usb_controller_by_name ( self , name ) : if not isinstance ( name , basestring ) : raise TypeError ( "name can only be an instance of type basestring" ) controller = self . _call ( "getUSBControllerByName" , in_p = [ name ] ) controller = IUSBController ( controller ) return controller
Returns a USB controller with the given type .
8,898
def get_usb_controller_count_by_type ( self , type_p ) : if not isinstance ( type_p , USBControllerType ) : raise TypeError ( "type_p can only be an instance of type USBControllerType" ) controllers = self . _call ( "getUSBControllerCountByType" , in_p = [ type_p ] ) return controllers
Returns the number of USB controllers of the given type attached to the VM .
8,899
def get_cpu_property ( self , property_p ) : if not isinstance ( property_p , CPUPropertyType ) : raise TypeError ( "property_p can only be an instance of type CPUPropertyType" ) value = self . _call ( "getCPUProperty" , in_p = [ property_p ] ) return value
Returns the virtual CPU boolean value of the specified property .