idx
int64
0
63k
question
stringlengths
53
5.28k
target
stringlengths
5
805
28,200
def matching_method ( self , matching_method ) : allowed_values = [ "CONTAINS" , "STARTSWITH" , "EXACT" , "TAGPATH" ] if matching_method not in allowed_values : raise ValueError ( "Invalid value for `matching_method` ({0}), must be one of {1}" . format ( matching_method , allowed_values ) ) self . _matching_method = ma...
Sets the matching_method of this SearchQuery .
28,201
def alert_type ( self , alert_type ) : allowed_values = [ "CLASSIC" , "THRESHOLD" ] if alert_type not in allowed_values : raise ValueError ( "Invalid value for `alert_type` ({0}), must be one of {1}" . format ( alert_type , allowed_values ) ) self . _alert_type = alert_type
Sets the alert_type of this Alert .
28,202
def severity_list ( self , severity_list ) : allowed_values = [ "INFO" , "SMOKE" , "WARN" , "SEVERE" ] if not set ( severity_list ) . issubset ( set ( allowed_values ) ) : raise ValueError ( "Invalid values for `severity_list` [{0}], must be a subset of [{1}]" . format ( ", " . join ( map ( str , set ( severity_list ) ...
Sets the severity_list of this Alert .
28,203
def category_filter ( self , category_filter ) : allowed_values = [ "ADMINISTRATIVE" , "SERVICEHEALTH" , "ALERT" , "AUTOSCALE" , "SECURITY" ] if not set ( category_filter ) . issubset ( set ( allowed_values ) ) : raise ValueError ( "Invalid values for `category_filter` [{0}], must be a subset of [{1}]" . format ( ", " ...
Sets the category_filter of this AzureActivityLogConfiguration .
28,204
def entity_type ( self , entity_type ) : if entity_type is None : raise ValueError ( "Invalid value for `entity_type`, must not be `None`" ) allowed_values = [ "DASHBOARD" , "ALERT" , "MAINTENANCE_WINDOW" , "NOTIFICANT" , "EVENT" , "SOURCE" , "EXTERNAL_LINK" , "AGENT" , "CLOUD_INTEGRATION" , "APPLICATION" , "REGISTERED...
Sets the entity_type of this SavedSearch .
28,205
def summarization ( self , summarization ) : allowed_values = [ "MEAN" , "MEDIAN" , "MIN" , "MAX" , "SUM" , "COUNT" , "LAST" , "FIRST" ] if summarization not in allowed_values : raise ValueError ( "Invalid value for `summarization` ({0}), must be one of {1}" . format ( summarization , allowed_values ) ) self . _summari...
Sets the summarization of this Chart .
28,206
def categories_to_fetch ( self , categories_to_fetch ) : allowed_values = [ "APPENGINE" , "BIGQUERY" , "BIGTABLE" , "CLOUDFUNCTIONS" , "CLOUDIOT" , "CLOUDSQL" , "CLOUDTASKS" , "COMPUTE" , "CONTAINER" , "DATAFLOW" , "DATAPROC" , "DATASTORE" , "FIREBASEDATABASE" , "FIREBASEHOSTING" , "INTERCONNECT" , "LOADBALANCING" , "L...
Sets the categories_to_fetch of this GCPConfiguration .
28,207
def alert_statuses ( self , alert_statuses ) : if alert_statuses is None : raise ValueError ( "Invalid value for `alert_statuses`, must not be `None`" ) allowed_values = [ "VISIBLE" , "HIDDEN" , "NOT_LOADED" ] if not set ( alert_statuses . keys ( ) ) . issubset ( set ( allowed_values ) ) : raise ValueError ( "Invalid k...
Sets the alert_statuses of this IntegrationStatus .
28,208
def content_status ( self , content_status ) : if content_status is None : raise ValueError ( "Invalid value for `content_status`, must not be `None`" ) allowed_values = [ "INVALID" , "NOT_LOADED" , "HIDDEN" , "VISIBLE" ] if content_status not in allowed_values : raise ValueError ( "Invalid value for `content_status` (...
Sets the content_status of this IntegrationStatus .
28,209
def install_status ( self , install_status ) : if install_status is None : raise ValueError ( "Invalid value for `install_status`, must not be `None`" ) allowed_values = [ "UNDECIDED" , "UNINSTALLED" , "INSTALLED" ] if install_status not in allowed_values : raise ValueError ( "Invalid value for `install_status` ({0}), ...
Sets the install_status of this IntegrationStatus .
28,210
def event_filter_type ( self , event_filter_type ) : allowed_values = [ "BYCHART" , "AUTOMATIC" , "ALL" , "NONE" , "BYDASHBOARD" , "BYCHARTANDDASHBOARD" ] if event_filter_type not in allowed_values : raise ValueError ( "Invalid value for `event_filter_type` ({0}), must be one of {1}" . format ( event_filter_type , allo...
Sets the event_filter_type of this Dashboard .
28,211
def scatter_plot_source ( self , scatter_plot_source ) : allowed_values = [ "X" , "Y" ] if scatter_plot_source not in allowed_values : raise ValueError ( "Invalid value for `scatter_plot_source` ({0}), must be one of {1}" . format ( scatter_plot_source , allowed_values ) ) self . _scatter_plot_source = scatter_plot_sou...
Sets the scatter_plot_source of this ChartSourceQuery .
28,212
def content_type ( self , content_type ) : allowed_values = [ "application/json" , "text/html" , "text/plain" , "application/x-www-form-urlencoded" , "" ] if content_type not in allowed_values : raise ValueError ( "Invalid value for `content_type` ({0}), must be one of {1}" . format ( content_type , allowed_values ) ) ...
Sets the content_type of this Notificant .
28,213
def method ( self , method ) : if method is None : raise ValueError ( "Invalid value for `method`, must not be `None`" ) allowed_values = [ "WEBHOOK" , "EMAIL" , "PAGERDUTY" ] if method not in allowed_values : raise ValueError ( "Invalid value for `method` ({0}), must be one of {1}" . format ( method , allowed_values )...
Sets the method of this Notificant .
28,214
def triggers ( self , triggers ) : if triggers is None : raise ValueError ( "Invalid value for `triggers`, must not be `None`" ) allowed_values = [ "ALERT_OPENED" , "ALERT_UPDATED" , "ALERT_RESOLVED" , "ALERT_MAINTENANCE" , "ALERT_SNOOZED" , "ALERT_INVALID" , "ALERT_NO_LONGER_INVALID" , "ALERT_TESTING" , "ALERT_RETRIGG...
Sets the triggers of this Notificant .
28,215
def creator_type ( self , creator_type ) : allowed_values = [ "USER" , "ALERT" , "SYSTEM" ] if not set ( creator_type ) . issubset ( set ( allowed_values ) ) : raise ValueError ( "Invalid values for `creator_type` [{0}], must be a subset of [{1}]" . format ( ", " . join ( map ( str , set ( creator_type ) - set ( allowe...
Sets the creator_type of this Event .
28,216
def _integerValue_to_int ( value_str ) : m = BINARY_VALUE . match ( value_str ) if m : value = int ( m . group ( 1 ) , 2 ) elif OCTAL_VALUE . match ( value_str ) : value = int ( value_str , 8 ) elif DECIMAL_VALUE . match ( value_str ) : value = int ( value_str ) elif HEX_VALUE . match ( value_str ) : value = int ( valu...
Convert a value string that conforms to DSP0004 integerValue into the corresponding integer and return it . The returned value has Python type int or in Python 2 type long if needed .
28,217
def _realValue_to_float ( value_str ) : if REAL_VALUE . match ( value_str ) : value = float ( value_str ) else : value = None return value
Convert a value string that conforms to DSP0004 realValue into the corresponding float and return it .
28,218
def parse_cmdline ( argparser_ ) : opts = argparser_ . parse_args ( ) if not opts . server : argparser_ . error ( 'No WBEM server specified' ) return None return opts
Parse the command line . This tests for any required args
28,219
def _statuscode2name ( status_code ) : try : s = _STATUSCODE2NAME [ status_code ] except KeyError : s = _format ( "Invalid status code {0}" , status_code ) return s
Return the symbolic name for a CIM status code .
28,220
def _statuscode2string ( status_code ) : try : s = _STATUSCODE2STRING [ status_code ] except KeyError : s = _format ( "Invalid status code {0}" , status_code ) return s
Return a short message for a CIM status code .
28,221
def build_mock_repository ( conn_ , file_path_list , verbose ) : for file_path in file_path_list : ext = _os . path . splitext ( file_path ) [ 1 ] if not _os . path . exists ( file_path ) : raise ValueError ( 'File name %s does not exist' % file_path ) if ext == '.mof' : conn_ . compile_mof_file ( file_path ) elif ext ...
Build the mock repository from the file_path list and fake connection instance . This allows both mof files and python files to be used to build the repository .
28,222
def _remote_connection ( server , opts , argparser_ ) : global CONN if opts . timeout is not None : if opts . timeout < 0 or opts . timeout > 300 : argparser_ . error ( 'timeout option(%s) out of range' % opts . timeout ) if opts . mock_server : CONN = FakedWBEMConnection ( default_namespace = opts . namespace , timeou...
Initiate a remote connection via PyWBEM . Arguments for the request are part of the command line arguments and include user name password namespace etc .
28,223
def _get_connection_info ( ) : info = 'Connection: %s,' % CONN . url if CONN . creds is not None : info += ' userid=%s,' % CONN . creds [ 0 ] else : info += ' no creds,' info += ' cacerts=%s,' % ( 'sys-default' if CONN . ca_certs is None else CONN . ca_certs ) info += ' verifycert=%s,' % ( 'off' if CONN . no_verificati...
Return a string with the connection info .
28,224
def _get_banner ( ) : result = '' result += '\nPython %s' % _sys . version result += '\n\nWbemcli interactive shell' result += '\n%s' % _get_connection_info ( ) if _sys . platform == 'win32' : result += '\nEnter Ctrl-Z or quit() or exit() to exit' else : result += '\nPress Ctrl-D or enter quit() or exit() to exit' resu...
Return a banner message for the interactive console .
28,225
def _setup_dmtf_schema ( self ) : def print_verbose ( msg ) : if self . verbose : print ( msg ) if not os . path . isdir ( self . schema_root_dir ) : print_verbose ( _format ( "Creating directory for CIM Schema archive: {0}" , self . schema_root_dir ) ) os . mkdir ( self . schema_root_dir ) if not os . path . isfile ( ...
Install the DMTF CIM schema from the DMTF web site if it is not already installed . This includes downloading the DMTF CIM schema zip file from the DMTF web site and expanding that file into a subdirectory defined by schema_mof_dir .
28,226
def clean ( self ) : if os . path . isdir ( self . schema_mof_dir ) : shutil . rmtree ( self . schema_mof_dir )
Remove all of the MOF files and the schema_mof_dir for the defined schema . This is useful because while the downloaded schema is a single compressed zip file it creates several thousand MOF files that take up considerable space .
28,227
def remove ( self ) : self . clean ( ) if os . path . isfile ( self . schema_zip_file ) : os . remove ( self . schema_zip_file ) if os . path . isdir ( self . schema_root_dir ) and os . listdir ( self . schema_root_dir ) == [ ] : os . rmdir ( self . schema_root_dir )
The schema_mof_dir directory is removed if it esists and the schema_zip_file is removed if it exists . If the schema_root_dir is empty after these removals that directory is removed .
28,228
def print_table ( title , headers , rows , sort_columns = None ) : if sort_columns is not None : if isinstance ( sort_columns , int ) : rows = sorted ( rows , key = itemgetter ( sort_columns ) ) elif isinstance ( sort_columns , ( list , tuple ) ) : rows = sorted ( rows , key = itemgetter ( * sort_columns ) ) else : ass...
Print a table of rows with headers using tabulate .
28,229
def fold_list ( input_list , max_width = None ) : if not input_list : return "" if not isinstance ( input_list [ 0 ] , six . string_types ) : input_list = [ str ( item ) for item in input_list ] if max_width : mystr = ", " . join ( input_list ) return fold_string ( mystr , max_width ) return "\n" . join ( input_list )
Fold the entries in input_list . If max_width is not None fold only if it is longer than max_width . Otherwise fold each entry .
28,230
def fold_string ( input_string , max_width ) : new_string = input_string if isinstance ( input_string , six . string_types ) : if max_width < len ( input_string ) : new_string = textwrap . fill ( input_string , max_width ) return new_string
Fold a string within a maximum width .
28,231
def path_wo_ns ( obj ) : if isinstance ( obj , pywbem . CIMInstance ) : path = obj . path . copy ( ) elif isinstance ( obj , pywbem . CIMInstanceName ) : path = obj . copy ( ) else : assert False path . host = None path . namespace = None return path
Return path of an instance or instance path without host or namespace . Creates copy of the object so the original is not changed .
28,232
def connect ( nickname , server_def , debug = None , timeout = 10 ) : url = server_def . url conn = pywbem . WBEMConnection ( url , ( server_def . user , server_def . password ) , default_namespace = server_def . implementation_namespace , no_verification = server_def . no_verification , timeout = timeout ) if debug : ...
Connect and confirm server works by testing for a known class in the default namespace or if there is no default namespace defined in all the possible interop namespaces .
28,233
def overview ( name , server ) : print ( '%s OVERVIEW' % name ) print ( " Interop namespace: %s" % server . interop_ns ) print ( " Brand: %s" % server . brand ) print ( " Version: %s" % server . version ) print ( " Namespaces: %s" % ", " . join ( server . namespaces ) ) print ( ' namespace_classname: %s' % server ...
Overview of the server as seen through the properties of the server class .
28,234
def get_references ( profile_path , role , profile_name , server ) : references_for_profile = server . conn . References ( ObjectName = profile_path , ResultClass = "CIM_ReferencedProfile" , Role = role ) if VERBOSE : print ( 'References for profile=%s, path=%s, ResultClass=' 'CIM_ReferencedProfile, Role=%s' % ( profil...
Get display and return the References for the path provided ResultClass CIM_ReferencedProfile and the role provided .
28,235
def show_profiles ( name , server , org_vm ) : rows = [ ] for profile_inst in server . profiles : pn = profile_name ( org_vm , profile_inst ) deps = get_associated_profile_names ( profile_inst . path , "dependent" , org_vm , server , include_classnames = False ) dep_refs = get_references ( profile_inst . path , "antece...
Create a table of info about the profiles based on getting the references etc . both in the dependent and antecedent direction .
28,236
def fold_path ( path , width = 30 ) : assert isinstance ( path , six . string_types ) if len ( path ) > width : path . replace ( "." , ".\n " ) return path
Fold a string form of a path so that each element is on separate line
28,237
def count_ref_associators ( nickname , server , profile_insts , org_vm ) : def get_assoc_count ( server , profile_inst ) : deps = server . conn . AssociatorNames ( ObjectName = profile_inst . path , AssocClass = "CIM_ReferencedProfile" , ResultRole = 'Dependent' ) ants = server . conn . AssociatorNames ( ObjectName = p...
Get dict of counts of associator returns for ResultRole == Dependent and ResultRole == Antecedent for profiles in list . This method counts by executing repeated AssociationName calls on CIM_ReferencedProfile for each profile instance in profile_insts with the result Role set to Dependent and then Antecedent to get the...
28,238
def fast_count_associators ( server ) : try : ref_insts = server . conn . EnumerateInstances ( "CIM_ReferencedProfile" , namespace = server . interop_ns ) for ref_inst in ref_insts : for prop in ref_inst . values ( ) : prop . host = None except pywbem . Error as er : print ( 'CIM_ReferencedProfile failed for conn=%s\ne...
Create count of associators for CIM_ReferencedProfile using the antecedent and dependent reference properties as ResultRole for each profile defined in server . profiles and return a dictionary of the count . This code does a shortcut in executing EnumerateInstances to get CIM_ReferencedProfile and processing the assoc...
28,239
def show_instances ( server , cim_class ) : if cim_class == 'CIM_RegisteredProfile' : for inst in server . profiles : print ( inst . tomof ( ) ) return for ns in server . namespaces : try : insts = server . conn . EnumerateInstances ( cim_class , namespace = ns ) if len ( insts ) : print ( 'INSTANCES OF %s ns=%s' % ( c...
Display the instances of the CIM_Class defined by cim_class . If the namespace is None use the interop namespace . Search all namespaces for instances except for CIM_RegisteredProfile
28,240
def get_profiles_in_svr ( nickname , server , all_profiles_dict , org_vm , add_error_list = False ) : profiles_in_dict = [ ] for profile_inst in server . profiles : pn = profile_name ( org_vm , profile_inst , short = True ) if pn in all_profiles_dict : profiles_in_dict . append ( profile_inst ) else : if add_error_list...
Test all profiles in server . profiles to determine if profile is in the all_profiles_dict .
28,241
def possible_target_profiles ( nickname , server , all_profiles_dict , org_vm , autonomous = True , output = 'path' ) : assert output in [ 'path' , 'name' ] profiles_in_svr = get_profiles_in_svr ( nickname , server , all_profiles_dict , org_vm ) possible_profiles = [ ] for profile_inst in profiles_in_svr : profile_org_...
Get list of possible autonomous or component profiles based on the list of all profiles and the list of profiles in the defined server .
28,242
def show_tree ( nickname , server , org_vm , reference_direction = 'snia' ) : scoping_result_role = "Dependent" if reference_direction == 'snia' else "Antecedent" profiles = server . profiles reg_profiles = { } for profile in profiles : reg_profiles [ profile . path . to_wbem_uri ( format = "canonical" ) ] = profile tr...
sShow a tree view of the registered profiles using the ECTP and referencedprofile associations to define the tree . Starts with SMI - S if it iexists
28,243
def display_servers ( server_definitions_filename ) : servers = ServerDefinitionFile2 ( server_definitions_filename ) title = 'List of all servers that can be tested' headers = [ 'Name' , 'Url' , 'Default_namespace' ] rows = [ ] for server in servers . list_all_servers ( ) : rows . append ( ( server . nickname , server...
display the defined servers information as a table .
28,244
def elapsed_ms ( self ) : dt = datetime . datetime . now ( ) - self . start_time return ( ( dt . days * 24 * 3600 ) + dt . seconds ) * 1000 + dt . microseconds / 1000.0
Get the elapsed time in milliseconds . returns floating point representation of elapsed time in seconds .
28,245
def list_servers ( self , nicknames = None ) : if not nicknames : return self . list_all_servers ( ) if isinstance ( nicknames , six . string_types ) : nicknames = [ nicknames ] sd_list = [ ] sd_nick_list = [ ] for nickname in nicknames : if nickname in self . _servers : sd_list . append ( self . get_server ( nickname ...
Iterate through the servers of the server group with the specified nicknames or the single server with the specified nickname and yield a ServerDefinition object for each server .
28,246
def print_profile_info ( org_vm , profile_instance ) : org = org_vm . tovalues ( profile_instance [ 'RegisteredOrganization' ] ) name = profile_instance [ 'RegisteredName' ] vers = profile_instance [ 'RegisteredVersion' ] print ( " %s %s Profile %s" % ( org , name , vers ) )
Print information on a profile defined by profile_instance .
28,247
def create_indication_data ( msg_id , sequence_number , source_id , delta_time , protocol_ver ) : data_template = data = { 'sequence_number' : sequence_number , 'source_id' : source_id , 'delta_time' : delta_time , 'protocol_ver' : protocol_ver , 'msg_id' : msg_id } return data_template % data
Create a singled indication XML from the template and the included sequence_number delta_time and protocol_ver
28,248
def send_indication ( url , headers , payload , verbose , verify = None , keyfile = None , timeout = 4 ) : try : response = requests . post ( url , headers = headers , data = payload , timeout = timeout , verify = verify ) except Exception as ex : print ( 'Exception %s' % ex ) return False if verbose or response . stat...
Send indication using requests module .
28,249
def _get_required_attribute ( node , attr ) : if not node . hasAttribute ( attr ) : raise ParseError ( 'Expecting %s attribute in element %s' % ( attr , node . tagName ) ) return node . getAttribute ( attr )
Return an attribute by name . Raise ParseError if not present .
28,250
def _get_end_event ( parser , tagName ) : ( event , node ) = six . next ( parser ) if event != pulldom . END_ELEMENT or node . tagName != tagName : raise ParseError ( 'Expecting %s end tag, got %s %s' % ( tagName , event , node . tagName ) )
Check that the next event is the end of a particular XML tag .
28,251
def make_parser ( stream_or_string ) : if isinstance ( stream_or_string , six . string_types ) : return pulldom . parseString ( str ( stream_or_string ) ) else : return pulldom . parse ( stream_or_string )
Create a xml . dom . pulldom parser .
28,252
def parse_any ( stream_or_string ) : parser = make_parser ( stream_or_string ) ( event , node ) = six . next ( parser ) if event != pulldom . START_DOCUMENT : raise ParseError ( 'Expecting document start' ) ( event , node ) = six . next ( parser ) if event != pulldom . START_ELEMENT : raise ParseError ( 'Expecting elem...
Parse any XML string or stream . This function fabricates the names of the parser functions by prepending parse_ to the node name and then calling that function .
28,253
def _process_indication ( indication , host ) : global RECEIVED_INDICATION_DICT COUNTER_LOCK . acquire ( ) if host in RECEIVED_INDICATION_DICT : RECEIVED_INDICATION_DICT [ host ] += 1 else : RECEIVED_INDICATION_DICT [ host ] = 1 COUNTER_LOCK . release ( ) listener . logger . info ( "Consumed CIM indication #%s: host=%s...
This function gets called when an indication is received .
28,254
def _get_argv ( index , default = None ) : return _sys . argv [ index ] if len ( _sys . argv ) > index else default
get the argv input argument defined by index . Return the default attribute if that argument does not exist
28,255
def status ( reset = None ) : global RECEIVED_INDICATION_DICT for host , count in six . iteritems ( RECEIVED_INDICATION_DICT ) : print ( 'Host %s Received %s indications' % ( host , count ) ) if reset : for host in RECEIVED_INDICATION_DICT : RECEIVED_INDICATION_DICT [ host ] = 0 print ( 'Host %s Reset: Received %s indi...
Show status of indications received . If optional reset attribute is True reset the counter .
28,256
def _get_members ( self , class_obj , member_type , include_in_public = None ) : try : app = self . state . document . settings . env . app except AttributeError : app = None if not include_in_public : include_in_public = [ ] all_members = [ ] for member_name in dir ( class_obj ) : try : documenter = get_documenter ( a...
Return class members of the specified type .
28,257
def _get_def_class ( self , class_obj , member_name ) : member_obj = getattr ( class_obj , member_name ) for def_class_obj in inspect . getmro ( class_obj ) : if member_name in def_class_obj . __dict__ : if def_class_obj . __name__ in self . _excluded_classes : return class_obj return def_class_obj self . _logger . war...
Return the class object in MRO order that defines a member .
28,258
def reset ( self ) : self . _count = 0 self . _exception_count = 0 self . _stat_start_time = None self . _time_sum = float ( 0 ) self . _time_min = float ( 'inf' ) self . _time_max = float ( 0 ) self . _server_time_sum = float ( 0 ) self . _server_time_min = float ( 'inf' ) self . _server_time_max = float ( 0 ) self . ...
Reset the statistics data for this object .
28,259
def start_timer ( self ) : if self . container . enabled : self . _start_time = time . time ( ) if not self . _stat_start_time : self . _stat_start_time = self . _start_time
This is a low - level method that is called by pywbem at the begin of an operation . It starts the measurement for that operation if statistics is enabled for the connection .
28,260
def stop_timer ( self , request_len , reply_len , server_time = None , exception = False ) : if not self . container . enabled : return None if self . _start_time is None : raise RuntimeError ( 'stop_timer() called without preceding ' 'start_timer()' ) dt = time . time ( ) - self . _start_time self . _start_time = None...
This is a low - level method is called by pywbem at the end of an operation . It completes the measurement for that operation by capturing the needed data and updates the statistics data if statistics is enabled for the connection .
28,261
def formatted ( self , include_server_time ) : if include_server_time : return ( '{0:5d} {1:5d} ' '{2:7.3f} {3:7.3f} {4:7.3f} ' '{5:7.3f} {6:7.3f} {7:7.3f} ' '{8:6.0f} {9:6.0f} {10:6.0f} ' '{11:8.0f} {12:8.0f} {13:8.0f} {14}\n' . format ( self . count , self . exception_count , self . avg_time , self . min_time , self ...
Return a formatted one - line string with the statistics values for the operation for which this statistics object maintains data .
28,262
def formatted ( self ) : ret = "Statistics (times in seconds, lengths in Bytes):\n" if self . enabled : snapshot = sorted ( self . snapshot ( ) , key = lambda item : item [ 1 ] . avg_time , reverse = True ) include_svr = False for name , stats in snapshot : if stats . _server_time_stored : include_svr = True if include...
Return a human readable string with the statistics for this container . The operations are sorted by decreasing average time .
28,263
def reset ( self ) : for stat in six . itervalues ( self . _op_stats ) : if stat . _start_time is not None : return False self . _op_stats = { } return True
Reset all statistics and clear any statistic names . All statistics must be inactive before a reset will execute
28,264
def remove_duplicate_metadata_dirs ( package_name ) : print ( "Removing duplicate metadata directories of package: %s" % package_name ) module = importlib . import_module ( package_name ) py_mn = "%s.%s" % ( sys . version_info [ 0 ] , sys . version_info [ 1 ] ) print ( "Current Python version: %s" % py_mn ) version = m...
Remove duplicate metadata directories of a package .
28,265
def display_path_info ( descriptor , class_ , namespace ) : paths = CONN . EnumerateInstanceNames ( class_ , namespace = interop ) print ( '%ss: count=%s' % ( descriptor , len ( paths ) ) ) for path in paths : print ( '%s: %s' % ( descriptor , path ) ) return paths
Display info on the instance names of the class parameter retrieved from the interop namespace of the server defined by CONN .
28,266
def kids ( tup_tree ) : k = tup_tree [ 2 ] if k is None : return [ ] return [ x for x in k if type ( x ) == tuple ]
Return a list with the child elements of tup_tree .
28,267
def pcdata ( self , tup_tree ) : try : data = u'' . join ( tup_tree [ 2 ] ) except TypeError : raise CIMXMLParseError ( _format ( "Element {0!A} has unexpected child elements: " "{1!A} (allowed is only text content)" , name ( tup_tree ) , tup_tree [ 2 ] ) , conn_id = self . conn_id ) return data
Return the concatenated character data within the child nodes of a tuple tree node as a unicode string . Whitespace is preserved .
28,268
def check_node ( self , tup_tree , nodename , required_attrs = None , optional_attrs = None , allowed_children = None , allow_pcdata = False ) : if name ( tup_tree ) != nodename : raise CIMXMLParseError ( _format ( "Unexpected element {0!A} (expecting element {1!A})" , name ( tup_tree ) , nodename ) , conn_id = self . ...
Check static local constraints on a tuple tree node .
28,269
def one_child ( self , tup_tree , acceptable ) : k = kids ( tup_tree ) if not k : raise CIMXMLParseError ( _format ( "Element {0!A} missing required child element {1!A}" , name ( tup_tree ) , acceptable ) , conn_id = self . conn_id ) if len ( k ) > 1 : raise CIMXMLParseError ( _format ( "Element {0!A} has too many chil...
Parse children of a node with exactly one child node .
28,270
def notimplemented ( self , tup_tree ) : raise CIMXMLParseError ( _format ( "Internal Error: Parsing support for element {0!A} is " "not implemented" , name ( tup_tree ) ) , conn_id = self . conn_id )
Raise exception for not implemented function .
28,271
def parse_value ( self , tup_tree ) : self . check_node ( tup_tree , 'VALUE' , ( ) , ( ) , ( ) , allow_pcdata = True ) return self . pcdata ( tup_tree )
Parse a VALUE element and return its text content as a unicode string . Whitespace is preserved .
28,272
def parse_value_array ( self , tup_tree ) : self . check_node ( tup_tree , 'VALUE.ARRAY' ) children = self . list_of_various ( tup_tree , ( 'VALUE' , 'VALUE.NULL' ) ) return children
Parse a VALUE . ARRAY element and return the items in the array as a list of unicode strings or None for NULL items . Whitespace is preserved .
28,273
def parse_value_reference ( self , tup_tree ) : self . check_node ( tup_tree , 'VALUE.REFERENCE' ) child = self . one_child ( tup_tree , ( 'CLASSPATH' , 'LOCALCLASSPATH' , 'CLASSNAME' , 'INSTANCEPATH' , 'LOCALINSTANCEPATH' , 'INSTANCENAME' ) ) return child
Parse a VALUE . REFERENCE element and return the instance path or class path it represents as a CIMInstanceName or CIMClassName object respectively .
28,274
def parse_value_refarray ( self , tup_tree ) : self . check_node ( tup_tree , 'VALUE.REFARRAY' ) children = self . list_of_various ( tup_tree , ( 'VALUE.REFERENCE' , 'VALUE.NULL' ) ) return children
Parse a VALUE . REFARRAY element and return the array of instance paths or class paths it represents as a list of CIMInstanceName or CIMClassName objects respectively .
28,275
def parse_value_instancewithpath ( self , tup_tree ) : self . check_node ( tup_tree , 'VALUE.INSTANCEWITHPATH' ) k = kids ( tup_tree ) if len ( k ) != 2 : raise CIMXMLParseError ( _format ( "Element {0!A} has invalid number of child elements " "{1!A} (expecting two child elements " "(INSTANCEPATH, INSTANCE))" , name ( ...
The VALUE . INSTANCEWITHPATH is used to define a value that comprises a single CIMInstance with additional information that defines the absolute path to that object .
28,276
def parse_localnamespacepath ( self , tup_tree ) : self . check_node ( tup_tree , 'LOCALNAMESPACEPATH' , ( ) , ( ) , ( 'NAMESPACE' , ) ) if not kids ( tup_tree ) : raise CIMXMLParseError ( _format ( "Element {0!A} missing child elements (expecting one " "or more child elements 'NAMESPACE')" , name ( tup_tree ) ) , conn...
Parse a LOCALNAMESPACEPATH element and return the namespace it represents as a unicode string .
28,277
def parse_host ( self , tup_tree ) : self . check_node ( tup_tree , 'HOST' , ( ) , ( ) , ( ) , allow_pcdata = True ) return self . pcdata ( tup_tree )
Parse a HOST element and return its text content as a unicode string .
28,278
def parse_classpath ( self , tup_tree ) : self . check_node ( tup_tree , 'CLASSPATH' ) k = kids ( tup_tree ) if len ( k ) != 2 : raise CIMXMLParseError ( _format ( "Element {0!A} has invalid number of child elements " "{1!A} (expecting two child elements " "(NAMESPACEPATH, CLASSNAME))" , name ( tup_tree ) , k ) , conn_...
Parse a CLASSPATH element and return the class path it represents as a CIMClassName object .
28,279
def parse_localclasspath ( self , tup_tree ) : self . check_node ( tup_tree , 'LOCALCLASSPATH' ) k = kids ( tup_tree ) if len ( k ) != 2 : raise CIMXMLParseError ( _format ( "Element {0!A} has invalid number of child elements " "{1!A} (expecting two child elements " "(LOCALNAMESPACEPATH, CLASSNAME))" , name ( tup_tree ...
Parse a LOCALCLASSPATH element and return the class path it represents as a CIMClassName object .
28,280
def parse_classname ( self , tup_tree ) : self . check_node ( tup_tree , 'CLASSNAME' , ( 'NAME' , ) , ( ) , ( ) ) classname = attrs ( tup_tree ) [ 'NAME' ] class_path = CIMClassName ( classname ) return class_path
Parse a CLASSNAME element and return the class path it represents as a CIMClassName object .
28,281
def parse_instancepath ( self , tup_tree ) : self . check_node ( tup_tree , 'INSTANCEPATH' ) k = kids ( tup_tree ) if len ( k ) != 2 : raise CIMXMLParseError ( _format ( "Element {0!A} has invalid number of child elements " "{1!A} (expecting two child elements " "(NAMESPACEPATH, INSTANCENAME))" , name ( tup_tree ) , k ...
Parse an INSTANCEPATH element and return the instance path it represents as a CIMInstanceName object .
28,282
def parse_localinstancepath ( self , tup_tree ) : self . check_node ( tup_tree , 'LOCALINSTANCEPATH' ) k = kids ( tup_tree ) if len ( k ) != 2 : raise CIMXMLParseError ( _format ( "Element {0!A} has invalid number of child elements " "{1!A} (expecting two child elements " "(LOCALNAMESPACEPATH, INSTANCENAME))" , name ( ...
Parse a LOCALINSTANCEPATH element and return the instance path it represents as a CIMInstanceName object .
28,283
def parse_instancename ( self , tup_tree ) : self . check_node ( tup_tree , 'INSTANCENAME' , ( 'CLASSNAME' , ) ) k = kids ( tup_tree ) if not k : return CIMInstanceName ( attrs ( tup_tree ) [ 'CLASSNAME' ] , { } ) kid0 = k [ 0 ] k0_name = name ( kid0 ) classname = attrs ( tup_tree ) [ 'CLASSNAME' ] if k0_name in ( 'KEY...
Parse an INSTANCENAME element and return the instance path it represents as a CIMInstanceName object .
28,284
def parse_keybinding ( self , tup_tree ) : self . check_node ( tup_tree , 'KEYBINDING' , ( 'NAME' , ) ) child = self . one_child ( tup_tree , ( 'KEYVALUE' , 'VALUE.REFERENCE' ) ) return { attrs ( tup_tree ) [ 'NAME' ] : child }
Parse a KEYBINDING element and return the keybinding as a one - item dictionary from name to value where the value is a CIM data type object based upon the type information in the child elements if present . If no type information is present numeric values are returned as int or float .
28,285
def parse_keyvalue ( self , tup_tree ) : self . check_node ( tup_tree , 'KEYVALUE' , ( ) , ( 'VALUETYPE' , 'TYPE' ) , ( ) , allow_pcdata = True ) data = self . pcdata ( tup_tree ) attrl = attrs ( tup_tree ) valuetype = attrl . get ( 'VALUETYPE' , None ) cimtype = attrl . get ( 'TYPE' , None ) if cimtype == '' : cimtype...
Parse a KEYVALUE element and return the keybinding value as a CIM data type object based upon the type information in its VALUETYPE and TYPE attributes if present .
28,286
def parse_class ( self , tup_tree ) : self . check_node ( tup_tree , 'CLASS' , ( 'NAME' , ) , ( 'SUPERCLASS' , ) , ( 'QUALIFIER' , 'PROPERTY' , 'PROPERTY.REFERENCE' , 'PROPERTY.ARRAY' , 'METHOD' ) ) attrl = attrs ( tup_tree ) superclass = attrl . get ( 'SUPERCLASS' , None ) properties = self . list_of_matching ( tup_tr...
Parse CLASS element returning a CIMClass if the parse was successful .
28,287
def parse_instance ( self , tup_tree ) : self . check_node ( tup_tree , 'INSTANCE' , ( 'CLASSNAME' , ) , ( 'xml:lang' , ) , ( 'QUALIFIER' , 'PROPERTY' , 'PROPERTY.ARRAY' , 'PROPERTY.REFERENCE' ) ) qualifiers = self . list_of_matching ( tup_tree , ( 'QUALIFIER' , ) ) props = self . list_of_matching ( tup_tree , ( 'PROPE...
Return a CIMInstance .
28,288
def parse_scope ( self , tup_tree ) : self . check_node ( tup_tree , 'SCOPE' , ( ) , ( 'CLASS' , 'ASSOCIATION' , 'REFERENCE' , 'PROPERTY' , 'METHOD' , 'PARAMETER' , 'INDICATION' ) , ( ) ) scopes = NocaseDict ( ) for k , v in attrs ( tup_tree ) . items ( ) : v_ = self . unpack_boolean ( v ) if v_ is None : raise CIMXMLP...
Parse a SCOPE element and return a dictionary with an item for each specified scope attribute .
28,289
def parse_qualifier_declaration ( self , tup_tree ) : self . check_node ( tup_tree , 'QUALIFIER.DECLARATION' , ( 'NAME' , 'TYPE' ) , ( 'ISARRAY' , 'ARRAYSIZE' , 'OVERRIDABLE' , 'TOSUBCLASS' , 'TOINSTANCE' , 'TRANSLATABLE' ) , ( 'SCOPE' , 'VALUE' , 'VALUE.ARRAY' ) ) attrl = attrs ( tup_tree ) qname = attrl [ 'NAME' ] _t...
Parse QUALIFIER . DECLARATION element .
28,290
def parse_qualifier ( self , tup_tree ) : self . check_node ( tup_tree , 'QUALIFIER' , ( 'NAME' , 'TYPE' ) , ( 'OVERRIDABLE' , 'TOSUBCLASS' , 'TOINSTANCE' , 'TRANSLATABLE' , 'PROPAGATED' , 'xml:lang' ) , ( 'VALUE' , 'VALUE.ARRAY' ) ) attrl = attrs ( tup_tree ) qname = attrl [ 'NAME' ] _type = attrl [ 'TYPE' ] value = s...
Parse QUALIFIER element returning CIMQualifier .
28,291
def parse_property ( self , tup_tree ) : self . check_node ( tup_tree , 'PROPERTY' , ( 'TYPE' , 'NAME' ) , ( 'CLASSORIGIN' , 'PROPAGATED' , 'EmbeddedObject' , 'EMBEDDEDOBJECT' , 'xml:lang' ) , ( 'QUALIFIER' , 'VALUE' ) ) attrl = attrs ( tup_tree ) try : val = self . unpack_value ( tup_tree ) except ValueError as exc : ...
Parse PROPERTY into a CIMProperty object .
28,292
def parse_paramvalue ( self , tup_tree ) : self . check_node ( tup_tree , 'PARAMVALUE' , ( 'NAME' , ) , ( 'TYPE' , 'PARAMTYPE' , 'EmbeddedObject' , 'EMBEDDEDOBJECT' ) ) child = self . optional_child ( tup_tree , ( 'VALUE' , 'VALUE.REFERENCE' , 'VALUE.ARRAY' , 'VALUE.REFARRAY' , 'CLASSNAME' , 'INSTANCENAME' , 'CLASS' , ...
Parse PARAMVALUE element .
28,293
def parse_expparamvalue ( self , tup_tree ) : self . check_node ( tup_tree , 'EXPPARAMVALUE' , ( 'NAME' , ) , ( ) , ( 'INSTANCE' , ) ) child = self . optional_child ( tup_tree , ( 'INSTANCE' , ) ) _name = attrs ( tup_tree ) [ 'NAME' ] return _name , child
Parse for EXPPARMVALUE Element . I . e .
28,294
def parse_simplersp ( self , tup_tree ) : self . check_node ( tup_tree , 'SIMPLERSP' ) child = self . one_child ( tup_tree , ( 'METHODRESPONSE' , 'IMETHODRESPONSE' ) ) return name ( tup_tree ) , attrs ( tup_tree ) , child
Parse for SIMPLERSP Element .
28,295
def parse_methodresponse ( self , tup_tree ) : self . check_node ( tup_tree , 'METHODRESPONSE' , ( 'NAME' , ) ) return ( name ( tup_tree ) , attrs ( tup_tree ) , self . list_of_various ( tup_tree , ( 'ERROR' , 'RETURNVALUE' , 'PARAMVALUE' ) ) )
Parse expected METHODRESPONSE ELEMENT . I . e .
28,296
def parse_expmethodresponse ( self , tup_tree ) : raise CIMXMLParseError ( _format ( "Internal Error: Parsing support for element {0!A} is not " "implemented" , name ( tup_tree ) ) , conn_id = self . conn_id )
This function not implemented .
28,297
def parse_imethodresponse ( self , tup_tree ) : self . check_node ( tup_tree , 'IMETHODRESPONSE' , ( 'NAME' , ) ) return ( name ( tup_tree ) , attrs ( tup_tree ) , self . list_of_various ( tup_tree , ( 'ERROR' , 'IRETURNVALUE' , 'PARAMVALUE' ) ) )
Parse the tuple for an IMETHODRESPONE Element . I . e .
28,298
def parse_returnvalue ( self , tup_tree ) : self . check_node ( tup_tree , 'RETURNVALUE' , ( ) , ( 'PARAMTYPE' , 'EmbeddedObject' , 'EMBEDDEDOBJECT' ) ) child = self . optional_child ( tup_tree , ( 'VALUE' , 'VALUE.REFERENCE' ) ) attrl = attrs ( tup_tree ) if 'EmbeddedObject' in attrl or 'EMBEDDEDOBJECT' in attrl : chi...
Parse the RETURNVALUE element . Returns name attributes and one child as a tuple .
28,299
def parse_ireturnvalue ( self , tup_tree ) : self . check_node ( tup_tree , 'IRETURNVALUE' ) values = self . list_of_same ( tup_tree , ( 'CLASSNAME' , 'INSTANCENAME' , 'VALUE' , 'VALUE.OBJECTWITHPATH' , 'VALUE.OBJECTWITHLOCALPATH' , 'VALUE.OBJECT' , 'OBJECTPATH' , 'QUALIFIER.DECLARATION' , 'VALUE.ARRAY' , 'VALUE.REFERE...
Parse IRETURNVALUE element . Returns name attributes and values of the tup_tree .