code
string
signature
string
docstring
string
loss_without_docstring
float64
loss_with_docstring
float64
factor
float64
system = self._get_host_details() try: if system['Boot']['BootSourceOverrideEnabled'] == 'Once': device = system['Boot']['BootSourceOverrideTarget'] if device in DEVICE_RIS_TO_COMMON: return DEVICE_RIS_TO_COMMON[device] ...
def get_one_time_boot(self)
Retrieves the current setting for the one time boot. :returns: Returns the first boot device that would be used in next boot. Returns 'Normal' is no device is set. :raises: IloError, on an error from iLO. :raises: IloCommandNotSupportedError, if the command is not supported ...
7.027832
6.07524
1.156799
manager, uri = self._get_ilo_details() try: fw_uri = manager['Oem']['Hp']['links']['UpdateService']['href'] except KeyError: msg = ("Firmware Update Service resource not found.") raise exception.IloCommandNotSupportedError(msg) return fw_uri
def _get_firmware_update_service_resource(self)
Gets the firmware update service uri. :returns: firmware update service uri :raises: IloError, on an error from iLO. :raises: IloConnectionError, if not able to reach iLO. :raises: IloCommandNotSupportedError, for not finding the uri
7.243765
6.429487
1.126647
fw_update_uri = self._get_firmware_update_service_resource() action_data = { 'Action': 'InstallFromURI', 'FirmwareURI': file_url, } # perform the POST LOG.debug(self._('Flashing firmware file: %s ...'), file_url) status, headers, response...
def update_firmware(self, file_url, component_type)
Updates the given firmware on the server for the given component. :param file_url: location of the raw firmware file. Extraction of the firmware file (if in compact format) is expected to happen prior to this invocation. :param component_type: Type of c...
3.462308
3.454965
1.002125
try: fw_update_uri = self._get_firmware_update_service_resource() except exception.IloError as e: LOG.debug(self._('Progress of firmware update not known: %s'), str(e)) return "UNKNOWN", "UNKNOWN" # perform the GET statu...
def get_firmware_update_progress(self)
Get the progress of the firmware update. :returns: firmware update state, one of the following values: "IDLE", "UPLOADING", "PROGRESSING", "COMPLETED", "ERROR". If the update resource is not found, then "UNKNOWN". :returns: firmware update progress percent :r...
3.492486
3.334149
1.047489
tpm_values = {"NotPresent": False, "PresentDisabled": True, "PresentEnabled": True} try: tpm_state = self._get_bios_setting('TpmState') except exception.IloCommandNotSupportedError: tpm_state = "NotPresent" tpm_...
def _get_tpm_capability(self)
Retrieves if server is TPM capable or not. :returns True if TPM is Present else False
4.261279
3.809737
1.118523
try: cpu_vt = self._get_bios_setting('ProcVirtualization') except exception.IloCommandNotSupportedError: return False if cpu_vt == 'Enabled': vt_status = True else: vt_status = False return vt_status
def _get_cpu_virtualization(self)
get cpu virtualization status.
5.132246
4.329117
1.185518
try: nvdimm_n_status = self._get_bios_setting('NvDimmNMemFunctionality') if nvdimm_n_status == 'Enabled': nvn_status = True else: nvn_status = False except exception.IloCommandNotSupportedError: nvn_status = False ...
def _get_nvdimm_n_status(self)
Get status of NVDIMM_N. :returns: True if NVDIMM_N is present and enabled, False otherwise.
4.307094
4.541492
0.948387
cur_status = self.get_host_power_status() if cur_status != 'ON': raise exception.IloError("Server is not in powered on state.") self._perform_power_op("Nmi")
def inject_nmi(self)
Inject NMI, Non Maskable Interrupt. Inject NMI (Non Maskable Interrupt) for a node immediately. :raises: IloError, on an error from iLO
8.498568
6.844547
1.241655
headers, bios_uri, bios_settings = self._check_bios_resource() # Remove the "links" section bios_settings.pop("links", None) if only_allowed_settings: return utils.apply_bios_properties_filter( bios_settings, constants.SUPPORTED_BIOS_PROPERTIES) ...
def get_current_bios_settings(self, only_allowed_settings=True)
Get current BIOS settings. :param: only_allowed_settings: True when only allowed BIOS settings are to be returned. If False, All the BIOS settings supported by iLO are returned. :return: a dictionary of current BIOS settings is returned. Depending on the...
4.807373
5.782148
0.831416
headers, bios_uri, bios_settings = self._check_bios_resource() try: settings_config_uri = bios_settings['links']['Settings']['href'] except KeyError: msg = ("Settings resource not found. Couldn't get pending BIOS " "Settings.") rais...
def get_pending_bios_settings(self, only_allowed_settings=True)
Get current BIOS settings. :param: only_allowed_settings: True when only allowed BIOS settings are to be returned. If False, All the BIOS settings supported by iLO are returned. :return: a dictionary of pending BIOS settings. Depending on the 'only_allow...
3.790874
3.744417
1.012407
if not data: raise exception.IloError("Could not apply settings with" " empty data") if only_allowed_settings: unsupported_settings = [key for key in data if key not in ( constants.SUPPORTED_BIOS_PROPERTIES)] ...
def set_bios_settings(self, data=None, only_allowed_settings=True)
Sets current BIOS settings to the provided data. :param: only_allowed_settings: True when only allowed BIOS settings are to be set. If False, all the BIOS settings supported by iLO and present in the 'data' are set. :param: data: a dictionary of BIOS settings to be appli...
3.499213
3.441931
1.016642
headers_bios, bios_uri, bios_settings = self._check_bios_resource() # Get the BaseConfig resource. try: base_config_uri = bios_settings['links']['BaseConfigs']['href'] except KeyError: msg = ("BaseConfigs resource not found. Couldn't apply the BIOS " ...
def get_default_bios_settings(self, only_allowed_settings=True)
Get default BIOS settings. :param: only_allowed_settings: True when only allowed BIOS settings are to be returned. If False, All the BIOS settings supported by iLO are returned. :return: a dictionary of default BIOS settings(factory settings). Depending ...
3.544009
3.650161
0.970919
headers, bios_uri, bios_settings = self._check_bios_resource() settings_result = bios_settings.get("SettingsResult").get("Messages") status = "failed" if len(settings_result) > 1 else "success" return {"status": status, "results": settings_result}
def get_bios_settings_result(self)
Gets the result of the bios settings applied :raises: IloError, on an error from iLO. :raises: IloCommandNotSupportedError, if the command is not supported on the server.
5.27316
5.86684
0.898808
# provide library for Z versus element names, and Z for elements u.give_zip_element_z_and_names() # solar abundances are read here u.solar(file_solar,solar_factor) # from here I have average abundances in mass_range to plot average_iso_abund_marco(mass_range,cycle,logic_stable,i_decay) ...
def _obsolete_plot_el_abund_marco(directory,name_h5_file,mass_range,cycle,logic_stable,i_decay,file_solar,solar_factor,symbol='ko')
Interface to plot elements abundances averaged over mass_range. Parameters ---------- directory : string Location of h5 file to plot. Needed for plot_tools. name_h5_file : string Name of h5 file. Needed for plot_tools. mass_range : list A 1x2 array required to plot data in...
3.325321
3.262848
1.019147
return self.se.get(cycle_list,dataitem,isotope,sparse)
def get(self, cycle_list, dataitem=None, isotope=None, sparse=1)
Simple function that simply calls h5T.py get method. There are three ways to call this function. Parameters ---------- cycle_list : string, list If cycle_list is a string, then get interpates the argument cycle_list as a dataitem and fetches the dataitem for all...
5.188429
6.148854
0.843804
isoabunds=self.se.get(cycle,'iso_massf') A=array(self.se.A) Z=array(self.se.Z) names=self.se.isos Zuq=list(set(Z)) # list of unique Zs Zuq.sort() if index==None: index=[0,len(isoabunds)] if type(index)==list: elemabunds=...
def get_elemental_abunds(self,cycle,index=None)
returns the elemental abundances for one cycle, either for the whole star or a specific zone depending upon the value of 'index'. Parameters ---------- cycle : string or integer Model to get the abundances for. index : integer or list, optional zo...
4.00075
4.150755
0.963861
DataPlot.plot_prof_1(self,species,mod,xlim1,xlim2,ylim1,ylim2,symbol)
def plot_prof_1(self, mod, species, xlim1, xlim2, ylim1, ylim2, symbol=None)
plot one species for cycle between xlim1 and xlim2 Parameters ---------- mod : string or integer Model to plot, same as cycle number. species : list Which species to plot. xlim1, xlim2 : float Mass coordinate range. ylim1, ylim2 : floa...
4.2067
6.598248
0.637548
mass=self.se.get(mod,'mass') Xspecies=self.se.get(mod,'yps',species) pyl.plot(mass,Xspecies,'-',label=str(mod)+', '+species) pyl.xlim(xlim1,xlim2) pyl.legend()
def plot_prof_2(self, mod, species, xlim1, xlim2)
Plot one species for cycle between xlim1 and xlim2 Parameters ---------- mod : string or integer Model to plot, same as cycle number. species : list Which species to plot. xlim1, xlim2 : float Mass coordinate range.
5.911174
5.984907
0.98768
from xlsxwriter.workbook import Workbook # https://xlsxwriter.readthedocs.org/ Note: We neex xlswriter. Please meake sure it is installed. Run pip install xlsxwriter to install it using pip. If pip is not installed, install it via easy_install pip. Depending on the system you are on, you might need su...
def ernst_table_exporter(self, cycle, outfname='table_out', sheetname='Sheet 1')
This routine takes NuGrid data (model output) for a given cycle and writes it into an Excel sheet. This is one format as requested by Ernst Zinner in June 2013 (through Marco). If you want all radioactive isotopes, start from the restart file. Empty columns are not written out and ...
3.412148
3.39227
1.00586
self.plot_prof_1(num,'H-1',0.,5.,-5,0.) self.plot_prof_1(num,'He-4',0.,5.,-5,0.) self.plot_prof_1(num,'C-12',0.,5.,-5,0.) self.plot_prof_1(num,'O-16',0.,5.,-5,0.) pyl.legend(loc=3)
def plot4(self, num)
Plots the abundances of H-1, He-4, C-12 and O-16.
3.039785
2.264285
1.342492
self.plot_prof_2(num,'H-1',0.,5.) self.plot_prof_2(num,'He-4',0.,5.) self.plot_prof_2(num,'C-12',0.,5.) self.plot_prof_2(num,'O-16',0.,5.) pyl.legend(loc=3)
def plot4_nolog(self, num)
Plots the abundances of H-1, He-4, C-12 and O-16.
3.367157
2.355483
1.429498
mass=self.se.get(mod,'mass') Xspecies=self.se.get(mod,'yps',species) pyl.plot(mass[0:len(mass):sparse],np.log10(Xspecies[0:len(Xspecies):sparse]),symbol) pyl.xlim(xlim1,xlim2) pyl.ylim(ylim1,ylim2) pyl.legend()
def plot_prof_sparse(self, mod, species, xlim1, xlim2, ylim1, ylim2, sparse, symbol)
plot one species for cycle between xlim1 and xlim2. Parameters ---------- species : list which species to plot. mod : string or integer Model (cycle) to plot. xlim1, xlim2 : float Mass coordinate range. ylim1, ylim2 : float ...
4.15729
4.016471
1.03506
filename='traj_'+str(mass_coo)+'.dat' f = open(filename,'a') radius_at_mass_coo=[] density_at_mass_coo=[] temperature_at_mass_coo=[] masses=self.se.get(list(range(ini,end+1,delta)),'mass') temps=self.se.get(list(range(ini,end+1,delta)),'temperature') ...
def trajectory(self, ini, end, delta, mass_coo, age_in_sec=False, online=False)
create a trajectory out of a stellar model Parameters ---------- ini : integer Initial model, inital cycle number. end : integer Final model, final cycle number. delta : integer Sparsity factor of the frames. mass_coo : float ...
2.48521
2.299737
1.08065
# Marco, you have already implemented finding headers and columns in # ABUP files. You may want to transplant that into here? species='C-12' filename = 'ABUPP%07d0000.DAT' % mod print(filename) mass,c12=np.loadtxt(filename,skiprows=4,usecols=[1,18],unpack=True) c12_se...
def abup_se_plot(mod,species)
plot species from one ABUPP file and the se file. You must use this function in the directory where the ABP files are and an ABUP file for model mod must exist. Parameters ---------- mod : integer Model to plot, you need to have an ABUPP file for that mo...
8.579093
6.825135
1.256985
import nuutils as u masses = [] # Check the inputs #if not self.se.cycles.count(str(cycle)): # print 'You entered an cycle that doesn\'t exist in this dataset:', cycle # print 'I will try and correct your format.' # cyc_len = len(self.se.cyc...
def _read_iso_abund_marco(self, mass_range, cycle)
plot the abundance of all the chemical species Parameters ---------- mass_range : list A 1x2 array containing the lower and upper mass range. If None, it will plot over the entire range. cycle : string or integer A string/integer of the cycle of inte...
5.476134
5.361959
1.021294
import nuutils as u global decayed_multi_d decayed_multi_d=[] #print len(mass_frac) #print len(decay_raw) for iii in range(len(mass_frac)): jj=-1 decayed=[] for i in range(len(u.decay_raw)): if u.jdum[i] > 0....
def decay(self, mass_frac)
this module simply calculate abundances of isotopes after decay. It requires that before it is used a call is made to _read_iso_abund_marco and _stable_species. Parameters ---------- mass_frac : list alist of mass_frac dicts. See Also -------- ...
4.579711
4.261882
1.074575
if ("tmass" in keyw) == False: keyw["tmass"] = "mass" if ("abund" in keyw) == False: keyw["abund"] = "iso_massf" if ("cycle" in keyw) == False: keyw["cycle"] = "cycle" print("Windyields() initialised. Reading files...") ypsinit = [...
def windyields(self, ini, end, delta, **keyw)
This function returns the wind yields and ejected masses. X_i, E_i = data.windyields(ini, end, delta) Parameters ---------- ini : integer The starting cycle. end : integer The finishing cycle. delta : integer The cycle interval. ...
5.380856
4.384032
1.227376
if first == True: X_i = np.zeros([niso], float) E_i = np.zeros([niso], float) ypsinit = ypssurf[0] for m in range(niso): for n in range(nsteps): X_i[m] = X_i[m] + ((totalmass[n] - totalmass[n+1]) * \ ...
def _windcalc(self, first, totalmass, nsteps, niso, ypssurf, ypsinit, \ X_i, E_i, cycles)
This function calculates the windyields and ejected masses as called from windyields(). It uses a summation version of the formulae used in Hirschi et al. 2005, "Yields of rotating stars at solar metallicity". If it is the first file, the arrays need to be created and the initial abund...
1.452552
1.449916
1.001818
import nuutils as u if not stable and i_decay == 2: print('ERROR: choose i_decay = 1') return #data=mp.se(directory,name_h5_file) self._read_iso_abund_marco(mass_range,cycle) #print spe if i_decay == 2: u.stable_specie() ...
def average_iso_abund_marco(self,mass_range,cycle,stable,i_decay)
Interface to average over mass_range. Parameters ---------- mass_range : list A 1x2 array required to plot data in a certain mass range. Needed for _read_iso_abund_marco. cycle : integer which cycle from the h5 file?. Needed for _read_iso_abund_marco...
3.850537
3.678916
1.04665
import nuutils as u # provide library for Z versus element names, and Z for elements #element_name = self.se.elements element_name = self.elements_names u.give_zip_element_z_and_names(element_name) self.z_of_element_name = u.index_z_for_elements
def _get_elem_names(self)
returns for one cycle an element name dictionary.
19.924103
17.772705
1.121051
import nuutils as u masses_for_this_cycle = self.se.get(cycle,'mass') self._read_iso_abund_marco([min(masses_for_this_cycle),max(masses_for_this_cycle)],cycle) u.stable_specie() self.decay(self.mass_frac) self.index_for_all_species = u.cl self.index_f...
def get_abundance_iso_decay(self,cycle)
returns the decayed stable isotopes. Parameters ---------- cycle : integer The cycle.
3.858155
3.817275
1.010709
import nuutils as u masses_for_this_cycle = self.se.get(cycle,'mass') self._read_iso_abund_marco([min(masses_for_this_cycle),max(masses_for_this_cycle)],cycle) u.stable_specie() self.decay(self.mass_frac) # provide library for Z versus element names, and Z fo...
def get_abundance_elem(self,cycle)
returns the undecayed element profile (all elements that are in elem_names). Parameters ---------- cycle : integer The cycle number
5.371567
5.449547
0.985691
return utils.max_safe( [device.get('CapacityBytes') for device in self.devices if device.get('CapacityBytes') is not None])
def maximum_size_bytes(self)
Gets the biggest disk drive :returns size in bytes.
8.6208
8.011897
1.076
if target_value not in mappings.PUSH_POWER_BUTTON_VALUE_MAP_REV: msg = ('The parameter "%(parameter)s" value "%(target_value)s" is ' 'invalid. Valid values are: %(valid_power_values)s' % {'parameter': 'target_value', 'target_value': target_value, ...
def push_power_button(self, target_value)
Reset the system in hpe exclusive manner. :param target_value: The target value to be set. :raises: InvalidInputError, if the target value is not allowed. :raises: SushyError, on an error from iLO.
3.363676
2.855894
1.177801
return bios.BIOSSettings( self._conn, utils.get_subresource_path_by(self, 'Bios'), redfish_version=self.redfish_version)
def bios_settings(self)
Property to provide reference to `BIOSSettings` instance It is calculated once when the first time it is queried. On refresh, this property gets reset.
5.176975
5.861539
0.883211
device = PERSISTENT_BOOT_DEVICE_MAP.get(devices[0].upper()) if device == sushy.BOOT_SOURCE_TARGET_UEFI_TARGET: try: uefi_devices = self.uefi_target_override_devices iscsi_device = None for uefi_device in uefi_devices: ...
def update_persistent_boot(self, devices=[], persistent=False)
Changes the persistent boot device order in BIOS boot mode for host Note: It uses first boot device from the devices and ignores rest. :param devices: ordered list of boot devices :param persistent: Boolean flag to indicate if the device to be set as a persistent boo...
3.428705
3.505362
0.978132
return secure_boot.SecureBoot( self._conn, utils.get_subresource_path_by(self, 'SecureBoot'), redfish_version=self.redfish_version)
def secure_boot(self)
Property to provide reference to `SecureBoot` instance It is calculated once when the first time it is queried. On refresh, this property gets reset.
4.49414
4.66458
0.963461
return ethernet_interface.EthernetInterfaceCollection( self._conn, self._get_hpe_sub_resource_collection_path('EthernetInterfaces'), redfish_version=self.redfish_version)
def ethernet_interfaces(self)
Provide reference to EthernetInterfacesCollection instance
5.497924
4.805307
1.144136
return hpe_smart_storage.HPESmartStorage( self._conn, utils.get_subresource_path_by( self, ['Oem', 'Hpe', 'Links', 'SmartStorage']), redfish_version=self.redfish_version)
def smart_storage(self)
This property gets the object for smart storage. This property gets the object for smart storage. There is no collection for smart storages. :returns: an instance of smart storage
5.678439
7.232736
0.785103
return storage.StorageCollection( self._conn, utils.get_subresource_path_by(self, 'Storage'), redfish_version=self.redfish_version)
def storages(self)
This property gets the list of instances for Storages This property gets the list of instances for Storages :returns: a list of instances of Storages
5.172445
7.057151
0.732937
return simple_storage.SimpleStorageCollection( self._conn, utils.get_subresource_path_by(self, 'SimpleStorage'), redfish_version=self.redfish_version)
def simple_storages(self)
This property gets the list of instances for SimpleStorages :returns: a list of instances of SimpleStorages
5.147448
5.950701
0.865015
return memory.MemoryCollection( self._conn, utils.get_subresource_path_by(self, 'Memory'), redfish_version=self.redfish_version)
def memory(self)
Property to provide reference to `MemoryCollection` instance It is calculated once when the first time it is queried. On refresh, this property gets reset.
7.421224
6.791907
1.092657
return (smart_storage_config. HPESmartStorageConfig(self._conn, smart_storage_config_url, redfish_version=self.redfish_version))
def get_smart_storage_config(self, smart_storage_config_url)
Returns a SmartStorageConfig Instance for each controller.
6.051065
5.424779
1.115449
ac = self.smart_storage.array_controllers.array_controller_by_model( controller_model) if ac: for ssc_id in self.smart_storage_config_identities: ssc_obj = self.get_smart_storage_config(ssc_id) if ac.location == ssc_obj.location: ...
def _get_smart_storage_config_by_controller_model(self, controller_model)
Returns a SmartStorageConfig Instance for controller by model. :returns: SmartStorageConfig Instance for controller
3.917812
4.160699
0.941623
if self.smart_storage_config_identities is None: msg = ('The Redfish controller failed to get the ' 'SmartStorageConfig controller configurations.') LOG.debug(msg) raise exception.IloError(msg)
def check_smart_storage_config_ids(self)
Check SmartStorageConfig controllers is there in hardware. :raises: IloError, on an error from iLO.
7.069551
5.116259
1.381781
self.check_smart_storage_config_ids() any_exceptions = [] ld_exc_count = 0 for config_id in self.smart_storage_config_identities: try: ssc_obj = self.get_smart_storage_config(config_id) ssc_obj.delete_raid() except exceptio...
def delete_raid(self)
Delete the raid configuration on the hardware. Loops through each SmartStorageConfig controller and clears the raid configuration. :raises: IloError, on an error from iLO.
3.489758
3.114572
1.120461
default = ( self.smart_storage.array_controllers.get_default_controller.model) controllers = {default: []} for ld in raid_config['logical_disks']: if 'controller' not in ld.keys(): controllers[default].append(ld) else: ...
def _parse_raid_config_data(self, raid_config)
It will parse raid config data based on raid controllers :param raid_config: A dictionary containing target raid configuration data. This data stucture should be as follows: raid_config = {'logical_disks': [{'raid_level': 1, 's...
4.359978
4.161329
1.047737
self.check_smart_storage_config_ids() any_exceptions = [] controllers = self._parse_raid_config_data(raid_config) # Creating raid on rest of the controllers for controller in controllers: try: config = {'logical_disks': controllers[controller]...
def create_raid(self, raid_config)
Create the raid configuration on the hardware. :param raid_config: A dictionary containing target raid configuration data. This data stucture should be as follows: raid_config = {'logical_disks': [{'raid_level': 1, 'size_gb': 1...
4.017216
3.745792
1.072461
controllers = self._parse_raid_config_data(raid_config) ld_exc_count = 0 any_exceptions = [] config = {'logical_disks': []} for controller in controllers: try: ssc_obj = ( self._get_smart_storage_config_by_controller_model(...
def _post_create_read_raid(self, raid_config)
Read the logical drives from the system after post-create raid :param raid_config: A dictionary containing target raid configuration data. This data stucture should be as follows: raid_config = {'logical_disks': [{'raid_level': 1, ...
3.539564
3.370545
1.050146
any_exceptions = [] ssc_ids = self.smart_storage_config_identities config = {'logical_disks': []} for ssc_id in ssc_ids: try: ssc_obj = self.get_smart_storage_config(ssc_id) ac_obj = ( self.smart_storage.array_contr...
def _post_delete_read_raid(self)
Read the logical drives from the system after post-delete raid :raises: IloError, if any error form iLO :returns: Empty dictionary with format: {'logical_disks': []}
4.160767
3.801611
1.094475
self.check_smart_storage_config_ids() if raid_config: # When read called after create raid, user can pass raid config # as a input result = self._post_create_read_raid(raid_config=raid_config) else: # When read called after delete raid, th...
def read_raid(self, raid_config=None)
Read the logical drives from the system :param raid_config: None or a dictionary containing target raid configuration data. This data stucture should be as follows: raid_config = {'logical_disks': [{'raid_level': 1, ...
7.265471
7.95014
0.91388
''' Sends the request and return response. Catches HTTPError and hands it to error handler ''' operation_context = operation_context or _OperationContext() retry_context = RetryContext() # Apply the appropriate host based on the location mode self._apply_...
def _perform_request(self, request, parser=None, parser_args=None, operation_context=None)
Sends the request and return response. Catches HTTPError and hands it to error handler
5.381721
5.060451
1.063487
''' Convert json response to entity. The entity format is: { "Address":"Mountain View", "Age":23, "AmountDue":200.23, "CustomerCode@odata.type":"Edm.Guid", "CustomerCode":"c9da6455-213d-42c9-9a79-3e9149a57833", "CustomerSince@odata.type":"Edm.DateTime", "Cus...
def _convert_json_to_entity(entry_element, property_resolver)
Convert json response to entity. The entity format is: { "Address":"Mountain View", "Age":23, "AmountDue":200.23, "CustomerCode@odata.type":"Edm.Guid", "CustomerCode":"c9da6455-213d-42c9-9a79-3e9149a57833", "CustomerSince@odata.type":"Edm.DateTime", "CustomerSin...
3.450995
2.4015
1.437016
''' Converts the response to tables class. ''' if response is None: return response tables = _list() continuation = _get_continuation_from_response_headers(response) tables.next_marker = continuation.get('NextTableName') root = loads(response.body.decode('utf-8')) if 'TableNa...
def _convert_json_response_to_tables(response)
Converts the response to tables class.
4.009098
3.719119
1.07797
''' Converts the response to tables class. ''' if response is None: return response entities = _list() entities.next_marker = _get_continuation_from_response_headers(response) root = loads(response.body.decode('utf-8')) if 'value' in root: for entity in root['value']: ...
def _convert_json_response_to_entities(response, property_resolver)
Converts the response to tables class.
4.206621
3.528407
1.192215
''' Extracts the etag from the response headers. ''' if response and response.headers: for name, value in response.headers: if name.lower() == 'etag': return value return None
def _extract_etag(response)
Extracts the etag from the response headers.
3.434046
3.502562
0.980438
''' Returns a generator to list the tables. The generator will lazily follow the continuation tokens returned by the service and stop when all tables have been returned or num_results is reached. If num_results is specified and the account has more than that number of ...
def list_tables(self, num_results=None, marker=None, timeout=None)
Returns a generator to list the tables. The generator will lazily follow the continuation tokens returned by the service and stop when all tables have been returned or num_results is reached. If num_results is specified and the account has more than that number of tables, the generat...
3.609816
1.305578
2.764919
''' Returns a list of tables under the specified account. Makes a single list request to the service. Used internally by the list_tables method. :param int max_results: The maximum number of tables to return. A single list request may return up to 1000 tables a...
def _list_tables(self, max_results=None, marker=None, timeout=None)
Returns a list of tables under the specified account. Makes a single list request to the service. Used internally by the list_tables method. :param int max_results: The maximum number of tables to return. A single list request may return up to 1000 tables and potentially a con...
3.952475
1.562876
2.528975
''' Creates a new table in the storage account. :param str table_name: The name of the table to create. The table name may contain only alphanumeric characters and cannot begin with a numeric character. It is case-insensitive and must be from 3 to 63 characte...
def create_table(self, table_name, fail_on_exist=False, timeout=None)
Creates a new table in the storage account. :param str table_name: The name of the table to create. The table name may contain only alphanumeric characters and cannot begin with a numeric character. It is case-insensitive and must be from 3 to 63 characters long. :pa...
2.285906
1.583417
1.443654
''' Returns a boolean indicating whether the table exists. :param str table_name: The name of table to check for existence. :param int timeout: The server timeout, expressed in seconds. :return: A boolean indicating whether the table exists. :rtyp...
def exists(self, table_name, timeout=None)
Returns a boolean indicating whether the table exists. :param str table_name: The name of table to check for existence. :param int timeout: The server timeout, expressed in seconds. :return: A boolean indicating whether the table exists. :rtype: bool
2.342259
1.916218
1.222335
''' Returns details about any stored access policies specified on the table that may be used with Shared Access Signatures. :param str table_name: The name of an existing table. :param int timeout: The server timeout, expressed in seconds. :return...
def get_table_acl(self, table_name, timeout=None)
Returns details about any stored access policies specified on the table that may be used with Shared Access Signatures. :param str table_name: The name of an existing table. :param int timeout: The server timeout, expressed in seconds. :return: A dictionary of ac...
2.54682
1.478886
1.722121
''' Sets stored access policies for the table that may be used with Shared Access Signatures. When you set permissions for a table, the existing permissions are replaced. To update the table’s permissions, call :func:`~get_table_acl` to fetch all access polic...
def set_table_acl(self, table_name, signed_identifiers=None, timeout=None)
Sets stored access policies for the table that may be used with Shared Access Signatures. When you set permissions for a table, the existing permissions are replaced. To update the table’s permissions, call :func:`~get_table_acl` to fetch all access policies associated with ...
3.251359
1.251595
2.597773
''' Commits a :class:`~azure.storage.table.TableBatch` request. :param str table_name: The name of the table to commit the batch to. :param TableBatch batch: The batch to commit. :param int timeout: The server timeout, expressed in seconds. ...
def commit_batch(self, table_name, batch, timeout=None)
Commits a :class:`~azure.storage.table.TableBatch` request. :param str table_name: The name of the table to commit the batch to. :param TableBatch batch: The batch to commit. :param int timeout: The server timeout, expressed in seconds. :return: A lis...
2.950933
2.434107
1.212327
''' Creates a batch object which can be used as a context manager. Commits the batch on exit. :param str table_name: The name of the table to commit the batch to. :param int timeout: The server timeout, expressed in seconds. ''' batch = TableBatch...
def batch(self, table_name, timeout=None)
Creates a batch object which can be used as a context manager. Commits the batch on exit. :param str table_name: The name of the table to commit the batch to. :param int timeout: The server timeout, expressed in seconds.
3.932746
2.010796
1.955815
''' Get an entity from the specified table. Throws if the entity does not exist. :param str table_name: The name of the table to get the entity from. :param str partition_key: The PartitionKey of the entity. :param str row_key: The RowKey of t...
def get_entity(self, table_name, partition_key, row_key, select=None, accept=TablePayloadFormat.JSON_MINIMAL_METADATA, property_resolver=None, timeout=None)
Get an entity from the specified table. Throws if the entity does not exist. :param str table_name: The name of the table to get the entity from. :param str partition_key: The PartitionKey of the entity. :param str row_key: The RowKey of the entity. :...
2.75344
1.406783
1.95726
''' Inserts a new entity into the table. Throws if an entity with the same PartitionKey and RowKey already exists. When inserting an entity into a table, you must specify values for the PartitionKey and RowKey system properties. Together, these properties form the pri...
def insert_entity(self, table_name, entity, timeout=None)
Inserts a new entity into the table. Throws if an entity with the same PartitionKey and RowKey already exists. When inserting an entity into a table, you must specify values for the PartitionKey and RowKey system properties. Together, these properties form the primary key and must be...
3.855045
1.411512
2.731146
''' Updates an existing entity in a table. Throws if the entity does not exist. The update_entity operation replaces the entire entity and can be used to remove properties. :param str table_name: The name of the table containing the entity to update. :param...
def update_entity(self, table_name, entity, if_match='*', timeout=None)
Updates an existing entity in a table. Throws if the entity does not exist. The update_entity operation replaces the entire entity and can be used to remove properties. :param str table_name: The name of the table containing the entity to update. :param entity: ...
3.05959
1.401605
2.182919
''' Deletes an existing entity in a table. Throws if the entity does not exist. When an entity is successfully deleted, the entity is immediately marked for deletion and is no longer accessible to clients. The entity is later removed from the Table service during garbage colle...
def delete_entity(self, table_name, partition_key, row_key, if_match='*', timeout=None)
Deletes an existing entity in a table. Throws if the entity does not exist. When an entity is successfully deleted, the entity is immediately marked for deletion and is no longer accessible to clients. The entity is later removed from the Table service during garbage collection. :par...
2.868679
1.448751
1.980105
''' Replaces an existing entity or inserts a new entity if it does not exist in the table. Because this operation can insert or update an entity, it is also known as an "upsert" operation. If insert_or_replace_entity is used to replace an entity, any properties from the...
def insert_or_replace_entity(self, table_name, entity, timeout=None)
Replaces an existing entity or inserts a new entity if it does not exist in the table. Because this operation can insert or update an entity, it is also known as an "upsert" operation. If insert_or_replace_entity is used to replace an entity, any properties from the previous entity wil...
3.232094
1.555
2.078517
''' Merges an existing entity or inserts a new entity if it does not exist in the table. If insert_or_merge_entity is used to merge an entity, any properties from the previous entity will be retained if the request does not define or include them. :param str ...
def insert_or_merge_entity(self, table_name, entity, timeout=None)
Merges an existing entity or inserts a new entity if it does not exist in the table. If insert_or_merge_entity is used to merge an entity, any properties from the previous entity will be retained if the request does not define or include them. :param str table_name: ...
3.298682
1.59879
2.063237
''' Extracts table name from request.uri. The request.uri has either "/mytable(...)" or "/mytable" format. request: the request to insert, update or delete entity ''' if '(' in request.path: pos = request.path.find('(') return request....
def get_request_table(self, request)
Extracts table name from request.uri. The request.uri has either "/mytable(...)" or "/mytable" format. request: the request to insert, update or delete entity
7.686598
2.150496
3.574337
''' Extracts PartitionKey from request.body if it is a POST request or from request.path if it is not a POST request. Only insert operation request is a POST request and the PartitionKey is in the request body. request: the request to insert, update or delete entity ...
def get_request_partition_key(self, request)
Extracts PartitionKey from request.body if it is a POST request or from request.path if it is not a POST request. Only insert operation request is a POST request and the PartitionKey is in the request body. request: the request to insert, update or delete entity
4.470072
2.565755
1.742205
''' Extracts RowKey from request.body if it is a POST request or from request.path if it is not a POST request. Only insert operation request is a POST request and the Rowkey is in the request body. request: the request to insert, update or delete entity ''' ...
def get_request_row_key(self, request)
Extracts RowKey from request.body if it is a POST request or from request.path if it is not a POST request. Only insert operation request is a POST request and the Rowkey is in the request body. request: the request to insert, update or delete entity
4.479091
2.596884
1.724794
''' Validates that all requests have the same table name. Set the table name if it is the first request for the batch operation. request: the request to insert, update or delete entity ''' if self.batch_table: if self.get_request_table(request) !=...
def validate_request_table(self, request)
Validates that all requests have the same table name. Set the table name if it is the first request for the batch operation. request: the request to insert, update or delete entity
5.859806
2.403858
2.437667
''' Validates that all requests have the same PartitiionKey. Set the PartitionKey if it is the first request for the batch operation. request: the request to insert, update or delete entity ''' if self.batch_partition_key: if self.get_request_part...
def validate_request_partition_key(self, request)
Validates that all requests have the same PartitiionKey. Set the PartitionKey if it is the first request for the batch operation. request: the request to insert, update or delete entity
5.213264
2.310672
2.256168
''' Validates that all requests have the different RowKey and adds RowKey to existing RowKey list. request: the request to insert, update or delete entity ''' if self.batch_row_keys: if self.get_request_row_key(request) in self.batch_row_keys: ...
def validate_request_row_key(self, request)
Validates that all requests have the different RowKey and adds RowKey to existing RowKey list. request: the request to insert, update or delete entity
5.698828
2.314209
2.462538
''' Starts the batch operation. Intializes the batch variables is_batch: batch operation flag. batch_table: the table name of the batch operation batch_partition_key: the PartitionKey of the batch requests. batch_row_keys: ...
def begin_batch(self)
Starts the batch operation. Intializes the batch variables is_batch: batch operation flag. batch_table: the table name of the batch operation batch_partition_key: the PartitionKey of the batch requests. batch_row_keys: the RowKey list of a...
5.323659
1.477075
3.60419
''' Adds request to batch operation. request: the request to insert, update or delete entity ''' self.validate_request_table(request) self.validate_request_partition_key(request) self.validate_request_row_key(request) self.batch_requests.appen...
def insert_request_to_batch(self, request)
Adds request to batch operation. request: the request to insert, update or delete entity
5.856491
2.894801
2.023107
''' Commits the batch requests. ''' batch_boundary = b'batch_' + _new_boundary() changeset_boundary = b'changeset_' + _new_boundary() # Commits batch only the requests list is not empty. if self.batch_requests: request = HTTPRequest() request.method = 'P...
def commit_batch_requests(self)
Commits the batch requests.
2.580912
2.605888
0.990416
data = {'LicenseKey': key} license_service_uri = (utils.get_subresource_path_by(self, ['Oem', 'Hpe', 'Links', 'LicenseService'])) self._conn.post(license_service_uri, data=data)
def set_license(self, key)
Set the license on a redfish system :param key: license key
7.083586
6.241598
1.134899
return virtual_media.VirtualMediaCollection( self._conn, utils.get_subresource_path_by(self, 'VirtualMedia'), redfish_version=self.redfish_version)
def virtual_media(self)
Property to provide reference to `VirtualMediaCollection` instance. It is calculated once when the first time it is queried. On refresh, this property gets reset.
3.778207
4.278071
0.883157
raise exception.IloCommandNotSupportedError(ERRMSG)
def set_iscsi_info(self, target_name, lun, ip_address, port='3260', auth_method=None, username=None, password=None)
Set iscsi details of the system in uefi boot mode. The initiator system is set with the target details like IQN, LUN, IP, Port etc. :param target_name: Target Name for iscsi. :param lun: logical unit number. :param ip_address: IP address of the target. :param port: port ...
29.881395
31.601547
0.945567
''' Method for writeing Trajectory type ascii files files. Parameters ---------- filename : string The file where this data will be written. data : list A list of 1D data vectors with time, T and rho. ageunit : integer, optional If 1 ageunit = SEC, If 0 ageunit = YRS...
def writeTraj(filename='trajectory.input', data=[], ageunit=0, tunit=0, rhounit=0, idNum=0)
Method for writeing Trajectory type ascii files files. Parameters ---------- filename : string The file where this data will be written. data : list A list of 1D data vectors with time, T and rho. ageunit : integer, optional If 1 ageunit = SEC, If 0 ageunit = YRS. If 2 aguni...
4.576436
1.950822
2.345902
''' Method that dynamically determines the type of attribute that is passed into this method. Also it then returns that attribute's associated data. Parameters ---------- attri : string The attribute we are looking for. ''' isCol=Fals...
def get(self, attri)
Method that dynamically determines the type of attribute that is passed into this method. Also it then returns that attribute's associated data. Parameters ---------- attri : string The attribute we are looking for.
5.846485
3.219802
1.81579
''' Private method that reads in the header and column data. ''' if sldir.endswith(os.sep): fileName = str(sldir)+str(fileName) else: fileName = str(sldir)+os.sep+str(fileName) fileLines=[] #list of lines in the file header=[] #list ...
def _readFile(self, sldir, fileName, sep)
Private method that reads in the header and column data.
2.343113
2.230439
1.050517
''' INtiial to final mass relation ''' final_m=[] ini_m=[] for i in range(len(self.runs_H5_surf)): sefiles=se(self.runs_H5_out[i]) ini_m.append(sefiles.get("mini")) h1=sefiles.get(int(sefiles.se.cycles[-2]),'H-1') mass=sefiles.get(int(sefiles.s...
def initial_finall_mass_relation(self,marker='o',linestyle='--')
INtiial to final mass relation
4.169947
3.684368
1.131794
''' For paper1 marco routine: Numbers of remnant mass shell masses, exists also in mesa_set! ''' inim=[] remnm=[] for i in range(len(self.runs_H5_surf)): m1p65_last=se(self.runs_H5_out[i]) mass_dummy=m1p65_last.se.get(m1p65_last.se.cycles[len(m1p65_last.se.cycles)-1],'mass') top_of_envelope=m...
def final_bottom_envelope_set1(self)
For paper1 marco routine: Numbers of remnant mass shell masses, exists also in mesa_set!
5.929267
3.872764
1.531017
''' For paper1 extension: bottom_envelope Numbers of remnant mass shell masses, exists also in mesa_set + star age! ''' inim=[] remnm=[] time11=[] tottime=[] c_core=[] o_core=[] small_co_core=[]...
def remnant_lifetime_agb(self)
For paper1 extension: bottom_envelope Numbers of remnant mass shell masses, exists also in mesa_set + star age!
4.418185
3.401252
1.298988
''' PLots C/O surface number fraction ''' if len(t0_model)==0: t0_model = len(self.runs_H5_surf)*[0] plt.figure(fig) for i in range(len(self.runs_H5_surf)): sefiles=se(self.runs_H5_surf[i]) cycles=range(int(sefiles.se.cycles[0]),int(sefiles.se.cycles[-1]),sp...
def set_plot_CO_mass(self,fig=3123,xaxis='mass',linestyle=['-'],marker=['o'],color=['r'],age_years=True,sparsity=500,markersparsity=200,withoutZlabel=False,t0_model=[])
PLots C/O surface number fraction
2.918179
2.741885
1.064296
linestyle=200*['-'] import nugridse as mp import utils as u #print self.runs_H5_restart for i in range(len(self.runs_H5_restart)): sefiles=mp.se(self.runs_H5_restart[i]) cycle=cycles[i] if cycle==-1: cycle=int(sefiles.se.cycle...
def set_plot_profile_decay(self,cycles=20*[-1],mass_range=20*[[0,0]],ylim=20*[[0,0]],isotopes=[],linestyle=[],save_dir=''): ''' Plots HRDs end_model - array, control how far in models a run is plottet, if -1 till end symbs_1 - set symbols of runs ''' if len(linestyle)==0
Plots HRDs end_model - array, control how far in models a run is plottet, if -1 till end symbs_1 - set symbols of runs
3.44948
3.455914
0.998138
linestyle=200*['-'] import nugridse as mp import utils as u print self.runs_H5_restart massfrac_all=[] iso_all=[] for i in range(len(self.runs_H5_restart)): sefiles=mp.se(self.runs_H5_restart[i]) cycle=cycles[i] if cycle==-1: ...
def set_get_abu_distr_decay_old(self,cycles=20*[-1],mass_range=20*[[0,0]],ylim=20*[[0,0]],isotopes=['all'],linestyle=[],save_dir=''): ''' Plots HRDs end_model - array, control how far in models a run is plottet, if -1 till end symbs_1 - set symbols of runs ''' if len(linestyle)==0
Plots HRDs end_model - array, control how far in models a run is plottet, if -1 till end symbs_1 - set symbols of runs
4.27055
4.244504
1.006136
''' Uesse function cores in nugridse.py ''' core_info=[] minis=[] for i in range(len(self.runs_H5_surf)): sefiles=se(self.runs_H5_out[i]) mini=sefiles.get('mini') minis.append(mini) incycle=int(sefiles.se.cycles[-1]) core_info.append(sefiles.cores(incyc...
def set_cores_massive(self,filename='core_masses_massive.txt')
Uesse function cores in nugridse.py
4.818819
4.003379
1.203688
''' Outputs burnign stages as done in burningstages_upgrade (nugridse) ''' burn_info=[] burn_mini=[] for i in range(len(self.runs_H5_surf)): sefiles=se(self.runs_H5_out[i]) burn_info.append(sefiles.burnstage_upgrade()) mini=sefiles.get('mini'...
def set_burnstages_upgrade_massive(self)
Outputs burnign stages as done in burningstages_upgrade (nugridse)
9.4445
6.187092
1.526484
linestyle=200*['-'] plt.figure('CC evol') for i in range(len(self.runs_H5_surf)): sefiles=se(self.runs_H5_out[i]) t1_model=-1 sefiles.get('temperature') sefiles.get('density') mini=sefiles.get('mini') zini=sefiles.get('zini') ...
def set_plot_CC_T_rho_max(self,linestyle=[],burn_limit=0.997,color=['r'],marker=['o'],markevery=500): ''' Plots end_model - array, control how far in models a run is plottet, if -1 till end symbs_1 - set symbols of runs ''' if len(linestyle)==0
Plots end_model - array, control how far in models a run is plottet, if -1 till end symbs_1 - set symbols of runs
4.032911
4.078797
0.98875
linestyle=200*['-'] plt.figure('CC evol') for i in range(len(self.runs_H5_surf)): sefiles=se(self.runs_H5_out[i]) t1_model=-1 sefiles.get('temperature') sefiles.get('density') mini=sefiles.get('mini') zini=sefiles.get('zini') ...
def set_plot_CC_T_rho(self,linestyle=[],burn_limit=0.997,color=['r'],marker=['o'],nolabelZ=False,markevery=500): ''' Plots HRDs end_model - array, control how far in models a run is plottet, if -1 till end symbs_1 - set symbols of runs ''' if len(linestyle)==0
Plots HRDs end_model - array, control how far in models a run is plottet, if -1 till end symbs_1 - set symbols of runs
2.582475
2.589892
0.997136
'''Validates the request body passed in and converts it to bytes if our policy allows it.''' if param_value is None: return b'' if isinstance(param_value, bytes): return param_value raise TypeError(_ERROR_VALUE_SHOULD_BE_BYTES.format(param_name))
def _get_request_body_bytes_only(param_name, param_value)
Validates the request body passed in and converts it to bytes if our policy allows it.
5.804671
3.012633
1.926777
try: return getattr(resource, attribute_name) except (sushy.exceptions.SushyError, exception.MissingAttributeError) as e: msg = (('The Redfish controller failed to get the ' 'attribute %(attribute)s from resource %(resource)s. ' 'Error %(error)s')...
def _get_attribute_value_of(resource, attribute_name, default=None)
Gets the value of attribute_name from the resource It catches the exception, if any, while retrieving the value of attribute_name from resource and returns default. :param resource: The resource object :attribute_name: Property of the resource :returns the property value if no error encountered ...
3.064191
3.016099
1.015945
local_max_bytes = 0 logical_max_mib = 0 volume_max_bytes = 0 physical_max_mib = 0 drives_max_bytes = 0 simple_max_bytes = 0 # Gets the resources and properties # its quite possible for a system to lack the resource, hence its # URI may also be lacking. # Check if smart_sto...
def get_local_gb(system_obj)
Gets the largest volume or the largest disk :param system_obj: The HPESystem object. :returns the size in GB
2.895013
2.83986
1.019421
smart_value = False storage_value = False smart_resource = _get_attribute_value_of(system_obj, 'smart_storage') if smart_resource is not None: smart_value = _get_attribute_value_of( smart_resource, 'has_ssd', default=False) if smart_value: return smart_value # ...
def has_ssd(system_obj)
Gets if the system has any drive as SSD drive :param system_obj: The HPESystem object. :returns True if system has SSD drives.
3.994038
4.211201
0.948432
storage_value = False storage_resource = _get_attribute_value_of(system_obj, 'storages') if storage_resource is not None: storage_value = _get_attribute_value_of( storage_resource, 'has_nvme_ssd', default=False) return storage_value
def has_nvme_ssd(system_obj)
Gets if the system has any drive as NVMe SSD drive :param system_obj: The HPESystem object. :returns True if system has SSD drives and protocol is NVMe.
3.883762
4.706912
0.825119