repository_name stringlengths 7 55 | func_path_in_repository stringlengths 4 223 | func_name stringlengths 1 134 | whole_func_string stringlengths 75 104k | language stringclasses 1
value | func_code_string stringlengths 75 104k | func_code_tokens listlengths 19 28.4k | func_documentation_string stringlengths 1 46.9k | func_documentation_tokens listlengths 1 1.97k | split_name stringclasses 1
value | func_code_url stringlengths 87 315 |
|---|---|---|---|---|---|---|---|---|---|---|
NuGrid/NuGridPy | nugridpy/data_plot.py | DataPlot.plot_isopattern | def plot_isopattern(self,isos,normiso,spec=None,tpulse='all',dcycle=500,fign=1,deltay=False,logy=False,
iniabufile='iniab2.0E-02GN93.ppn',legend=None,plt_symb='o',plt_col='k',plt_lt='-',
plt_lw=1.,plt_show=True):
'''
This routine plots isotopic pattern plo... | python | def plot_isopattern(self,isos,normiso,spec=None,tpulse='all',dcycle=500,fign=1,deltay=False,logy=False,
iniabufile='iniab2.0E-02GN93.ppn',legend=None,plt_symb='o',plt_col='k',plt_lt='-',
plt_lw=1.,plt_show=True):
'''
This routine plots isotopic pattern plo... | [
"def",
"plot_isopattern",
"(",
"self",
",",
"isos",
",",
"normiso",
",",
"spec",
"=",
"None",
",",
"tpulse",
"=",
"'all'",
",",
"dcycle",
"=",
"500",
",",
"fign",
"=",
"1",
",",
"deltay",
"=",
"False",
",",
"logy",
"=",
"False",
",",
"iniabufile",
... | This routine plots isotopic pattern plots for different input along with grain data.
Parameters
----------
isos : list / string
Enter the list of isotopes that you want to consider here. The list should
be given in the standard format, e.g., ['Fe-54','Fe-56','Fe-57','Fe-... | [
"This",
"routine",
"plots",
"isotopic",
"pattern",
"plots",
"for",
"different",
"input",
"along",
"with",
"grain",
"data",
"."
] | train | https://github.com/NuGrid/NuGridPy/blob/eee8047446e398be77362d82c1d8b3310054fab0/nugridpy/data_plot.py#L1190-L1438 |
NuGrid/NuGridPy | nugridpy/data_plot.py | DataPlot._clear | def _clear(self, title=True, xlabel=True, ylabel=True):
'''
Method for removing the title and/or xlabel and/or Ylabel.
Parameters
----------
Title : boolean, optional
Boolean of if title will be cleared. The default is True.
xlabel : boolean, optional
... | python | def _clear(self, title=True, xlabel=True, ylabel=True):
'''
Method for removing the title and/or xlabel and/or Ylabel.
Parameters
----------
Title : boolean, optional
Boolean of if title will be cleared. The default is True.
xlabel : boolean, optional
... | [
"def",
"_clear",
"(",
"self",
",",
"title",
"=",
"True",
",",
"xlabel",
"=",
"True",
",",
"ylabel",
"=",
"True",
")",
":",
"if",
"title",
":",
"pyl",
".",
"title",
"(",
"''",
")",
"if",
"xlabel",
":",
"pyl",
".",
"xlabel",
"(",
"''",
")",
"if",... | Method for removing the title and/or xlabel and/or Ylabel.
Parameters
----------
Title : boolean, optional
Boolean of if title will be cleared. The default is True.
xlabel : boolean, optional
Boolean of if xlabel will be cleared. The default is True.
yl... | [
"Method",
"for",
"removing",
"the",
"title",
"and",
"/",
"or",
"xlabel",
"and",
"/",
"or",
"Ylabel",
"."
] | train | https://github.com/NuGrid/NuGridPy/blob/eee8047446e398be77362d82c1d8b3310054fab0/nugridpy/data_plot.py#L1441-L1460 |
NuGrid/NuGridPy | nugridpy/data_plot.py | DataPlot._xlimrev | def _xlimrev(self):
''' reverse xrange'''
xmax,xmin=pyl.xlim()
pyl.xlim(xmin,xmax) | python | def _xlimrev(self):
''' reverse xrange'''
xmax,xmin=pyl.xlim()
pyl.xlim(xmin,xmax) | [
"def",
"_xlimrev",
"(",
"self",
")",
":",
"xmax",
",",
"xmin",
"=",
"pyl",
".",
"xlim",
"(",
")",
"pyl",
".",
"xlim",
"(",
"xmin",
",",
"xmax",
")"
] | reverse xrange | [
"reverse",
"xrange"
] | train | https://github.com/NuGrid/NuGridPy/blob/eee8047446e398be77362d82c1d8b3310054fab0/nugridpy/data_plot.py#L1463-L1466 |
NuGrid/NuGridPy | nugridpy/data_plot.py | DataPlot.abu_chartMulti | def abu_chartMulti(self, cyclist, mass_range=None, ilabel=True,
imlabel=True, imlabel_fontsize=8, imagic=False,
boxstable=True, lbound=20, plotaxis=[0,0,0,0],
color_map='jet', pdf=False, title=None, path=None):
'''
Method that plots ab... | python | def abu_chartMulti(self, cyclist, mass_range=None, ilabel=True,
imlabel=True, imlabel_fontsize=8, imagic=False,
boxstable=True, lbound=20, plotaxis=[0,0,0,0],
color_map='jet', pdf=False, title=None, path=None):
'''
Method that plots ab... | [
"def",
"abu_chartMulti",
"(",
"self",
",",
"cyclist",
",",
"mass_range",
"=",
"None",
",",
"ilabel",
"=",
"True",
",",
"imlabel",
"=",
"True",
",",
"imlabel_fontsize",
"=",
"8",
",",
"imagic",
"=",
"False",
",",
"boxstable",
"=",
"True",
",",
"lbound",
... | Method that plots abundence chart and saves those figures to a
.png file (by default). Plots a figure for each cycle in the
argument cycle.
Parameters
----------
cyclist : list
The list of cycles we are plotting.
mass_range : list, optional
A 1x2 ... | [
"Method",
"that",
"plots",
"abundence",
"chart",
"and",
"saves",
"those",
"figures",
"to",
"a",
".",
"png",
"file",
"(",
"by",
"default",
")",
".",
"Plots",
"a",
"figure",
"for",
"each",
"cycle",
"in",
"the",
"argument",
"cycle",
"."
] | train | https://github.com/NuGrid/NuGridPy/blob/eee8047446e398be77362d82c1d8b3310054fab0/nugridpy/data_plot.py#L1468-L1537 |
NuGrid/NuGridPy | nugridpy/data_plot.py | DataPlot.abu_chart | def abu_chart(self, cycle, mass_range=None ,ilabel=True,
imlabel=True, imlabel_fontsize=8, imagic=False,
boxstable=True, lbound=(-12, 0),
plotaxis=[0, 0, 0, 0], show=True, color_map='jet',
ifig=None,data_provided=False,thedata=None,
... | python | def abu_chart(self, cycle, mass_range=None ,ilabel=True,
imlabel=True, imlabel_fontsize=8, imagic=False,
boxstable=True, lbound=(-12, 0),
plotaxis=[0, 0, 0, 0], show=True, color_map='jet',
ifig=None,data_provided=False,thedata=None,
... | [
"def",
"abu_chart",
"(",
"self",
",",
"cycle",
",",
"mass_range",
"=",
"None",
",",
"ilabel",
"=",
"True",
",",
"imlabel",
"=",
"True",
",",
"imlabel_fontsize",
"=",
"8",
",",
"imagic",
"=",
"False",
",",
"boxstable",
"=",
"True",
",",
"lbound",
"=",
... | Plots an abundance chart
Parameters
----------
cycle : string, integer or list
The cycle we are looking in. If it is a list of cycles,
this method will then do a plot for each of these cycles
and save them all to a file.
mass_range : list, optional
... | [
"Plots",
"an",
"abundance",
"chart"
] | train | https://github.com/NuGrid/NuGridPy/blob/eee8047446e398be77362d82c1d8b3310054fab0/nugridpy/data_plot.py#L1540-L1935 |
NuGrid/NuGridPy | nugridpy/data_plot.py | DataPlot.abu_flux_chart | def abu_flux_chart(self, cycle, ilabel=True, imlabel=True,
imagic=False, boxstable=True, lbound=(-12,0),
plotaxis=[0,0,0,0], which_flux=None, prange=None,
profile='charged', show=True):
'''
Plots an abundance and flux chart
Pa... | python | def abu_flux_chart(self, cycle, ilabel=True, imlabel=True,
imagic=False, boxstable=True, lbound=(-12,0),
plotaxis=[0,0,0,0], which_flux=None, prange=None,
profile='charged', show=True):
'''
Plots an abundance and flux chart
Pa... | [
"def",
"abu_flux_chart",
"(",
"self",
",",
"cycle",
",",
"ilabel",
"=",
"True",
",",
"imlabel",
"=",
"True",
",",
"imagic",
"=",
"False",
",",
"boxstable",
"=",
"True",
",",
"lbound",
"=",
"(",
"-",
"12",
",",
"0",
")",
",",
"plotaxis",
"=",
"[",
... | Plots an abundance and flux chart
Parameters
----------
cycle : string, integer or list
The cycle we are looking in. If it is a list of cycles,
this method will then do a plot for each of these cycles
and save them all to a file.
ilabel : boolean, opt... | [
"Plots",
"an",
"abundance",
"and",
"flux",
"chart"
] | train | https://github.com/NuGrid/NuGridPy/blob/eee8047446e398be77362d82c1d8b3310054fab0/nugridpy/data_plot.py#L1937-L2625 |
NuGrid/NuGridPy | nugridpy/data_plot.py | DataPlot.iso_abundMulti | def iso_abundMulti(self, cyclist, stable=False, amass_range=None,
mass_range=None, ylim=[0,0], ref=-1,
decayed=False, include_title=False, title=None,
pdf=False, color_plot=True, grid=False,
point_set=1):
'''
Met... | python | def iso_abundMulti(self, cyclist, stable=False, amass_range=None,
mass_range=None, ylim=[0,0], ref=-1,
decayed=False, include_title=False, title=None,
pdf=False, color_plot=True, grid=False,
point_set=1):
'''
Met... | [
"def",
"iso_abundMulti",
"(",
"self",
",",
"cyclist",
",",
"stable",
"=",
"False",
",",
"amass_range",
"=",
"None",
",",
"mass_range",
"=",
"None",
",",
"ylim",
"=",
"[",
"0",
",",
"0",
"]",
",",
"ref",
"=",
"-",
"1",
",",
"decayed",
"=",
"False",
... | Method that plots figures and saves those figures to a .png
file. Plots a figure for each cycle in the argument cycle.
Can be called via iso_abund method by passing a list to cycle.
Parameters
----------
cycllist : list
The cycles of interest. This method will do a... | [
"Method",
"that",
"plots",
"figures",
"and",
"saves",
"those",
"figures",
"to",
"a",
".",
"png",
"file",
".",
"Plots",
"a",
"figure",
"for",
"each",
"cycle",
"in",
"the",
"argument",
"cycle",
".",
"Can",
"be",
"called",
"via",
"iso_abund",
"method",
"by"... | train | https://github.com/NuGrid/NuGridPy/blob/eee8047446e398be77362d82c1d8b3310054fab0/nugridpy/data_plot.py#L3230-L3306 |
NuGrid/NuGridPy | nugridpy/data_plot.py | DataPlot.iso_abund | def iso_abund(self, cycle, stable=False, amass_range=None,
mass_range=None, ylim=[0,0], ref=-1, show=True,
log_logic=True, decayed=False, color_plot=True,
grid=False, point_set=1, include_title=False,
data_provided=False,thedata=None, verbose=True,... | python | def iso_abund(self, cycle, stable=False, amass_range=None,
mass_range=None, ylim=[0,0], ref=-1, show=True,
log_logic=True, decayed=False, color_plot=True,
grid=False, point_set=1, include_title=False,
data_provided=False,thedata=None, verbose=True,... | [
"def",
"iso_abund",
"(",
"self",
",",
"cycle",
",",
"stable",
"=",
"False",
",",
"amass_range",
"=",
"None",
",",
"mass_range",
"=",
"None",
",",
"ylim",
"=",
"[",
"0",
",",
"0",
"]",
",",
"ref",
"=",
"-",
"1",
",",
"show",
"=",
"True",
",",
"l... | plot the abundance of all the chemical species
Parameters
----------
cycle : string, integer or list
The cycle of interest. If it is a list of cycles, this
method will do a plot for each cycle and save them to a
file.
stable : boolean, optional
... | [
"plot",
"the",
"abundance",
"of",
"all",
"the",
"chemical",
"species"
] | train | https://github.com/NuGrid/NuGridPy/blob/eee8047446e398be77362d82c1d8b3310054fab0/nugridpy/data_plot.py#L3309-L3811 |
NuGrid/NuGridPy | nugridpy/data_plot.py | DataPlot.elemental_abund | def elemental_abund(self,cycle,zrange=[1,85],ylim=[0,0],title_items=None,
ref=-1,ref_filename=None,z_pin=None,pin=None,
pin_filename=None,zchi2=None,logeps=False,dilution=None,show_names=True,label='',
colour='black',plotlines=':',plotlabels=True,m... | python | def elemental_abund(self,cycle,zrange=[1,85],ylim=[0,0],title_items=None,
ref=-1,ref_filename=None,z_pin=None,pin=None,
pin_filename=None,zchi2=None,logeps=False,dilution=None,show_names=True,label='',
colour='black',plotlines=':',plotlabels=True,m... | [
"def",
"elemental_abund",
"(",
"self",
",",
"cycle",
",",
"zrange",
"=",
"[",
"1",
",",
"85",
"]",
",",
"ylim",
"=",
"[",
"0",
",",
"0",
"]",
",",
"title_items",
"=",
"None",
",",
"ref",
"=",
"-",
"1",
",",
"ref_filename",
"=",
"None",
",",
"z_... | Plot the decayed elemental abundance distribution (PPN).
Plot the elemental abundance distribution (nugridse).
(FH, 06/2014; SJ 07/2014)
Parameters
----------
cycle : string, integer or list
The cycle of interest. If it is a list of cycles, this
method w... | [
"Plot",
"the",
"decayed",
"elemental",
"abundance",
"distribution",
"(",
"PPN",
")",
".",
"Plot",
"the",
"elemental",
"abundance",
"distribution",
"(",
"nugridse",
")",
".",
"(",
"FH",
"06",
"/",
"2014",
";",
"SJ",
"07",
"/",
"2014",
")"
] | train | https://github.com/NuGrid/NuGridPy/blob/eee8047446e398be77362d82c1d8b3310054fab0/nugridpy/data_plot.py#L3813-L4232 |
NuGrid/NuGridPy | nugridpy/data_plot.py | DataPlot._do_title_string | def _do_title_string(self,title_items,cycle):
'''
Create title string
Private method that creates a title string for a cycle plot
out of a list of title_items that are cycle attributes and can
be obtained with self.get
Parameters
----------
title_items :... | python | def _do_title_string(self,title_items,cycle):
'''
Create title string
Private method that creates a title string for a cycle plot
out of a list of title_items that are cycle attributes and can
be obtained with self.get
Parameters
----------
title_items :... | [
"def",
"_do_title_string",
"(",
"self",
",",
"title_items",
",",
"cycle",
")",
":",
"title_string",
"=",
"[",
"]",
"form_str",
"=",
"'%4.1F'",
"for",
"item",
"in",
"title_items",
":",
"num",
"=",
"self",
".",
"get",
"(",
"item",
",",
"fname",
"=",
"cyc... | Create title string
Private method that creates a title string for a cycle plot
out of a list of title_items that are cycle attributes and can
be obtained with self.get
Parameters
----------
title_items : list
A list of cycle attributes.
cycle : scal... | [
"Create",
"title",
"string"
] | train | https://github.com/NuGrid/NuGridPy/blob/eee8047446e398be77362d82c1d8b3310054fab0/nugridpy/data_plot.py#L4234-L4270 |
NuGrid/NuGridPy | nugridpy/data_plot.py | DataPlot.plotprofMulti | def plotprofMulti(self, ini, end, delta, what_specie, xlim1, xlim2,
ylim1, ylim2, symbol=None):
'''
create a movie with mass fractions vs mass coordinate between
xlim1 and xlim2, ylim1 and ylim2. Only works with instances of
se.
Parameters
--------... | python | def plotprofMulti(self, ini, end, delta, what_specie, xlim1, xlim2,
ylim1, ylim2, symbol=None):
'''
create a movie with mass fractions vs mass coordinate between
xlim1 and xlim2, ylim1 and ylim2. Only works with instances of
se.
Parameters
--------... | [
"def",
"plotprofMulti",
"(",
"self",
",",
"ini",
",",
"end",
",",
"delta",
",",
"what_specie",
",",
"xlim1",
",",
"xlim2",
",",
"ylim1",
",",
"ylim2",
",",
"symbol",
"=",
"None",
")",
":",
"plotType",
"=",
"self",
".",
"_classTest",
"(",
")",
"if",
... | create a movie with mass fractions vs mass coordinate between
xlim1 and xlim2, ylim1 and ylim2. Only works with instances of
se.
Parameters
----------
ini : integer
Initial model i.e. cycle.
end : integer
Final model i.e. cycle.
delta : in... | [
"create",
"a",
"movie",
"with",
"mass",
"fractions",
"vs",
"mass",
"coordinate",
"between",
"xlim1",
"and",
"xlim2",
"ylim1",
"and",
"ylim2",
".",
"Only",
"works",
"with",
"instances",
"of",
"se",
"."
] | train | https://github.com/NuGrid/NuGridPy/blob/eee8047446e398be77362d82c1d8b3310054fab0/nugridpy/data_plot.py#L4272-L4322 |
NuGrid/NuGridPy | nugridpy/data_plot.py | DataPlot.movie | def movie(self, cycles, plotstyle='',movname='',fps=12,**kwargs):
from matplotlib import animation
'''
Make an interactive movie in the matplotlib window for a number of
different plot types:
Plot types
----------
'iso_abund' : abundance distr... | python | def movie(self, cycles, plotstyle='',movname='',fps=12,**kwargs):
from matplotlib import animation
'''
Make an interactive movie in the matplotlib window for a number of
different plot types:
Plot types
----------
'iso_abund' : abundance distr... | [
"def",
"movie",
"(",
"self",
",",
"cycles",
",",
"plotstyle",
"=",
"''",
",",
"movname",
"=",
"''",
",",
"fps",
"=",
"12",
",",
"*",
"*",
"kwargs",
")",
":",
"from",
"matplotlib",
"import",
"animation",
"modelself",
"=",
"self",
"supported_styles",
"="... | Make an interactive movie in the matplotlib window for a number of
different plot types:
Plot types
----------
'iso_abund' : abundance distribution a la se.iso_abund()
'abu_chart' : abundance chart a la se.abu_chart()
'plot' : plot any number... | [
"Make",
"an",
"interactive",
"movie",
"in",
"the",
"matplotlib",
"window",
"for",
"a",
"number",
"of",
"different",
"plot",
"types",
":"
] | train | https://github.com/NuGrid/NuGridPy/blob/eee8047446e398be77362d82c1d8b3310054fab0/nugridpy/data_plot.py#L4324-L4531 |
NuGrid/NuGridPy | nugridpy/data_plot.py | DataPlot.plot_prof_1 | def plot_prof_1(self, species, keystring, xlim1, xlim2, ylim1,
ylim2, symbol=None, show=False):
'''
Plot one species for cycle between xlim1 and xlim2 Only works
with instances of se and mesa _profile.
Parameters
----------
species : list
... | python | def plot_prof_1(self, species, keystring, xlim1, xlim2, ylim1,
ylim2, symbol=None, show=False):
'''
Plot one species for cycle between xlim1 and xlim2 Only works
with instances of se and mesa _profile.
Parameters
----------
species : list
... | [
"def",
"plot_prof_1",
"(",
"self",
",",
"species",
",",
"keystring",
",",
"xlim1",
",",
"xlim2",
",",
"ylim1",
",",
"ylim2",
",",
"symbol",
"=",
"None",
",",
"show",
"=",
"False",
")",
":",
"plotType",
"=",
"self",
".",
"_classTest",
"(",
")",
"if",
... | Plot one species for cycle between xlim1 and xlim2 Only works
with instances of se and mesa _profile.
Parameters
----------
species : list
Which species to plot.
keystring : string or integer
Label that appears in the plot or in the case of se, a
... | [
"Plot",
"one",
"species",
"for",
"cycle",
"between",
"xlim1",
"and",
"xlim2",
"Only",
"works",
"with",
"instances",
"of",
"se",
"and",
"mesa",
"_profile",
"."
] | train | https://github.com/NuGrid/NuGridPy/blob/eee8047446e398be77362d82c1d8b3310054fab0/nugridpy/data_plot.py#L4534-L4592 |
NuGrid/NuGridPy | nugridpy/data_plot.py | DataPlot.density_profile | def density_profile(self,ixaxis='mass',ifig=None,colour=None,label=None,fname=None):
'''
Plot density as a function of either mass coordiate or radius.
Parameters
----------
ixaxis : string
'mass' or 'radius'
The default value is 'mass'
ifig : int... | python | def density_profile(self,ixaxis='mass',ifig=None,colour=None,label=None,fname=None):
'''
Plot density as a function of either mass coordiate or radius.
Parameters
----------
ixaxis : string
'mass' or 'radius'
The default value is 'mass'
ifig : int... | [
"def",
"density_profile",
"(",
"self",
",",
"ixaxis",
"=",
"'mass'",
",",
"ifig",
"=",
"None",
",",
"colour",
"=",
"None",
",",
"label",
"=",
"None",
",",
"fname",
"=",
"None",
")",
":",
"pT",
"=",
"self",
".",
"_classTest",
"(",
")",
"# Class-specif... | Plot density as a function of either mass coordiate or radius.
Parameters
----------
ixaxis : string
'mass' or 'radius'
The default value is 'mass'
ifig : integer or string
The figure label
The default value is None
colour : string... | [
"Plot",
"density",
"as",
"a",
"function",
"of",
"either",
"mass",
"coordiate",
"or",
"radius",
"."
] | train | https://github.com/NuGrid/NuGridPy/blob/eee8047446e398be77362d82c1d8b3310054fab0/nugridpy/data_plot.py#L4594-L4656 |
NuGrid/NuGridPy | nugridpy/data_plot.py | DataPlot.abu_profile | def abu_profile(self,ixaxis='mass',isos=None,ifig=None,fname=None,logy=False,
colourblind=False):
'''
Plot common abundances as a function of either mass coordiate or radius.
Parameters
----------
ixaxis : string, optional
'mass', 'logradius' or ... | python | def abu_profile(self,ixaxis='mass',isos=None,ifig=None,fname=None,logy=False,
colourblind=False):
'''
Plot common abundances as a function of either mass coordiate or radius.
Parameters
----------
ixaxis : string, optional
'mass', 'logradius' or ... | [
"def",
"abu_profile",
"(",
"self",
",",
"ixaxis",
"=",
"'mass'",
",",
"isos",
"=",
"None",
",",
"ifig",
"=",
"None",
",",
"fname",
"=",
"None",
",",
"logy",
"=",
"False",
",",
"colourblind",
"=",
"False",
")",
":",
"pT",
"=",
"self",
".",
"_classTe... | Plot common abundances as a function of either mass coordiate or radius.
Parameters
----------
ixaxis : string, optional
'mass', 'logradius' or 'radius'
The default value is 'mass'
isos : list, optional
list of isos to plot, i.e. ['h1','he4','c12'] f... | [
"Plot",
"common",
"abundances",
"as",
"a",
"function",
"of",
"either",
"mass",
"coordiate",
"or",
"radius",
"."
] | train | https://github.com/NuGrid/NuGridPy/blob/eee8047446e398be77362d82c1d8b3310054fab0/nugridpy/data_plot.py#L4658-L4745 |
openstack/proliantutils | proliantutils/redfish/main.py | HPESushy.get_system | def get_system(self, identity):
"""Given the identity return a HPESystem object
:param identity: The identity of the System resource
:returns: The System object
"""
return system.HPESystem(self._conn, identity,
redfish_version=self.redfish_version... | python | def get_system(self, identity):
"""Given the identity return a HPESystem object
:param identity: The identity of the System resource
:returns: The System object
"""
return system.HPESystem(self._conn, identity,
redfish_version=self.redfish_version... | [
"def",
"get_system",
"(",
"self",
",",
"identity",
")",
":",
"return",
"system",
".",
"HPESystem",
"(",
"self",
".",
"_conn",
",",
"identity",
",",
"redfish_version",
"=",
"self",
".",
"redfish_version",
")"
] | Given the identity return a HPESystem object
:param identity: The identity of the System resource
:returns: The System object | [
"Given",
"the",
"identity",
"return",
"a",
"HPESystem",
"object"
] | train | https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/redfish/main.py#L66-L73 |
openstack/proliantutils | proliantutils/redfish/main.py | HPESushy.get_manager | def get_manager(self, identity):
"""Given the identity return a HPEManager object
:param identity: The identity of the Manager resource
:returns: The Manager object
"""
return manager.HPEManager(self._conn, identity,
redfish_version=self.redfish... | python | def get_manager(self, identity):
"""Given the identity return a HPEManager object
:param identity: The identity of the Manager resource
:returns: The Manager object
"""
return manager.HPEManager(self._conn, identity,
redfish_version=self.redfish... | [
"def",
"get_manager",
"(",
"self",
",",
"identity",
")",
":",
"return",
"manager",
".",
"HPEManager",
"(",
"self",
".",
"_conn",
",",
"identity",
",",
"redfish_version",
"=",
"self",
".",
"redfish_version",
")"
] | Given the identity return a HPEManager object
:param identity: The identity of the Manager resource
:returns: The Manager object | [
"Given",
"the",
"identity",
"return",
"a",
"HPEManager",
"object"
] | train | https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/redfish/main.py#L78-L85 |
openstack/proliantutils | proliantutils/redfish/main.py | HPESushy.get_update_service | def get_update_service(self):
"""Return a HPEUpdateService object
:returns: The UpdateService object
"""
update_service_url = utils.get_subresource_path_by(self,
'UpdateService')
return (update_service.
H... | python | def get_update_service(self):
"""Return a HPEUpdateService object
:returns: The UpdateService object
"""
update_service_url = utils.get_subresource_path_by(self,
'UpdateService')
return (update_service.
H... | [
"def",
"get_update_service",
"(",
"self",
")",
":",
"update_service_url",
"=",
"utils",
".",
"get_subresource_path_by",
"(",
"self",
",",
"'UpdateService'",
")",
"return",
"(",
"update_service",
".",
"HPEUpdateService",
"(",
"self",
".",
"_conn",
",",
"update_serv... | Return a HPEUpdateService object
:returns: The UpdateService object | [
"Return",
"a",
"HPEUpdateService",
"object"
] | train | https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/redfish/main.py#L87-L96 |
openstack/proliantutils | proliantutils/redfish/main.py | HPESushy.get_account_service | def get_account_service(self):
"""Return a HPEAccountService object"""
account_service_url = utils.get_subresource_path_by(self,
'AccountService')
return (account_service.
HPEAccountService(self._conn, account_service_u... | python | def get_account_service(self):
"""Return a HPEAccountService object"""
account_service_url = utils.get_subresource_path_by(self,
'AccountService')
return (account_service.
HPEAccountService(self._conn, account_service_u... | [
"def",
"get_account_service",
"(",
"self",
")",
":",
"account_service_url",
"=",
"utils",
".",
"get_subresource_path_by",
"(",
"self",
",",
"'AccountService'",
")",
"return",
"(",
"account_service",
".",
"HPEAccountService",
"(",
"self",
".",
"_conn",
",",
"accoun... | Return a HPEAccountService object | [
"Return",
"a",
"HPEAccountService",
"object"
] | train | https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/redfish/main.py#L98-L105 |
openstack/proliantutils | proliantutils/sum/sum_controller.py | _execute_sum | def _execute_sum(sum_file_path, mount_point, components=None):
"""Executes the SUM based firmware update command.
This method executes the SUM based firmware update command to update the
components specified, if not, it performs update on all the firmware
components on th server.
:param sum_file_p... | python | def _execute_sum(sum_file_path, mount_point, components=None):
"""Executes the SUM based firmware update command.
This method executes the SUM based firmware update command to update the
components specified, if not, it performs update on all the firmware
components on th server.
:param sum_file_p... | [
"def",
"_execute_sum",
"(",
"sum_file_path",
",",
"mount_point",
",",
"components",
"=",
"None",
")",
":",
"cmd",
"=",
"' --c '",
"+",
"' --c '",
".",
"join",
"(",
"components",
")",
"if",
"components",
"else",
"''",
"try",
":",
"if",
"SUM_LOCATION",
"in",... | Executes the SUM based firmware update command.
This method executes the SUM based firmware update command to update the
components specified, if not, it performs update on all the firmware
components on th server.
:param sum_file_path: A string with the path to the SUM binary to be
executed
... | [
"Executes",
"the",
"SUM",
"based",
"firmware",
"update",
"command",
"."
] | train | https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/sum/sum_controller.py#L55-L91 |
openstack/proliantutils | proliantutils/sum/sum_controller.py | _get_log_file_data_as_encoded_content | def _get_log_file_data_as_encoded_content():
"""Gzip and base64 encode files and BytesIO buffers.
This method gets the log files created by SUM based
firmware update and tar zip the files.
:returns: A gzipped and base64 encoded string as text.
"""
with io.BytesIO() as fp:
with tarfile.o... | python | def _get_log_file_data_as_encoded_content():
"""Gzip and base64 encode files and BytesIO buffers.
This method gets the log files created by SUM based
firmware update and tar zip the files.
:returns: A gzipped and base64 encoded string as text.
"""
with io.BytesIO() as fp:
with tarfile.o... | [
"def",
"_get_log_file_data_as_encoded_content",
"(",
")",
":",
"with",
"io",
".",
"BytesIO",
"(",
")",
"as",
"fp",
":",
"with",
"tarfile",
".",
"open",
"(",
"fileobj",
"=",
"fp",
",",
"mode",
"=",
"'w:gz'",
")",
"as",
"tar",
":",
"for",
"f",
"in",
"O... | Gzip and base64 encode files and BytesIO buffers.
This method gets the log files created by SUM based
firmware update and tar zip the files.
:returns: A gzipped and base64 encoded string as text. | [
"Gzip",
"and",
"base64",
"encode",
"files",
"and",
"BytesIO",
"buffers",
"."
] | train | https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/sum/sum_controller.py#L94-L108 |
openstack/proliantutils | proliantutils/sum/sum_controller.py | _parse_sum_ouput | def _parse_sum_ouput(exit_code):
"""Parse the SUM output log file.
This method parses through the SUM log file in the
default location to return the SUM update status. Sample return
string:
"Summary: The installation of the component failed. Status of updated
components: Total: 5 Success: 4 F... | python | def _parse_sum_ouput(exit_code):
"""Parse the SUM output log file.
This method parses through the SUM log file in the
default location to return the SUM update status. Sample return
string:
"Summary: The installation of the component failed. Status of updated
components: Total: 5 Success: 4 F... | [
"def",
"_parse_sum_ouput",
"(",
"exit_code",
")",
":",
"if",
"exit_code",
"==",
"3",
":",
"return",
"\"Summary: %s\"",
"%",
"EXIT_CODE_TO_STRING",
".",
"get",
"(",
"exit_code",
")",
"if",
"exit_code",
"in",
"(",
"0",
",",
"1",
",",
"253",
")",
":",
"if",... | Parse the SUM output log file.
This method parses through the SUM log file in the
default location to return the SUM update status. Sample return
string:
"Summary: The installation of the component failed. Status of updated
components: Total: 5 Success: 4 Failed: 1"
:param exit_code: A integ... | [
"Parse",
"the",
"SUM",
"output",
"log",
"file",
"."
] | train | https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/sum/sum_controller.py#L111-L156 |
openstack/proliantutils | proliantutils/sum/sum_controller.py | update_firmware | def update_firmware(node):
"""Performs SUM based firmware update on the node.
This method performs SUM firmware update by mounting the
SPP ISO on the node. It performs firmware update on all or
some of the firmware components.
:param node: A node object of type dict.
:returns: Operation Status... | python | def update_firmware(node):
"""Performs SUM based firmware update on the node.
This method performs SUM firmware update by mounting the
SPP ISO on the node. It performs firmware update on all or
some of the firmware components.
:param node: A node object of type dict.
:returns: Operation Status... | [
"def",
"update_firmware",
"(",
"node",
")",
":",
"sum_update_iso",
"=",
"node",
"[",
"'clean_step'",
"]",
"[",
"'args'",
"]",
".",
"get",
"(",
"'url'",
")",
"# Validates the http image reference for SUM update ISO.",
"try",
":",
"utils",
".",
"validate_href",
"(",... | Performs SUM based firmware update on the node.
This method performs SUM firmware update by mounting the
SPP ISO on the node. It performs firmware update on all or
some of the firmware components.
:param node: A node object of type dict.
:returns: Operation Status string.
:raises: SUMOperation... | [
"Performs",
"SUM",
"based",
"firmware",
"update",
"on",
"the",
"node",
"."
] | train | https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/sum/sum_controller.py#L159-L237 |
gvalkov/python-ansimarkup | ansimarkup/markup.py | AnsiMarkup.parse | def parse(self, text):
'''Return a string with markup tags converted to ansi-escape sequences.'''
tags, results = [], []
text = self.re_tag.sub(lambda m: self.sub_tag(m, tags, results), text)
if self.strict and tags:
markup = "%s%s%s" % (self.tag_sep[0], tags.pop(0), self.t... | python | def parse(self, text):
'''Return a string with markup tags converted to ansi-escape sequences.'''
tags, results = [], []
text = self.re_tag.sub(lambda m: self.sub_tag(m, tags, results), text)
if self.strict and tags:
markup = "%s%s%s" % (self.tag_sep[0], tags.pop(0), self.t... | [
"def",
"parse",
"(",
"self",
",",
"text",
")",
":",
"tags",
",",
"results",
"=",
"[",
"]",
",",
"[",
"]",
"text",
"=",
"self",
".",
"re_tag",
".",
"sub",
"(",
"lambda",
"m",
":",
"self",
".",
"sub_tag",
"(",
"m",
",",
"tags",
",",
"results",
... | Return a string with markup tags converted to ansi-escape sequences. | [
"Return",
"a",
"string",
"with",
"markup",
"tags",
"converted",
"to",
"ansi",
"-",
"escape",
"sequences",
"."
] | train | https://github.com/gvalkov/python-ansimarkup/blob/92611bec49e8fdfaea0c77d63b758d8643398fdf/ansimarkup/markup.py#L50-L64 |
gvalkov/python-ansimarkup | ansimarkup/markup.py | AnsiMarkup.ansiprint | def ansiprint(self, *args, **kwargs):
'''Wrapper around builtins.print() that runs parse() on all arguments first.'''
args = (self.parse(str(i)) for i in args)
builtins.print(*args, **kwargs) | python | def ansiprint(self, *args, **kwargs):
'''Wrapper around builtins.print() that runs parse() on all arguments first.'''
args = (self.parse(str(i)) for i in args)
builtins.print(*args, **kwargs) | [
"def",
"ansiprint",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"args",
"=",
"(",
"self",
".",
"parse",
"(",
"str",
"(",
"i",
")",
")",
"for",
"i",
"in",
"args",
")",
"builtins",
".",
"print",
"(",
"*",
"args",
",",
"*",... | Wrapper around builtins.print() that runs parse() on all arguments first. | [
"Wrapper",
"around",
"builtins",
".",
"print",
"()",
"that",
"runs",
"parse",
"()",
"on",
"all",
"arguments",
"first",
"."
] | train | https://github.com/gvalkov/python-ansimarkup/blob/92611bec49e8fdfaea0c77d63b758d8643398fdf/ansimarkup/markup.py#L66-L69 |
gvalkov/python-ansimarkup | ansimarkup/markup.py | AnsiMarkup.strip | def strip(self, text):
'''Return string with markup tags removed.'''
tags, results = [], []
return self.re_tag.sub(lambda m: self.clear_tag(m, tags, results), text) | python | def strip(self, text):
'''Return string with markup tags removed.'''
tags, results = [], []
return self.re_tag.sub(lambda m: self.clear_tag(m, tags, results), text) | [
"def",
"strip",
"(",
"self",
",",
"text",
")",
":",
"tags",
",",
"results",
"=",
"[",
"]",
",",
"[",
"]",
"return",
"self",
".",
"re_tag",
".",
"sub",
"(",
"lambda",
"m",
":",
"self",
".",
"clear_tag",
"(",
"m",
",",
"tags",
",",
"results",
")"... | Return string with markup tags removed. | [
"Return",
"string",
"with",
"markup",
"tags",
"removed",
"."
] | train | https://github.com/gvalkov/python-ansimarkup/blob/92611bec49e8fdfaea0c77d63b758d8643398fdf/ansimarkup/markup.py#L71-L74 |
Azure/azure-multiapi-storage-python | azure/multiapi/storage/v2016_05_31/file/fileservice.py | FileService.list_shares | def list_shares(self, prefix=None, marker=None, num_results=None,
include_metadata=False, timeout=None):
'''
Returns a generator to list the shares under the specified account.
The generator will lazily follow the continuation tokens returned by
the service and stop ... | python | def list_shares(self, prefix=None, marker=None, num_results=None,
include_metadata=False, timeout=None):
'''
Returns a generator to list the shares under the specified account.
The generator will lazily follow the continuation tokens returned by
the service and stop ... | [
"def",
"list_shares",
"(",
"self",
",",
"prefix",
"=",
"None",
",",
"marker",
"=",
"None",
",",
"num_results",
"=",
"None",
",",
"include_metadata",
"=",
"False",
",",
"timeout",
"=",
"None",
")",
":",
"include",
"=",
"'metadata'",
"if",
"include_metadata"... | Returns a generator to list the shares under the specified account.
The generator will lazily follow the continuation tokens returned by
the service and stop when all shares have been returned or num_results
is reached.
If num_results is specified and the account has more than that num... | [
"Returns",
"a",
"generator",
"to",
"list",
"the",
"shares",
"under",
"the",
"specified",
"account",
".",
"The",
"generator",
"will",
"lazily",
"follow",
"the",
"continuation",
"tokens",
"returned",
"by",
"the",
"service",
"and",
"stop",
"when",
"all",
"shares"... | train | https://github.com/Azure/azure-multiapi-storage-python/blob/bd5482547f993c6eb56fd09070e15c2e9616e440/azure/multiapi/storage/v2016_05_31/file/fileservice.py#L524-L559 |
Azure/azure-multiapi-storage-python | azure/multiapi/storage/v2016_05_31/file/fileservice.py | FileService.list_directories_and_files | def list_directories_and_files(self, share_name, directory_name=None,
num_results=None, marker=None, timeout=None,
prefix=None):
'''
Returns a generator to list the directories and files under the specified share.
The generat... | python | def list_directories_and_files(self, share_name, directory_name=None,
num_results=None, marker=None, timeout=None,
prefix=None):
'''
Returns a generator to list the directories and files under the specified share.
The generat... | [
"def",
"list_directories_and_files",
"(",
"self",
",",
"share_name",
",",
"directory_name",
"=",
"None",
",",
"num_results",
"=",
"None",
",",
"marker",
"=",
"None",
",",
"timeout",
"=",
"None",
",",
"prefix",
"=",
"None",
")",
":",
"operation_context",
"=",... | Returns a generator to list the directories and files under the specified share.
The generator will lazily follow the continuation tokens returned by
the service and stop when all directories and files have been returned or
num_results is reached.
If num_results is specified and the sha... | [
"Returns",
"a",
"generator",
"to",
"list",
"the",
"directories",
"and",
"files",
"under",
"the",
"specified",
"share",
".",
"The",
"generator",
"will",
"lazily",
"follow",
"the",
"continuation",
"tokens",
"returned",
"by",
"the",
"service",
"and",
"stop",
"whe... | train | https://github.com/Azure/azure-multiapi-storage-python/blob/bd5482547f993c6eb56fd09070e15c2e9616e440/azure/multiapi/storage/v2016_05_31/file/fileservice.py#L1065-L1108 |
Azure/azure-multiapi-storage-python | azure/multiapi/storage/v2016_05_31/file/fileservice.py | FileService._get_file | def _get_file(self, share_name, directory_name, file_name,
start_range=None, end_range=None, validate_content=False,
timeout=None, _context=None):
'''
Downloads a file's content, metadata, and properties. You can specify a
range if you don't need to download th... | python | def _get_file(self, share_name, directory_name, file_name,
start_range=None, end_range=None, validate_content=False,
timeout=None, _context=None):
'''
Downloads a file's content, metadata, and properties. You can specify a
range if you don't need to download th... | [
"def",
"_get_file",
"(",
"self",
",",
"share_name",
",",
"directory_name",
",",
"file_name",
",",
"start_range",
"=",
"None",
",",
"end_range",
"=",
"None",
",",
"validate_content",
"=",
"False",
",",
"timeout",
"=",
"None",
",",
"_context",
"=",
"None",
"... | Downloads a file's content, metadata, and properties. You can specify a
range if you don't need to download the file in its entirety. If no range
is specified, the full file will be downloaded.
See get_file_to_* for high level functions that handle the download
of large files with autom... | [
"Downloads",
"a",
"file",
"s",
"content",
"metadata",
"and",
"properties",
".",
"You",
"can",
"specify",
"a",
"range",
"if",
"you",
"don",
"t",
"need",
"to",
"download",
"the",
"file",
"in",
"its",
"entirety",
".",
"If",
"no",
"range",
"is",
"specified",... | train | https://github.com/Azure/azure-multiapi-storage-python/blob/bd5482547f993c6eb56fd09070e15c2e9616e440/azure/multiapi/storage/v2016_05_31/file/fileservice.py#L1741-L1794 |
Azure/azure-multiapi-storage-python | azure/multiapi/storage/v2016_05_31/file/fileservice.py | FileService.get_file_to_path | def get_file_to_path(self, share_name, directory_name, file_name, file_path,
open_mode='wb', start_range=None, end_range=None,
validate_content=False, progress_callback=None,
max_connections=2, timeout=None):
'''
Downloads a file... | python | def get_file_to_path(self, share_name, directory_name, file_name, file_path,
open_mode='wb', start_range=None, end_range=None,
validate_content=False, progress_callback=None,
max_connections=2, timeout=None):
'''
Downloads a file... | [
"def",
"get_file_to_path",
"(",
"self",
",",
"share_name",
",",
"directory_name",
",",
"file_name",
",",
"file_path",
",",
"open_mode",
"=",
"'wb'",
",",
"start_range",
"=",
"None",
",",
"end_range",
"=",
"None",
",",
"validate_content",
"=",
"False",
",",
"... | Downloads a file to a file path, with automatic chunking and progress
notifications. Returns an instance of File with properties and metadata.
:param str share_name:
Name of existing share.
:param str directory_name:
The path to the directory.
:param str file_nam... | [
"Downloads",
"a",
"file",
"to",
"a",
"file",
"path",
"with",
"automatic",
"chunking",
"and",
"progress",
"notifications",
".",
"Returns",
"an",
"instance",
"of",
"File",
"with",
"properties",
"and",
"metadata",
"."
] | train | https://github.com/Azure/azure-multiapi-storage-python/blob/bd5482547f993c6eb56fd09070e15c2e9616e440/azure/multiapi/storage/v2016_05_31/file/fileservice.py#L1796-L1876 |
Azure/azure-multiapi-storage-python | azure/multiapi/storage/v2016_05_31/file/fileservice.py | FileService.get_file_to_stream | def get_file_to_stream(
self, share_name, directory_name, file_name, stream,
start_range=None, end_range=None, validate_content=False,
progress_callback=None, max_connections=2, timeout=None):
'''
Downloads a file to a stream, with automatic chunking and progress
notifica... | python | def get_file_to_stream(
self, share_name, directory_name, file_name, stream,
start_range=None, end_range=None, validate_content=False,
progress_callback=None, max_connections=2, timeout=None):
'''
Downloads a file to a stream, with automatic chunking and progress
notifica... | [
"def",
"get_file_to_stream",
"(",
"self",
",",
"share_name",
",",
"directory_name",
",",
"file_name",
",",
"stream",
",",
"start_range",
"=",
"None",
",",
"end_range",
"=",
"None",
",",
"validate_content",
"=",
"False",
",",
"progress_callback",
"=",
"None",
"... | Downloads a file to a stream, with automatic chunking and progress
notifications. Returns an instance of :class:`File` with properties
and metadata.
:param str share_name:
Name of existing share.
:param str directory_name:
The path to the directory.
:para... | [
"Downloads",
"a",
"file",
"to",
"a",
"stream",
"with",
"automatic",
"chunking",
"and",
"progress",
"notifications",
".",
"Returns",
"an",
"instance",
"of",
":",
"class",
":",
"File",
"with",
"properties",
"and",
"metadata",
"."
] | train | https://github.com/Azure/azure-multiapi-storage-python/blob/bd5482547f993c6eb56fd09070e15c2e9616e440/azure/multiapi/storage/v2016_05_31/file/fileservice.py#L1878-L2068 |
Azure/azure-multiapi-storage-python | azure/multiapi/storage/v2016_05_31/file/fileservice.py | FileService.get_file_to_bytes | def get_file_to_bytes(self, share_name, directory_name, file_name,
start_range=None, end_range=None, validate_content=False,
progress_callback=None, max_connections=2, timeout=None):
'''
Downloads a file as an array of bytes, with automatic chunking a... | python | def get_file_to_bytes(self, share_name, directory_name, file_name,
start_range=None, end_range=None, validate_content=False,
progress_callback=None, max_connections=2, timeout=None):
'''
Downloads a file as an array of bytes, with automatic chunking a... | [
"def",
"get_file_to_bytes",
"(",
"self",
",",
"share_name",
",",
"directory_name",
",",
"file_name",
",",
"start_range",
"=",
"None",
",",
"end_range",
"=",
"None",
",",
"validate_content",
"=",
"False",
",",
"progress_callback",
"=",
"None",
",",
"max_connectio... | Downloads a file as an array of bytes, with automatic chunking and
progress notifications. Returns an instance of :class:`File` with
properties, metadata, and content.
:param str share_name:
Name of existing share.
:param str directory_name:
The path to the direc... | [
"Downloads",
"a",
"file",
"as",
"an",
"array",
"of",
"bytes",
"with",
"automatic",
"chunking",
"and",
"progress",
"notifications",
".",
"Returns",
"an",
"instance",
"of",
":",
"class",
":",
"File",
"with",
"properties",
"metadata",
"and",
"content",
"."
] | train | https://github.com/Azure/azure-multiapi-storage-python/blob/bd5482547f993c6eb56fd09070e15c2e9616e440/azure/multiapi/storage/v2016_05_31/file/fileservice.py#L2070-L2147 |
Azure/azure-multiapi-storage-python | azure/multiapi/storage/v2016_05_31/file/fileservice.py | FileService.get_file_to_text | def get_file_to_text(
self, share_name, directory_name, file_name, encoding='utf-8',
start_range=None, end_range=None, validate_content=False,
progress_callback=None, max_connections=2, timeout=None):
'''
Downloads a file as unicode text, with automatic chunking and progress
... | python | def get_file_to_text(
self, share_name, directory_name, file_name, encoding='utf-8',
start_range=None, end_range=None, validate_content=False,
progress_callback=None, max_connections=2, timeout=None):
'''
Downloads a file as unicode text, with automatic chunking and progress
... | [
"def",
"get_file_to_text",
"(",
"self",
",",
"share_name",
",",
"directory_name",
",",
"file_name",
",",
"encoding",
"=",
"'utf-8'",
",",
"start_range",
"=",
"None",
",",
"end_range",
"=",
"None",
",",
"validate_content",
"=",
"False",
",",
"progress_callback",
... | Downloads a file as unicode text, with automatic chunking and progress
notifications. Returns an instance of :class:`File` with properties,
metadata, and content.
:param str share_name:
Name of existing share.
:param str directory_name:
The path to the directory.... | [
"Downloads",
"a",
"file",
"as",
"unicode",
"text",
"with",
"automatic",
"chunking",
"and",
"progress",
"notifications",
".",
"Returns",
"an",
"instance",
"of",
":",
"class",
":",
"File",
"with",
"properties",
"metadata",
"and",
"content",
"."
] | train | https://github.com/Azure/azure-multiapi-storage-python/blob/bd5482547f993c6eb56fd09070e15c2e9616e440/azure/multiapi/storage/v2016_05_31/file/fileservice.py#L2149-L2228 |
openstack/proliantutils | proliantutils/utils.py | process_firmware_image | def process_firmware_image(compact_firmware_file, ilo_object):
"""Processes the firmware file.
Processing the firmware file entails extracting the firmware file from its
compact format. Along with the raw (extracted) firmware file, this method
also sends out information of whether or not the extracted ... | python | def process_firmware_image(compact_firmware_file, ilo_object):
"""Processes the firmware file.
Processing the firmware file entails extracting the firmware file from its
compact format. Along with the raw (extracted) firmware file, this method
also sends out information of whether or not the extracted ... | [
"def",
"process_firmware_image",
"(",
"compact_firmware_file",
",",
"ilo_object",
")",
":",
"fw_img_extractor",
"=",
"firmware_controller",
".",
"get_fw_extractor",
"(",
"compact_firmware_file",
")",
"LOG",
".",
"debug",
"(",
"'Extracting firmware file: %s ...'",
",",
"co... | Processes the firmware file.
Processing the firmware file entails extracting the firmware file from its
compact format. Along with the raw (extracted) firmware file, this method
also sends out information of whether or not the extracted firmware file
a) needs to be uploaded to http store
b)... | [
"Processes",
"the",
"firmware",
"file",
"."
] | train | https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/utils.py#L33-L73 |
openstack/proliantutils | proliantutils/utils.py | _get_hash_object | def _get_hash_object(hash_algo_name):
"""Create a hash object based on given algorithm.
:param hash_algo_name: name of the hashing algorithm.
:raises: InvalidInputError, on unsupported or invalid input.
:returns: a hash object based on the given named algorithm.
"""
algorithms = (hashlib.algori... | python | def _get_hash_object(hash_algo_name):
"""Create a hash object based on given algorithm.
:param hash_algo_name: name of the hashing algorithm.
:raises: InvalidInputError, on unsupported or invalid input.
:returns: a hash object based on the given named algorithm.
"""
algorithms = (hashlib.algori... | [
"def",
"_get_hash_object",
"(",
"hash_algo_name",
")",
":",
"algorithms",
"=",
"(",
"hashlib",
".",
"algorithms_guaranteed",
"if",
"six",
".",
"PY3",
"else",
"hashlib",
".",
"algorithms",
")",
"if",
"hash_algo_name",
"not",
"in",
"algorithms",
":",
"msg",
"=",... | Create a hash object based on given algorithm.
:param hash_algo_name: name of the hashing algorithm.
:raises: InvalidInputError, on unsupported or invalid input.
:returns: a hash object based on the given named algorithm. | [
"Create",
"a",
"hash",
"object",
"based",
"on",
"given",
"algorithm",
"."
] | train | https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/utils.py#L76-L90 |
openstack/proliantutils | proliantutils/utils.py | hash_file | def hash_file(file_like_object, hash_algo='md5'):
"""Generate a hash for the contents of a file.
It returns a hash of the file object as a string of double length,
containing only hexadecimal digits. It supports all the algorithms
hashlib does.
:param file_like_object: file like object whose hash t... | python | def hash_file(file_like_object, hash_algo='md5'):
"""Generate a hash for the contents of a file.
It returns a hash of the file object as a string of double length,
containing only hexadecimal digits. It supports all the algorithms
hashlib does.
:param file_like_object: file like object whose hash t... | [
"def",
"hash_file",
"(",
"file_like_object",
",",
"hash_algo",
"=",
"'md5'",
")",
":",
"checksum",
"=",
"_get_hash_object",
"(",
"hash_algo",
")",
"for",
"chunk",
"in",
"iter",
"(",
"lambda",
":",
"file_like_object",
".",
"read",
"(",
"32768",
")",
",",
"b... | Generate a hash for the contents of a file.
It returns a hash of the file object as a string of double length,
containing only hexadecimal digits. It supports all the algorithms
hashlib does.
:param file_like_object: file like object whose hash to be calculated.
:param hash_algo: name of the hashin... | [
"Generate",
"a",
"hash",
"for",
"the",
"contents",
"of",
"a",
"file",
"."
] | train | https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/utils.py#L93-L107 |
openstack/proliantutils | proliantutils/utils.py | verify_image_checksum | def verify_image_checksum(image_location, expected_checksum):
"""Verifies checksum (md5) of image file against the expected one.
This method generates the checksum of the image file on the fly and
verifies it against the expected checksum provided as argument.
:param image_location: location of image ... | python | def verify_image_checksum(image_location, expected_checksum):
"""Verifies checksum (md5) of image file against the expected one.
This method generates the checksum of the image file on the fly and
verifies it against the expected checksum provided as argument.
:param image_location: location of image ... | [
"def",
"verify_image_checksum",
"(",
"image_location",
",",
"expected_checksum",
")",
":",
"try",
":",
"with",
"open",
"(",
"image_location",
",",
"'rb'",
")",
"as",
"fd",
":",
"actual_checksum",
"=",
"hash_file",
"(",
"fd",
")",
"except",
"IOError",
"as",
"... | Verifies checksum (md5) of image file against the expected one.
This method generates the checksum of the image file on the fly and
verifies it against the expected checksum provided as argument.
:param image_location: location of image file whose checksum is verified.
:param expected_checksum: checks... | [
"Verifies",
"checksum",
"(",
"md5",
")",
"of",
"image",
"file",
"against",
"the",
"expected",
"one",
"."
] | train | https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/utils.py#L110-L135 |
openstack/proliantutils | proliantutils/utils.py | validate_href | def validate_href(image_href):
"""Validate HTTP image reference.
:param image_href: Image reference.
:raises: exception.ImageRefValidationFailed if HEAD request failed or
returned response code not equal to 200.
:returns: Response to HEAD request.
"""
try:
... | python | def validate_href(image_href):
"""Validate HTTP image reference.
:param image_href: Image reference.
:raises: exception.ImageRefValidationFailed if HEAD request failed or
returned response code not equal to 200.
:returns: Response to HEAD request.
"""
try:
... | [
"def",
"validate_href",
"(",
"image_href",
")",
":",
"try",
":",
"response",
"=",
"requests",
".",
"head",
"(",
"image_href",
")",
"if",
"response",
".",
"status_code",
"!=",
"http_client",
".",
"OK",
":",
"raise",
"exception",
".",
"ImageRefValidationFailed",... | Validate HTTP image reference.
:param image_href: Image reference.
:raises: exception.ImageRefValidationFailed if HEAD request failed or
returned response code not equal to 200.
:returns: Response to HEAD request. | [
"Validate",
"HTTP",
"image",
"reference",
"."
] | train | https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/utils.py#L138-L156 |
openstack/proliantutils | proliantutils/utils.py | apply_bios_properties_filter | def apply_bios_properties_filter(settings, filter_to_be_applied):
"""Applies the filter to return the dict of filtered BIOS properties.
:param settings: dict of BIOS settings on which filter to be applied.
:param filter_to_be_applied: list of keys to be applied as filter.
:returns: A dictionary of filt... | python | def apply_bios_properties_filter(settings, filter_to_be_applied):
"""Applies the filter to return the dict of filtered BIOS properties.
:param settings: dict of BIOS settings on which filter to be applied.
:param filter_to_be_applied: list of keys to be applied as filter.
:returns: A dictionary of filt... | [
"def",
"apply_bios_properties_filter",
"(",
"settings",
",",
"filter_to_be_applied",
")",
":",
"if",
"not",
"settings",
"or",
"not",
"filter_to_be_applied",
":",
"return",
"settings",
"return",
"{",
"k",
":",
"settings",
"[",
"k",
"]",
"for",
"k",
"in",
"filte... | Applies the filter to return the dict of filtered BIOS properties.
:param settings: dict of BIOS settings on which filter to be applied.
:param filter_to_be_applied: list of keys to be applied as filter.
:returns: A dictionary of filtered BIOS settings. | [
"Applies",
"the",
"filter",
"to",
"return",
"the",
"dict",
"of",
"filtered",
"BIOS",
"properties",
"."
] | train | https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/utils.py#L159-L169 |
Azure/azure-multiapi-storage-python | azure/multiapi/storage/v2016_05_31/table/_request.py | _insert_or_replace_entity | def _insert_or_replace_entity(entity, require_encryption=False,
key_encryption_key=None, encryption_resolver=None):
'''
Constructs an insert or replace entity request.
'''
_validate_entity(entity, key_encryption_key is not None)
_validate_encryption_required(require_enc... | python | def _insert_or_replace_entity(entity, require_encryption=False,
key_encryption_key=None, encryption_resolver=None):
'''
Constructs an insert or replace entity request.
'''
_validate_entity(entity, key_encryption_key is not None)
_validate_encryption_required(require_enc... | [
"def",
"_insert_or_replace_entity",
"(",
"entity",
",",
"require_encryption",
"=",
"False",
",",
"key_encryption_key",
"=",
"None",
",",
"encryption_resolver",
"=",
"None",
")",
":",
"_validate_entity",
"(",
"entity",
",",
"key_encryption_key",
"is",
"not",
"None",
... | Constructs an insert or replace entity request. | [
"Constructs",
"an",
"insert",
"or",
"replace",
"entity",
"request",
"."
] | train | https://github.com/Azure/azure-multiapi-storage-python/blob/bd5482547f993c6eb56fd09070e15c2e9616e440/azure/multiapi/storage/v2016_05_31/table/_request.py#L152-L171 |
openstack/proliantutils | proliantutils/redfish/resources/account_service/account_service.py | HPEAccountService.accounts | def accounts(self):
"""Property to provide instance of HPEAccountCollection"""
return account.HPEAccountCollection(
self._conn, utils.get_subresource_path_by(self, 'Accounts'),
redfish_version=self.redfish_version) | python | def accounts(self):
"""Property to provide instance of HPEAccountCollection"""
return account.HPEAccountCollection(
self._conn, utils.get_subresource_path_by(self, 'Accounts'),
redfish_version=self.redfish_version) | [
"def",
"accounts",
"(",
"self",
")",
":",
"return",
"account",
".",
"HPEAccountCollection",
"(",
"self",
".",
"_conn",
",",
"utils",
".",
"get_subresource_path_by",
"(",
"self",
",",
"'Accounts'",
")",
",",
"redfish_version",
"=",
"self",
".",
"redfish_version... | Property to provide instance of HPEAccountCollection | [
"Property",
"to",
"provide",
"instance",
"of",
"HPEAccountCollection"
] | train | https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/redfish/resources/account_service/account_service.py#L31-L35 |
openstack/proliantutils | proliantutils/redfish/resources/account_service/account.py | HPEAccount.update_credentials | def update_credentials(self, password):
"""Update credentials of a redfish system
:param password: password to be updated
"""
data = {
'Password': password,
}
self._conn.patch(self.path, data=data) | python | def update_credentials(self, password):
"""Update credentials of a redfish system
:param password: password to be updated
"""
data = {
'Password': password,
}
self._conn.patch(self.path, data=data) | [
"def",
"update_credentials",
"(",
"self",
",",
"password",
")",
":",
"data",
"=",
"{",
"'Password'",
":",
"password",
",",
"}",
"self",
".",
"_conn",
".",
"patch",
"(",
"self",
".",
"path",
",",
"data",
"=",
"data",
")"
] | Update credentials of a redfish system
:param password: password to be updated | [
"Update",
"credentials",
"of",
"a",
"redfish",
"system"
] | train | https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/redfish/resources/account_service/account.py#L25-L33 |
openstack/proliantutils | proliantutils/redfish/resources/account_service/account.py | HPEAccountCollection.get_member_details | def get_member_details(self, username):
"""Returns the HPEAccount object
:param username: username of account
:returns: HPEAccount object if criterion matches, None otherwise
"""
members = self.get_members()
for member in members:
if member.username == userna... | python | def get_member_details(self, username):
"""Returns the HPEAccount object
:param username: username of account
:returns: HPEAccount object if criterion matches, None otherwise
"""
members = self.get_members()
for member in members:
if member.username == userna... | [
"def",
"get_member_details",
"(",
"self",
",",
"username",
")",
":",
"members",
"=",
"self",
".",
"get_members",
"(",
")",
"for",
"member",
"in",
"members",
":",
"if",
"member",
".",
"username",
"==",
"username",
":",
"return",
"member"
] | Returns the HPEAccount object
:param username: username of account
:returns: HPEAccount object if criterion matches, None otherwise | [
"Returns",
"the",
"HPEAccount",
"object"
] | train | https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/redfish/resources/account_service/account.py#L43-L52 |
openstack/proliantutils | proliantutils/redfish/resources/manager/virtual_media.py | _get_media | def _get_media(media_types):
"""Helper method to map the media types."""
get_mapped_media = (lambda x: maps.VIRTUAL_MEDIA_TYPES_MAP[x]
if x in maps.VIRTUAL_MEDIA_TYPES_MAP else None)
return list(map(get_mapped_media, media_types)) | python | def _get_media(media_types):
"""Helper method to map the media types."""
get_mapped_media = (lambda x: maps.VIRTUAL_MEDIA_TYPES_MAP[x]
if x in maps.VIRTUAL_MEDIA_TYPES_MAP else None)
return list(map(get_mapped_media, media_types)) | [
"def",
"_get_media",
"(",
"media_types",
")",
":",
"get_mapped_media",
"=",
"(",
"lambda",
"x",
":",
"maps",
".",
"VIRTUAL_MEDIA_TYPES_MAP",
"[",
"x",
"]",
"if",
"x",
"in",
"maps",
".",
"VIRTUAL_MEDIA_TYPES_MAP",
"else",
"None",
")",
"return",
"list",
"(",
... | Helper method to map the media types. | [
"Helper",
"method",
"to",
"map",
"the",
"media",
"types",
"."
] | train | https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/redfish/resources/manager/virtual_media.py#L30-L34 |
openstack/proliantutils | proliantutils/redfish/resources/manager/virtual_media.py | VirtualMedia._get_action_element | def _get_action_element(self, action_type):
"""Helper method to return the action object."""
action = eval("self._hpe_actions." + action_type + "_vmedia")
if not action:
if action_type == "insert":
action_path = '#HpeiLOVirtualMedia.InsertVirtualMedia'
el... | python | def _get_action_element(self, action_type):
"""Helper method to return the action object."""
action = eval("self._hpe_actions." + action_type + "_vmedia")
if not action:
if action_type == "insert":
action_path = '#HpeiLOVirtualMedia.InsertVirtualMedia'
el... | [
"def",
"_get_action_element",
"(",
"self",
",",
"action_type",
")",
":",
"action",
"=",
"eval",
"(",
"\"self._hpe_actions.\"",
"+",
"action_type",
"+",
"\"_vmedia\"",
")",
"if",
"not",
"action",
":",
"if",
"action_type",
"==",
"\"insert\"",
":",
"action_path",
... | Helper method to return the action object. | [
"Helper",
"method",
"to",
"return",
"the",
"action",
"object",
"."
] | train | https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/redfish/resources/manager/virtual_media.py#L53-L67 |
openstack/proliantutils | proliantutils/redfish/resources/manager/virtual_media.py | VirtualMedia.insert_media | def insert_media(self, url):
"""Inserts Virtual Media to the device
:param url: URL to image.
:raises: SushyError, on an error from iLO.
"""
try:
super(VirtualMedia, self).insert_media(url, write_protected=True)
except sushy_exceptions.SushyError:
... | python | def insert_media(self, url):
"""Inserts Virtual Media to the device
:param url: URL to image.
:raises: SushyError, on an error from iLO.
"""
try:
super(VirtualMedia, self).insert_media(url, write_protected=True)
except sushy_exceptions.SushyError:
... | [
"def",
"insert_media",
"(",
"self",
",",
"url",
")",
":",
"try",
":",
"super",
"(",
"VirtualMedia",
",",
"self",
")",
".",
"insert_media",
"(",
"url",
",",
"write_protected",
"=",
"True",
")",
"except",
"sushy_exceptions",
".",
"SushyError",
":",
"target_u... | Inserts Virtual Media to the device
:param url: URL to image.
:raises: SushyError, on an error from iLO. | [
"Inserts",
"Virtual",
"Media",
"to",
"the",
"device"
] | train | https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/redfish/resources/manager/virtual_media.py#L69-L80 |
openstack/proliantutils | proliantutils/redfish/resources/manager/virtual_media.py | VirtualMedia.eject_media | def eject_media(self):
"""Ejects Virtual Media.
:raises: SushyError, on an error from iLO.
"""
try:
super(VirtualMedia, self).eject_media()
except sushy_exceptions.SushyError:
target_uri = self._get_action_element('eject').target_uri
self._con... | python | def eject_media(self):
"""Ejects Virtual Media.
:raises: SushyError, on an error from iLO.
"""
try:
super(VirtualMedia, self).eject_media()
except sushy_exceptions.SushyError:
target_uri = self._get_action_element('eject').target_uri
self._con... | [
"def",
"eject_media",
"(",
"self",
")",
":",
"try",
":",
"super",
"(",
"VirtualMedia",
",",
"self",
")",
".",
"eject_media",
"(",
")",
"except",
"sushy_exceptions",
".",
"SushyError",
":",
"target_uri",
"=",
"self",
".",
"_get_action_element",
"(",
"'eject'"... | Ejects Virtual Media.
:raises: SushyError, on an error from iLO. | [
"Ejects",
"Virtual",
"Media",
"."
] | train | https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/redfish/resources/manager/virtual_media.py#L82-L91 |
openstack/proliantutils | proliantutils/redfish/resources/manager/virtual_media.py | VirtualMedia.set_vm_status | def set_vm_status(self, boot_on_next_reset):
"""Set the Virtual Media drive status.
:param boot_on_next_reset: boolean value
:raises: SushyError, on an error from iLO.
"""
data = {
"Oem": {
"Hpe": {
"BootOnNextServerReset": boot_on... | python | def set_vm_status(self, boot_on_next_reset):
"""Set the Virtual Media drive status.
:param boot_on_next_reset: boolean value
:raises: SushyError, on an error from iLO.
"""
data = {
"Oem": {
"Hpe": {
"BootOnNextServerReset": boot_on... | [
"def",
"set_vm_status",
"(",
"self",
",",
"boot_on_next_reset",
")",
":",
"data",
"=",
"{",
"\"Oem\"",
":",
"{",
"\"Hpe\"",
":",
"{",
"\"BootOnNextServerReset\"",
":",
"boot_on_next_reset",
"}",
"}",
"}",
"self",
".",
"_conn",
".",
"patch",
"(",
"self",
".... | Set the Virtual Media drive status.
:param boot_on_next_reset: boolean value
:raises: SushyError, on an error from iLO. | [
"Set",
"the",
"Virtual",
"Media",
"drive",
"status",
"."
] | train | https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/redfish/resources/manager/virtual_media.py#L93-L106 |
openstack/proliantutils | proliantutils/redfish/resources/manager/virtual_media.py | VirtualMediaCollection.get_member_device | def get_member_device(self, device):
"""Returns the given virtual media device object.
:param device: virtual media device to be queried
:returns virtual media device object.
"""
for vmedia_device in self.get_members():
if device in vmedia_device.media_types:
... | python | def get_member_device(self, device):
"""Returns the given virtual media device object.
:param device: virtual media device to be queried
:returns virtual media device object.
"""
for vmedia_device in self.get_members():
if device in vmedia_device.media_types:
... | [
"def",
"get_member_device",
"(",
"self",
",",
"device",
")",
":",
"for",
"vmedia_device",
"in",
"self",
".",
"get_members",
"(",
")",
":",
"if",
"device",
"in",
"vmedia_device",
".",
"media_types",
":",
"return",
"vmedia_device"
] | Returns the given virtual media device object.
:param device: virtual media device to be queried
:returns virtual media device object. | [
"Returns",
"the",
"given",
"virtual",
"media",
"device",
"object",
"."
] | train | https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/redfish/resources/manager/virtual_media.py#L115-L123 |
Azure/azure-multiapi-storage-python | azure/multiapi/storage/v2015_04_05/table/_request.py | _get_entity | def _get_entity(partition_key, row_key, select, accept):
'''
Constructs a get entity request.
'''
_validate_not_none('partition_key', partition_key)
_validate_not_none('row_key', row_key)
_validate_not_none('accept', accept)
request = HTTPRequest()
request.method = 'GET'
request.head... | python | def _get_entity(partition_key, row_key, select, accept):
'''
Constructs a get entity request.
'''
_validate_not_none('partition_key', partition_key)
_validate_not_none('row_key', row_key)
_validate_not_none('accept', accept)
request = HTTPRequest()
request.method = 'GET'
request.head... | [
"def",
"_get_entity",
"(",
"partition_key",
",",
"row_key",
",",
"select",
",",
"accept",
")",
":",
"_validate_not_none",
"(",
"'partition_key'",
",",
"partition_key",
")",
"_validate_not_none",
"(",
"'row_key'",
",",
"row_key",
")",
"_validate_not_none",
"(",
"'a... | Constructs a get entity request. | [
"Constructs",
"a",
"get",
"entity",
"request",
"."
] | train | https://github.com/Azure/azure-multiapi-storage-python/blob/bd5482547f993c6eb56fd09070e15c2e9616e440/azure/multiapi/storage/v2015_04_05/table/_request.py#L35-L47 |
Azure/azure-multiapi-storage-python | azure/multiapi/storage/v2015_04_05/table/_request.py | _insert_entity | def _insert_entity(entity):
'''
Constructs an insert entity request.
'''
_validate_entity(entity)
request = HTTPRequest()
request.method = 'POST'
request.headers = [_DEFAULT_CONTENT_TYPE_HEADER,
_DEFAULT_PREFER_HEADER,
_DEFAULT_ACCEPT_HEADER]
... | python | def _insert_entity(entity):
'''
Constructs an insert entity request.
'''
_validate_entity(entity)
request = HTTPRequest()
request.method = 'POST'
request.headers = [_DEFAULT_CONTENT_TYPE_HEADER,
_DEFAULT_PREFER_HEADER,
_DEFAULT_ACCEPT_HEADER]
... | [
"def",
"_insert_entity",
"(",
"entity",
")",
":",
"_validate_entity",
"(",
"entity",
")",
"request",
"=",
"HTTPRequest",
"(",
")",
"request",
".",
"method",
"=",
"'POST'",
"request",
".",
"headers",
"=",
"[",
"_DEFAULT_CONTENT_TYPE_HEADER",
",",
"_DEFAULT_PREFER... | Constructs an insert entity request. | [
"Constructs",
"an",
"insert",
"entity",
"request",
"."
] | train | https://github.com/Azure/azure-multiapi-storage-python/blob/bd5482547f993c6eb56fd09070e15c2e9616e440/azure/multiapi/storage/v2015_04_05/table/_request.py#L49-L62 |
Azure/azure-multiapi-storage-python | azure/multiapi/storage/v2015_04_05/table/_request.py | _merge_entity | def _merge_entity(entity, if_match):
'''
Constructs a merge entity request.
'''
_validate_not_none('if_match', if_match)
_validate_entity(entity)
request = HTTPRequest()
request.method = 'MERGE'
request.headers = [_DEFAULT_CONTENT_TYPE_HEADER,
_DEFAULT_ACCEPT_HEA... | python | def _merge_entity(entity, if_match):
'''
Constructs a merge entity request.
'''
_validate_not_none('if_match', if_match)
_validate_entity(entity)
request = HTTPRequest()
request.method = 'MERGE'
request.headers = [_DEFAULT_CONTENT_TYPE_HEADER,
_DEFAULT_ACCEPT_HEA... | [
"def",
"_merge_entity",
"(",
"entity",
",",
"if_match",
")",
":",
"_validate_not_none",
"(",
"'if_match'",
",",
"if_match",
")",
"_validate_entity",
"(",
"entity",
")",
"request",
"=",
"HTTPRequest",
"(",
")",
"request",
".",
"method",
"=",
"'MERGE'",
"request... | Constructs a merge entity request. | [
"Constructs",
"a",
"merge",
"entity",
"request",
"."
] | train | https://github.com/Azure/azure-multiapi-storage-python/blob/bd5482547f993c6eb56fd09070e15c2e9616e440/azure/multiapi/storage/v2015_04_05/table/_request.py#L80-L94 |
Azure/azure-multiapi-storage-python | azure/multiapi/storage/v2015_04_05/table/_request.py | _delete_entity | def _delete_entity(partition_key, row_key, if_match):
'''
Constructs a delete entity request.
'''
_validate_not_none('if_match', if_match)
_validate_not_none('partition_key', partition_key)
_validate_not_none('row_key', row_key)
request = HTTPRequest()
request.method = 'DELETE'
requ... | python | def _delete_entity(partition_key, row_key, if_match):
'''
Constructs a delete entity request.
'''
_validate_not_none('if_match', if_match)
_validate_not_none('partition_key', partition_key)
_validate_not_none('row_key', row_key)
request = HTTPRequest()
request.method = 'DELETE'
requ... | [
"def",
"_delete_entity",
"(",
"partition_key",
",",
"row_key",
",",
"if_match",
")",
":",
"_validate_not_none",
"(",
"'if_match'",
",",
"if_match",
")",
"_validate_not_none",
"(",
"'partition_key'",
",",
"partition_key",
")",
"_validate_not_none",
"(",
"'row_key'",
... | Constructs a delete entity request. | [
"Constructs",
"a",
"delete",
"entity",
"request",
"."
] | train | https://github.com/Azure/azure-multiapi-storage-python/blob/bd5482547f993c6eb56fd09070e15c2e9616e440/azure/multiapi/storage/v2015_04_05/table/_request.py#L96-L108 |
Azure/azure-multiapi-storage-python | azure/multiapi/storage/v2015_04_05/table/_request.py | _insert_or_replace_entity | def _insert_or_replace_entity(entity):
'''
Constructs an insert or replace entity request.
'''
_validate_entity(entity)
request = HTTPRequest()
request.method = 'PUT'
request.headers = [_DEFAULT_CONTENT_TYPE_HEADER,
_DEFAULT_ACCEPT_HEADER]
request.body = _get_req... | python | def _insert_or_replace_entity(entity):
'''
Constructs an insert or replace entity request.
'''
_validate_entity(entity)
request = HTTPRequest()
request.method = 'PUT'
request.headers = [_DEFAULT_CONTENT_TYPE_HEADER,
_DEFAULT_ACCEPT_HEADER]
request.body = _get_req... | [
"def",
"_insert_or_replace_entity",
"(",
"entity",
")",
":",
"_validate_entity",
"(",
"entity",
")",
"request",
"=",
"HTTPRequest",
"(",
")",
"request",
".",
"method",
"=",
"'PUT'",
"request",
".",
"headers",
"=",
"[",
"_DEFAULT_CONTENT_TYPE_HEADER",
",",
"_DEFA... | Constructs an insert or replace entity request. | [
"Constructs",
"an",
"insert",
"or",
"replace",
"entity",
"request",
"."
] | train | https://github.com/Azure/azure-multiapi-storage-python/blob/bd5482547f993c6eb56fd09070e15c2e9616e440/azure/multiapi/storage/v2015_04_05/table/_request.py#L110-L122 |
openstack/proliantutils | proliantutils/ilo/firmware_controller.py | find_executable | def find_executable(executable_name):
"""Tries to find executable in PATH environment
It uses ``shutil.which`` method in Python3 and
``distutils.spawn.find_executable`` method in Python2.7 to find the
absolute path to the 'name' executable.
:param executable_name: name of the executable
:return... | python | def find_executable(executable_name):
"""Tries to find executable in PATH environment
It uses ``shutil.which`` method in Python3 and
``distutils.spawn.find_executable`` method in Python2.7 to find the
absolute path to the 'name' executable.
:param executable_name: name of the executable
:return... | [
"def",
"find_executable",
"(",
"executable_name",
")",
":",
"if",
"six",
".",
"PY3",
":",
"executable_abs",
"=",
"shutil",
".",
"which",
"(",
"executable_name",
")",
"else",
":",
"import",
"distutils",
".",
"spawn",
"executable_abs",
"=",
"distutils",
".",
"... | Tries to find executable in PATH environment
It uses ``shutil.which`` method in Python3 and
``distutils.spawn.find_executable`` method in Python2.7 to find the
absolute path to the 'name' executable.
:param executable_name: name of the executable
:returns: Returns the absolute path to the executabl... | [
"Tries",
"to",
"find",
"executable",
"in",
"PATH",
"environment"
] | train | https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/ilo/firmware_controller.py#L56-L71 |
openstack/proliantutils | proliantutils/ilo/firmware_controller.py | check_firmware_update_component | def check_firmware_update_component(func):
"""Checks the firmware update component."""
@six.wraps(func)
def wrapper(self, filename, component_type):
"""Wrapper around ``update_firmware`` call.
:param filename: location of the raw firmware file.
:param component_type: Type of compone... | python | def check_firmware_update_component(func):
"""Checks the firmware update component."""
@six.wraps(func)
def wrapper(self, filename, component_type):
"""Wrapper around ``update_firmware`` call.
:param filename: location of the raw firmware file.
:param component_type: Type of compone... | [
"def",
"check_firmware_update_component",
"(",
"func",
")",
":",
"@",
"six",
".",
"wraps",
"(",
"func",
")",
"def",
"wrapper",
"(",
"self",
",",
"filename",
",",
"component_type",
")",
":",
"\"\"\"Wrapper around ``update_firmware`` call.\n\n :param filename: loca... | Checks the firmware update component. | [
"Checks",
"the",
"firmware",
"update",
"component",
"."
] | train | https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/ilo/firmware_controller.py#L74-L93 |
openstack/proliantutils | proliantutils/ilo/firmware_controller.py | get_fw_extractor | def get_fw_extractor(fw_file):
"""Gets the firmware extractor object fine-tuned for specified type
:param fw_file: compact firmware file to be extracted from
:raises: InvalidInputError, for unsupported file types
:returns: FirmwareImageExtractor object
"""
fw_img_extractor = FirmwareImageExtrac... | python | def get_fw_extractor(fw_file):
"""Gets the firmware extractor object fine-tuned for specified type
:param fw_file: compact firmware file to be extracted from
:raises: InvalidInputError, for unsupported file types
:returns: FirmwareImageExtractor object
"""
fw_img_extractor = FirmwareImageExtrac... | [
"def",
"get_fw_extractor",
"(",
"fw_file",
")",
":",
"fw_img_extractor",
"=",
"FirmwareImageExtractor",
"(",
"fw_file",
")",
"extension",
"=",
"fw_img_extractor",
".",
"fw_file_ext",
".",
"lower",
"(",
")",
"if",
"extension",
"==",
"'.scexe'",
":",
"# assign _do_e... | Gets the firmware extractor object fine-tuned for specified type
:param fw_file: compact firmware file to be extracted from
:raises: InvalidInputError, for unsupported file types
:returns: FirmwareImageExtractor object | [
"Gets",
"the",
"firmware",
"extractor",
"object",
"fine",
"-",
"tuned",
"for",
"specified",
"type"
] | train | https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/ilo/firmware_controller.py#L295-L332 |
openstack/proliantutils | proliantutils/ilo/firmware_controller.py | _extract_scexe_file | def _extract_scexe_file(self, target_file, extract_path):
"""Extracts the scexe file.
:param target_file: the firmware file to be extracted from
:param extract_path: the path where extraction is supposed to happen
"""
# Command to extract the smart component file.
unpack_cmd = '--unpack=' + ext... | python | def _extract_scexe_file(self, target_file, extract_path):
"""Extracts the scexe file.
:param target_file: the firmware file to be extracted from
:param extract_path: the path where extraction is supposed to happen
"""
# Command to extract the smart component file.
unpack_cmd = '--unpack=' + ext... | [
"def",
"_extract_scexe_file",
"(",
"self",
",",
"target_file",
",",
"extract_path",
")",
":",
"# Command to extract the smart component file.",
"unpack_cmd",
"=",
"'--unpack='",
"+",
"extract_path",
"# os.path.isfile(target_file)",
"cmd",
"=",
"[",
"target_file",
",",
"un... | Extracts the scexe file.
:param target_file: the firmware file to be extracted from
:param extract_path: the path where extraction is supposed to happen | [
"Extracts",
"the",
"scexe",
"file",
"."
] | train | https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/ilo/firmware_controller.py#L335-L345 |
openstack/proliantutils | proliantutils/ilo/firmware_controller.py | _extract_rpm_file | def _extract_rpm_file(self, target_file, extract_path):
"""Extracts the rpm file.
:param target_file: the firmware file to be extracted from
:param extract_path: the path where extraction is supposed to happen
:raises: ImageExtractionFailed, if any issue with extraction
"""
if not os.path.exist... | python | def _extract_rpm_file(self, target_file, extract_path):
"""Extracts the rpm file.
:param target_file: the firmware file to be extracted from
:param extract_path: the path where extraction is supposed to happen
:raises: ImageExtractionFailed, if any issue with extraction
"""
if not os.path.exist... | [
"def",
"_extract_rpm_file",
"(",
"self",
",",
"target_file",
",",
"extract_path",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"extract_path",
")",
":",
"os",
".",
"makedirs",
"(",
"extract_path",
")",
"os",
".",
"chdir",
"(",
"extract_p... | Extracts the rpm file.
:param target_file: the firmware file to be extracted from
:param extract_path: the path where extraction is supposed to happen
:raises: ImageExtractionFailed, if any issue with extraction | [
"Extracts",
"the",
"rpm",
"file",
"."
] | train | https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/ilo/firmware_controller.py#L348-L375 |
openstack/proliantutils | proliantutils/ilo/firmware_controller.py | _get_firmware_file | def _get_firmware_file(path):
"""Gets the raw firmware file
Gets the raw firmware file from the extracted directory structure
:param path: the directory structure to search for
:returns: the raw firmware file with the complete path
"""
for dirpath, dirnames, filenames in os.walk(path):
... | python | def _get_firmware_file(path):
"""Gets the raw firmware file
Gets the raw firmware file from the extracted directory structure
:param path: the directory structure to search for
:returns: the raw firmware file with the complete path
"""
for dirpath, dirnames, filenames in os.walk(path):
... | [
"def",
"_get_firmware_file",
"(",
"path",
")",
":",
"for",
"dirpath",
",",
"dirnames",
",",
"filenames",
"in",
"os",
".",
"walk",
"(",
"path",
")",
":",
"for",
"filename",
"in",
"filenames",
":",
"file_name",
",",
"file_ext",
"=",
"os",
".",
"path",
".... | Gets the raw firmware file
Gets the raw firmware file from the extracted directory structure
:param path: the directory structure to search for
:returns: the raw firmware file with the complete path | [
"Gets",
"the",
"raw",
"firmware",
"file"
] | train | https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/ilo/firmware_controller.py#L378-L390 |
openstack/proliantutils | proliantutils/ilo/firmware_controller.py | _get_firmware_file_in_new_path | def _get_firmware_file_in_new_path(searching_path):
"""Gets the raw firmware file in a new path
Gets the raw firmware file from the extracted directory structure
and creates a hard link to that in a file path and cleans up the
lookup extract path.
:param searching_path: the directory structure to s... | python | def _get_firmware_file_in_new_path(searching_path):
"""Gets the raw firmware file in a new path
Gets the raw firmware file from the extracted directory structure
and creates a hard link to that in a file path and cleans up the
lookup extract path.
:param searching_path: the directory structure to s... | [
"def",
"_get_firmware_file_in_new_path",
"(",
"searching_path",
")",
":",
"firmware_file_path",
"=",
"_get_firmware_file",
"(",
"searching_path",
")",
"if",
"not",
"firmware_file_path",
":",
"return",
"None",
"# Note(deray): the path of the new firmware file will be of the form:"... | Gets the raw firmware file in a new path
Gets the raw firmware file from the extracted directory structure
and creates a hard link to that in a file path and cleans up the
lookup extract path.
:param searching_path: the directory structure to search for
:returns: the raw firmware file with the comp... | [
"Gets",
"the",
"raw",
"firmware",
"file",
"in",
"a",
"new",
"path"
] | train | https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/ilo/firmware_controller.py#L393-L419 |
openstack/proliantutils | proliantutils/ilo/firmware_controller.py | FirmwareImageUploader.upload_file_to | def upload_file_to(self, addressinfo, timeout):
"""Uploads the raw firmware file to iLO
Uploads the raw firmware file (already set as attribute in
FirmwareImageControllerBase constructor) to iLO, whose address
information is passed to this method.
:param addressinfo: tuple of ho... | python | def upload_file_to(self, addressinfo, timeout):
"""Uploads the raw firmware file to iLO
Uploads the raw firmware file (already set as attribute in
FirmwareImageControllerBase constructor) to iLO, whose address
information is passed to this method.
:param addressinfo: tuple of ho... | [
"def",
"upload_file_to",
"(",
"self",
",",
"addressinfo",
",",
"timeout",
")",
":",
"self",
".",
"hostname",
",",
"self",
".",
"port",
"=",
"addressinfo",
"self",
".",
"timeout",
"=",
"timeout",
"filename",
"=",
"self",
".",
"fw_file",
"firmware",
"=",
"... | Uploads the raw firmware file to iLO
Uploads the raw firmware file (already set as attribute in
FirmwareImageControllerBase constructor) to iLO, whose address
information is passed to this method.
:param addressinfo: tuple of hostname and port of the iLO
:param timeout: timeout ... | [
"Uploads",
"the",
"raw",
"firmware",
"file",
"to",
"iLO"
] | train | https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/ilo/firmware_controller.py#L120-L191 |
openstack/proliantutils | proliantutils/ilo/firmware_controller.py | FirmwareImageUploader._get_socket | def _get_socket(self, sslversion=ssl.PROTOCOL_TLSv1):
"""Sets up an https connection and do an HTTP/raw socket request
:param sslversion: version of ssl session
:raises: IloConnectionError, for connection failures
:returns: ssl wrapped socket object
"""
err = None
... | python | def _get_socket(self, sslversion=ssl.PROTOCOL_TLSv1):
"""Sets up an https connection and do an HTTP/raw socket request
:param sslversion: version of ssl session
:raises: IloConnectionError, for connection failures
:returns: ssl wrapped socket object
"""
err = None
... | [
"def",
"_get_socket",
"(",
"self",
",",
"sslversion",
"=",
"ssl",
".",
"PROTOCOL_TLSv1",
")",
":",
"err",
"=",
"None",
"sock",
"=",
"None",
"try",
":",
"for",
"res",
"in",
"socket",
".",
"getaddrinfo",
"(",
"self",
".",
"hostname",
",",
"self",
".",
... | Sets up an https connection and do an HTTP/raw socket request
:param sslversion: version of ssl session
:raises: IloConnectionError, for connection failures
:returns: ssl wrapped socket object | [
"Sets",
"up",
"an",
"https",
"connection",
"and",
"do",
"an",
"HTTP",
"/",
"raw",
"socket",
"request"
] | train | https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/ilo/firmware_controller.py#L193-L248 |
openstack/proliantutils | proliantutils/ilo/firmware_controller.py | FirmwareImageExtractor.extract | def extract(self):
"""Extracts the raw firmware file from its compact format
Extracts the raw firmware file from its compact file format (already
set as attribute in FirmwareImageControllerBase constructor).
:raises: InvalidInputError, if raw firmware file not found
:raises: Ima... | python | def extract(self):
"""Extracts the raw firmware file from its compact format
Extracts the raw firmware file from its compact file format (already
set as attribute in FirmwareImageControllerBase constructor).
:raises: InvalidInputError, if raw firmware file not found
:raises: Ima... | [
"def",
"extract",
"(",
"self",
")",
":",
"target_file",
"=",
"self",
".",
"fw_file",
"common",
".",
"add_exec_permission_to",
"(",
"target_file",
")",
"# create a temp directory where the extraction will occur",
"temp_dir",
"=",
"tempfile",
".",
"mkdtemp",
"(",
")",
... | Extracts the raw firmware file from its compact format
Extracts the raw firmware file from its compact file format (already
set as attribute in FirmwareImageControllerBase constructor).
:raises: InvalidInputError, if raw firmware file not found
:raises: ImageExtractionFailed, for extrac... | [
"Extracts",
"the",
"raw",
"firmware",
"file",
"from",
"its",
"compact",
"format"
] | train | https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/ilo/firmware_controller.py#L258-L292 |
openstack/proliantutils | proliantutils/redfish/resources/system/smart_storage_config.py | HPESmartStorageConfig._generic_format | def _generic_format(self, raid_config, controller=None):
"""Convert redfish data of current raid config to generic format.
:param raid_config: Raid configuration dictionary
:param controller: Array controller model in post_create read else
None
:returns: curre... | python | def _generic_format(self, raid_config, controller=None):
"""Convert redfish data of current raid config to generic format.
:param raid_config: Raid configuration dictionary
:param controller: Array controller model in post_create read else
None
:returns: curre... | [
"def",
"_generic_format",
"(",
"self",
",",
"raid_config",
",",
"controller",
"=",
"None",
")",
":",
"logical_drives",
"=",
"raid_config",
"[",
"\"LogicalDrives\"",
"]",
"logical_disks",
"=",
"[",
"]",
"controller",
"=",
"controller",
"for",
"ld",
"in",
"logic... | Convert redfish data of current raid config to generic format.
:param raid_config: Raid configuration dictionary
:param controller: Array controller model in post_create read else
None
:returns: current raid config. | [
"Convert",
"redfish",
"data",
"of",
"current",
"raid",
"config",
"to",
"generic",
"format",
"."
] | train | https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/redfish/resources/system/smart_storage_config.py#L48-L68 |
openstack/proliantutils | proliantutils/redfish/resources/system/smart_storage_config.py | HPESmartStorageConfig._check_smart_storage_message | def _check_smart_storage_message(self):
"""Check for smart storage message.
:returns: result, raid_message
"""
ssc_mesg = self.smart_storage_config_message
result = True
raid_message = ""
for element in ssc_mesg:
if "Success" not in element['MessageId... | python | def _check_smart_storage_message(self):
"""Check for smart storage message.
:returns: result, raid_message
"""
ssc_mesg = self.smart_storage_config_message
result = True
raid_message = ""
for element in ssc_mesg:
if "Success" not in element['MessageId... | [
"def",
"_check_smart_storage_message",
"(",
"self",
")",
":",
"ssc_mesg",
"=",
"self",
".",
"smart_storage_config_message",
"result",
"=",
"True",
"raid_message",
"=",
"\"\"",
"for",
"element",
"in",
"ssc_mesg",
":",
"if",
"\"Success\"",
"not",
"in",
"element",
... | Check for smart storage message.
:returns: result, raid_message | [
"Check",
"for",
"smart",
"storage",
"message",
"."
] | train | https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/redfish/resources/system/smart_storage_config.py#L70-L82 |
openstack/proliantutils | proliantutils/redfish/resources/system/smart_storage_config.py | HPESmartStorageConfig.read_raid | def read_raid(self, controller=None):
"""Get the current RAID configuration from the system.
:param controller: If controller model its post-create read else
post-delete
:returns: current raid config.
"""
if controller:
if not self.logical_... | python | def read_raid(self, controller=None):
"""Get the current RAID configuration from the system.
:param controller: If controller model its post-create read else
post-delete
:returns: current raid config.
"""
if controller:
if not self.logical_... | [
"def",
"read_raid",
"(",
"self",
",",
"controller",
"=",
"None",
")",
":",
"if",
"controller",
":",
"if",
"not",
"self",
".",
"logical_drives",
":",
"msg",
"=",
"(",
"'No logical drives found on the controller'",
")",
"LOG",
".",
"debug",
"(",
"msg",
")",
... | Get the current RAID configuration from the system.
:param controller: If controller model its post-create read else
post-delete
:returns: current raid config. | [
"Get",
"the",
"current",
"RAID",
"configuration",
"from",
"the",
"system",
"."
] | train | https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/redfish/resources/system/smart_storage_config.py#L84-L117 |
openstack/proliantutils | proliantutils/redfish/resources/system/smart_storage_config.py | HPESmartStorageConfig.delete_raid | def delete_raid(self):
"""Clears the RAID configuration from the system.
"""
if not self.logical_drives:
msg = ('No logical drives found on the controller '
'%(controller)s' % {'controller': str(self.controller_id)})
LOG.debug(msg)
raise ex... | python | def delete_raid(self):
"""Clears the RAID configuration from the system.
"""
if not self.logical_drives:
msg = ('No logical drives found on the controller '
'%(controller)s' % {'controller': str(self.controller_id)})
LOG.debug(msg)
raise ex... | [
"def",
"delete_raid",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"logical_drives",
":",
"msg",
"=",
"(",
"'No logical drives found on the controller '",
"'%(controller)s'",
"%",
"{",
"'controller'",
":",
"str",
"(",
"self",
".",
"controller_id",
")",
"}",
... | Clears the RAID configuration from the system. | [
"Clears",
"the",
"RAID",
"configuration",
"from",
"the",
"system",
"."
] | train | https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/redfish/resources/system/smart_storage_config.py#L119-L136 |
openstack/proliantutils | proliantutils/redfish/resources/system/smart_storage_config.py | HPESmartStorageConfig.create_raid | 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_leve... | python | 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_leve... | [
"def",
"create_raid",
"(",
"self",
",",
"raid_config",
")",
":",
"manager",
".",
"validate",
"(",
"raid_config",
")",
"logical_drives",
"=",
"raid_config",
"[",
"'logical_disks'",
"]",
"redfish_logical_disk",
"=",
"[",
"]",
"for",
"ld",
"in",
"logical_drives",
... | 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... | [
"Create",
"the",
"raid",
"configuration",
"on",
"the",
"hardware",
"."
] | train | https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/redfish/resources/system/smart_storage_config.py#L138-L180 |
NuGrid/NuGridPy | nugridpy/ppn.py | xtime._readFile | def _readFile(self, fname, sldir):
'''
Private method that reads in the data file and organizes it
within this object.
'''
if sldir.endswith('/'):
fname = str(sldir)+str(fname)
else:
fname = str(sldir)+'/'+str(fname)
f=open(fname,'r')
... | python | def _readFile(self, fname, sldir):
'''
Private method that reads in the data file and organizes it
within this object.
'''
if sldir.endswith('/'):
fname = str(sldir)+str(fname)
else:
fname = str(sldir)+'/'+str(fname)
f=open(fname,'r')
... | [
"def",
"_readFile",
"(",
"self",
",",
"fname",
",",
"sldir",
")",
":",
"if",
"sldir",
".",
"endswith",
"(",
"'/'",
")",
":",
"fname",
"=",
"str",
"(",
"sldir",
")",
"+",
"str",
"(",
"fname",
")",
"else",
":",
"fname",
"=",
"str",
"(",
"sldir",
... | Private method that reads in the data file and organizes it
within this object. | [
"Private",
"method",
"that",
"reads",
"in",
"the",
"data",
"file",
"and",
"organizes",
"it",
"within",
"this",
"object",
"."
] | train | https://github.com/NuGrid/NuGridPy/blob/eee8047446e398be77362d82c1d8b3310054fab0/nugridpy/ppn.py#L150-L192 |
NuGrid/NuGridPy | nugridpy/ppn.py | xtime.get | def get(self, col_str):
'''
get one data column with the data
Parameters
----------
col_str : string
One of the column strings in self.cols.
'''
data_column=zeros(self.ilines)
for i in range(self.ilines):
data_column[i]=self.data[... | python | def get(self, col_str):
'''
get one data column with the data
Parameters
----------
col_str : string
One of the column strings in self.cols.
'''
data_column=zeros(self.ilines)
for i in range(self.ilines):
data_column[i]=self.data[... | [
"def",
"get",
"(",
"self",
",",
"col_str",
")",
":",
"data_column",
"=",
"zeros",
"(",
"self",
".",
"ilines",
")",
"for",
"i",
"in",
"range",
"(",
"self",
".",
"ilines",
")",
":",
"data_column",
"[",
"i",
"]",
"=",
"self",
".",
"data",
"[",
"i",
... | get one data column with the data
Parameters
----------
col_str : string
One of the column strings in self.cols. | [
"get",
"one",
"data",
"column",
"with",
"the",
"data"
] | train | https://github.com/NuGrid/NuGridPy/blob/eee8047446e398be77362d82c1d8b3310054fab0/nugridpy/ppn.py#L194-L207 |
NuGrid/NuGridPy | nugridpy/ppn.py | xtime.plot_xtime | def plot_xtime(self, y, x='time', label='default', labelx=None,
labely=None ,title=None, shape='.', logx=False,
logy=True, base=10):
'''
make a simple plot of two columns against each other.
An example would be instance.plot_xtime('PB206', label='PB206 vs t... | python | def plot_xtime(self, y, x='time', label='default', labelx=None,
labely=None ,title=None, shape='.', logx=False,
logy=True, base=10):
'''
make a simple plot of two columns against each other.
An example would be instance.plot_xtime('PB206', label='PB206 vs t... | [
"def",
"plot_xtime",
"(",
"self",
",",
"y",
",",
"x",
"=",
"'time'",
",",
"label",
"=",
"'default'",
",",
"labelx",
"=",
"None",
",",
"labely",
"=",
"None",
",",
"title",
"=",
"None",
",",
"shape",
"=",
"'.'",
",",
"logx",
"=",
"False",
",",
"log... | make a simple plot of two columns against each other.
An example would be instance.plot_xtime('PB206', label='PB206 vs t_y'
Recomend using the plot function DataPlot.plot() it has more
functionality.
Parameters
----------
Y : string
Column on Y-axis.
... | [
"make",
"a",
"simple",
"plot",
"of",
"two",
"columns",
"against",
"each",
"other",
"."
] | train | https://github.com/NuGrid/NuGridPy/blob/eee8047446e398be77362d82c1d8b3310054fab0/nugridpy/ppn.py#L209-L273 |
NuGrid/NuGridPy | nugridpy/ppn.py | abu_vector.getCycleData | def getCycleData(self, attri, fname, numtype='cycNum'):
"""
In this method a column of data for the associated cycle
attribute is returned.
Parameters
----------
attri : string
The name of the attribute we are looking for.
fname : string
T... | python | def getCycleData(self, attri, fname, numtype='cycNum'):
"""
In this method a column of data for the associated cycle
attribute is returned.
Parameters
----------
attri : string
The name of the attribute we are looking for.
fname : string
T... | [
"def",
"getCycleData",
"(",
"self",
",",
"attri",
",",
"fname",
",",
"numtype",
"=",
"'cycNum'",
")",
":",
"fname",
"=",
"self",
".",
"findFile",
"(",
"fname",
",",
"numtype",
")",
"if",
"self",
".",
"inputdir",
"==",
"''",
":",
"self",
".",
"inputdi... | In this method a column of data for the associated cycle
attribute is returned.
Parameters
----------
attri : string
The name of the attribute we are looking for.
fname : string
The name of the file we are getting the data from or the
cycle nu... | [
"In",
"this",
"method",
"a",
"column",
"of",
"data",
"for",
"the",
"associated",
"cycle",
"attribute",
"is",
"returned",
"."
] | train | https://github.com/NuGrid/NuGridPy/blob/eee8047446e398be77362d82c1d8b3310054fab0/nugridpy/ppn.py#L478-L540 |
NuGrid/NuGridPy | nugridpy/ppn.py | abu_vector.getColData | def getColData(self, attri, fname, numtype='cycNum'):
"""
In this method a column of data for the associated column
attribute is returned.
Parameters
----------
attri : string
The name of the attribute we are looking for.
fname : string
Th... | python | def getColData(self, attri, fname, numtype='cycNum'):
"""
In this method a column of data for the associated column
attribute is returned.
Parameters
----------
attri : string
The name of the attribute we are looking for.
fname : string
Th... | [
"def",
"getColData",
"(",
"self",
",",
"attri",
",",
"fname",
",",
"numtype",
"=",
"'cycNum'",
")",
":",
"fname",
"=",
"self",
".",
"findFile",
"(",
"fname",
",",
"numtype",
")",
"f",
"=",
"open",
"(",
"fname",
",",
"'r'",
")",
"for",
"i",
"in",
... | In this method a column of data for the associated column
attribute is returned.
Parameters
----------
attri : string
The name of the attribute we are looking for.
fname : string
The name of the file we are getting the data from or the
cycle n... | [
"In",
"this",
"method",
"a",
"column",
"of",
"data",
"for",
"the",
"associated",
"column",
"attribute",
"is",
"returned",
"."
] | train | https://github.com/NuGrid/NuGridPy/blob/eee8047446e398be77362d82c1d8b3310054fab0/nugridpy/ppn.py#L545-L607 |
NuGrid/NuGridPy | nugridpy/ppn.py | abu_vector.getElement | def getElement(self, attri, fname, numtype='cycNum'):
'''
In this method instead of getting a particular column of data,
the program gets a particular row of data for a particular
element name.
attri : string
The name of the attribute we are looking for. A complete
... | python | def getElement(self, attri, fname, numtype='cycNum'):
'''
In this method instead of getting a particular column of data,
the program gets a particular row of data for a particular
element name.
attri : string
The name of the attribute we are looking for. A complete
... | [
"def",
"getElement",
"(",
"self",
",",
"attri",
",",
"fname",
",",
"numtype",
"=",
"'cycNum'",
")",
":",
"element",
"=",
"[",
"]",
"#Variable for holding the list of element names",
"number",
"=",
"[",
"]",
"#Variable for holding the array of numbers",
"z",
"=",
"... | In this method instead of getting a particular column of data,
the program gets a particular row of data for a particular
element name.
attri : string
The name of the attribute we are looking for. A complete
list of them can be obtained by calling
>>> get('e... | [
"In",
"this",
"method",
"instead",
"of",
"getting",
"a",
"particular",
"column",
"of",
"data",
"the",
"program",
"gets",
"a",
"particular",
"row",
"of",
"data",
"for",
"a",
"particular",
"element",
"name",
"."
] | train | https://github.com/NuGrid/NuGridPy/blob/eee8047446e398be77362d82c1d8b3310054fab0/nugridpy/ppn.py#L609-L688 |
NuGrid/NuGridPy | nugridpy/ppn.py | abu_vector.get | def get(self, attri, fname=None, numtype='cycNum', decayed=False):
'''
In this method all data for an entire cycle (basically the
content of an iso_massfnnnn.DAT file) or a column of data for
the associated attribute is returned.
Parameters
----------
attri : str... | python | def get(self, attri, fname=None, numtype='cycNum', decayed=False):
'''
In this method all data for an entire cycle (basically the
content of an iso_massfnnnn.DAT file) or a column of data for
the associated attribute is returned.
Parameters
----------
attri : str... | [
"def",
"get",
"(",
"self",
",",
"attri",
",",
"fname",
"=",
"None",
",",
"numtype",
"=",
"'cycNum'",
",",
"decayed",
"=",
"False",
")",
":",
"if",
"type",
"(",
"attri",
")",
"is",
"type",
"(",
"1",
")",
":",
"print",
"(",
"\"Calling get method in cyc... | In this method all data for an entire cycle (basically the
content of an iso_massfnnnn.DAT file) or a column of data for
the associated attribute is returned.
Parameters
----------
attri : string or integer
If attri is a string, attri is the cycle or name of the
... | [
"In",
"this",
"method",
"all",
"data",
"for",
"an",
"entire",
"cycle",
"(",
"basically",
"the",
"content",
"of",
"an",
"iso_massfnnnn",
".",
"DAT",
"file",
")",
"or",
"a",
"column",
"of",
"data",
"for",
"the",
"associated",
"attribute",
"is",
"returned",
... | train | https://github.com/NuGrid/NuGridPy/blob/eee8047446e398be77362d82c1d8b3310054fab0/nugridpy/ppn.py#L692-L763 |
NuGrid/NuGridPy | nugridpy/ppn.py | abu_vector._getcycle | def _getcycle(self, cycle, decayed=False):
''' Private method for getting a cycle, called from get.'''
yps=self.get('ABUNDANCE_MF', cycle)
z=self.get('Z', cycle) #charge
a=self.get('A', cycle) #mass
isomers=self.get('ISOM', cycle)
a_iso_to_plot,z_iso_to_plot,abunds,isoto... | python | def _getcycle(self, cycle, decayed=False):
''' Private method for getting a cycle, called from get.'''
yps=self.get('ABUNDANCE_MF', cycle)
z=self.get('Z', cycle) #charge
a=self.get('A', cycle) #mass
isomers=self.get('ISOM', cycle)
a_iso_to_plot,z_iso_to_plot,abunds,isoto... | [
"def",
"_getcycle",
"(",
"self",
",",
"cycle",
",",
"decayed",
"=",
"False",
")",
":",
"yps",
"=",
"self",
".",
"get",
"(",
"'ABUNDANCE_MF'",
",",
"cycle",
")",
"z",
"=",
"self",
".",
"get",
"(",
"'Z'",
",",
"cycle",
")",
"#charge",
"a",
"=",
"se... | Private method for getting a cycle, called from get. | [
"Private",
"method",
"for",
"getting",
"a",
"cycle",
"called",
"from",
"get",
"."
] | train | https://github.com/NuGrid/NuGridPy/blob/eee8047446e398be77362d82c1d8b3310054fab0/nugridpy/ppn.py#L765-L810 |
NuGrid/NuGridPy | nugridpy/ppn.py | abu_vector._getattr | def _getattr(self, attri, fname=None, numtype='cycNum'):
''' Private method for getting an attribute, called from get.'''
if str(fname.__class__)=="<type 'list'>":
isList=True
else:
isList=False
data=[]
if fname==None:
fname=self.files
... | python | def _getattr(self, attri, fname=None, numtype='cycNum'):
''' Private method for getting an attribute, called from get.'''
if str(fname.__class__)=="<type 'list'>":
isList=True
else:
isList=False
data=[]
if fname==None:
fname=self.files
... | [
"def",
"_getattr",
"(",
"self",
",",
"attri",
",",
"fname",
"=",
"None",
",",
"numtype",
"=",
"'cycNum'",
")",
":",
"if",
"str",
"(",
"fname",
".",
"__class__",
")",
"==",
"\"<type 'list'>\"",
":",
"isList",
"=",
"True",
"else",
":",
"isList",
"=",
"... | Private method for getting an attribute, called from get. | [
"Private",
"method",
"for",
"getting",
"an",
"attribute",
"called",
"from",
"get",
"."
] | train | https://github.com/NuGrid/NuGridPy/blob/eee8047446e398be77362d82c1d8b3310054fab0/nugridpy/ppn.py#L813-L850 |
NuGrid/NuGridPy | nugridpy/ppn.py | abu_vector._readPPN | def _readPPN(self, fname, sldir):
'''
Private method that reads in and organizes the .ppn file
Loads the data of the .ppn file into the variable cols.
'''
if sldir.endswith(os.sep):
#Making sure fname will be formatted correctly
fname = str(sldir)... | python | def _readPPN(self, fname, sldir):
'''
Private method that reads in and organizes the .ppn file
Loads the data of the .ppn file into the variable cols.
'''
if sldir.endswith(os.sep):
#Making sure fname will be formatted correctly
fname = str(sldir)... | [
"def",
"_readPPN",
"(",
"self",
",",
"fname",
",",
"sldir",
")",
":",
"if",
"sldir",
".",
"endswith",
"(",
"os",
".",
"sep",
")",
":",
"#Making sure fname will be formatted correctly",
"fname",
"=",
"str",
"(",
"sldir",
")",
"+",
"str",
"(",
"fname",
")"... | Private method that reads in and organizes the .ppn file
Loads the data of the .ppn file into the variable cols. | [
"Private",
"method",
"that",
"reads",
"in",
"and",
"organizes",
"the",
".",
"ppn",
"file",
"Loads",
"the",
"data",
"of",
"the",
".",
"ppn",
"file",
"into",
"the",
"variable",
"cols",
"."
] | train | https://github.com/NuGrid/NuGridPy/blob/eee8047446e398be77362d82c1d8b3310054fab0/nugridpy/ppn.py#L853-L876 |
NuGrid/NuGridPy | nugridpy/ppn.py | abu_vector._readFile | def _readFile(self, fname, sldir):
'''
private method that reads in and organizes the .DAT file
Loads the data of the .DAT File into the variables cattrs and cols.
In both these cases they are dictionaries, but in the case of cols,
it is a dictionary of numpy array exect for the ... | python | def _readFile(self, fname, sldir):
'''
private method that reads in and organizes the .DAT file
Loads the data of the .DAT File into the variables cattrs and cols.
In both these cases they are dictionaries, but in the case of cols,
it is a dictionary of numpy array exect for the ... | [
"def",
"_readFile",
"(",
"self",
",",
"fname",
",",
"sldir",
")",
":",
"cattrs",
"=",
"[",
"]",
"if",
"sldir",
".",
"endswith",
"(",
"os",
".",
"sep",
")",
":",
"#Making sure fname will be formatted correctly",
"fname",
"=",
"str",
"(",
"sldir",
")",
"+"... | private method that reads in and organizes the .DAT file
Loads the data of the .DAT File into the variables cattrs and cols.
In both these cases they are dictionaries, but in the case of cols,
it is a dictionary of numpy array exect for the element ,
element_name where it is just a list | [
"private",
"method",
"that",
"reads",
"in",
"and",
"organizes",
"the",
".",
"DAT",
"file",
"Loads",
"the",
"data",
"of",
"the",
".",
"DAT",
"File",
"into",
"the",
"variables",
"cattrs",
"and",
"cols",
".",
"In",
"both",
"these",
"cases",
"they",
"are",
... | train | https://github.com/NuGrid/NuGridPy/blob/eee8047446e398be77362d82c1d8b3310054fab0/nugridpy/ppn.py#L879-L926 |
NuGrid/NuGridPy | nugridpy/ppn.py | abu_vector.findFile | def findFile(self, fname, numtype):
"""
Function that finds the associated file for fname when Fname is
time or NDump.
Parameters
----------
fname : string
The name of the file we are looking for.
numType : string
Designates how this funct... | python | def findFile(self, fname, numtype):
"""
Function that finds the associated file for fname when Fname is
time or NDump.
Parameters
----------
fname : string
The name of the file we are looking for.
numType : string
Designates how this funct... | [
"def",
"findFile",
"(",
"self",
",",
"fname",
",",
"numtype",
")",
":",
"numType",
"=",
"numtype",
".",
"upper",
"(",
")",
"if",
"numType",
"==",
"'FILE'",
":",
"#do nothing",
"return",
"fname",
"elif",
"numType",
"==",
"'CYCNUM'",
":",
"try",
":",
"fn... | Function that finds the associated file for fname when Fname is
time or NDump.
Parameters
----------
fname : string
The name of the file we are looking for.
numType : string
Designates how this function acts and how it interprets
fname. If nu... | [
"Function",
"that",
"finds",
"the",
"associated",
"file",
"for",
"fname",
"when",
"Fname",
"is",
"time",
"or",
"NDump",
"."
] | train | https://github.com/NuGrid/NuGridPy/blob/eee8047446e398be77362d82c1d8b3310054fab0/nugridpy/ppn.py#L928-L967 |
Azure/azure-multiapi-storage-python | azure/multiapi/storage/v2016_05_31/retry.py | _Retry._retry | def _retry(self, context, backoff):
'''
A function which determines whether and how to retry.
:param ~azure.storage.models.RetryContext context:
The retry context. This contains the request, response, and other data
which can be used to determine whether or not to retr... | python | def _retry(self, context, backoff):
'''
A function which determines whether and how to retry.
:param ~azure.storage.models.RetryContext context:
The retry context. This contains the request, response, and other data
which can be used to determine whether or not to retr... | [
"def",
"_retry",
"(",
"self",
",",
"context",
",",
"backoff",
")",
":",
"# If the context does not contain a count parameter, this request has not ",
"# been retried yet. Add the count parameter to track the number of retries.",
"if",
"not",
"hasattr",
"(",
"context",
",",
"'coun... | A function which determines whether and how to retry.
:param ~azure.storage.models.RetryContext context:
The retry context. This contains the request, response, and other data
which can be used to determine whether or not to retry.
:param function() backoff:
A func... | [
"A",
"function",
"which",
"determines",
"whether",
"and",
"how",
"to",
"retry",
"."
] | train | https://github.com/Azure/azure-multiapi-storage-python/blob/bd5482547f993c6eb56fd09070e15c2e9616e440/azure/multiapi/storage/v2016_05_31/retry.py#L113-L144 |
Azure/azure-multiapi-storage-python | azure/multiapi/storage/v2016_05_31/_deserialization.py | _convert_xml_to_service_stats | def _convert_xml_to_service_stats(response):
'''
<?xml version="1.0" encoding="utf-8"?>
<StorageServiceStats>
<GeoReplication>
<Status>live|bootstrap|unavailable</Status>
<LastSyncTime>sync-time|<empty></LastSyncTime>
</GeoReplication>
</StorageServiceStats>
'''... | python | def _convert_xml_to_service_stats(response):
'''
<?xml version="1.0" encoding="utf-8"?>
<StorageServiceStats>
<GeoReplication>
<Status>live|bootstrap|unavailable</Status>
<LastSyncTime>sync-time|<empty></LastSyncTime>
</GeoReplication>
</StorageServiceStats>
'''... | [
"def",
"_convert_xml_to_service_stats",
"(",
"response",
")",
":",
"if",
"response",
"is",
"None",
"or",
"response",
".",
"body",
"is",
"None",
":",
"return",
"None",
"service_stats_element",
"=",
"ETree",
".",
"fromstring",
"(",
"response",
".",
"body",
")",
... | <?xml version="1.0" encoding="utf-8"?>
<StorageServiceStats>
<GeoReplication>
<Status>live|bootstrap|unavailable</Status>
<LastSyncTime>sync-time|<empty></LastSyncTime>
</GeoReplication>
</StorageServiceStats> | [
"<?xml",
"version",
"=",
"1",
".",
"0",
"encoding",
"=",
"utf",
"-",
"8",
"?",
">",
"<StorageServiceStats",
">",
"<GeoReplication",
">",
"<Status",
">",
"live|bootstrap|unavailable<",
"/",
"Status",
">",
"<LastSyncTime",
">",
"sync",
"-",
"time|<empty",
">",
... | train | https://github.com/Azure/azure-multiapi-storage-python/blob/bd5482547f993c6eb56fd09070e15c2e9616e440/azure/multiapi/storage/v2016_05_31/_deserialization.py#L168-L191 |
openstack/proliantutils | proliantutils/redfish/resources/update_service.py | HPEUpdateService._get_firmware_update_element | def _get_firmware_update_element(self):
"""Get the url for firmware update
:returns: firmware update url
:raises: Missing resource error on missing url
"""
fw_update_action = self._actions.update_firmware
if not fw_update_action:
raise (sushy.exceptions.
... | python | def _get_firmware_update_element(self):
"""Get the url for firmware update
:returns: firmware update url
:raises: Missing resource error on missing url
"""
fw_update_action = self._actions.update_firmware
if not fw_update_action:
raise (sushy.exceptions.
... | [
"def",
"_get_firmware_update_element",
"(",
"self",
")",
":",
"fw_update_action",
"=",
"self",
".",
"_actions",
".",
"update_firmware",
"if",
"not",
"fw_update_action",
":",
"raise",
"(",
"sushy",
".",
"exceptions",
".",
"MissingActionError",
"(",
"action",
"=",
... | Get the url for firmware update
:returns: firmware update url
:raises: Missing resource error on missing url | [
"Get",
"the",
"url",
"for",
"firmware",
"update"
] | train | https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/redfish/resources/update_service.py#L45-L56 |
openstack/proliantutils | proliantutils/redfish/resources/update_service.py | HPEUpdateService.flash_firmware | def flash_firmware(self, redfish_inst, file_url):
"""Perform firmware flashing on a redfish system
:param file_url: url to firmware bits.
:param redfish_inst: redfish instance
:raises: IloError, on an error from iLO.
"""
action_data = {
'ImageURI': file_url,... | python | def flash_firmware(self, redfish_inst, file_url):
"""Perform firmware flashing on a redfish system
:param file_url: url to firmware bits.
:param redfish_inst: redfish instance
:raises: IloError, on an error from iLO.
"""
action_data = {
'ImageURI': file_url,... | [
"def",
"flash_firmware",
"(",
"self",
",",
"redfish_inst",
",",
"file_url",
")",
":",
"action_data",
"=",
"{",
"'ImageURI'",
":",
"file_url",
",",
"}",
"target_uri",
"=",
"self",
".",
"_get_firmware_update_element",
"(",
")",
".",
"target_uri",
"try",
":",
"... | Perform firmware flashing on a redfish system
:param file_url: url to firmware bits.
:param redfish_inst: redfish instance
:raises: IloError, on an error from iLO. | [
"Perform",
"firmware",
"flashing",
"on",
"a",
"redfish",
"system"
] | train | https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/redfish/resources/update_service.py#L58-L95 |
openstack/proliantutils | proliantutils/redfish/resources/update_service.py | HPEUpdateService.wait_for_redfish_firmware_update_to_complete | def wait_for_redfish_firmware_update_to_complete(self, redfish_object):
"""Continuously polls for iLO firmware update to complete.
:param redfish_object: redfish instance
"""
p_state = ['Idle']
c_state = ['Idle']
def has_firmware_flash_completed():
"""Checks... | python | def wait_for_redfish_firmware_update_to_complete(self, redfish_object):
"""Continuously polls for iLO firmware update to complete.
:param redfish_object: redfish instance
"""
p_state = ['Idle']
c_state = ['Idle']
def has_firmware_flash_completed():
"""Checks... | [
"def",
"wait_for_redfish_firmware_update_to_complete",
"(",
"self",
",",
"redfish_object",
")",
":",
"p_state",
"=",
"[",
"'Idle'",
"]",
"c_state",
"=",
"[",
"'Idle'",
"]",
"def",
"has_firmware_flash_completed",
"(",
")",
":",
"\"\"\"Checks for completion status of firm... | Continuously polls for iLO firmware update to complete.
:param redfish_object: redfish instance | [
"Continuously",
"polls",
"for",
"iLO",
"firmware",
"update",
"to",
"complete",
"."
] | train | https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/redfish/resources/update_service.py#L97-L139 |
openstack/proliantutils | proliantutils/redfish/resources/update_service.py | HPEUpdateService.get_firmware_update_progress | def get_firmware_update_progress(self):
"""Get the progress of the firmware update.
:returns: firmware update state, one of the following values:
"Idle","Uploading","Verifying","Writing",
"Updating","Complete","Error".
If the update resource is not ... | python | def get_firmware_update_progress(self):
"""Get the progress of the firmware update.
:returns: firmware update state, one of the following values:
"Idle","Uploading","Verifying","Writing",
"Updating","Complete","Error".
If the update resource is not ... | [
"def",
"get_firmware_update_progress",
"(",
"self",
")",
":",
"# perform refresh",
"try",
":",
"self",
".",
"refresh",
"(",
")",
"except",
"sushy",
".",
"exceptions",
".",
"SushyError",
"as",
"e",
":",
"msg",
"=",
"(",
"(",
"'Progress of firmware update not know... | Get the progress of the firmware update.
:returns: firmware update state, one of the following values:
"Idle","Uploading","Verifying","Writing",
"Updating","Complete","Error".
If the update resource is not found, then "Unknown".
:returns: firmware u... | [
"Get",
"the",
"progress",
"of",
"the",
"firmware",
"update",
"."
] | train | https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/redfish/resources/update_service.py#L141-L161 |
openstack/proliantutils | proliantutils/redfish/resources/system/bios.py | BIOSSettings.pending_settings | def pending_settings(self):
"""Property to provide reference to bios_pending_settings instance
It is calculated once when the first time it is queried. On refresh,
this property gets reset.
"""
return BIOSPendingSettings(
self._conn, utils.get_subresource_path_by(
... | python | def pending_settings(self):
"""Property to provide reference to bios_pending_settings instance
It is calculated once when the first time it is queried. On refresh,
this property gets reset.
"""
return BIOSPendingSettings(
self._conn, utils.get_subresource_path_by(
... | [
"def",
"pending_settings",
"(",
"self",
")",
":",
"return",
"BIOSPendingSettings",
"(",
"self",
".",
"_conn",
",",
"utils",
".",
"get_subresource_path_by",
"(",
"self",
",",
"[",
"\"@Redfish.Settings\"",
",",
"\"SettingsObject\"",
"]",
")",
",",
"redfish_version",... | Property to provide reference to bios_pending_settings instance
It is calculated once when the first time it is queried. On refresh,
this property gets reset. | [
"Property",
"to",
"provide",
"reference",
"to",
"bios_pending_settings",
"instance"
] | train | https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/redfish/resources/system/bios.py#L52-L61 |
openstack/proliantutils | proliantutils/redfish/resources/system/bios.py | BIOSSettings.boot_settings | def boot_settings(self):
"""Property to provide reference to bios boot instance
It is calculated once when the first time it is queried. On refresh,
this property gets reset.
"""
return BIOSBootSettings(
self._conn, utils.get_subresource_path_by(
self... | python | def boot_settings(self):
"""Property to provide reference to bios boot instance
It is calculated once when the first time it is queried. On refresh,
this property gets reset.
"""
return BIOSBootSettings(
self._conn, utils.get_subresource_path_by(
self... | [
"def",
"boot_settings",
"(",
"self",
")",
":",
"return",
"BIOSBootSettings",
"(",
"self",
".",
"_conn",
",",
"utils",
".",
"get_subresource_path_by",
"(",
"self",
",",
"[",
"\"Oem\"",
",",
"\"Hpe\"",
",",
"\"Links\"",
",",
"\"Boot\"",
"]",
")",
",",
"redfi... | Property to provide reference to bios boot instance
It is calculated once when the first time it is queried. On refresh,
this property gets reset. | [
"Property",
"to",
"provide",
"reference",
"to",
"bios",
"boot",
"instance"
] | train | https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/redfish/resources/system/bios.py#L73-L82 |
openstack/proliantutils | proliantutils/redfish/resources/system/bios.py | BIOSSettings.iscsi_resource | def iscsi_resource(self):
"""Property to provide reference to bios iscsi resource instance
It is calculated once when the first time it is queried. On refresh,
this property gets reset.
"""
return iscsi.ISCSIResource(
self._conn, utils.get_subresource_path_by(
... | python | def iscsi_resource(self):
"""Property to provide reference to bios iscsi resource instance
It is calculated once when the first time it is queried. On refresh,
this property gets reset.
"""
return iscsi.ISCSIResource(
self._conn, utils.get_subresource_path_by(
... | [
"def",
"iscsi_resource",
"(",
"self",
")",
":",
"return",
"iscsi",
".",
"ISCSIResource",
"(",
"self",
".",
"_conn",
",",
"utils",
".",
"get_subresource_path_by",
"(",
"self",
",",
"[",
"\"Oem\"",
",",
"\"Hpe\"",
",",
"\"Links\"",
",",
"\"iScsi\"",
"]",
")"... | Property to provide reference to bios iscsi resource instance
It is calculated once when the first time it is queried. On refresh,
this property gets reset. | [
"Property",
"to",
"provide",
"reference",
"to",
"bios",
"iscsi",
"resource",
"instance"
] | train | https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/redfish/resources/system/bios.py#L86-L95 |
openstack/proliantutils | proliantutils/redfish/resources/system/bios.py | BIOSSettings.bios_mappings | def bios_mappings(self):
"""Property to provide reference to bios mappings instance
It is calculated once when the first time it is queried. On refresh,
this property gets reset.
"""
return BIOSMappings(
self._conn, utils.get_subresource_path_by(
self... | python | def bios_mappings(self):
"""Property to provide reference to bios mappings instance
It is calculated once when the first time it is queried. On refresh,
this property gets reset.
"""
return BIOSMappings(
self._conn, utils.get_subresource_path_by(
self... | [
"def",
"bios_mappings",
"(",
"self",
")",
":",
"return",
"BIOSMappings",
"(",
"self",
".",
"_conn",
",",
"utils",
".",
"get_subresource_path_by",
"(",
"self",
",",
"[",
"\"Oem\"",
",",
"\"Hpe\"",
",",
"\"Links\"",
",",
"\"Mappings\"",
"]",
")",
",",
"redfi... | Property to provide reference to bios mappings instance
It is calculated once when the first time it is queried. On refresh,
this property gets reset. | [
"Property",
"to",
"provide",
"reference",
"to",
"bios",
"mappings",
"instance"
] | train | https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/redfish/resources/system/bios.py#L99-L108 |
openstack/proliantutils | proliantutils/redfish/resources/system/bios.py | BIOSSettings._get_base_configs | def _get_base_configs(self):
"""Method that returns object of bios base configs."""
return BIOSBaseConfigs(
self._conn, utils.get_subresource_path_by(
self, ["Oem", "Hpe", "Links", "BaseConfigs"]),
redfish_version=self.redfish_version) | python | def _get_base_configs(self):
"""Method that returns object of bios base configs."""
return BIOSBaseConfigs(
self._conn, utils.get_subresource_path_by(
self, ["Oem", "Hpe", "Links", "BaseConfigs"]),
redfish_version=self.redfish_version) | [
"def",
"_get_base_configs",
"(",
"self",
")",
":",
"return",
"BIOSBaseConfigs",
"(",
"self",
".",
"_conn",
",",
"utils",
".",
"get_subresource_path_by",
"(",
"self",
",",
"[",
"\"Oem\"",
",",
"\"Hpe\"",
",",
"\"Links\"",
",",
"\"BaseConfigs\"",
"]",
")",
","... | Method that returns object of bios base configs. | [
"Method",
"that",
"returns",
"object",
"of",
"bios",
"base",
"configs",
"."
] | train | https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/redfish/resources/system/bios.py#L111-L116 |
openstack/proliantutils | proliantutils/redfish/resources/system/bios.py | BIOSPendingSettings.set_pending_boot_mode | def set_pending_boot_mode(self, boot_mode):
"""Sets the boot mode of the system for next boot.
:param boot_mode: either sys_cons.BIOS_BOOT_MODE_LEGACY_BIOS,
sys_cons.BIOS_BOOT_MODE_UEFI.
"""
bios_properties = {
'BootMode': mappings.GET_BIOS_BOOT_MODE_MAP_REV.get(boo... | python | def set_pending_boot_mode(self, boot_mode):
"""Sets the boot mode of the system for next boot.
:param boot_mode: either sys_cons.BIOS_BOOT_MODE_LEGACY_BIOS,
sys_cons.BIOS_BOOT_MODE_UEFI.
"""
bios_properties = {
'BootMode': mappings.GET_BIOS_BOOT_MODE_MAP_REV.get(boo... | [
"def",
"set_pending_boot_mode",
"(",
"self",
",",
"boot_mode",
")",
":",
"bios_properties",
"=",
"{",
"'BootMode'",
":",
"mappings",
".",
"GET_BIOS_BOOT_MODE_MAP_REV",
".",
"get",
"(",
"boot_mode",
")",
"}",
"if",
"boot_mode",
"==",
"sys_cons",
".",
"BIOS_BOOT_M... | Sets the boot mode of the system for next boot.
:param boot_mode: either sys_cons.BIOS_BOOT_MODE_LEGACY_BIOS,
sys_cons.BIOS_BOOT_MODE_UEFI. | [
"Sets",
"the",
"boot",
"mode",
"of",
"the",
"system",
"for",
"next",
"boot",
"."
] | train | https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/redfish/resources/system/bios.py#L137-L150 |
openstack/proliantutils | proliantutils/redfish/resources/system/bios.py | BIOSPendingSettings.update_bios_data_by_post | def update_bios_data_by_post(self, data):
"""Update bios data by post
:param data: default bios config data
"""
bios_settings_data = {
'Attributes': data
}
self._conn.post(self.path, data=bios_settings_data) | python | def update_bios_data_by_post(self, data):
"""Update bios data by post
:param data: default bios config data
"""
bios_settings_data = {
'Attributes': data
}
self._conn.post(self.path, data=bios_settings_data) | [
"def",
"update_bios_data_by_post",
"(",
"self",
",",
"data",
")",
":",
"bios_settings_data",
"=",
"{",
"'Attributes'",
":",
"data",
"}",
"self",
".",
"_conn",
".",
"post",
"(",
"self",
".",
"path",
",",
"data",
"=",
"bios_settings_data",
")"
] | Update bios data by post
:param data: default bios config data | [
"Update",
"bios",
"data",
"by",
"post"
] | train | https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/redfish/resources/system/bios.py#L152-L160 |
openstack/proliantutils | proliantutils/redfish/resources/system/bios.py | BIOSPendingSettings.update_bios_data_by_patch | def update_bios_data_by_patch(self, data):
"""Update bios data by patch
:param data: default bios config data
"""
bios_settings_data = {
'Attributes': data
}
self._conn.patch(self.path, data=bios_settings_data) | python | def update_bios_data_by_patch(self, data):
"""Update bios data by patch
:param data: default bios config data
"""
bios_settings_data = {
'Attributes': data
}
self._conn.patch(self.path, data=bios_settings_data) | [
"def",
"update_bios_data_by_patch",
"(",
"self",
",",
"data",
")",
":",
"bios_settings_data",
"=",
"{",
"'Attributes'",
":",
"data",
"}",
"self",
".",
"_conn",
".",
"patch",
"(",
"self",
".",
"path",
",",
"data",
"=",
"bios_settings_data",
")"
] | Update bios data by patch
:param data: default bios config data | [
"Update",
"bios",
"data",
"by",
"patch"
] | train | https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/redfish/resources/system/bios.py#L162-L170 |
openstack/proliantutils | proliantutils/redfish/resources/system/bios.py | BIOSBootSettings.get_persistent_boot_device | def get_persistent_boot_device(self):
"""Get current persistent boot device set for the host
:returns: persistent boot device for the system
:raises: IloError, on an error from iLO.
"""
boot_string = None
if not self.persistent_boot_config_order or not self.boot_sources:... | python | def get_persistent_boot_device(self):
"""Get current persistent boot device set for the host
:returns: persistent boot device for the system
:raises: IloError, on an error from iLO.
"""
boot_string = None
if not self.persistent_boot_config_order or not self.boot_sources:... | [
"def",
"get_persistent_boot_device",
"(",
"self",
")",
":",
"boot_string",
"=",
"None",
"if",
"not",
"self",
".",
"persistent_boot_config_order",
"or",
"not",
"self",
".",
"boot_sources",
":",
"msg",
"=",
"(",
"'Boot sources or persistent boot config order not found'",
... | Get current persistent boot device set for the host
:returns: persistent boot device for the system
:raises: IloError, on an error from iLO. | [
"Get",
"current",
"persistent",
"boot",
"device",
"set",
"for",
"the",
"host"
] | train | https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/redfish/resources/system/bios.py#L179-L209 |
openstack/proliantutils | proliantutils/redfish/resources/system/bios.py | BIOSBootSettings.get_uefi_boot_string | def get_uefi_boot_string(self, mac):
"""Get uefi iscsi boot string for the host
:returns: iscsi boot string for the system
:raises: IloError, on an error from iLO.
"""
boot_sources = self.boot_sources
if not boot_sources:
msg = ('Boot sources are not found')
... | python | def get_uefi_boot_string(self, mac):
"""Get uefi iscsi boot string for the host
:returns: iscsi boot string for the system
:raises: IloError, on an error from iLO.
"""
boot_sources = self.boot_sources
if not boot_sources:
msg = ('Boot sources are not found')
... | [
"def",
"get_uefi_boot_string",
"(",
"self",
",",
"mac",
")",
":",
"boot_sources",
"=",
"self",
".",
"boot_sources",
"if",
"not",
"boot_sources",
":",
"msg",
"=",
"(",
"'Boot sources are not found'",
")",
"LOG",
".",
"debug",
"(",
"msg",
")",
"raise",
"except... | Get uefi iscsi boot string for the host
:returns: iscsi boot string for the system
:raises: IloError, on an error from iLO. | [
"Get",
"uefi",
"iscsi",
"boot",
"string",
"for",
"the",
"host"
] | train | https://github.com/openstack/proliantutils/blob/86ef3b47b4eca97c221577e3570b0240d6a25f22/proliantutils/redfish/resources/system/bios.py#L211-L229 |
NuGrid/NuGridPy | nugridpy/astronomy.py | visc_mol_sol | def visc_mol_sol(T,rho,X):
'''
Molecular plasma viscosity (Spitzer 1962)
Parameters
----------
X : float
H mass fraction
T : float
temperature in K
rho : float
density in cgs
Returns
-------
nu : float
molecular diffusivity in [cm**2/s]
Note... | python | def visc_mol_sol(T,rho,X):
'''
Molecular plasma viscosity (Spitzer 1962)
Parameters
----------
X : float
H mass fraction
T : float
temperature in K
rho : float
density in cgs
Returns
-------
nu : float
molecular diffusivity in [cm**2/s]
Note... | [
"def",
"visc_mol_sol",
"(",
"T",
",",
"rho",
",",
"X",
")",
":",
"visc_mol",
"=",
"1.84e-17",
"*",
"(",
"1.",
"+",
"7.",
"*",
"X",
")",
"*",
"(",
"old_div",
"(",
"T",
"**",
"2.5",
",",
"rho",
")",
")",
"return",
"visc_mol"
] | Molecular plasma viscosity (Spitzer 1962)
Parameters
----------
X : float
H mass fraction
T : float
temperature in K
rho : float
density in cgs
Returns
-------
nu : float
molecular diffusivity in [cm**2/s]
Notes
-----
According to Eq 22 in S... | [
"Molecular",
"plasma",
"viscosity",
"(",
"Spitzer",
"1962",
")",
"Parameters",
"----------",
"X",
":",
"float",
"H",
"mass",
"fraction",
"T",
":",
"float",
"temperature",
"in",
"K",
"rho",
":",
"float",
"density",
"in",
"cgs"
] | train | https://github.com/NuGrid/NuGridPy/blob/eee8047446e398be77362d82c1d8b3310054fab0/nugridpy/astronomy.py#L48-L78 |
NuGrid/NuGridPy | nugridpy/astronomy.py | visc_rad_kap_sc | def visc_rad_kap_sc(T,rho,X):
'''
Radiative viscosity (Thomas, 1930) for e- scattering opacity
Parameters
----------
X : float
H mass fraction
T : float
temperature in K
rho : float
density in cgs
Returns
-------
nu : float
radiative diffusivity in [... | python | def visc_rad_kap_sc(T,rho,X):
'''
Radiative viscosity (Thomas, 1930) for e- scattering opacity
Parameters
----------
X : float
H mass fraction
T : float
temperature in K
rho : float
density in cgs
Returns
-------
nu : float
radiative diffusivity in [... | [
"def",
"visc_rad_kap_sc",
"(",
"T",
",",
"rho",
",",
"X",
")",
":",
"kappa",
"=",
"0.2",
"*",
"(",
"1.",
"+",
"X",
")",
"nu_rad",
"=",
"6.88e-26",
"*",
"(",
"old_div",
"(",
"T",
"**",
"4",
",",
"(",
"kappa",
"*",
"rho",
"**",
"2",
")",
")",
... | Radiative viscosity (Thomas, 1930) for e- scattering opacity
Parameters
----------
X : float
H mass fraction
T : float
temperature in K
rho : float
density in cgs
Returns
-------
nu : float
radiative diffusivity in [cm**2/s]
Examples
--------
>>... | [
"Radiative",
"viscosity",
"(",
"Thomas",
"1930",
")",
"for",
"e",
"-",
"scattering",
"opacity"
] | train | https://github.com/NuGrid/NuGridPy/blob/eee8047446e398be77362d82c1d8b3310054fab0/nugridpy/astronomy.py#L81-L120 |
NuGrid/NuGridPy | nugridpy/astronomy.py | Gamma1_gasrad | def Gamma1_gasrad(beta):
'''
Gamma1 for a mix of ideal gas and radiation
Hansen & Kawaler, page 177, Eqn. 3.110
Parameters
----------
beta : float
Gas pressure fraction Pgas/(Pgas+Prad)
'''
Gamma3minus1 = (old_div(2.,3.))*(4.-3.*beta)/(8.-7.*beta)
Gamma1 = beta + (4.... | python | def Gamma1_gasrad(beta):
'''
Gamma1 for a mix of ideal gas and radiation
Hansen & Kawaler, page 177, Eqn. 3.110
Parameters
----------
beta : float
Gas pressure fraction Pgas/(Pgas+Prad)
'''
Gamma3minus1 = (old_div(2.,3.))*(4.-3.*beta)/(8.-7.*beta)
Gamma1 = beta + (4.... | [
"def",
"Gamma1_gasrad",
"(",
"beta",
")",
":",
"Gamma3minus1",
"=",
"(",
"old_div",
"(",
"2.",
",",
"3.",
")",
")",
"*",
"(",
"4.",
"-",
"3.",
"*",
"beta",
")",
"/",
"(",
"8.",
"-",
"7.",
"*",
"beta",
")",
"Gamma1",
"=",
"beta",
"+",
"(",
"4.... | Gamma1 for a mix of ideal gas and radiation
Hansen & Kawaler, page 177, Eqn. 3.110
Parameters
----------
beta : float
Gas pressure fraction Pgas/(Pgas+Prad) | [
"Gamma1",
"for",
"a",
"mix",
"of",
"ideal",
"gas",
"and",
"radiation"
] | train | https://github.com/NuGrid/NuGridPy/blob/eee8047446e398be77362d82c1d8b3310054fab0/nugridpy/astronomy.py#L122-L136 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.