query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
returns list of medians of life expectancies of all the years from 1960 to 2015 of high income category of countries
def high_income_countries(): high_countries_data = [] years = [] medians = [] lst = [] for idx in range(1960, 2016): years.append(idx) for idx in high_countries: high_countries_data.append(life_expectancy_graph(idx)) y_idx = 0 for idx in high_countries_data: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def low_income_countries():\r\n low_countries_data = []\r\n years = []\r\n medians = []\r\n lst = []\r\n for idx in range(1960, 2016):\r\n years.append(idx)\r\n for idx in low_countries:\r\n low_countries_data.append(life_expectancy_graph(idx))\r\n y_idx = 0\r\n for idx in low...
[ "0.8232228", "0.79833865", "0.7896011", "0.75432706", "0.7347628", "0.7279632", "0.7237976", "0.7189825", "0.69867724", "0.68406177", "0.6005981", "0.55256027", "0.54909545", "0.5362033", "0.52243906", "0.51795703", "0.5162693", "0.5161273", "0.5135138", "0.5107014", "0.51000...
0.8440245
0
returns list of medians of life expectancies all the years from 1960 to 2015 of low income category of countries
def low_income_countries(): low_countries_data = [] years = [] medians = [] lst = [] for idx in range(1960, 2016): years.append(idx) for idx in low_countries: low_countries_data.append(life_expectancy_graph(idx)) y_idx = 0 for idx in low_countries_data: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def high_income_countries():\r\n high_countries_data = []\r\n years = []\r\n medians = []\r\n lst = []\r\n for idx in range(1960, 2016):\r\n years.append(idx)\r\n for idx in high_countries:\r\n high_countries_data.append(life_expectancy_graph(idx))\r\n y_idx = 0\r\n for idx in...
[ "0.8163041", "0.79932195", "0.7629565", "0.7366575", "0.7085949", "0.7013312", "0.6857983", "0.67728174", "0.66159344", "0.6608726", "0.5927459", "0.56531584", "0.55937845", "0.5528759", "0.52845293", "0.5237982", "0.52361083", "0.5064734", "0.5063792", "0.5045841", "0.501769...
0.84986115
0
returns list of medians of life expectancies all the years from 1960 to 2015 of lower middle income category of countries
def lower_middle_income_countries(): lower_middle_countries_data = [] years = [] medians = [] lst = [] for idx in range(1960, 2016): years.append(idx) for idx in lower_middle_countries: lower_middle_countries_data.append(life_expectancy_graph(idx)) y_idx = 0 for...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def low_income_countries():\r\n low_countries_data = []\r\n years = []\r\n medians = []\r\n lst = []\r\n for idx in range(1960, 2016):\r\n years.append(idx)\r\n for idx in low_countries:\r\n low_countries_data.append(life_expectancy_graph(idx))\r\n y_idx = 0\r\n for idx in low...
[ "0.82594836", "0.81239355", "0.8027209", "0.76326436", "0.7560238", "0.72878283", "0.7192892", "0.703807", "0.68495995", "0.6803364", "0.6067006", "0.55328685", "0.5489229", "0.54189485", "0.5258152", "0.52244323", "0.51967055", "0.5187414", "0.51295394", "0.51035774", "0.507...
0.8407358
0
returns list of medians of life expectancies all the years from 1960 to 2015 of upper middle income category of countries
def upper_middle_income_countries(): upper_middle_countries_data = [] years = [] medians = [] lst = [] for idx in range(1960, 2016): years.append(idx) for idx in upper_middle_countries: upper_middle_countries_data.append(life_expectancy_graph(idx)) y_idx = 0 for...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lower_middle_income_countries():\r\n lower_middle_countries_data = []\r\n years = []\r\n medians = []\r\n lst = []\r\n for idx in range(1960, 2016):\r\n years.append(idx)\r\n for idx in lower_middle_countries:\r\n lower_middle_countries_data.append(life_expectancy_graph(idx))\r\...
[ "0.8276846", "0.8132003", "0.8073348", "0.77521634", "0.7707552", "0.7392722", "0.7356976", "0.7288535", "0.7103225", "0.69387406", "0.6100426", "0.55157006", "0.54712534", "0.5457827", "0.53506804", "0.52389526", "0.519282", "0.5162494", "0.51319134", "0.50984526", "0.508291...
0.8340939
0
plots the graph for life expectancy vs income category for the years from 1960 to 2015
def income_graph(t0, t1, t2, t3): medians0 = sorted(high_income_countries()) t3.goto(-250, ((2.5*medians0[0])-15)) t3.rt(90) for idx in range(1, len(medians0)): t3.pd() t3.setpos((-250+(idx*8.8)), (2.5*medians0[idx])-25) medians1 = sorted(low_income_countries()) t0.goto...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def income_distribution_plot(income_data,year):\n income_year = income_data.loc[year]\n plt.figure(figsize=(10,8))\n income_year.hist(bins=100,alpha=0.3,color='k')\n plt.title('Income Distribution of Year %s' % year)\n plt.xlabel('Income per person')\n plt.ylabel('Frequency')\n plt.savefig('In...
[ "0.7102294", "0.6791818", "0.66974103", "0.66413957", "0.65676576", "0.63302284", "0.63299006", "0.6252672", "0.6244726", "0.6215606", "0.6192069", "0.6141037", "0.59000665", "0.58274305", "0.5784233", "0.5737825", "0.57364583", "0.57241774", "0.56863356", "0.56375414", "0.56...
0.0
-1
draws index for different regions
def drawIndex_region(t0, t1, t2, t3): get_pos0(t0) t0.fd(50) t0.pd() t0.pencolor("blue") t0.write("Sub-Saharan Africa", font=("Arial", 10, "bold")) t1.rt(90) get_pos1(t1) t1.fd(50) t1.pd() t1.pencolor("red") t1.write("South Asia", font=("Arial", 10, "bold")) g...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def drawIndexLines_region(t0, t1, t2, t3):\r\n t0.pu()\r\n t1.pu()\r\n t2.pu()\r\n t3.pu()\r\n\r\n t0.rt(90)\r\n t0.fd(240)\r\n t0.left(90)\r\n t0.fd(640)\r\n\r\n t1.rt(90)\r\n t1.fd(240)\r\n t1.left(90)\r\n t1.fd(620)\r\n\r\n t2.rt(90)\r\n t2.fd(240)\r\n t2.left(90)\r\...
[ "0.7278132", "0.65021855", "0.6314981", "0.63081306", "0.6208257", "0.6096945", "0.5833721", "0.5821732", "0.58176714", "0.5713605", "0.57063395", "0.5675881", "0.5673361", "0.55971086", "0.55971086", "0.55394804", "0.5516584", "0.5502051", "0.5487764", "0.5471065", "0.546945...
0.78799367
0
draws the reference color lines for the graph
def drawLines_region(t0, t1, t2, t3): t0.pd() t1.pd() t2.pd() t3.pd() t0.pencolor("blue") t0.pensize(3) t1.pensize(3) t2.pensize(3) t3.pensize(3) t1.pencolor("red") t2.pencolor("green") t3.pencolor("gold") t0.rt(90) t1.rt(90) t2.rt(90) t3.r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connect_rug(self):\n for index, value in self.df.loc[\n self.df[f\"highlight_{self.y}\"] == 1\n ].iterrows():\n color = (\n self.fgcolors[0]\n if self.df.loc[index, self.obs] == 0\n else self.fgcolors[1]\n )\n ...
[ "0.64555866", "0.63504744", "0.6338793", "0.6313018", "0.62794095", "0.6252993", "0.6154617", "0.6021198", "0.59559184", "0.5909137", "0.58783704", "0.58506924", "0.5837566", "0.5821018", "0.580766", "0.58066195", "0.5804894", "0.5793253", "0.57698154", "0.5764883", "0.575289...
0.54171455
76
draws references for the graph
def drawIndexLines_region(t0, t1, t2, t3): t0.pu() t1.pu() t2.pu() t3.pu() t0.rt(90) t0.fd(240) t0.left(90) t0.fd(640) t1.rt(90) t1.fd(240) t1.left(90) t1.fd(620) t2.rt(90) t2.fd(240) t2.left(90) t2.fd(600) t3.rt(90) t3.fd...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw(self):\n draw(self.graph)", "def setDrawing(self):\n self.graph_drawing=[]", "def paint(self):\n x = []\n y = []\n plt.figure(figsize=(10, 5), facecolor=\"silver\")\n ax = plt.axes()\n for node in self.graph.nodes.values():\n x.append(node.ge...
[ "0.6683385", "0.6486473", "0.6465142", "0.64329785", "0.641261", "0.63845026", "0.63810503", "0.63728887", "0.63241315", "0.6317288", "0.62890226", "0.6253096", "0.6214897", "0.61302143", "0.6123078", "0.61121505", "0.6066776", "0.6046698", "0.6046698", "0.6046698", "0.604669...
0.0
-1
returns a list of medians of life expectancies of a list of countries under Sub Saharan Africa region from 1960 to 2015
def sub_saharan_africa_countries(): sub_saharan_africa_data = [] years = [] medians = [] lst = [] for idx in range(1960, 2016): years.append(idx) for idx in sub_saharan_africa: sub_saharan_africa_data.append(life_expectancy_graph(idx)) y_idx = 0 for idx in sub_s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def north_america_countries():\r\n north_america_data = []\r\n years = []\r\n medians = []\r\n lst = []\r\n for idx in range(1960, 2016):\r\n years.append(idx)\r\n for idx in north_america:\r\n north_america_data.append(life_expectancy_graph(idx))\r\n y_idx = 0\r\n for idx in...
[ "0.76881295", "0.7627402", "0.7583476", "0.74692076", "0.7437016", "0.70819294", "0.7006813", "0.69099957", "0.6874187", "0.67247957", "0.55833876", "0.54977113", "0.53604025", "0.53602636", "0.53228164", "0.5301231", "0.5279429", "0.5211209", "0.5171082", "0.5142252", "0.511...
0.7650562
1
returns a list of medians of life expectancies of a list of countries under South Asia region from 1960 to 2015
def south_asia_countries(): south_asia_countries_data = [] years = [] medians = [] lst = [] for idx in range(1960, 2016): years.append(idx) for idx in south_asia: south_asia_countries_data.append(life_expectancy_graph(idx)) y_idx = 0 for idx in south_asia_countr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def north_america_countries():\r\n north_america_data = []\r\n years = []\r\n medians = []\r\n lst = []\r\n for idx in range(1960, 2016):\r\n years.append(idx)\r\n for idx in north_america:\r\n north_america_data.append(life_expectancy_graph(idx))\r\n y_idx = 0\r\n for idx in...
[ "0.78435636", "0.77569723", "0.7716137", "0.73004186", "0.7292699", "0.71673214", "0.71292865", "0.7065693", "0.69835836", "0.6960264", "0.54727006", "0.5262739", "0.5241673", "0.52223796", "0.52219015", "0.52006936", "0.51881665", "0.5175976", "0.51192135", "0.50188416", "0....
0.7985845
0
returns a list of medians of life expectancies of a list of countries under Europe and Central Asia region from 1960 to 2015
def europe_central_asia_countries(): europe_central_asia_data = [] years = [] medians = [] lst = [] for idx in range(1960, 2016): years.append(idx) for idx in europe_central_asia: europe_central_asia_data.append(life_expectancy_graph(idx)) y_idx = 0 for idx in e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def east_asia_pacific_countries():\r\n east_asia_pacific_data = []\r\n years = []\r\n medians = []\r\n lst = []\r\n for idx in range(1960, 2016):\r\n years.append(idx)\r\n for idx in east_asia_pacific:\r\n east_asia_pacific_data.append(life_expectancy_graph(idx))\r\n y_idx = 0\r\...
[ "0.77198267", "0.75744975", "0.74780154", "0.71805763", "0.7176427", "0.7105141", "0.6993841", "0.6901811", "0.6830706", "0.66818535", "0.54685944", "0.54521793", "0.5327367", "0.53260374", "0.52117366", "0.5190211", "0.5170156", "0.5153415", "0.5144954", "0.51005596", "0.509...
0.7873929
0
returns a list of medians of life expectancies of a list of countries under Latin America region from 1960 to 2015
def latin_america_countries(): latin_america_data = [] years = [] medians = [] lst = [] for idx in range(1960, 2016): years.append(idx) for idx in latin_america: latin_america_data.append(life_expectancy_graph(idx)) y_idx = 0 for idx in latin_america_data: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def north_america_countries():\r\n north_america_data = []\r\n years = []\r\n medians = []\r\n lst = []\r\n for idx in range(1960, 2016):\r\n years.append(idx)\r\n for idx in north_america:\r\n north_america_data.append(life_expectancy_graph(idx))\r\n y_idx = 0\r\n for idx in...
[ "0.778165", "0.77446824", "0.76414925", "0.74636173", "0.71829915", "0.71820664", "0.7104726", "0.70515454", "0.69765896", "0.694002", "0.56173676", "0.55375946", "0.54947615", "0.5420925", "0.52819693", "0.52718943", "0.5226814", "0.52098465", "0.51996815", "0.51978755", "0....
0.7709831
2
returns a list of medians of life expectancies of a list of countries under Middle East region from 1960 to 2015
def middle_east_countries(): middle_east_data = [] years = [] medians = [] lst = [] for idx in range(1960, 2016): years.append(idx) for idx in middle_east: middle_east_data.append(life_expectancy_graph(idx)) y_idx = 0 for idx in middle_east_data: if idx...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def east_asia_pacific_countries():\r\n east_asia_pacific_data = []\r\n years = []\r\n medians = []\r\n lst = []\r\n for idx in range(1960, 2016):\r\n years.append(idx)\r\n for idx in east_asia_pacific:\r\n east_asia_pacific_data.append(life_expectancy_graph(idx))\r\n y_idx = 0\r\...
[ "0.78270024", "0.7824166", "0.7636247", "0.75106204", "0.74698454", "0.7421901", "0.7281597", "0.72203743", "0.7108592", "0.66894037", "0.5503082", "0.5239548", "0.5229089", "0.52227896", "0.5200565", "0.5198604", "0.5143516", "0.50688607", "0.50044894", "0.50024873", "0.5000...
0.77177835
2
returns a list of medians of life expectancies of a list of countries under North America region from 1960 to 2015
def north_america_countries(): north_america_data = [] years = [] medians = [] lst = [] for idx in range(1960, 2016): years.append(idx) for idx in north_america: north_america_data.append(life_expectancy_graph(idx)) y_idx = 0 for idx in north_america_data: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def east_asia_pacific_countries():\r\n east_asia_pacific_data = []\r\n years = []\r\n medians = []\r\n lst = []\r\n for idx in range(1960, 2016):\r\n years.append(idx)\r\n for idx in east_asia_pacific:\r\n east_asia_pacific_data.append(life_expectancy_graph(idx))\r\n y_idx = 0\r\...
[ "0.76958174", "0.7619637", "0.7474777", "0.7396712", "0.72314185", "0.72068703", "0.71775454", "0.71580356", "0.7121208", "0.6816649", "0.5631868", "0.5515316", "0.54731774", "0.52937293", "0.5210382", "0.5188534", "0.51719624", "0.517113", "0.51578605", "0.515636", "0.515161...
0.78965974
0
returns a list of medians of life expectancies of a list of countries under East Pacific region from 1960 to 2015
def east_asia_pacific_countries(): east_asia_pacific_data = [] years = [] medians = [] lst = [] for idx in range(1960, 2016): years.append(idx) for idx in east_asia_pacific: east_asia_pacific_data.append(life_expectancy_graph(idx)) y_idx = 0 for idx in east_asia...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def north_america_countries():\r\n north_america_data = []\r\n years = []\r\n medians = []\r\n lst = []\r\n for idx in range(1960, 2016):\r\n years.append(idx)\r\n for idx in north_america:\r\n north_america_data.append(life_expectancy_graph(idx))\r\n y_idx = 0\r\n for idx in...
[ "0.7664074", "0.76425236", "0.7421062", "0.7399349", "0.7230995", "0.722657", "0.7191443", "0.7057813", "0.7056686", "0.6702355", "0.5623167", "0.54896224", "0.5303246", "0.52805936", "0.52179736", "0.51864105", "0.5120541", "0.50935054", "0.50814116", "0.50631076", "0.505381...
0.80362725
0
plots the graph for life expectancy vs regions for the years from 1960 to 2015
def region_graph(t0, t1, t2, t3): medians0 = sorted(sub_saharan_africa_countries()) t0.goto(-250, ((medians0[0])-50)) t0.rt(90) for idx in range(1, len(medians0)): t0.pencolor("blue") t0.pd() t0.setpos((-250+(idx*10.5)), ((medians0[idx]))) medians1 = sorted(south_as...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_plot(self):\n years = sorted(set(self.prediction_df_without_covid19['Year']))\n predict_without_covid_country = self.prediction_df_without_covid19[\n self.prediction_df_without_covid19['Country'].isin([self.country])].sort_values(['Year'],\n ...
[ "0.6884355", "0.66418695", "0.6632937", "0.6625268", "0.66110927", "0.6493741", "0.6416215", "0.6383338", "0.6382739", "0.6365332", "0.6312538", "0.6292821", "0.6284985", "0.62473613", "0.6221893", "0.62204677", "0.6156741", "0.6094693", "0.6058386", "0.6022845", "0.5976684",...
0.0
-1
asks the user to select which graph they want to plot
def main(): inp = input("Hit enter to draw first graph(or type 1 to draw second):") if inp == "": drawCoordinatePlane_income() drawIndexLines_income(t0, t1, t2, t3) income_graph(t0, t1, t2, t3) t.done() elif inp == '1': drawCoordinatePlane_region() dr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def graphs_change():\n d = curdoc()\n _remove_fig(d)\n _remove_selection(d)\n graph_val = d.get_model_by_name(GRAPH_SELECTION).value\n model_id, message_name, model_type = run_handlers.get_modelid_messagename_type(d)\n props = run_handlers.get_model_properties(model_id, message_name, model_type)\...
[ "0.639732", "0.6286357", "0.6126755", "0.61089015", "0.6107879", "0.6055158", "0.60493314", "0.60363376", "0.5990013", "0.5972623", "0.58906865", "0.58519304", "0.5802852", "0.57793033", "0.57744956", "0.576418", "0.56951857", "0.5676766", "0.563152", "0.5610704", "0.5598076"...
0.6548505
0
Calculate top level of navigation menu to take care of 4th level menu
def calculateTopLevel(context, portlet, request=None): if portlet.topLevel != 3 or not HAS_MENU: return portlet.topLevel portal = api.portal.get() contextPhyPath = context.getPhysicalPath() portalPhyPath = portal.getPhysicalPath() path = [elem for elem in list(contextPhyPath) if elem not in ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculateTopLevel(context, portlet):\n if portlet.topLevel != 3 or not HAS_MENU:\n return portlet.topLevel\n portal = api.portal.get()\n contextPhyPath = context.getPhysicalPath()\n portalPhyPath = portal.getPhysicalPath()\n path = [elem for elem in list(contextPhyPath) if elem not in lis...
[ "0.71321285", "0.57847756", "0.5641548", "0.55163324", "0.550595", "0.54956126", "0.5414998", "0.539189", "0.53853977", "0.53552043", "0.5354511", "0.53424156", "0.53370595", "0.5336853", "0.5309493", "0.5305363", "0.53029245", "0.5302912", "0.5299191", "0.5290584", "0.528587...
0.6778316
1
Deposits money into the account.
def deposit_money(self, money: float) -> None: assert isinstance(money, float), f"{money} must be float." assert money > 0.0, f"{money} must be a positive number." self.money += money
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deposit(self, deposit_money):\r\n self.balance += deposit_money", "def deposit(account, amount):\n pass", "def deposit_money():\n print(\"\\n\")\n print(messages.account_credentials)\n u_id = pyip.inputInt(\"Your Id: \", greaterThan=0)\n password = pyip.inputPassword(\...
[ "0.7318794", "0.72886235", "0.6962039", "0.68814415", "0.68485117", "0.68485117", "0.6785626", "0.6707197", "0.6544597", "0.6491407", "0.6489743", "0.6483237", "0.6468584", "0.6468584", "0.6468584", "0.6412802", "0.63959944", "0.6394679", "0.638556", "0.63778776", "0.63553745...
0.613008
39
Gets money from the account.
def get_money(self, money: float): assert isinstance(money, float), f"{money} must be float." assert money > 0.0, f"{money} must be a positive number." assert self.money >= money,( f"There's no enough {money} in the account. " f"Current money: {self.money}" ) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_money(self):\n return self.money", "def getMoney(self):\n if 1 in self.money:\n return self.money[1]\n else:\n return 0", "def money(self):\n return self._money", "def money(self):\r\n return self._money", "def get_cash(self):\r\n retu...
[ "0.77768886", "0.7421409", "0.7334864", "0.73027575", "0.7056404", "0.69649", "0.68131787", "0.6809664", "0.6584206", "0.65711844", "0.6539568", "0.6451774", "0.6422996", "0.63765144", "0.6334424", "0.63186806", "0.62565714", "0.624652", "0.6231285", "0.6230703", "0.61993265"...
0.71219337
4
Checks if the user has money.
def has_money(self) -> bool: return self.money > 0.0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_user_has_enough_money(session, user_id, amount):\n user_funds = get_user_balance(session, user_id)\n if user_funds + amount < 0:\n raise NotEnoughMoneyException(\"Not enough money in your wallet!\")", "def balance_money_check():\r\n print(balance_money)", "def positive_balance_check(u...
[ "0.72290194", "0.70000076", "0.6976345", "0.67223203", "0.6660722", "0.6602281", "0.6554564", "0.65110725", "0.6492368", "0.6469948", "0.64189357", "0.6256046", "0.6249659", "0.62413937", "0.62168956", "0.6193624", "0.6191508", "0.6180676", "0.615271", "0.6132183", "0.6107606...
0.784849
0
Updates the database with the current information. This function is currently a simulation.
def update_database(self) -> None: # Simulate that we update a database time.sleep(10)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(self):\n self.getDbRecord().update()", "def update(self):\n\n if not self.db: self.validate()\n\n self.logging.debug( \"update(%s)\" % (self.db) )\n\n for name in self.tables:\n self.dbs_tables[name]['md5'] = get_md5( self.dbs_tables[name]['path'] )\n\n se...
[ "0.76159406", "0.7392184", "0.7367425", "0.7291767", "0.7247658", "0.7247658", "0.69999254", "0.6939565", "0.68994844", "0.68132865", "0.6747768", "0.6690826", "0.6690826", "0.6690826", "0.6620711", "0.66156876", "0.6606088", "0.6606088", "0.6568157", "0.6534905", "0.65212244...
0.7799866
0
Get the location of the image in the local file system.
def _image_location(image_info): return os.path.join(tempfile.gettempdir(), image_info['id'])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_image_location(self, imageDest, imgName) :\n return os.path.normpath(imageDest + imgName)", "def get_pathname(self):\n return self.image_data.path", "def get_image_path(self) -> Optional[str]:\n try:\n return self.localised_faces.all()[0].get_image_path()\n except...
[ "0.7270025", "0.71111804", "0.69871145", "0.6943286", "0.6910744", "0.6907894", "0.689165", "0.6874285", "0.6739917", "0.67269015", "0.67117935", "0.6685618", "0.65890384", "0.65889764", "0.65679765", "0.65447944", "0.64883924", "0.64872074", "0.64596", "0.6436543", "0.641509...
0.75856805
0
Opens a download stream for the given URL.
def _download_with_proxy(image_info, url, image_id): no_proxy = image_info.get('no_proxy') if no_proxy: os.environ['no_proxy'] = no_proxy proxies = image_info.get('proxies', {}) verify, cert = utils.get_ssl_client_options(CONF) resp = None for attempt in range(CONF.image_download_connect...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def open_stream(self, url, mode):\n path: Path = self.base_path / url\n path.parent.mkdir(parents=True, exist_ok=True)\n return path.open(mode, self.CHUNK_SIZE)", "def download_file(self, url, filename):\n r = requests.get(url, stream=True)\n r.raise_for_status()\n\n wit...
[ "0.6853671", "0.67117727", "0.6613041", "0.6497833", "0.6454517", "0.64511824", "0.63918996", "0.6390658", "0.6370147", "0.6340823", "0.6320876", "0.6296568", "0.62854606", "0.6219454", "0.6219454", "0.6191227", "0.6184668", "0.6179352", "0.61757696", "0.6154342", "0.6151909"...
0.0
-1
Identify if checksum is not a url
def _is_checksum_url(checksum): if (checksum.startswith('http://') or checksum.startswith('https://')): return True else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_is_url(self):\n\n url = \"https://shadowrun.needs.management\"\n self.assertTrue(run(verification.is_url(url)))\n\n url = \"https:// www.google.com\"\n self.assertFalse(run(verification.is_url(url)))", "def is_url(url):\n return re.search(r\"^[a-zA-Z][-+\\.\\w]*://[^\\s]+$...
[ "0.67955256", "0.6711128", "0.6629706", "0.6590174", "0.65432364", "0.64278924", "0.64265555", "0.6420125", "0.64089924", "0.6365152", "0.6355471", "0.633363", "0.62696356", "0.62568754", "0.62489027", "0.6203447", "0.61695457", "0.6169127", "0.61661506", "0.61625254", "0.616...
0.854597
0
Fetch checksum from remote location, if needed.
def _fetch_checksum(checksum, image_info): if not _is_checksum_url(checksum): # Not a remote checksum, return as it is. return checksum LOG.debug('Downloading checksums file from %s', checksum) resp = _download_with_proxy(image_info, checksum, checksum).text lines = [line.strip() for li...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetch_remote_hashcode(self, path):\n\t\treturn self.fetch_repo_file(\"/hash/\" + path.replace(\"packages/\", \"\")).decode('utf-8').strip()", "def _get_checksum_value(self, path, replacement):\n url = self._url.replace(path, replacement)\n r = adapter_utilities.requests_get_url_wrapper(url=url)...
[ "0.6621548", "0.62670505", "0.6246209", "0.61276025", "0.6006019", "0.5998622", "0.5937732", "0.58940667", "0.58716685", "0.5833767", "0.5813088", "0.57937276", "0.5782618", "0.5782055", "0.5768444", "0.5738386", "0.5712875", "0.5701004", "0.56596315", "0.56450033", "0.564396...
0.74518305
0
Call disk_util to create partition and write the partition image.
def _write_partition_image(image, image_info, device, configdrive=None): # Retrieve the cached node as it has the latest information # and allows us to also sanity check the deployment so we don't end # up writing MBR when we're in UEFI mode. cached_node = hardware.get_cached_node() node_uuid = ima...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create(self, disk):\n logging.info('Adding type %d partition to disk image: %s' % (self.type, disk.filename))\n run_cmd('parted', '--script', '--', disk.filename, 'mkpart', 'primary', self.parted_fstype(), self.begin, self.end)", "def create(self, directory):\n\n if not self.prea...
[ "0.78580046", "0.7789034", "0.71833235", "0.6673402", "0.6431242", "0.63775516", "0.6299334", "0.6287222", "0.62633705", "0.6147114", "0.6137456", "0.6136881", "0.6103691", "0.6055679", "0.6050517", "0.5989319", "0.59827954", "0.596023", "0.590046", "0.5891317", "0.58601815",...
0.6898741
3
Writes a whole disk image to the specified device.
def _write_whole_disk_image(image, image_info, device): # FIXME(dtantsur): pass the real node UUID for logging disk_utils.destroy_disk_metadata(device, '') disk_utils.udev_settle() command = ['qemu-img', 'convert', '-t', 'directsync', '-S', '0', '-O', 'host_device', '-W', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _write_image(image_info, device, configdrive=None):\n starttime = time.time()\n image = _image_location(image_info)\n uuids = {}\n if image_info.get('image_type') == 'partition':\n uuids = _write_partition_image(image, image_info, device, configdrive)\n else:\n _write_whole_disk_im...
[ "0.6323444", "0.60408735", "0.59747845", "0.59708077", "0.5736613", "0.5731183", "0.5729069", "0.5661791", "0.5656663", "0.5638294", "0.5626332", "0.5575175", "0.5546914", "0.55326694", "0.5532495", "0.5479675", "0.54623824", "0.54249805", "0.5423954", "0.5403864", "0.5357074...
0.7741589
0
Writes an image to the specified device.
def _write_image(image_info, device, configdrive=None): starttime = time.time() image = _image_location(image_info) uuids = {} if image_info.get('image_type') == 'partition': uuids = _write_partition_image(image, image_info, device, configdrive) else: _write_whole_disk_image(image, i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write(self, image):\n raise NotImplementedError()", "def _write_whole_disk_image(image, image_info, device):\n # FIXME(dtantsur): pass the real node UUID for logging\n disk_utils.destroy_disk_metadata(device, '')\n disk_utils.udev_settle()\n\n command = ['qemu-img', 'convert',\n ...
[ "0.69265103", "0.68728566", "0.65653086", "0.62508744", "0.62169874", "0.61919206", "0.61615336", "0.6148212", "0.61479294", "0.61329484", "0.6039113", "0.5993614", "0.59822637", "0.595975", "0.5951792", "0.59349656", "0.59197754", "0.5915622", "0.58451605", "0.57514024", "0....
0.6375691
3
Helper method to get and populate different messages.
def _message_format(msg, image_info, device, partition_uuids): message = None result_msg = msg root_uuid = partition_uuids.get('root uuid') efi_system_partition_uuid = ( partition_uuids.get('efi system partition uuid')) if (image_info.get('deploy_boot_mode') == 'uefi' and efi_sy...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_messages(self):", "def get_messages(self):\r\n return self.messages", "def consolidate_messages(self, msg):", "def test_msgs():\n msgs = [\n \"Hi, how are you doing today? Do you want to get a beer? See you soon!\",\n \"If I can't let it go out of my mind?\",\n \"I wou...
[ "0.65561706", "0.64689714", "0.6434235", "0.6367772", "0.63536197", "0.63536197", "0.6289148", "0.6254911", "0.6173688", "0.61228234", "0.60919917", "0.6073076", "0.60661095", "0.60655934", "0.60605484", "0.60513234", "0.6050599", "0.6048509", "0.6048509", "0.6041617", "0.601...
0.0
-1
Determine the SHA2 algorithm by checksum length.
def _get_algorithm_by_length(checksum): # NOTE(TheJulia): This is all based on SHA-2 lengths. # SHA-3 would require a hint, thus ValueError because # it may not be a fixed length. That said, SHA-2 is not # as of this not being added, being withdrawn standards wise. checksum_len = len(checksum) i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def HashAlgorithm(self) -> _n_7_t_0:", "def _resolve_hasher(algorithm, file_hash=None):\n if algorithm == 'sha256':\n return hashlib.sha256()\n\n if algorithm == 'auto' and file_hash is not None and len(file_hash) == 64:\n return hashlib.sha256()\n\n # This is used only for legacy purposes.\n return ha...
[ "0.63673866", "0.60331875", "0.59180725", "0.5894623", "0.57694453", "0.5698704", "0.565829", "0.55929166", "0.55559", "0.5546999", "0.5538493", "0.55226487", "0.550057", "0.5471561", "0.5461795", "0.5451725", "0.54435396", "0.53990275", "0.53709245", "0.53452957", "0.5344683...
0.77344
0
Checks if md5 is permitted, otherwise raises ValueError.
def check_md5_enabled(): if not CONF.md5_enabled: raise ValueError('MD5 support is disabled, and support ' 'will be removed in a 2024 version of ' 'Ironic.')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_md5(self):\n\n self.log.info('-' * 80)\n self.log.info('Check md5 sum')\n\n self.log.info(self._ref_value)\n self.log.info(self._output_file)\n\n code, out = cmd_exec(['md5sum', self._output_file], shell=False, log=self.log)\n if code:\n self.log.erro...
[ "0.670779", "0.66090995", "0.6538745", "0.6527264", "0.63977784", "0.63788414", "0.6294754", "0.6282655", "0.6177657", "0.6153426", "0.6127971", "0.6074809", "0.6043532", "0.60397506", "0.59920514", "0.5977418", "0.597439", "0.59529215", "0.59529215", "0.59297997", "0.5926426...
0.73328245
0
Initialize an instance of the ImageDownload class. Trys each URL in image_info successively until a URL returns a successful request code. Once the object is initialized, the user may retrieve chunks of the image through the standard python iterator interface until either the image is fully downloaded, or an error is e...
def __init__(self, image_info, time_obj=None): self._time = time_obj or time.time() self._image_info = image_info self._request = None self._bytes_transferred = 0 self._expected_size = None checksum = image_info.get('checksum') retrieved_checksum = False ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _download_with_proxy(image_info, url, image_id):\n no_proxy = image_info.get('no_proxy')\n if no_proxy:\n os.environ['no_proxy'] = no_proxy\n proxies = image_info.get('proxies', {})\n verify, cert = utils.get_ssl_client_options(CONF)\n resp = None\n for attempt in range(CONF.image_down...
[ "0.639782", "0.63584447", "0.6287458", "0.62174606", "0.61738527", "0.6118016", "0.5947707", "0.59460086", "0.58970416", "0.58651745", "0.58612", "0.58416", "0.5826836", "0.57431966", "0.5737952", "0.56520253", "0.56443036", "0.5636683", "0.56282073", "0.5610202", "0.5603142"...
0.53469115
45
Downloads and returns the next chunk of the image.
def __iter__(self): self._last_chunk_time = None for chunk in self._request.iter_content(IMAGE_CHUNK_SIZE): # Per requests forum posts/discussions, iter_content should # periodically yield to the caller for the client to do things # like stopwatch and potentially inte...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __next__(self):\n while True:\n self.stream_bytes += self.stream_conn.read(1024)\n first = bytearray(self.stream_bytes).find(b'\\xff\\xd8')\n last = bytearray(self.stream_bytes).find(b'\\xff\\xd9')\n if first != -1 and last != -1:\n jpg = self.s...
[ "0.6684182", "0.65446764", "0.65069497", "0.646257", "0.62814903", "0.6260052", "0.6155381", "0.60745096", "0.58635724", "0.5798877", "0.5794452", "0.5783087", "0.5719212", "0.5713165", "0.57125616", "0.5710869", "0.56956375", "0.5694767", "0.5633111", "0.5610772", "0.5600973...
0.5495783
28
Verifies the checksum of the local images matches expectations. If this function does not raise ImageChecksumError then it is very likely that the local copy of the image was transmitted and stored correctly.
def verify_image(self, image_location): checksum = self._hash_algo.hexdigest() LOG.debug('Verifying image at %(image_location)s against ' '%(algo_name)s checksum %(checksum)s', {'image_location': image_location, 'algo_name': self._hash_algo.name, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testChecksumCondition(self):\n file_defs = [\n {'name': 'file_0_byte.txt', 'path': '', 'size': 0},\n {'name': 'file_1_byte.txt', 'path': '', 'size': 1},\n {'name': 'file_320k_minus 1_byte.txt', 'path': 'folder1', 'size': 320 * 1024 - 1, 'mod_inc': -1},\n ...
[ "0.64813644", "0.5933218", "0.5920034", "0.5915917", "0.5913081", "0.59013367", "0.5858877", "0.58465624", "0.5839293", "0.5838658", "0.5833695", "0.58166033", "0.5802921", "0.57959175", "0.57829624", "0.5775084", "0.5745312", "0.57087827", "0.5661978", "0.5660748", "0.565807...
0.7228067
0
Property value to return the number of bytes transferred.
def bytes_transferred(self): return self._bytes_transferred
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def BytesTransferred(self) -> int:", "def num_bytes(self) -> str:\n return pulumi.get(self, \"num_bytes\")", "def __len__(self):\n return len(self.bytes)", "def num_bytes(self):\n if self._num_bytes is None:\n status, info = self._resource._file.stat(\n timeout=...
[ "0.7957637", "0.72188973", "0.72182286", "0.7116724", "0.7116724", "0.70890856", "0.7017371", "0.7000203", "0.69469666", "0.692903", "0.6909466", "0.6889679", "0.6888642", "0.6877114", "0.6858719", "0.6853", "0.6848012", "0.6818101", "0.68149185", "0.6809503", "0.67906845", ...
0.8315916
0
Property value to return the server indicated length.
def content_length(self): # If none, there is nothing we can do, the server didn't have # a response. return self._expected_size
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getLength(self):\n return self.length", "def length(self):\n return self._info.length # pylint: disable=E1101", "def _get_length(self):\n return self._length", "def get_length(self):\n return self._length", "def get_length(self):\n return self._length", "def get_le...
[ "0.85687685", "0.8519502", "0.8495102", "0.8469865", "0.8469865", "0.8415048", "0.82790715", "0.82790715", "0.82674795", "0.8264685", "0.82456523", "0.8241544", "0.82194644", "0.819457", "0.819457", "0.8186871", "0.8186871", "0.812182", "0.8109638", "0.80927384", "0.80659336"...
0.0
-1
Downloads the specified image to the local file system.
def _download_image(image_info): starttime = time.time() image_location = _image_location(image_info) for attempt in range(CONF.image_download_connection_retries + 1): try: image_download = ImageDownload(image_info, time_obj=starttime) with open(image_location, 'wb') as f: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download_image(self, url):\r\n file_path = os.path.join(self.temp_dir, 'image.png')\r\n urlretrieve(url, file_path)\r\n return file_path", "def __download_image_file(self):\n if not file_utils.file_exists(self.image_file_path):\n logger.info('Downloading Image from - ' ...
[ "0.7351575", "0.725897", "0.71668446", "0.6947142", "0.69321436", "0.6929937", "0.6882543", "0.6868318", "0.68291295", "0.68159735", "0.6807469", "0.6788119", "0.67806107", "0.6735161", "0.67277104", "0.66885495", "0.66315204", "0.6597189", "0.65967166", "0.65920085", "0.6547...
0.6198562
42
Validates the image_info dictionary has all required information.
def _validate_image_info(ext, image_info=None, **kwargs): image_info = image_info or {} checksum_avail = False md5sum_avail = False os_hash_checksum_avail = False for field in ['id', 'urls']: if field not in image_info: msg = 'Image is missing \'{}\' field.'.format(field) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_missing_info(self):\r\n self.validate(None, None,\r\n N_image_shape=(3, 2, 8, 8),\r\n N_filter_shape=(4, 2, 5, 5))\r\n self.validate((3, 2, None, None), None,\r\n N_image_shape=(3, 2, 8, 8),\r\n N_filter_shap...
[ "0.6829416", "0.64101285", "0.6372421", "0.6283547", "0.62626284", "0.623681", "0.61904836", "0.6102994", "0.6038631", "0.6016138", "0.5986248", "0.59705144", "0.59603906", "0.59208983", "0.589194", "0.5877769", "0.5828762", "0.5828762", "0.58162236", "0.5749991", "0.56880915...
0.74150187
0
Validate the final partition table. Check if after writing the image to disk we have a valid partition table by trying to read it. This will fail if the disk is junk.
def _validate_partitioning(device): try: # Ensure we re-read the partition table before we try to list # partitions utils.execute('partprobe', device, run_as_root=True, attempts=CONF.disk_utils.partprobe_attempts) except (processutils.UnknownArgumentError, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_disk_size(self):\n if self.skip_disk_space_check:\n return True\n\n self.table_size = int(self.get_table_size(self.table_name))\n dump_size = int(self.get_expected_dump_size(self.table_name))\n disk_space = int(util.disk_partition_free(self.outfile_dir))\n # ...
[ "0.63102293", "0.62371194", "0.6020164", "0.59953326", "0.57650995", "0.5762729", "0.57039857", "0.57000345", "0.56442827", "0.55840147", "0.5523122", "0.5465158", "0.54439074", "0.538946", "0.5389009", "0.53505623", "0.5338153", "0.5333453", "0.53331393", "0.5261127", "0.525...
0.75619286
0
Constructs an instance of StandbyExtension.
def __init__(self, agent=None): super(StandbyExtension, self).__init__(agent=agent) self.cached_image_id = None self.partition_uuids = None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, environment):\n super(SlimishExtension, self).__init__(environment)\n environment.extend(\n slim_debug=True,\n slim_print=False,\n file_extensions=('.slim',),\n )", "def makeExtension(configs=[]):\n return FootnoteExtension(configs=confi...
[ "0.58713496", "0.5835261", "0.5830287", "0.57060844", "0.57038", "0.55792546", "0.5507978", "0.5480129", "0.5469574", "0.5451654", "0.5421142", "0.5411173", "0.5361274", "0.5360658", "0.5322133", "0.53036964", "0.5280921", "0.52798617", "0.52752435", "0.5256977", "0.5256977",...
0.57255626
3
Cache an image and write it to a local device.
def _cache_and_write_image(self, image_info, device, configdrive=None): _download_image(image_info) self.partition_uuids = _write_image(image_info, device, configdrive) self.cached_image_id = image_info['id']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _cache_image(self, event: str, image):\n image_path = self.history_image_path(event)\n tmp_filename = \"\"\n image_dir = os.path.split(image_path)[0]\n _LOGGER.debug(\"Save camera photo to %s\", image_path)\n if not os.path.exists(image_dir):\n os.makedirs(image_di...
[ "0.7174358", "0.7164342", "0.70680064", "0.7064031", "0.70357573", "0.69947386", "0.6844347", "0.67205036", "0.6550955", "0.6152098", "0.61229587", "0.6080348", "0.60026", "0.5944168", "0.5906471", "0.58985215", "0.5875219", "0.58504903", "0.58280385", "0.57820386", "0.577248...
0.7460007
0
Streams raw image data to specified local device.
def _stream_raw_image_onto_device(self, image_info, device): starttime = time.time() total_retries = CONF.image_download_connection_retries for attempt in range(total_retries + 1): try: image_download = ImageDownload(image_info, time_obj=starttime) wi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_image(self, device_id, image):\n self.logger.debug(f\"{device_id}: sending processed image!\")\n base64_img = base64.b64encode(\n cv2.imencode('.jpg', image)[1].tostring())\n self.socketio.emit(\n \"image\", {\"message\": base64_img}, room=f\"device-{device_id}\"...
[ "0.5345032", "0.5286425", "0.5225742", "0.51191074", "0.50935507", "0.5064945", "0.50522405", "0.49928376", "0.49729043", "0.49509344", "0.49202582", "0.4889088", "0.4863438", "0.4853132", "0.4849005", "0.48228058", "0.48110718", "0.47815132", "0.47463894", "0.47404286", "0.4...
0.6818737
0
Asynchronously caches specified image to the local OS device.
def cache_image(self, image_info, force=False, configdrive=None): LOG.debug('Caching image %s', image_info['id']) device = hardware.dispatch_to_managers('get_os_install_device', permit_refresh=True) msg = 'image ({}) already present on device {} ' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _cache_and_write_image(self, image_info, device, configdrive=None):\n _download_image(image_info)\n self.partition_uuids = _write_image(image_info, device, configdrive)\n self.cached_image_id = image_info['id']", "def cache_image(self):\n img_temp = NamedTemporaryFile()\n #...
[ "0.6824201", "0.66112345", "0.64930284", "0.644959", "0.63396084", "0.6275694", "0.62740225", "0.6254846", "0.6060011", "0.6041437", "0.58406264", "0.5829925", "0.5736584", "0.57318676", "0.5649928", "0.5632496", "0.55853283", "0.5560031", "0.55574805", "0.5540361", "0.549615...
0.56625384
14
Asynchronously prepares specified image on local OS install device. In this case, 'prepare' means make local machine completely ready to reboot to the image specified by image_info. Downloads and writes an image to disk if necessary. Also writes a configdrive to disk if the configdrive parameter is specified.
def prepare_image(self, image_info, configdrive=None): LOG.debug('Preparing image %s', image_info['id']) # NOTE(dtantsur): backward compatibility if configdrive is None: configdrive = image_info.pop('configdrive', None) device = hardware.dispatch_to_managers('get_os_install_d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _cache_and_write_image(self, image_info, device, configdrive=None):\n _download_image(image_info)\n self.partition_uuids = _write_image(image_info, device, configdrive)\n self.cached_image_id = image_info['id']", "def cache_image(self, image_info, force=False, configdrive=None):\n ...
[ "0.61373055", "0.5932022", "0.58297837", "0.5641948", "0.5422074", "0.53789437", "0.5355548", "0.5333866", "0.5305039", "0.5210984", "0.5166904", "0.5160415", "0.51545095", "0.5135883", "0.51172787", "0.5077922", "0.5063657", "0.50623053", "0.5020906", "0.5016245", "0.5012629...
0.78571266
0
Run the shutdown or reboot command
def _run_shutdown_command(self, command): # TODO(TheJulia): When we have deploy/clean steps, we should remove # this upon shutdown. The clock sync deploy step can run before # completing other operations. self._sync_clock(ignore_errors=True) if command not in ('reboot', 'powerof...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shutdown():\n os.system(\"sudo shutdown now\")", "def reboot():\n if not required():\n return \"Kernel reboot not required\"\n cmd_str = 'shutdown -r +1 \"Server is going down for kernel upgrade\"'\n Popen([cmd_str], shell=True, stdin=None,\n stdout=None, stderr=None, close_fd...
[ "0.7731829", "0.7347262", "0.7337728", "0.7152013", "0.7128588", "0.70234734", "0.70224255", "0.6965964", "0.6880892", "0.6878727", "0.68633", "0.68391895", "0.68310267", "0.6743067", "0.6679534", "0.66542256", "0.6654123", "0.6637868", "0.6637379", "0.66303295", "0.66051185"...
0.7438582
1
Runs image on agent's system via reboot.
def run_image(self): LOG.info('Rebooting system') self._run_shutdown_command('reboot')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reboot(self):\n raise NotImplementedError", "def external_reboot(info):\n\n text, reason = info\n SysTools.reboot(reason)", "def reboot(self, *args, **kwargs):\n log_tag = self.get_log_tag()\n self.logger.info(\"{} Attempting to reset the Treerunner board\"\n ...
[ "0.69385177", "0.68277025", "0.6792417", "0.66663486", "0.66571987", "0.66274637", "0.6605065", "0.652732", "0.6526463", "0.64705724", "0.6427431", "0.63956904", "0.63891965", "0.6374544", "0.63547057", "0.6338393", "0.63373744", "0.63192075", "0.63185483", "0.6287356", "0.62...
0.8678054
0
Powers off the agent's system.
def power_off(self): LOG.info('Powering off system') self._run_shutdown_command('poweroff')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def powerOff(self):\n self._sendCommand(self.SONY_CMD_ExtBackupCommunicator_ForcePowerOff, bufferSize=0)", "async def power_off(self):\n ...", "def systemOff():\n # Updated 11/19/16\n I2C.write_byte_data(Valve_bus, pinOut_O, 0x00 )\n I2C.write_byte_data(Pump_Mag_bus, pinOut_O, 0x00)", "async...
[ "0.7070646", "0.6922541", "0.662973", "0.6623043", "0.6576769", "0.6501467", "0.6488038", "0.6456454", "0.64498055", "0.6436767", "0.6434931", "0.6412994", "0.64061755", "0.6384542", "0.6366528", "0.63192016", "0.6312006", "0.63031405", "0.6302914", "0.62978655", "0.6295983",...
0.74974024
0
Flush file system buffers forcing changed blocks to disk.
def sync(self): LOG.debug('Flushing file system buffers') try: utils.execute('sync') except processutils.ProcessExecutionError as e: error_msg = 'Flushing file system buffers failed. Error: %s' % e LOG.error(error_msg) raise errors.CommandExecution...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _flush(self):\r\n\r\n fh = open(self.filename, \"a\")\r\n fh.write(\"\".join(self.buffer))\r\n fh.close()\r\n\r\n self.buffer = []", "def flush_buffers(self):\n\n for file_dictionary in [self.infiles, self.outfiles]:\n for name, fi in file_dictionary.items():\n ...
[ "0.75430226", "0.7511212", "0.7423708", "0.7305217", "0.72343165", "0.7155582", "0.712694", "0.710647", "0.70842326", "0.7073423", "0.7058113", "0.69757587", "0.6940303", "0.6929731", "0.69257444", "0.6846642", "0.6831325", "0.68252045", "0.68020684", "0.6722753", "0.6722753"...
0.7694749
0
Sync the clock to a configured NTP server.
def _sync_clock(self, ignore_errors=False): try: utils.sync_clock(ignore_errors=ignore_errors) # Sync the system hardware clock from the software clock, # as they are independent and the HW clock can still drift # with long running ramdisks. utils.exec...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _update_system_clock(self):\n if self.platform in RASPBERRY_PI_PLATFORMS:\n LOG.info('Updating the system clock via NTP...')\n if self.is_paired:\n # Only display time sync message when paired because the prompt\n # to go to home.mycroft.ai will be dis...
[ "0.72019464", "0.67585665", "0.6649007", "0.657078", "0.64096606", "0.6387202", "0.61035496", "0.59282035", "0.59197986", "0.5900489", "0.5859015", "0.5682285", "0.5646636", "0.56120664", "0.5563949", "0.54567546", "0.53946847", "0.5387688", "0.5359521", "0.53485525", "0.5341...
0.62447476
6
Returns number of moves
def distributeCoins(root): #excess = abs(#ofcoins -1) = #moves if root is None: return 0 l = distributeCoins(root.left) r = distributeCoins(root.right) excess = abs(root.val - 1) return excess
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def number_of_moves(self):\n return self._move_seq.length()", "def get_number_of_moves(self):\n return self._number_of_moves", "def number_moves(game, player):\n return float(len(game.get_legal_moves(player)))", "def length(self):\n return len(self._moves)", "def get_num_moves(self,...
[ "0.8681805", "0.856184", "0.80898356", "0.7614885", "0.7369249", "0.72765887", "0.6953156", "0.69468915", "0.6910281", "0.6842801", "0.67577493", "0.665538", "0.66479564", "0.6636441", "0.6622427", "0.6613338", "0.6564527", "0.6544723", "0.65278643", "0.6525226", "0.6524772",...
0.0
-1
Create OODDataset given a data loader and a tokenization function.
def __init__(self, loader, tok_fn, return_intent_labels=True, to_lower_case=True): super().__init__() self.loader = loader for attr in ["raw_texts", "raw_labels", "ood_labels"]: setattr(self, attr, getattr(self.loader, attr)) self.n_ood = sum(self.ood_labels) self.n_i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_datset_train_tokenization(dataset,tokenizer,tokenizer_trainer,batch_size : int):\n def make_batch_iter(dataset):\n for i in range(0, len(dataset), batch_size):\n yield dataset[i : i + batch_size][\"code\"]\n tokenizer.train_from_iterator(make_batch_iter(), trainer=tokenizer_trainer...
[ "0.6530549", "0.6220432", "0.6111498", "0.6098955", "0.60953796", "0.608362", "0.606018", "0.6023531", "0.5942583", "0.5922213", "0.5895218", "0.5889697", "0.57360965", "0.57269007", "0.57235485", "0.5714535", "0.5697009", "0.5693994", "0.5655012", "0.5638884", "0.5638126", ...
0.5756681
12
Map raw labels onto their numerical representation.
def vectorize_labels(self): label_counter = Counter(self.raw_labels) if 'oos' in label_counter: label_counter.pop('oos') unique_labels, label_cnts = zip(*sorted(label_counter.items())) unique_labels, label_cnts = list(unique_labels), list(label_cnts) label_vocab = {la...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convertLabels(self, labels):\n counter = 0\n numericLabels = []\n for label in labels:\n if label not in self.labelDict:\n self.labelDict[label] = counter\n self.backwards_conversion[counter] = label\n counter += 1\n numeri...
[ "0.7552026", "0.673033", "0.65772784", "0.65754217", "0.6574145", "0.652427", "0.6432568", "0.6432568", "0.64288896", "0.6390633", "0.6351704", "0.6344979", "0.63178086", "0.62096834", "0.6207216", "0.6198722", "0.61695147", "0.6168775", "0.615346", "0.6135756", "0.6106407", ...
0.56232923
60
Map tokenized texts into respective numerical sequences.
def vectorize_texts(self, encoder) -> NoReturn: self.encoder = encoder self.vectorized_texts = [self.encoder.encode(t) for t in self.tokenized_texts]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mapper(textstr):\n\n\ttokens = re.findall(token_regex, textstr)\n\treturn [(token.lower(), 1) for token in tokens]", "def _preprocess(self, txt_seq):\n input = []\n for token in txt_seq.split():\n input.append(self.word2id.get(token, self.word2id[\"<UNK>\"]))\n input.append(se...
[ "0.6435899", "0.624509", "0.62392515", "0.6179867", "0.6151187", "0.60807806", "0.6066256", "0.60037786", "0.59584934", "0.5941563", "0.59076416", "0.59047365", "0.5896926", "0.5896829", "0.5896787", "0.58962786", "0.58532524", "0.5839776", "0.58289903", "0.5817644", "0.58063...
0.0
-1
Get train/dev/test split of the OOD dataset in the form suitable for transformer models.
def get_transformer_splits(loader_cls, tokenizer, return_intent_labels=True): datasets = [] for subset in SUBSETS: dataset = OODDataset(loader_cls(subset=subset), tokenizer.tokenize, return_intent_labels) dataset.vectorize_texts(tokenizer) datasets.append(dat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_split_data(self):\n X, y, _, _ = self.get_subsets()\n return train_test_split(X, y, test_size=0.3, random_state=42)", "def dataset_splits(self):\n return [{\n \"split\": problem.DatasetSplit.TRAIN,\n \"shards\": 80,\n }, {\n \"split\": problem.DatasetSplit.EVAL,\n...
[ "0.73489857", "0.7299666", "0.7240295", "0.6996687", "0.69727206", "0.6866645", "0.6861226", "0.68377197", "0.68276453", "0.6814517", "0.680304", "0.678786", "0.6782424", "0.6765372", "0.67429614", "0.67218626", "0.6718416", "0.6713332", "0.67119724", "0.67029387", "0.6696772...
0.0
-1
Get loader class for a dataset.
def get_loader(dataset_name, **kwargs): if dataset_name == "rostd": loader = partial_class(ROSTDLoader, data_root_dir="data/rostd", use_coarse_labels=False) elif dataset_name == "rostd_coarse": loader = partial_class(ROSTDLoader, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loader(self):\n return self.loader_class()", "def get_cls(dataset_name):\n return find_dataset_using_name(dataset_name)", "def init_loader(dataset):\n if dataset == 'chaos':\n return ChaosLoader()\n return None", "def get_data_loader(\n name: str, **kwargs) -> data_loader.DataLo...
[ "0.746107", "0.6963209", "0.6959952", "0.68778324", "0.665751", "0.66192013", "0.6553479", "0.6545444", "0.65317357", "0.6488149", "0.6470945", "0.6427437", "0.63847756", "0.63402325", "0.6329773", "0.6324222", "0.63233507", "0.62848765", "0.6283929", "0.6254267", "0.625302",...
0.7470058
0
Get OOD dataset splits.
def get_dataset_transformers(tokenizer, dataset_name, **kwargs): loader = get_loader(dataset_name, **kwargs) return get_transformer_splits(loader, tokenizer)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split(self):\n return self.dataset_split", "def dataset_splits(self):\n return [{\n \"split\": problem.DatasetSplit.TRAIN,\n \"shards\": 80,\n }, {\n \"split\": problem.DatasetSplit.EVAL,\n \"shards\": 2,\n }]", "def get_split_data(self):\n X, y, _, _ = se...
[ "0.7341581", "0.7027424", "0.6882111", "0.6793445", "0.6487141", "0.6362548", "0.62349886", "0.61450887", "0.60991263", "0.6091308", "0.6091308", "0.604086", "0.6022808", "0.600386", "0.59541494", "0.5941092", "0.5916573", "0.5916359", "0.5847142", "0.58466256", "0.58289415",...
0.0
-1
Get OOD dataset splits for an OOD dataset.
def get_dataset_simple(dataset_name, add_valid_to_vocab=False, add_test_to_vocab=False, to_lower_case=True, tok_fn=word_tokenize, **kwargs): loader = get_loader(dataset_name, **kwargs) return get_s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split(self):\n return self.dataset_split", "def dataset_splits(self):\n return [{\n \"split\": problem.DatasetSplit.TRAIN,\n \"shards\": 80,\n }, {\n \"split\": problem.DatasetSplit.EVAL,\n \"shards\": 2,\n }]", "def dataset_splits(self):\n # 10% evaluatio...
[ "0.70372236", "0.69845265", "0.6694059", "0.6559792", "0.64192224", "0.64192224", "0.6092194", "0.6038562", "0.5961354", "0.59335774", "0.5930705", "0.5916459", "0.5904958", "0.59022033", "0.5896183", "0.58663386", "0.5865254", "0.58487064", "0.58262956", "0.58186454", "0.580...
0.0
-1
Collate function for BoW method.
def collate_fn_bow(data, vocab_size): labels = torch.zeros(len(data), dtype=torch.long) ood_labels = torch.zeros(len(data), dtype=torch.long) rows, cols = [], [] values = [] for idx, (numerical_sent, label, is_ood) in enumerate(data): labels[idx] = label ood_labels[idx] = is_ood ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def collate_batch(self) -> Dict[str, Any]:\n pass", "def collate_fn(self, *args):\n return TupleMiniBatch(default_collate(*args))", "def collate_fn(batch):\r\n names, images, annos = zip(*batch)\r\n images = default_collate(images)\r\n return names, images, annos", "def col...
[ "0.6285648", "0.61482316", "0.608017", "0.608017", "0.6023473", "0.5729764", "0.56924856", "0.5670218", "0.56569993", "0.5647658", "0.5637822", "0.56375355", "0.56301194", "0.56301194", "0.5628027", "0.5609602", "0.560494", "0.55924386", "0.5554792", "0.555237", "0.5529124", ...
0.0
-1
rearrange the command sequence
def _worker(self): player = self.first_player # first player q = [None, self.q1, self.q2] states = [None, 'reset', 'reset'] not_ret = None while True: op, a, ret = q[player].get() # print(f'worker: player: {player} op: {op}') try: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cmd_order_fixup(self, cmds, name):\n if cmds:\n if name and not [\n item for item in cmds if item.startswith(\"interface\")\n ]:\n cmds.insert(0, \"interface \" + name)\n\n redirects = [\n item for item in cmds if re.match(\"(...
[ "0.659373", "0.6334113", "0.5985796", "0.59837687", "0.5917184", "0.5854761", "0.5768019", "0.57034343", "0.5682071", "0.5664563", "0.5645805", "0.5577803", "0.5568027", "0.5552826", "0.5534912", "0.5533396", "0.55119896", "0.55039597", "0.55010617", "0.55000657", "0.5491518"...
0.0
-1
Return SimulationFilteredTimeRange from the simulation settings.
def from_settings(cls, settings: SimulationSettingsModel): return cls( start=settings.project.simulation_range.start, end=settings.project.simulation_range.end, )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_time_range_from_settings(settings: SimulationSettingsModel):\n start_time = get_start_time(settings)\n end_time = start_time + timedelta(minutes=settings.project.simulation_duration_min)\n step_time = get_simulation_resolution(settings)\n return start_time, end_time, step_time", "def get_r...
[ "0.6075539", "0.576304", "0.5740652", "0.56231076", "0.5363798", "0.5343467", "0.5323035", "0.52851176", "0.52137524", "0.52137524", "0.5064868", "0.50415677", "0.5023017", "0.4955685", "0.49384615", "0.4932563", "0.4915583", "0.48986036", "0.48892584", "0.48766854", "0.48663...
0.5361289
5
Return True if the timestamp is within the filtered range.
def is_within_range(self, timestamp): if self._no_filtering: return True ts = time.struct_time(( self._start.tm_year, self._start.tm_mon, self._start.tm_mday, timestamp.hour, timestamp.minute, timestamp.second, self._start.tm_wday, self._start.tm_yday, se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def within_threshold(self, other):\n if abs(other.ts - self.ts) < TIME_THRESHOLD:\n return True\n return False", "def within_time_interval(self, from_time, to_time, time):\n\t\tif from_time == None:\n\t\t\tif to_time == None:\n\t\t\t\treturn True\n\t\t\telse:\n\t\t\t\treturn bool(time <=...
[ "0.675669", "0.67546004", "0.66915435", "0.666187", "0.6656196", "0.6534372", "0.6418472", "0.6381407", "0.63664734", "0.6338443", "0.62505734", "0.62325436", "0.62271273", "0.62031996", "0.6198777", "0.61113006", "0.6110163", "0.6054065", "0.6018648", "0.60164005", "0.596743...
0.8684515
0
Return the start time of the simulation.
def get_start_time(settings: SimulationSettingsModel): return settings.project.start_time
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_time(self) -> pulumi.Output[Optional[int]]:\n return pulumi.get(self, \"start_time\")", "def start_time(self) -> float:\n return self._start_time", "def start_time(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"start_time\")", "def start_time(self):\n return se...
[ "0.8377511", "0.83447194", "0.8335398", "0.8305851", "0.8246277", "0.8246277", "0.8148698", "0.8148698", "0.8148698", "0.8148698", "0.8148698", "0.8148698", "0.8148698", "0.8148698", "0.80517", "0.80485797", "0.80266994", "0.7996719", "0.7996719", "0.79724574", "0.79643977", ...
0.77836007
30
Return the simulation of the resolution
def get_simulation_resolution(settings: SimulationSettingsModel): return timedelta(seconds=settings.project.step_resolution_sec)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resolution(self):\n return Prism.resolution(self,self.beam,self.wavelength)", "def make_simulation(self):\n if self.skip_reference:\n self.units = 'time steps per second'\n else:\n self.units = 'calls per second'\n\n self.reference_sim, self.compare_sim = sel...
[ "0.6900691", "0.6561556", "0.6413628", "0.63199735", "0.63027394", "0.62969726", "0.62730795", "0.6152061", "0.6115921", "0.5950889", "0.59448564", "0.5923001", "0.58970904", "0.5887493", "0.5887381", "0.58404", "0.5833304", "0.58197236", "0.5795295", "0.5785967", "0.57474697...
0.6709174
1
Return the start time, step time, and end time from the settings.
def create_time_range_from_settings(settings: SimulationSettingsModel): start_time = get_start_time(settings) end_time = start_time + timedelta(minutes=settings.project.simulation_duration_min) step_time = get_simulation_resolution(settings) return start_time, end_time, step_time
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_start_time(settings: SimulationSettingsModel):\n return settings.project.start_time", "def __get_times(self):\n data = self.simulate_file.readlines()\n data = list(map(str.strip, data))\n data = list(map(float, data))\n start = data[0]\n times = data[1:]\n ret...
[ "0.67618924", "0.6756509", "0.6688929", "0.64605314", "0.6407463", "0.6403378", "0.63651186", "0.63542116", "0.6330691", "0.63102907", "0.6257525", "0.6255249", "0.62505156", "0.62222517", "0.6194169", "0.61568725", "0.61469734", "0.6144589", "0.61044663", "0.6078161", "0.601...
0.74676275
0
Return time indices created from the simulation settings.
def create_datetime_index_from_settings(settings: SimulationSettingsModel): start_time, end_time, step_time = create_time_range_from_settings(settings) data = [] cur_time = start_time while cur_time < end_time: data.append(cur_time) cur_time += step_time return pd.DatetimeIndex(data...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def time_indices(self, df):\r\n X = np.empty((df.shape[0], 3), dtype=np.float64)\r\n X[:, 0] = df.index.year\r\n X[:, 1] = df.index.month\r\n X[:, 2] = df.index.day\r\n return X", "def time_list(self):\n return (self.N_T * (np.arange(self.N_itr) + 1) /\n s...
[ "0.6130192", "0.600492", "0.5967918", "0.5965704", "0.59274644", "0.5879071", "0.5861965", "0.5861965", "0.5861965", "0.5844066", "0.5777731", "0.5748875", "0.56899023", "0.5667132", "0.5645093", "0.5626598", "0.56251013", "0.5620724", "0.5612228", "0.5569333", "0.5551456", ...
0.6180948
0
Return a loadshape dataframe representing all available data. This assumes that a loadshape has been selected in OpenDSS.
def create_loadshape_pmult_dataframe(settings: SimulationSettingsModel): start_time = settings.project.loadshape_start_time data = dss.LoadShape.PMult() interval = timedelta(seconds=dss.LoadShape.SInterval()) npts = dss.LoadShape.Npts() indices = [] cur_time = start_time for _ in range(npts...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def available_to_lay(self) -> pd.DataFrame:\n if not self.data_is_loaded:\n self.load_data()\n\n return self._available_to_lay", "def dataframe(self):\n if not self.all_records:\n print('No rows cached.')\n return\n dict_list = [row.as_dict() for row i...
[ "0.6330568", "0.6241007", "0.623866", "0.62355924", "0.6206864", "0.6149052", "0.61322594", "0.6111406", "0.6104934", "0.6099539", "0.6048846", "0.5989554", "0.597556", "0.5946196", "0.59261596", "0.5890683", "0.5890246", "0.58660966", "0.5862521", "0.58139795", "0.5796813", ...
0.6537646
0
Return a loadshape pmult dataframe that only contains time points used by the simulation. This assumes that a loadshape has been selected in OpenDSS.
def create_loadshape_pmult_dataframe_for_simulation(settings: SimulationSettingsModel): df = create_loadshape_pmult_dataframe(settings) simulation_index = create_datetime_index_from_settings(settings) return df.loc[simulation_index]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_loadshape_pmult_dataframe(settings: SimulationSettingsModel):\n start_time = settings.project.loadshape_start_time\n data = dss.LoadShape.PMult()\n interval = timedelta(seconds=dss.LoadShape.SInterval())\n npts = dss.LoadShape.Npts()\n\n indices = []\n cur_time = start_time\n for _ ...
[ "0.7490958", "0.5829951", "0.5621119", "0.53631383", "0.52734464", "0.51956564", "0.51909745", "0.51639205", "0.51525396", "0.51212883", "0.5091097", "0.5029446", "0.49741325", "0.49019918", "0.48935086", "0.48498857", "0.47839516", "0.47479317", "0.4738494", "0.47346386", "0...
0.69172424
1
Read filename into a pandas Dataframe and extract items in ids_df. It reads items (flights, positions or events) from filename into a pandas Dataframe and merges the items with ids_df on FLIGHT_ID as a UUID. It writes a copy of the Dataframe items WITHOUT mathing ids into a file called 'new_' + filename Returns a panda...
def extract_next_day_items(filename, ids_df, date_fields=[]): # An empty data frame to return new_items_df = pd.DataFrame() next_df = pd.DataFrame() try: if date_fields: next_df = pd.read_csv(filename, parse_dates=date_fields, converters={'FLIGHT_ID...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_dataframe_with_new_ids(filename, ids_df, *, date_fields=['TIME']):\n df = pd.read_csv(filename, parse_dates=date_fields, memory_map=True)\n return pd.merge(ids_df, df, left_index=True, right_on='FLIGHT_ID')", "def extract_overnight_data(filenames):\n day_ids_filename = filenames[0]\n\n fligh...
[ "0.7330701", "0.5534461", "0.54933244", "0.5378836", "0.52908814", "0.52467626", "0.5233091", "0.52184945", "0.5193366", "0.5172495", "0.51131463", "0.51092166", "0.50987095", "0.509562", "0.5085387", "0.50284123", "0.49850348", "0.4975146", "0.49732038", "0.49651432", "0.496...
0.71169
1
Extract flights, postions and events for the previosu day from the data. It writes items (flights, positions or events) WITHOUT ids in the ids file into files with 'new_' prepended to the filename. It writes positions and events with ids in the ids file into positions and files for the previus day, with the ids replace...
def extract_overnight_data(filenames): day_ids_filename = filenames[0] flights_filename = filenames[1] positions_filename = filenames[2] events_filename = filenames[3] # Extract date strings from the input filenames and validate them input_date_strings = [''] * len(input_filenames) for i i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_next_day_items(filename, ids_df, date_fields=[]):\n # An empty data frame to return\n new_items_df = pd.DataFrame()\n\n next_df = pd.DataFrame()\n try:\n if date_fields:\n next_df = pd.read_csv(filename, parse_dates=date_fields,\n converter...
[ "0.6062551", "0.5563013", "0.5444974", "0.54346234", "0.53789616", "0.535099", "0.52633065", "0.52605945", "0.5228094", "0.518463", "0.51673555", "0.50466776", "0.5044268", "0.50004363", "0.4950038", "0.4941842", "0.4930765", "0.4920016", "0.49200147", "0.4890476", "0.4878595...
0.65628237
0
Forward method that defines how the output of the adapter should be merged with the input, or if it should be merged at all. Also provides the module that called this strategy thereby allowing access to all other adapters in the calling module. This can be useful if one adapter is a meta adapter, that combines the outp...
def forward(self, input: torch.Tensor, adapter: torch.nn.Module, *, module: 'AdapterModuleMixin'): raise NotImplementedError()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forward(self, input: torch.Tensor, adapter: torch.nn.Module, *, module: 'AdapterModuleMixin'):\n out = adapter(input)\n return input + out", "def _forward_impl(self, *inputs, **kwargs):\n raise NotImplementedError('Abstract method.')", "def _merge(self):\n raise NotImplementedEr...
[ "0.622351", "0.55586976", "0.55143094", "0.5488171", "0.5435731", "0.53628135", "0.5335388", "0.52663696", "0.52549416", "0.5206372", "0.5185595", "0.5177787", "0.50885415", "0.50529665", "0.50304896", "0.50117123", "0.5008247", "0.5008247", "0.50006044", "0.49869508", "0.497...
0.55467725
2
A basic strategy, comprising of a residual connection over the input, after forward pass by the underlying adapter.
def forward(self, input: torch.Tensor, adapter: torch.nn.Module, *, module: 'AdapterModuleMixin'): out = adapter(input) return input + out
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forward(self, x):\n\n residual = x\n\n out = self.conv1(x)\n out = self.bn1(out)\n out = self.relu(out)\n\n out = self.conv2(out)\n out = self.bn2(out)\n out = self.relu(out)\n\n out = self.conv3(out)\n out = self.bn3(out)\n\n if self.downsa...
[ "0.6189128", "0.60645986", "0.5962519", "0.59512717", "0.57570064", "0.574863", "0.5739441", "0.56438893", "0.56438893", "0.56438893", "0.56355673", "0.560763", "0.56017196", "0.559043", "0.5517474", "0.5480964", "0.5480964", "0.5464217", "0.5431316", "0.54139894", "0.5413989...
0.5513437
15
Branch cleaning via subsequent erosion of end points
def cleanOpenBranches(skeleton, skelton_copy, points, radii, length, clean = True, verbose = False): assert np.isfortran(skeleton); assert np.isfortran(skelton_copy); timer = tmr.Timer(); timer_all = tmr.Timer(); # find branch and end points deg = cpl.convolve_3d_indices(skeleton, t3d.n26, points, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def segment_and_find_positions(self):\n initial_image = self.data\n xdim = self.data.shape[0]\n\n ydim = self.data.shape[1]\n downsized_image = transform.resize(\n initial_image,\n (xdim / DOWNSCALING_FACTOR, ydim / DOWNSCALING_FACTOR),\n mode=\"constant...
[ "0.6718515", "0.6329278", "0.61814344", "0.61806417", "0.61695665", "0.5868116", "0.5828168", "0.57176757", "0.56688243", "0.55745715", "0.5566061", "0.55622643", "0.55586195", "0.553018", "0.5529344", "0.5524337", "0.5515034", "0.5506454", "0.55020887", "0.5498602", "0.54791...
0.58322495
6
Transfers radii data for the common points
def transferRadii(points_from, radii_from, points_to, radii_to): # assume points are sorted lists of indices match = ld.match(points_from, points_to); ids = ld.where(match >= 0); match = ld.take(match, ids); radii = ld.take(radii_from, ids); ld.setArray(radii_to, match, radii); return radii_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def radialCopy(self, bufr, x=0, y=0, z=0, startRadius=2.0, endRadius=2.0,\r\n startAngle=0.0, endAngle=360.0, step=12):\r\n st = (endAngle - startAngle) / step\r\n rst = (endRadius - startRadius) / int(st)\r\n rd = startRadius\r\n sta = startAngle\r\n\r\n blist = []\r\n for r in r...
[ "0.5525771", "0.5510386", "0.5225015", "0.51187915", "0.5077811", "0.5011259", "0.5009781", "0.49644858", "0.49623564", "0.4959181", "0.4942424", "0.49414128", "0.49405032", "0.49126655", "0.4907", "0.48982129", "0.48980373", "0.48855355", "0.48623767", "0.4856129", "0.485331...
0.6246936
0
app context free jsonify helper
def xjsonify(obj): return Response(json.dumps(obj), mimetype='application/json')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def jsonify(obj):\n raise NotImplementedError", "def jsonify(f):\n @wraps(f)\n def decorated_function(*args, **kwargs):\n result = f(*args, **kwargs)\n data = json.dumps(result, indent=None if request.is_xhr else 2)\n return app.response_class(data, mimetype='application/json')\n ...
[ "0.72890085", "0.7164142", "0.69239974", "0.6794658", "0.6768426", "0.6551378", "0.65280634", "0.652159", "0.64017963", "0.63485336", "0.63122547", "0.6304009", "0.62762594", "0.6205541", "0.61815906", "0.6173508", "0.61646235", "0.61565655", "0.6052185", "0.60484475", "0.603...
0.6316456
10
Initialize the position for the guide
def postInit(self): self.save_transform = ["root", "top", "bottom", "ext", "int"]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _init(self, position):\n\t\tself._position = position", "def init_position(self):\n\t\t\n\t\t# Starting position, 1 is for WHITE, -1 is for BLACK\n\t\tself['D4'] = self['E5'] = 1\n\t\tself['D5'] = self['E4'] = -1", "def init_position(self):\n if self.invert_init_angle is False:\n self.the...
[ "0.73818886", "0.7179671", "0.71637106", "0.7016932", "0.7002005", "0.69516474", "0.68368506", "0.67219925", "0.6720673", "0.6682686", "0.6610065", "0.6596744", "0.65711063", "0.65698683", "0.6534707", "0.6509849", "0.6486196", "0.6462287", "0.64619696", "0.64500725", "0.6406...
0.0
-1
Add the Guide Root, blade and locators
def addObjects(self): self.root = self.addRoot() vTemp = transform.getOffsetPosition(self.root, [0, 1, 0]) self.top_loc = self.addLoc("top", self.root, vTemp) centers = [self.root, self.top_loc] self.dispcrv = self.addDispCurve("crv", centers) vTemp = transform.getOffse...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def CreateGuideWindows(self):\r\n\r\n self.DestroyGuideWindows()\r\n\r\n self._guides.append(AuiDockingGuideInfo().Left().\r\n Host(AuiSingleDockingGuide(self._frame, wx.LEFT)))\r\n self._guides.append(AuiDockingGuideInfo().Top().\r\n Host(...
[ "0.6299601", "0.60929096", "0.57400393", "0.57094324", "0.55230534", "0.55228513", "0.55117434", "0.54463744", "0.54393375", "0.5433647", "0.535917", "0.53076136", "0.528853", "0.5230734", "0.5230158", "0.5213023", "0.52080613", "0.5191819", "0.5191257", "0.51477665", "0.5139...
0.0
-1
Add the configurations settings
def addParameters(self): self.pRefArray = self.addParam("ikrefarray", "string", "") self.pUseIndex = self.addParam("useIndex", "bool", False) self.pParentJointIndex = self.addParam( "parentJointIndex", "long", -1, None, None) self.pJoint = self.addParam("joint", "bool", Tr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def configuration():", "def build_settings(self, settings):\n \n settings.add_json_panel(\"Network\", self.config, data=network_json)\n settings.add_json_panel(\"Camera\", self.config, data=camera_json)\n settings.add_json_panel(\"CV\", self.config, data=cv_json)\n settings.add...
[ "0.6941895", "0.6893389", "0.6817869", "0.6749662", "0.6724938", "0.667857", "0.667857", "0.667038", "0.66698974", "0.6605579", "0.6591482", "0.6589387", "0.6537679", "0.6537679", "0.6533307", "0.6527137", "0.651141", "0.6473452", "0.64672536", "0.6456205", "0.6456205", "0....
0.0
-1
Populate the controls values. Populate the controls values from the custom attributes of the component.
def populate_componentControls(self): # populate tab self.tabs.insertTab(1, self.settingsTab, "Component Settings") refArrayItems = self.root.attr("ikrefarray").get().split(",") for item in refArrayItems: self.settingsTab.refArray_listWidget.addItem(item)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _update_attr_list(self) -> None:\n old_flex_grid = self.flex_grid\n self.flex_grid = wx.FlexGridSizer(cols=3, vgap=5, hgap=10)\n wx_elements = []\n for attr_id in self.attr_ids:\n button = self.attr_buttons[attr_id]\n label_input = self.attr_labels[attr_id]\n ...
[ "0.6279057", "0.62399703", "0.60799664", "0.59515196", "0.5895168", "0.5884753", "0.5754655", "0.57229865", "0.5706931", "0.56097054", "0.5600419", "0.5594037", "0.5593972", "0.5583099", "0.5580033", "0.5559879", "0.5532323", "0.5515915", "0.55016774", "0.54932463", "0.549234...
0.62719935
1
Parse sudoku puzzle into lists of horizontal bars
def parse_puzzle(puzzle): puzzle = re.sub("\sGrid \d{2}","", sample) puzzle = puzzle.strip().split("\n") return puzzle
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parsePuzzle(fileName):\n data = []\n f = open(fileName, 'r')\n for line in f:\n splitLine = line.split(sep=\" \")\n row = []\n if len(splitLine) >= 9:\n for i in range(9):\n row.append(int(splitLine[i]))\n data.append(row)\n f.close()\n retur...
[ "0.62196636", "0.6099618", "0.6039913", "0.60288465", "0.5915466", "0.58174556", "0.57508373", "0.57166475", "0.5710631", "0.57069427", "0.56989294", "0.56715757", "0.5657205", "0.55930203", "0.5587946", "0.5585172", "0.5571849", "0.5559757", "0.5553917", "0.5527363", "0.5512...
0.665639
0
Find DS9 window with ds9_name if it exists
def check_for_ds9(ds9_name): ds9 = False if platform.system().lower() == 'darwin': processes = os.popen('ps aux | grep {}'.format(ds9_name)).readlines() else: processes = os.popen('ps aux --cols 1024 | grep {}'.format(ds9_name)).readlines() for process in processes: if "ds9" in p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_window_by_name(self, name):\n for window in self.windows:\n if window.name == name:\n return window\n else:\n raise ValueError(\"No source with that name.\")", "def find_window(**kwargs):\r\n try:\r\n kwargs['backend'] = 'win32'\r\n elem...
[ "0.6427394", "0.6138715", "0.6070238", "0.6070238", "0.59566784", "0.59566784", "0.5802954", "0.5770843", "0.5705655", "0.5681872", "0.5494898", "0.547359", "0.53805435", "0.53779405", "0.5368971", "0.53643894", "0.53633446", "0.5353856", "0.5212151", "0.5200518", "0.51943207...
0.7949997
0
Start up a DS9 window. Doing it like this is much more robust than using pyds9.
def start_ds9(ds9_name): os.system('ds9 -title {} &'.format(ds9_name))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init():\n if len(sys.argv) > 1:\n xid = sys.argv[1]\n else:\n xid = \"JS9\"\n j = pyjs9.JS9(id=xid)\n displayMessage(j, 'Start pyjs9.JS9(id={})'.format(xid))\n j.BlendDisplay(False)\n j.SetRGBMode(False)\n closeDisplay(j)\n return j", "def openCmdWindow(self): \n ...
[ "0.66212666", "0.62966526", "0.62417", "0.62284756", "0.6217704", "0.6153588", "0.6129243", "0.6115105", "0.6100095", "0.6047786", "0.6033856", "0.60008264", "0.5988808", "0.5970348", "0.59587115", "0.5958246", "0.5957658", "0.59339213", "0.5931745", "0.59217477", "0.59165937...
0.6965974
0
Display an image in DS9
def display_ds9(ds9_name, image_id): os.system('xpaset {} fits < {}'.format(ds9_name, image_id))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display(self):\n display(self.image)", "def display(self, image):\n raise NotImplementedError()", "def showImage(self, image):\n \n self.image = img", "def show_image(self):\n cv2.imshow(self.config.DISPLAY_NAME, self.image)", "def show(self, image_dir_root=None):\n ...
[ "0.7950811", "0.7688089", "0.7448952", "0.7399748", "0.73854136", "0.73576796", "0.72729415", "0.72708493", "0.7247672", "0.7178417", "0.7093474", "0.6981921", "0.6970735", "0.6967736", "0.69222945", "0.68731755", "0.6864712", "0.68514585", "0.68506086", "0.68479264", "0.6843...
0.0
-1
Set command for updating a ds9 window
def set_ds9(ds9_name, command): os.system('xpaset -p {} {}'.format(ds9_name, command))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def commandUpdate(self):\n pass", "def update_command():\n # global selected_tuple\n backend.update(selected_tuple[0], \n title_text.get(), \n author_text.get(), \n year_text.get(), \n isbn_text.get())", "def edit_command(...
[ "0.6671508", "0.66072565", "0.6469818", "0.63653046", "0.63592666", "0.6222237", "0.61264366", "0.6121376", "0.5945711", "0.593486", "0.59213996", "0.58844423", "0.58575165", "0.58477134", "0.58449966", "0.58388424", "0.5800405", "0.57867575", "0.5779738", "0.576639", "0.5765...
0.5655978
30
Configure the DS9 image viewing window
def setup_ds9(ds9_name, filename=None): print('Checking for DS9...') if not check_for_ds9(ds9_name): print('No DS9 found, starting DS9...') start_ds9(ds9_name) while not check_for_ds9(ds9_name): print('Checking for DS9...') time.sleep(1) time.sleep(5) set...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def showImageViewer(self):\n self.imageViewer.hide()\n self.imageViewer.show()", "def view(self, name_of_window=\"Image\") -> None:\n cv2.namedWindow(name_of_window, cv2.WINDOW_NORMAL)\n cv2.imshow(name_of_window, self.img)\n cv2.waitKey(0)\n cv2.destroyAllWindows()", ...
[ "0.6481146", "0.64717525", "0.6418818", "0.64153475", "0.64096636", "0.6382004", "0.6378728", "0.6373465", "0.63165075", "0.6314835", "0.63128144", "0.63030136", "0.62962854", "0.62939835", "0.6284158", "0.62737066", "0.626346", "0.626346", "0.6251645", "0.6232297", "0.621961...
0.0
-1
Take the output of convertWorldToPix and make a region file This region file can then be overlaid and edited by hand (mainly the sky annuli if not provided)
def output_ds9_region_file(reference_image_prefix, object_ids, x, y, r_aper, rsi=None, rso=None, index_offset=1.0): outfile = '{}.reg'.format(reference_image_prefix) if os.path.exists(outfile): print('WARNING: CLOBBERING {}'.format(outfile)) f = open(outfile, 'w') regi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_regfile(userinput, x, y, filename, color='blue', width=2):\n target_dir = userinput['OUTDIR']\n outputfile = target_dir + '/s_extraction/{}'.format(filename)\n\n logging.info('Writing region file {}'.format(filename))\n\n with open(outputfile, 'w') as file:\n file.write('global color=...
[ "0.64486927", "0.62990856", "0.6248389", "0.6173069", "0.6081953", "0.60625273", "0.60624045", "0.5981439", "0.59047073", "0.5865442", "0.58594865", "0.5831441", "0.58112216", "0.5809324", "0.57704157", "0.57330376", "0.57311654", "0.57198143", "0.5707962", "0.5669027", "0.56...
0.5800774
14
Read in ds9 regions from the ref image region file (if it exists) We assume that targets have proper named regions and that comparison stars have integer IDs (e.g. Comps = 1, 2, 3, 4 and Target = WASP148b)
def read_ds9_region_file(filename, fits_file_extension='.f', index_offset=1.0): filename = '{0:s}.reg'.format(filename.split(fits_file_extension)[0]) print('Looking for {0:s}'.format(filename)) try: f = pyregion.open(filename) except FileNotFoundError: print('File not found, do photometr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_new_region_mask():\n nreg = len(region_ind_new)\n# region_mask_file = '/home/ivan/Python/new_REGION_MASK_gx3v5.nc'\n region_mask_file = '/glade/home/emunoz/Python/mapping/model_grid/new_REGION_MASK_gx3v5.nc'\n fpreg = Nio.open_file(region_mask_file, 'r')\n region_mask ...
[ "0.5933103", "0.59109664", "0.5897308", "0.57201207", "0.56979305", "0.5669471", "0.5631514", "0.56129783", "0.56102836", "0.5565435", "0.54927933", "0.548975", "0.54692644", "0.5439447", "0.5394136", "0.5377214", "0.53687364", "0.53686196", "0.52797765", "0.52769166", "0.523...
0.70787835
0
The row principal coordinates.
def row_coordinates(self, X): utils.validation.check_is_fitted(self, 's_') return super().row_coordinates( X=pd.concat( ( X.select_dtypes(exclude=self.categorical_dtypes), self.one_hot_.transform(X.select_dtypes(include=self.categorica...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def principal(self):\n s = [self.voigt[i] for i in range(6)]\n\n # calculate centers\n cxy = (s[0] + s[1]) / 2\n cyz = (s[1] + s[2]) / 2\n czx = (s[2] + s[0]) / 2\n\n # calculate radii\n rxy = ((s[0] - s[1])**2 + (2*s[3])**2)**(1/2) / 2\n ryz = ((s[1] - s[2])...
[ "0.65612423", "0.61977327", "0.6183964", "0.6094005", "0.60902977", "0.6071574", "0.6052542", "0.6049814", "0.6042885", "0.6027983", "0.59492373", "0.5946421", "0.5932701", "0.5921994", "0.5921964", "0.58941716", "0.58855975", "0.58855975", "0.58805096", "0.58790445", "0.5876...
0.0
-1
Basic test with exiting Mockbeat normally
def test_base(self): self.render_config_template( redis=True, redis_host=os.getenv('REDIS_HOST') ) proc = self.start_beat() self.wait_until( lambda: self.output_has(lines=1) ) exit_code = proc.kill_and_wait() assert exit_code ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_base(self):\n self.render_config_template(\n )\n\n proc = self.start_beat()\n self.wait_until(lambda: self.log_contains(\"mockbeat start running.\"))\n proc.check_kill_and_wait()\n assert self.log_contains(\"mockbeat stopped.\")", "def test_base(self):\n ...
[ "0.74822557", "0.7424037", "0.7272021", "0.72507095", "0.7237111", "0.7100177", "0.70620066", "0.6856698", "0.68555576", "0.6697747", "0.65601945", "0.6559444", "0.6486146", "0.6480359", "0.64673686", "0.63501036", "0.6339037", "0.63158", "0.63158", "0.63158", "0.6309682", ...
0.7360069
2
Returns a tuple (key, data) for a the whose ID ends with the token 'suffix' eg. id_ends_with('chapterxii') > 'documenta/titlevii/chapterxii' (first match) (and should be only)
def id_ending_with(self, suffix): node = [(key, data) for key, data in self.traverse() if data['id'].endswith(suffix)] if node: return node[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def id_ends_with(self, id_ends_with):\n\n self._id_ends_with = id_ends_with", "def id_ends_with(self, id_ends_with):\n\n self._id_ends_with = id_ends_with", "def id_ends_with(self, id_ends_with):\n\n self._id_ends_with = id_ends_with", "def id_ends_with(self, id_ends_with):\n\n se...
[ "0.5396958", "0.5396958", "0.5396958", "0.5396958", "0.5396958", "0.53473395", "0.5153632", "0.5140553", "0.48913127", "0.48777017", "0.4877162", "0.485609", "0.48165828", "0.47987914", "0.47977215", "0.47852114", "0.47657573", "0.4761049", "0.473186", "0.47116792", "0.468389...
0.76647204
0
plot the graph to help visualisation
def draw(self): draw(self.graph)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_graph(self) -> None:", "def plot(self):\n pass", "def plot_graph(self) -> None:\n\n nodes_on_graph = self.dw_graph.get_all_v()\n for k, v in nodes_on_graph.items():\n if v.position is None:\n x_rand = random.uniform(0.5, self.dw_graph.v_size())\n ...
[ "0.8727718", "0.8163108", "0.7681799", "0.7636367", "0.76309836", "0.7582863", "0.75598663", "0.74692404", "0.73928803", "0.73710644", "0.7346827", "0.72983426", "0.7279208", "0.7271679", "0.72695357", "0.7259631", "0.7259235", "0.72409356", "0.7235202", "0.72112787", "0.7126...
0.0
-1
parsing from nx graph representation to dict/json
def to_dict(self): result = {"document_name": self.root_node()["meta"], "nodes": []} for node, data in self.traverse(): successors = list(self.successors(node)) predecessors = list(self.predecessors(node)) result["nodes"].append( {"key": node, "content...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_graph(self):\n\t\tnx_graph = nx.Graph()\n\t\tfor node in self.vertices:\n\t\t\tnx_graph.add_node(node)\n\n\t\tfor edge in self.edges:\n\t\t\tnode1, node2, weight = edge\n\t\t\tnx_graph.add_edge(node1, node2, weight=weight)\n\n\t\treturn nx_graph", "def graph():\n return jsonify(app.config[\"jsonifie...
[ "0.655953", "0.6546407", "0.64974105", "0.6468343", "0.64071405", "0.6401486", "0.63908213", "0.6340519", "0.6240928", "0.62059015", "0.6174766", "0.61554074", "0.6124724", "0.6082371", "0.6081923", "0.60808235", "0.6060363", "0.6059518", "0.60420454", "0.6040385", "0.6025191...
0.572193
42
search for nodes whose 'meta' match a given pattern
def search(self, pattern): result = None for node, data in self.traverse(): if pattern in data['meta']: return node, data return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search_by_pattern(self, pattern, key=lambda data: data['meta']):\n result = []\n for node, data in self.traverse():\n if re.search(pattern, key(data), flags=re.VERBOSE):\n result.append([node, data])\n return result", "def retrieve_meta(meta_text):\n\n with o...
[ "0.6359779", "0.6054582", "0.5847992", "0.5576674", "0.55236894", "0.5495992", "0.54890645", "0.54569626", "0.5273985", "0.5238845", "0.5232473", "0.5217748", "0.5207013", "0.5205651", "0.5182594", "0.5180747", "0.5167339", "0.51414347", "0.51159734", "0.5104405", "0.5090397"...
0.7677935
0
Searches for nodes whose 'meta' match a given pattern. Whitespaces in the pattern are ignored. To include whitespaces, use '\s'
def search_by_pattern(self, pattern, key=lambda data: data['meta']): result = [] for node, data in self.traverse(): if re.search(pattern, key(data), flags=re.VERBOSE): result.append([node, data]) return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search(self, pattern):\n result = None\n for node, data in self.traverse():\n if pattern in data['meta']:\n return node, data\n return result", "def retrieve_meta(meta_text):\n\n with open(meta_text) as f:\n meta = f.readlines()\n matchers = ['RADIANC...
[ "0.7267663", "0.5854621", "0.5834561", "0.5595308", "0.5595308", "0.54272485", "0.5408595", "0.53356975", "0.5223814", "0.521578", "0.5161457", "0.5109456", "0.50736016", "0.5072169", "0.50675434", "0.5061934", "0.5032716", "0.4989821", "0.4971602", "0.4934386", "0.49111143",...
0.59036064
1
get all of the ordered text lines composing the document the resulting text should keep intact the structure of the source
def text(self, just_text=False): lines = [] for node, data in self.traverse(): if just_text or data['has_text'] or data['pad']: lines += data['text'] else: lines += [data['meta']] + data['title'] + data['text'] return flatten(lines)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def merging_lines(document_list):\n final_list = []\n first_span = True\n for i, page in enumerate(document_list):\n if i == 10:\n print(\"HERE\")\n page_list = []\n for span in page:\n if first_span:\n page_list.append(span)\n first...
[ "0.6282679", "0.6174512", "0.61076474", "0.60337347", "0.59236604", "0.5919387", "0.5910874", "0.58422077", "0.58250576", "0.578409", "0.57539344", "0.5748657", "0.57432353", "0.5722367", "0.5676792", "0.5672794", "0.56629366", "0.56525177", "0.5639101", "0.56314397", "0.5612...
0.0
-1
returns a generator with the nodes ordered by the time of insertion
def traverse(self, data=True): nodes = sorted(self.graph.nodes(), key=lambda x: key_to_numeric(x)) for node in nodes: yield (node, self.graph.node[node]) if data else node
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pre_order(self):\n for node_data in self._pre_order_helper(self._root):\n yield node_data", "def _timeasc_traversal(self, root):\n return map(int, self.timeasc(root))", "def __gen_keys__(self):\n if self.seed == b'':\n self.seed = urandom(self.seed_size)\n\n ...
[ "0.6137673", "0.61214656", "0.6044213", "0.60115576", "0.5945092", "0.59437174", "0.5911763", "0.58921784", "0.5888375", "0.5860634", "0.5809217", "0.5806329", "0.578895", "0.5747766", "0.57000345", "0.5631553", "0.56208766", "0.5618145", "0.56050706", "0.56010145", "0.558589...
0.5232182
60
Return all leaf nodes of the graph Note that this does not necessarily mean that they will all be paragraphs We're returning all the nodes that do not have predecessors in the direct graph
def leaf_nodes(self, data=True): leaf_nodes = [ node for node in self.graph.nodes() if self.graph.in_degree(node) != 0 and self.graph.out_degree(node) == 0 ] for node in leaf_nodes: yield (node, self.graph.node[node]) if data else node
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def leaf_nodes(self):\n deps = set([\n item for sublist in self.edges.values() for item in sublist\n ]) # Now contains all nodes that contain dependencies.\n return (x for x in self.nodes if x not in deps) # Generator that\n # contains all nodes *without* any dependencies (...
[ "0.775657", "0.7487987", "0.7303196", "0.7146874", "0.70538235", "0.68833375", "0.663359", "0.65542793", "0.6508919", "0.6458122", "0.64562976", "0.6455231", "0.6405333", "0.64006096", "0.63531864", "0.63287926", "0.6294102", "0.6271516", "0.62543935", "0.62504905", "0.621953...
0.6968675
5
Return all paragraphs of the graph These are the ones which have the depth equal to 'max_depth' as detected in the construction of the Doc
def paragraphs(self, data=True): return self.nodes(self.max_depth, data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def score_max_depths(graph, max_depths):\n ###TODO\n pass", "def max_depth(self):\r\n lvl = 1\r\n has_lvl_desc = True\r\n while has_lvl_desc:\r\n num_children = len(self.level_n_descendants(lvl))\r\n if num_children==0:\r\n has_lvl_desc = False\r\n ...
[ "0.5418392", "0.5390383", "0.53330386", "0.5256559", "0.5252129", "0.5224893", "0.5178781", "0.51128185", "0.5104857", "0.50362504", "0.5033652", "0.50065494", "0.49520886", "0.4951647", "0.49241233", "0.49088892", "0.4897008", "0.4875365", "0.48643565", "0.48632002", "0.4844...
0.61820894
0
get maximum depth of the graph
def _max_depth(self): max_depth = 0 for node, data in self.traverse(): max_depth = max(max_depth, data['level']) return max_depth
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def max_depth(self) -> int:\n return pulumi.get(self, \"max_depth\")", "def depth(self):\n return self._max_depth", "def get_max_depth(self):\n return self.MAX_DEPTH", "def max_depth(self) -> int:\n return 0", "def depth(self):\n return max(n.depth for n in self.iternodes...
[ "0.82280046", "0.82237023", "0.8172066", "0.81567633", "0.8010133", "0.79035956", "0.7708579", "0.7676142", "0.75978315", "0.7511025", "0.75060564", "0.7479909", "0.7451953", "0.742769", "0.73627543", "0.7344261", "0.7339484", "0.72891027", "0.727792", "0.7275108", "0.7264026...
0.81646323
3
get first level that is actual populated by content (i.e. is not a padding node)
def _active_depth(self): for n_left, n_right in self.graph.dfs(): if self.node(n_right)['pad'] == 0: return self.node(n_right)['level'] return 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def first(self):\n return self._subtree_first_position(self.root()) if len(self) > 0 else None", "def get_first_node_child(self):\n\n pass", "def first_leaf(tree):\n if 'contents' in tree:\n x = tree['contents'][0]\n return first_leaf(x)\n else:\n return tree", "def f...
[ "0.6759169", "0.6743484", "0.6696154", "0.64812064", "0.63870245", "0.6377569", "0.6280612", "0.6224066", "0.61957824", "0.61690104", "0.6165698", "0.6161429", "0.608813", "0.6081571", "0.60669506", "0.60543215", "0.6043436", "0.6036316", "0.59674424", "0.5955085", "0.5917624...
0.0
-1