query
stringlengths
9
9.05k
document
stringlengths
10
222k
metadata
dict
negatives
listlengths
30
30
negative_scores
listlengths
30
30
document_score
stringlengths
4
10
document_rank
stringclasses
2 values
Returns last digit of a^b
def last_digit(a , b): temp_arr_a = [] temp_arr_b = [] while(a>0): temp_arr_a.append(a%10) a = a//10 while(b>0): temp_arr_b.append(b%10) b = b//10 return LastDigitHelper(temp_arr_a[::-1],temp_arr_b[::-1])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bit_manipulation(self, a: str, b: str) -> str:\n x, y = int(a, 2), int(b, 2)\n while y:\n answer = x ^ y\n carry = (x & y) << 1\n x, y = answer, carry\n return bin(x)[2:]", "def last_digits(x,y,n):\n\tr = modexp(x,y, 10**n)\n\n\t#post processing to make sure we didn't cut off a leadin...
[ "0.64815557", "0.635703", "0.6323173", "0.6261635", "0.62610626", "0.60959", "0.6007518", "0.60021526", "0.59732693", "0.59294915", "0.59172", "0.5874061", "0.5871729", "0.584262", "0.5781348", "0.57368034", "0.57270294", "0.5716488", "0.5714639", "0.57011753", "0.56823134", ...
0.6889433
0
Retrieves the current package running on the device.
def current_package(self) -> str: ext_name = 'mobile: getCurrentPackage' try: return self.assert_extension_exists(ext_name).execute_script(ext_name) except UnknownMethodException: # TODO: Remove the fallback return self.mark_extension_absence(ext_name).execute...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_active_package(self):\n return self.compute", "def package(cls):\n packages = get_packages()\n return packages.modules.get(cls.__module__)", "def get_current_package(self,ignore_error_handle = False):\n message = {}\n step = 'get current package'\n try:\n ...
[ "0.7282246", "0.6776407", "0.6632866", "0.6563965", "0.65178657", "0.64670855", "0.6440218", "0.64176047", "0.64087206", "0.6304794", "0.62999666", "0.6230555", "0.62082034", "0.62060446", "0.6202685", "0.61803627", "0.6140204", "0.6125821", "0.6116732", "0.6083639", "0.60732...
0.77967405
0
Aim is to update streamb by streama using a common key. Results will be in streamc, its format is that of streamb
def main(streama, streamb, streamc): # init global var # datas from streama newida = '' newkeya = '' newdatea = date(MINYEAR, 1, 1) newmnta = '' # datas from streama oldida = '' oldkeya = '' olddatea = date(MINYEAR, 1, 1) oldmnta = '' # datas from streamb newkeyb = '...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mconcat(a, b):\r\n if a is None:\r\n return b\r\n if b is None:\r\n return a\r\n for key in b.keyset:\r\n value=get(b,key)\r\n put(a,key,value)\r\n return a", "def process(stream1, stream2, delimiter, idx1, idx2, show):\n\n def parse(stream, idx):\n \"\"\"\n ...
[ "0.54515636", "0.5139896", "0.513122", "0.5106976", "0.50897145", "0.50897145", "0.5081774", "0.5046647", "0.5000696", "0.49335608", "0.48572096", "0.48555246", "0.48349974", "0.48169935", "0.48108128", "0.4801249", "0.47977075", "0.47940183", "0.47888657", "0.4786144", "0.47...
0.64154863
0
Converts list of star names to the Simbad ID of each star. Useful for comparision with same stars written in different ways. Args
def Simbad_names(star_names, time_pause = 60, n_step = 402): all_names_my_stars = [] count = 1 for star in star_names: result_table = Simbad.query_objectids(star) if result_table != None: names_star_Simbad = result_table['ID'] all_names_my_stars.append(names_star_S...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def idstar(star):\n # query = Gravity.select().where(Gravity.gravity != 0)\n # for g in query:\n # ...: print (g.gravity, g.starid.name, g.starid.pmra)\n # In this case, since the table Gravity is linked to the table Star via starid, we get the name of the star directly using starid.name\n #...
[ "0.5715571", "0.5641292", "0.5482911", "0.54706407", "0.5448561", "0.53510606", "0.5294954", "0.5268628", "0.52538073", "0.5145962", "0.51287305", "0.5111748", "0.5074646", "0.5061919", "0.5060797", "0.5023818", "0.50056607", "0.49366295", "0.49153474", "0.49102843", "0.48934...
0.60841554
0
returns command to ask this tile to build a worker this turn
def build_worker(self) -> str: return "bw {} {}".format(self.pos.x, self.pos.y)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hire_egg_worker(which):\n\n return 'junk'", "def get_command(self, ctx, name):\n if name not in self.daemon.list_actions():\n return None\n\n action = self.daemon.get_action(name)\n\n @wraps(action)\n def command(*args, **kwargs):\n return action(*args, **...
[ "0.57890385", "0.5406742", "0.53898126", "0.53898126", "0.53898126", "0.5364739", "0.5350785", "0.5330255", "0.5305483", "0.5300905", "0.5178551", "0.5172274", "0.51250726", "0.5120834", "0.5104383", "0.50891614", "0.5083659", "0.5077477", "0.50729185", "0.5056625", "0.505224...
0.5417323
1
returns command to ask this tile to build a cart this turn
def build_cart(self) -> str: return "bc {} {}".format(self.pos.x, self.pos.y)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_command(self):\n\n choice = input(\"> \")\n\n if choice == \"q\":\n return \"quit\"\n elif choice.isdigit() and int(choice) in self.model.products_id_list:\n self.product = ProductDetails(choice)\n substitute = self.product.find_substitute()\n ...
[ "0.55698615", "0.5508646", "0.54311943", "0.5328725", "0.5327739", "0.5281372", "0.52217513", "0.5078604", "0.5061011", "0.503337", "0.50004625", "0.49952474", "0.49895182", "0.4984941", "0.4972213", "0.49481794", "0.49228042", "0.49187016", "0.49090078", "0.48990202", "0.489...
0.6008704
0
get cargo space left in this unit
def cargo_space_left(self): return GAME_CONSTANTS["PARAMETERS"]["RESOURCE_CAPACITY"][self.type_str] - self.num_resources
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getCargoSpaceLeft(self):\n spaceused = self.cargo[\"wood\"] + self.cargo[\"coal\"] + self.cargo[\"uranium\"]\n if self.type == UNIT_TYPES.WORKER:\n return GAME_CONSTANTS[\"PARAMETERS\"][\"RESOURCE_CAPACITY\"][\"WORKER\"] - spaceused\n else:\n return GAME_CONSTANTS[\"P...
[ "0.84558314", "0.7005404", "0.65104955", "0.6461634", "0.6446924", "0.61363596", "0.6125196", "0.61117744", "0.61117744", "0.61117744", "0.61097604", "0.60723466", "0.60601735", "0.60502756", "0.5957754", "0.594649", "0.5944935", "0.5906883", "0.5906622", "0.5903146", "0.5901...
0.82059985
1
return the command to transfer a resource from a source unit to a destination unit as specified by their ids
def transfer(self, dest_id, resourceType, amount, logs=None) -> str: if logs is not None: logs.append((self.id, ValidActions.TRANSFER, dest_id)) return "t {} {} {} {}".format(self.id, dest_id, resourceType, amount)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transfer(self,source,target):\n self.__transfer_dict[tuple([source,target])]()", "def execute(self, devices, command_bytes):", "def _get_zfs_send_recv_cmd(self, src, dst):\n return utils.get_rrmgr_cmd(src, dst,\n compression=self.rrmgr_compression,\n ...
[ "0.5478194", "0.5301289", "0.5278881", "0.5159828", "0.51317626", "0.51315296", "0.5104579", "0.4970517", "0.49355325", "0.49082446", "0.49053028", "0.48414853", "0.48381266", "0.4835341", "0.48319343", "0.48268133", "0.480932", "0.48074305", "0.48045364", "0.47864357", "0.47...
0.6102304
0
return the command to build a city right under the worker
def build_city(self, logs=None) -> str: if self.is_cart(): raise ValueError(f"Unit {self.id} is a cart; cannot build a city!") if logs is not None: logs.append((self.id, ValidActions.BUILD, self.pos)) return "bcity {}".format(self.id)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_command(self) -> typing.Optional[str]:\n return self._values.get(\"build_command\")", "def build_command(self) -> typing.Optional[str]:\n return self._values.get(\"build_command\")", "def build_command(self) -> typing.Optional[str]:\n return self._values.get(\"build_command\")", ...
[ "0.59555453", "0.59555453", "0.59555453", "0.56855345", "0.5540091", "0.5530357", "0.55204004", "0.54828805", "0.5480421", "0.5363058", "0.53553057", "0.53334975", "0.53310096", "0.5327887", "0.53257054", "0.5297619", "0.52672607", "0.5239541", "0.5226622", "0.5131584", "0.51...
0.6060829
0
Function that writes all files for all paths of the polyhedre
def createAllFiles(poly, name): allConnections = poly.getAllConnections() allPaths = poly.getPaths() for i in range(len(allPaths)): writeFinal(name + "_" + str(i) +".dot", allConnections, allPaths[i], name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_files(self, basedir):\n outdir = basedir / self.type\n outdir.mkdir(parents=True, exist_ok=True)\n\n for point, row in zip(self.points, self.array):\n filepath = outdir / point\n with filepath.open('w') as f:\n idx = 0\n for ikey in...
[ "0.6619719", "0.66185224", "0.64555454", "0.63866466", "0.6379787", "0.63196236", "0.628272", "0.6251185", "0.62502337", "0.6206444", "0.6203168", "0.6184853", "0.60938925", "0.60918677", "0.60411173", "0.60036546", "0.5994885", "0.5991923", "0.5973439", "0.5973439", "0.59527...
0.7769273
0
Function that creates all image for all paths of the polyhedre
def createAllImageFiles(poly, name) : for i in range(len(poly.getPaths())): fileName = name + "_" + str(i) + ".dot" imgName = name + "_" + str(i) + ".jpg" Command = "neato -Tjpeg " + fileName + " -o " + imgName run(Command, shell=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create(path=\"cubes\",pathIm=\"cubes/img\"):\r\n\tobj_name=createNames(pathImg=pathIm)\r\n\tfor i in obj_name:\r\n\t\tfor j in obj_name[i]:\r\n\t\t\tdest=path+chr(47)+str(i)+\"_\"+str(j)\r\n\t\t\tcreate_mtl(dest+\".mtl\",\"img\"+chr(47)+str(i)+chr(47)+str(j)+\".png\")\r\n\t\t\tcreate_obj(dest+\".obj\",str(i)+\...
[ "0.6484281", "0.6417693", "0.63572615", "0.6268724", "0.62588155", "0.62354445", "0.6176815", "0.6175257", "0.6138654", "0.61066836", "0.6075611", "0.60679376", "0.60361594", "0.59879905", "0.59710187", "0.5912346", "0.5880527", "0.5863448", "0.5860692", "0.58603406", "0.5857...
0.74639696
0
>>> one_lnk = Link(1) >>> flip_two(one_lnk) >>> one_lnk Link(1) >>> lnk = Link(1, Link(2, Link(3, Link(4, Link(5))))) >>> flip_two(lnk) >>> lnk Link(2, Link(1, Link(4, Link(3, Link(5)))))
def flip_two(lnk): if lnk is not Link.empty and lnk.rest is not Link.empty: lnk.first, lnk.rest.first = lnk.rest.first, lnk.first flip_two(lnk.rest.rest)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flip_two_ptr(lnk):\n def helper(lnk, prev):\n if lnk is not Link.empty and lnk.rest is not Link.empty:\n if prev:\n prev.rest = lnk.rest\n temp = lnk.rest\n lnk.rest, temp.rest = lnk.rest.rest, lnk\n helper(lnk.rest, lnk)\n helper(lnk, Non...
[ "0.82952255", "0.67274755", "0.6386259", "0.6071076", "0.6054646", "0.5969344", "0.5818467", "0.57904196", "0.5764759", "0.57519877", "0.5736876", "0.57328045", "0.5708837", "0.56891006", "0.56742984", "0.5659875", "0.5644024", "0.5611128", "0.55798846", "0.5556491", "0.55373...
0.85974514
0
>>> one_lnk = Link(1) >>> flip_two_ptr(one_lnk) >>> one_lnk Link(1) >>> lnk = Link(1, Link(2, Link(3, Link(4, Link(5))))) >>> temp = lnk.rest >>> flip_two_ptr(lnk) >>> temp Link(2, Link(1, Link(4, Link(3, Link(5)))))
def flip_two_ptr(lnk): def helper(lnk, prev): if lnk is not Link.empty and lnk.rest is not Link.empty: if prev: prev.rest = lnk.rest temp = lnk.rest lnk.rest, temp.rest = lnk.rest.rest, lnk helper(lnk.rest, lnk) helper(lnk, None)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flip_two(lnk):\n if lnk is not Link.empty and lnk.rest is not Link.empty:\n lnk.first, lnk.rest.first = lnk.rest.first, lnk.first\n flip_two(lnk.rest.rest)", "def reverse(link):\n if link is Link.empty:\n return \"this linked list is empty\"\n link = Link(link.rest, link.first)\...
[ "0.8235925", "0.7227324", "0.64997506", "0.6399087", "0.6319393", "0.6235773", "0.61662036", "0.6136959", "0.6126622", "0.6113028", "0.6108484", "0.60924876", "0.6082385", "0.6055703", "0.6045684", "0.603583", "0.6023345", "0.6023063", "0.6021659", "0.60038805", "0.6001733", ...
0.9125939
0
Normalize a Channel, set `null` to 0 and the mag to given value.
def normalize(self, mag=1.0): def f(dataset, s, null, mag): dataset[s] -= null dataset[s] /= mag if self.signed: mag = self.mag() / mag else: mag = self.max() / mag self.chunkwise(f, null=self.null, mag=mag) self._null = 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _normalize(self):\r\n self.dataframe['norm_intensity'] = self.dataframe['intensity']\r\n self.dataframe['norm_intensity'] -= self.dataframe['norm_intensity'].min()\r\n self.dataframe['norm_intensity'] /= self.dataframe['norm_intensity'].max() * 0.01", "def normali...
[ "0.608774", "0.60527116", "0.6042676", "0.5887953", "0.5871583", "0.5869871", "0.5858427", "0.5853407", "0.5846617", "0.5843673", "0.57948995", "0.57607955", "0.566544", "0.5645322", "0.56308883", "0.5616104", "0.5607919", "0.5595453", "0.5573436", "0.5570104", "0.55578136", ...
0.7102045
0
Send the browser current game_id
def game_id(): # Use new_game method to start a new game session.clear() session["game_id"] = new_game(engine) print "Creating new game with game_id =", session["game_id"] # Redirect to home page return redirect(url_for("index"))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_game_id(self) -> str:\n return self.game_name_entry.get()", "def get_id():\n global UNIQUE_GAME_ID\n with threadLock:\n UNIQUE_GAME_ID += 1\n return str(UNIQUE_GAME_ID)", "def get_game(request):\n active_game = str(uuid4())\n GAMES[active_game] = Board()\n return {'id': ...
[ "0.6809703", "0.64957577", "0.6255549", "0.6174053", "0.6151177", "0.6024761", "0.60214674", "0.5945353", "0.58871055", "0.58468586", "0.5841496", "0.5824861", "0.57907766", "0.57907766", "0.57907766", "0.5699196", "0.5635471", "0.56036437", "0.5601251", "0.55836695", "0.5514...
0.7166306
0
Create the Rules Page
def rules(): print "Loading Rules" return render_template("rules.html")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_page(self):", "def rules():\r\n section = document.add_section()\r\n new_width, new_height = section.page_height, section.page_width\r\n section.orientation = WD_ORIENT.LANDSCAPE\r\n section.page_width = 10058400\r\n section.page_height = 7772400\r\n \r\n document.add_heading('Sys...
[ "0.6795799", "0.6687149", "0.6018615", "0.5847143", "0.57700336", "0.57147", "0.55924845", "0.55044985", "0.5496599", "0.5455442", "0.5424117", "0.53119", "0.5303927", "0.527854", "0.5263613", "0.52636105", "0.52604467", "0.5227407", "0.52262783", "0.52148724", "0.5205535", ...
0.71557677
0
Split segments into continuous runs of the same color.
def group_segments(segments): group = [] for seg in segments: if not group: group.append(seg) continue last_seg = group[-1] if ( seg.color == last_seg.color and points_equal(last_seg.b, seg.a) ): group.append(seg) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_segments(old_seg_ends, B):\n new_segment_ends = []\n for q in range(0, B.size):\n new_ends = list(np.linspace(old_seg_ends[q], old_seg_ends[q + 1], B[q] + 1))\n new_segment_ends.extend(new_ends[:-1])\n new_segment_ends.extend([1])\n new_segment_ends = np.asarray(new_segment_ends...
[ "0.6517769", "0.59771734", "0.5971747", "0.58473897", "0.5816569", "0.569773", "0.5664909", "0.5612116", "0.5564599", "0.55312043", "0.55094224", "0.5504251", "0.550151", "0.5499465", "0.54803205", "0.54728925", "0.5412093", "0.541105", "0.5402969", "0.54021615", "0.54021615"...
0.66077226
0
Submit job to compute the PageRank for each vertex in the graph. Return an object that tracks the execution of this job, from which a model with total PageRank as well as the PageRank value for each vertex in the graph is obtained.
def submit_training_job(env, graph, reset_probability=0.15, threshold=1e-2, max_iterations=20, _single_precision=False): _mt._get_metric_tracker().track('distributed.toolkit.graph_analytics.pagerank.submit_training_job') if not isinstance(graph, _SGraph): raise TypeError('graph input must b...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pagerank(self, alpha=0.85):\n try:\n self.logger.info('正在计算网络的PageRank值 ...')\n return self.order_dict(nx.pagerank(self.G, alpha=alpha), index=1)\n except Exception as e:\n self.logger.error(\"计算失败,原因:{0}\".format(e))", "def rank(self):\n return self.lib....
[ "0.54880756", "0.5422568", "0.53424877", "0.53228563", "0.53124905", "0.5295266", "0.5288873", "0.5284805", "0.52695876", "0.52413964", "0.52405745", "0.5168447", "0.5134135", "0.51277477", "0.51068217", "0.51020676", "0.5087875", "0.50740635", "0.5036986", "0.5033597", "0.50...
0.5994397
0
accept a list of fields (field_list), then print out the results from the query.
def cli_print_record( field_list, showid=False): debug("cli_print_record(%s)" % field_list) try: raw_record_list = api.find_records(field_list) except NoRecordsFound as error: print "No records found for: %(field_list)s, %(error)s" % locals() return False except InvaildQuery as ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_some(self,table,field_list,**query_dict):\n start_sql = 'SELECT '\n sql = ''\n query_sql = ''\n for field in field_list: start_sql += field + ',' \n start_sql = start_sql[0:-1] + ' FROM %s WHERE ' % (table)\n try:\n if query_dict:\n for i...
[ "0.6308946", "0.62454486", "0.6072988", "0.598985", "0.5895528", "0.58903146", "0.5818416", "0.57984674", "0.57883525", "0.57729805", "0.57577854", "0.5754459", "0.57458764", "0.5735312", "0.5730177", "0.5688709", "0.56719226", "0.56098896", "0.5580909", "0.55553097", "0.5553...
0.7122904
0
accept a list of fields (field_list), and delete all the records that the query matches.
def cli_delete_record(field_list): try: api.delete_record(field_list) except NoRecordsFound as error: print "%(error)s" % locals() return
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def delete_records(self, table_name: str, conditions_list=None):\n if conditions_list:\n conditions = LemkPgUtils.get_conditions(conditions_list)\n query = f\"\"\"DELETE FROM {table_name} WHERE {\" \".join(conditions)}\"\"\"\n else:\n query = f\"\"\"DELETE FROM ...
[ "0.6383642", "0.62998796", "0.62411", "0.61262584", "0.6087179", "0.60596013", "0.59672195", "0.5961191", "0.59508616", "0.5862673", "0.5853231", "0.58176136", "0.57552975", "0.5755074", "0.57523143", "0.57236516", "0.5698125", "0.56866366", "0.56681955", "0.5665122", "0.5658...
0.710338
0
accept a field_list and record_data. All records that match the queries in field_list will be updated with record_data.
def cli_update_record(field_list, record_data): api.update_record(field_list, record_data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _update(self, data: Dict[str, Any], fields_to_modify: List[str]):\n pass", "def update_records(self, records, data):\n if not records or not len(records):\n raise Exception(\"records should not be null\")\n elif type(records) != list:\n raise Exception(\n ...
[ "0.67938155", "0.6716241", "0.6430248", "0.6369891", "0.6217489", "0.6074803", "0.6074803", "0.60155153", "0.6004583", "0.59513104", "0.58645195", "0.58612293", "0.5861092", "0.5852638", "0.57965606", "0.5770256", "0.5687764", "0.5644667", "0.5629939", "0.5596801", "0.5596036...
0.7923878
0
Return a list of saved queries.
def cli_saved_queries_list(): query_list = None try: query_list = api.saved_queries_list() except NoRecordsFound as error: print "%(error)s" % locals() return for saved_query in query_list: print "%s: %s" % (saved_query['name'], ' '.join(saved_query['query_data']))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all():\n return SavedQuery.get_all()", "def queries(self):\n return self.__queries", "def getQueries(self):\r\n\t\tp=[]\r\n\t\tfor pa in self.session.query(Query):\r\n\t\t\tp.append(pa)\r\n\t\treturn p", "def queries(self):\n request = Request(method=\"get\", endpoint=\"/query/curren...
[ "0.7667576", "0.7585832", "0.75617886", "0.712175", "0.67487055", "0.6739182", "0.6725898", "0.66023", "0.64973307", "0.64898187", "0.64600664", "0.63632965", "0.63412994", "0.6326499", "0.63150954", "0.62393606", "0.62237144", "0.62087446", "0.6208423", "0.6192179", "0.61645...
0.8412328
0
Add a new saved query.
def cli_saved_queries_add(query_name, query_data=None): api.saved_queries_add(query_name=query_name, query_data=query_data) print "Create a saved query called: %(query_name)s WHERE %(query_data)s" % locals()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sql_query(self, new_query):\n self._project.sql_query = new_query", "def append(query):\n # type: (str) -> bool\n if not query or not SEARCH_SAVED:\n return False\n searches = retrieve()\n if query not in searches:\n searches.append(query)\n save(searches)", "def add...
[ "0.66554177", "0.6546092", "0.63932824", "0.63851625", "0.63511246", "0.6313394", "0.63000375", "0.6286107", "0.6180346", "0.61383593", "0.6059474", "0.6016288", "0.6015879", "0.6008801", "0.6008801", "0.6008801", "0.6001739", "0.5991288", "0.59602004", "0.5895817", "0.589522...
0.7951758
0
Set command line arguments to be taken from user
def command_line_arguments(): _parser.add_argument('-l', '--list', nargs='+', help='<Required> Set flag', required=True) _parser.add_argument("-A", "--access", required=True, help="access to host => grant/revoke")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_args():\n # Initialise argparse object\n parser = argparse.ArgumentParser(description='Set some arguments for our script')\n # Add some arguments, elements are: short form name, long form name, type of input expected\n # default value if you don't set an argument, help string (shown if you run ...
[ "0.7202128", "0.6717831", "0.6680046", "0.6588375", "0.64948684", "0.64900154", "0.6443785", "0.6419259", "0.6415527", "0.63784754", "0.63747734", "0.63634557", "0.63517284", "0.6348229", "0.63337815", "0.6329227", "0.632307", "0.6321973", "0.63211393", "0.63144726", "0.62946...
0.6827972
1
get provided host credentials
def get_host_credentials(hostname, all_json): return all_json.get(hostname)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _config_credentials_get():\n user = input(\"username:\")\n password = getpass.getpass()\n url = input(\"url:\")\n return user, password, url", "def get_credentials(server: str) -> Tuple[str, int, str]:\n\n try:\n host, port, passwd = Credentials.from_string(server)\n except InvalidCr...
[ "0.73745304", "0.67990994", "0.6733025", "0.6724817", "0.6701221", "0.6673382", "0.6610663", "0.6610663", "0.65922374", "0.6591646", "0.65898424", "0.64869344", "0.64693296", "0.6456553", "0.6452662", "0.64463603", "0.6443417", "0.63946605", "0.6389267", "0.6388173", "0.63849...
0.68818766
1
This endpoint connects to redis server and gets the matched keywords
def suggest(is_authenticated, is_authorized): if not is_authorized: return render_template("unauthorized_user.html"), 401 data_json = request.get_json() payload_data = {} payload_data['query'] = data_json.get('query') for field in payload_data: response_msg = check_field_validatio...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search(tcp, data):\n\n # send SEARCH keyword to server and print results\n tcp.sendMessage('SEARCH ' + data[0])\n print tcp.receiveMessage()", "def query(self, key: int, *args, **kwargs) -> Optional[bytes]:\n result = []\n\n with self.get_add_handler() as redis_handler:\n for _key...
[ "0.58292973", "0.5697416", "0.5663478", "0.5642598", "0.5598828", "0.5536215", "0.5508933", "0.5468474", "0.5466872", "0.5465162", "0.53629035", "0.53525054", "0.5346393", "0.53394216", "0.53375626", "0.5337224", "0.53328866", "0.5328069", "0.5277627", "0.5260911", "0.5240561...
0.59811133
0
Checks rows, columns and diagonals for a winner and returns player name if winner found
def check_winner(self): for row in self.board.values(): if all([mark == "x" for mark in row]): return self.player_1 elif all([mark == "o" for mark in row]): return self.player_2 # checks every column for i in range(3): first_ro...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def winner_found(self):\n\n first_row = self.find_three_in_row([self._board[0][0], self._board[0][1], self._board[0][2]])\n second_row = self.find_three_in_row([self._board[1][0], self._board[1][1], self._board[1][2]])\n third_row = self.find_three_in_row([self._board[2][0], self._board[2][1],...
[ "0.7850276", "0.7844686", "0.78040963", "0.77991927", "0.7786862", "0.7772859", "0.7772767", "0.775103", "0.77378315", "0.77017176", "0.769776", "0.7691695", "0.76738596", "0.7589716", "0.7542575", "0.7541765", "0.7540349", "0.753474", "0.75276124", "0.7417552", "0.74025553",...
0.8051105
0
A heuristic function estimates the cost from the current state to the nearest goal in the provided SearchProblem. This heuristic is trivial.
def myHeuristic(state, problem=None): #print("myHeuristic") #print(problem.isGoalState((1,1))) xy2 = problem.goal return abs(state[0] - xy2[0]) + abs(state[1] - xy2[1])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def uniformCostSearch(problem):\n # Initialization\n startState = problem.getStartState()\n\n if problem.isGoalState(startState):\n return [] # No action needed\n\n closedSet = set()\n queue = util.PriorityQueue()\n queue.push((startState, None, 0), 0)\n cameFrom = dict() # Stores most ...
[ "0.7427332", "0.72896004", "0.7284291", "0.72579", "0.71861756", "0.7181096", "0.7158981", "0.7101936", "0.7081954", "0.7069965", "0.70446587", "0.7041991", "0.70378923", "0.7026378", "0.70171255", "0.7001647", "0.6998071", "0.69829196", "0.6965342", "0.6959571", "0.6958475",...
0.7400617
1
Arranges for a program to run as if in an xterm. The program is not run directly within the xterm, but with its input and output redirected to the xterm. The `name` specifies the term to use, which may already be running.
def get_xterm(name, geom="80x30+0+0"): if name in _terminals: p, (files, stdin, stdout, stderr) = _terminals[name] else: p, files = start_display_xterm(name, geom) stdin = open(files[0]) stdout = open(files[1], "w") stderr = open(files[2], "w") _terminals[name] = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_in_xterm(name, cmd, geom=\"80x30+0+0\", cwd=None,\n useStdin=False):\n p, (files, stdin, stdout, stderr) = get_xterm(name, geom)\n if useStdin:\n stdin = subprocess.PIPE\n args = (cmd,) + files\n p = _run(args=\"exec %s\" % cmd, shell=True, stdin=stdin, std...
[ "0.72731894", "0.6425588", "0.6072298", "0.59669644", "0.54634476", "0.5459218", "0.53708595", "0.53413415", "0.5335392", "0.5267892", "0.52526206", "0.5241784", "0.51542586", "0.5081368", "0.50617504", "0.4828752", "0.48046297", "0.4778131", "0.47717136", "0.47596747", "0.47...
0.6771185
1
Start a process within a terminal. This starts a separate process so that its output and appears in a separate terminal. If necessary an Xterm will be started, but if the `name` refers to an Xterm that ProcMan has already started then that terminal is reused.
def run_in_xterm(name, cmd, geom="80x30+0+0", cwd=None, useStdin=False): p, (files, stdin, stdout, stderr) = get_xterm(name, geom) if useStdin: stdin = subprocess.PIPE args = (cmd,) + files p = _run(args="exec %s" % cmd, shell=True, stdin=stdin, stdout=stdout, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_display_xterm(title, geom=\"120x50+0+0\"):\n # Run sleep as the xterm's process rather than the normal shell.\n # NOTE: Anything that last for more than 10 days will break ;)\n p = subprocess.Popen(args=(\"xterm\",\n \"-T\", title,\n \"-geometry\", geom,\n # \"-l\", \"-lf\",...
[ "0.6421115", "0.6323413", "0.6249955", "0.6134532", "0.6110877", "0.6107632", "0.6044274", "0.59998924", "0.5938184", "0.5780604", "0.5651973", "0.5432514", "0.5416875", "0.5406733", "0.5402068", "0.540136", "0.5381226", "0.5286359", "0.5259668", "0.52372444", "0.52203286", ...
0.65523607
0
Starts an Xterm that can be used for redirection. The approach that we use is to run an XTerm with 'sleep 10d' as the program it should execute (i.e. we give it 'e sleep 10d'. This means that there should be a ``/usr/bin/sleep`` running as the child of the XTerm, which will have its STDIN, STDOUT and STDERR attaced to ...
def start_display_xterm(title, geom="120x50+0+0"): # Run sleep as the xterm's process rather than the normal shell. # NOTE: Anything that last for more than 10 days will break ;) p = subprocess.Popen(args=("xterm", "-T", title, "-geometry", geom, # "-l", "-lf", "%s.log" % (title.repl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_xTerm(self):\n path = os.path.normpath(self.pXterm)\n os.system('start \"Toto\" /d \"%s\"' % path)", "def run_in_xterm(name, cmd, geom=\"80x30+0+0\", cwd=None,\n useStdin=False):\n p, (files, stdin, stdout, stderr) = get_xterm(name, geom)\n if useStdin:\n ...
[ "0.6997668", "0.6861239", "0.6433669", "0.6050429", "0.59457225", "0.58234394", "0.57922614", "0.5637698", "0.5502042", "0.5352155", "0.53459644", "0.5345631", "0.52963144", "0.52610123", "0.5218999", "0.5180862", "0.5136395", "0.51340973", "0.5131129", "0.51257503", "0.50877...
0.7804727
0
Stop all the processes that are in the `procSet`. First any still running processes are sent SIGTERM then, if still running after 3 seconds, a SIGKILL is delivered.
def _stopProcessSet(procSet): # Send a SIGTERM to all (still running) processes. finished = {} needToWait = False for i, p in enumerate(procSet): if p.poll() is not None: finished[p] = None continue needToWait = True try: if platformType == "w...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def kill_processes(self):\n for proc in self.processes:\n if proc['proc'].poll() is not None:\n proc['proc'].terminate()", "def stopProcesses(*args):\n _stopProcessSet(_running)", "def stop(self):\n for process in self.process:\n process.stop()", "def sto...
[ "0.760437", "0.7129253", "0.71260667", "0.7077345", "0.69477403", "0.6945782", "0.6783743", "0.67598736", "0.6745251", "0.6736421", "0.6736421", "0.66943616", "0.66538376", "0.66531056", "0.66427165", "0.6602587", "0.65193135", "0.6468882", "0.64296544", "0.642096", "0.640845...
0.8264156
0
An alternative to os.system that runs in a new process group This uses the subprocess module to run a command in a similar manner to os.system, but the subprocess runs in its own process group. There are
def system_grp(cmd): p = subprocess.Popen(cmd, shell=True, preexec_fn=lambda:os.setpgrp()) try: return os.waitpid(p.pid, 0) finally: _killGrp(p)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def spawn(*command: Strings, **resources: int) -> None:\n current = Invocation.current\n\n def _run_exec(parts: List[str]) -> Awaitable:\n return asyncio.create_subprocess_exec(*parts, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE)\n\n await current.done(current.run_action(\"...
[ "0.6302876", "0.6268063", "0.6222188", "0.62070966", "0.61652493", "0.61190146", "0.6034322", "0.6029597", "0.60274696", "0.59873176", "0.597094", "0.5961691", "0.5948557", "0.5945869", "0.5926003", "0.5890027", "0.5826783", "0.58263457", "0.5808363", "0.5808363", "0.5808363"...
0.6964251
0
Remove tokens (PAD) from text
def remove_tokens(self, text): return text.replace(self.PAD_TK, "").replace(self.UNK_TK, "")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_punct(self,text):", "def pad_punctuation(text):\n\n text = re.sub(r\"([!\\\"#$%&\\'()*+,-./:;<=>?@\\[\\\\\\]^_`{|}~])\", r\" \\1 \", text)\n text = re.sub(r\"\\s{2,}\", \" \", text)\n return re.sub(r\"(<)\\s(\\w+)\\s(/)\\s(>)\", r\"\\1\\2\\3\\4\", text, re.I | re.M) # keep special tokens int...
[ "0.7152915", "0.6991101", "0.6867556", "0.6745236", "0.6733392", "0.6723463", "0.6695939", "0.66440445", "0.66368353", "0.6634762", "0.6600727", "0.6578465", "0.65717447", "0.6557954", "0.6538209", "0.65295035", "0.65250766", "0.65060663", "0.6466262", "0.643882", "0.643882",...
0.8181711
0
Allow the editors and users group to view the workstation.
def assign_workstation_permissions(self): perm = f"view_{Workstation._meta.model_name}" for group in [self.users_group, self.editors_group]: workstations = get_objects_for_group( group=group, perms=perm, klass=Workstation ) if ( self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_display(self, course, settings, is_user_authenticated, is_user_staff): # pylint: disable=unused-argument\r\n return True", "def enableWorkspace(self):\n # enable tabs\n for tabId in xrange( self.tab.count() ):\n doc = self.tab.widget(tabId)\n doc.setEnabled(Tru...
[ "0.58589333", "0.56498307", "0.5620146", "0.5602444", "0.55552506", "0.5548771", "0.55228484", "0.5475922", "0.5473233", "0.5449073", "0.543679", "0.54311645", "0.54066074", "0.54066074", "0.53920794", "0.5369299", "0.5365513", "0.53626275", "0.53398925", "0.53253734", "0.530...
0.70389026
0
Returns The most recent container image for this algorithm
def latest_ready_image(self): return ( self.algorithm_container_images.filter(ready=True) .order_by("-created") .first() )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_latest_image():\n return sqldb.get_latest_image()", "def get_oldest_image():\n return sqldb.get_oldest_image()", "def most_recent_image(self, shape):\n size = np.array(shape).prod()\n arr = np.ascontiguousarray(np.zeros(size, dtype=np.int32))\n self.lib.GetMostRecentImage(arr...
[ "0.7029266", "0.6995048", "0.69461316", "0.69450504", "0.6870035", "0.6715748", "0.6448968", "0.6362757", "0.6305601", "0.62002623", "0.6162885", "0.61494726", "0.6136684", "0.61160696", "0.6103054", "0.6093062", "0.6027537", "0.59714675", "0.59640044", "0.595704", "0.594172"...
0.7893187
0
Returns the default workstation, creating it if it does not already exist.
def default_workstation(self): w, created = Workstation.objects.get_or_create( slug=settings.DEFAULT_WORKSTATION_SLUG ) if created: w.title = settings.DEFAULT_WORKSTATION_SLUG w.save() return w
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def default():\n return DefaultSwh.default()", "def GetDefaultWiredNetwork(self):\n config = ConfigParser.ConfigParser()\n config.read(self.wired_conf)\n profileList = config.sections()\n for profile in profileList:\n if config.has_option(profile, \"default\"):\n ...
[ "0.64564544", "0.6380634", "0.6099718", "0.5942832", "0.5869021", "0.58102024", "0.5772783", "0.5761062", "0.57277817", "0.56636065", "0.5655392", "0.56540525", "0.5607993", "0.56071055", "0.5588896", "0.5576455", "0.5570802", "0.55385363", "0.5522304", "0.55080473", "0.54978...
0.8310973
0
A list_display column containing a checkbox widget.
def action_checkbox(self, obj): if self.check_concurrent_action: return helpers.checkbox.render(helpers.ACTION_CHECKBOX_NAME, force_str("%s,%s" % (obj.pk, get_revision_of_object(obj)))) else: # pragma: no cover return super().action_che...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_list_display(self, request):\n list_display = []\n for field_name in self.list_display:\n try:\n db_field = self.model._meta.get_field(field_name)\n if isinstance(db_field, BooleanField):\n field_name = boolean_switch_field(db_field)...
[ "0.6194315", "0.5683853", "0.5649223", "0.56066346", "0.55812025", "0.5547091", "0.52968127", "0.52922386", "0.5250746", "0.523286", "0.52301085", "0.52169627", "0.51726454", "0.51695156", "0.51318824", "0.51318824", "0.5123294", "0.51006347", "0.50877786", "0.50861514", "0.5...
0.57720435
1
Returns the ManagementForm instance for this FormSet.
def _management_form(self): if self.is_bound: form = ConcurrentManagementForm(self.data, auto_id=self.auto_id, prefix=self.prefix) if not form.is_valid(): raise ValidationError('ManagementForm data is missing or has been tampere...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def management_form(self):\n if self.is_bound:\n form = AttachmentManagementForm(self.data, auto_id=self.auto_id, prefix=self.prefix)\n if not form.is_valid():\n raise ValidationError('ManagementForm data is missing or has been tampered with')\n else:\n ...
[ "0.71396756", "0.66645527", "0.66645527", "0.63575435", "0.6231655", "0.62000716", "0.61292356", "0.6125592", "0.6120834", "0.6112439", "0.6102003", "0.60750073", "0.5939128", "0.5879666", "0.58429885", "0.57521427", "0.5715844", "0.56427836", "0.557819", "0.5555635", "0.5554...
0.7361751
0
compute mirrored point to a plane
def mirror_point_to_plane(point, plane): assert isinstance(plane, cg3d_plane.CGPlane) pn, norm = plane.get_point_and_normal() norm.normalize() return point - 2.0 * ((point - pn) * norm) * norm
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mirror_point_point(point, mirror):\n return add_vectors(mirror, subtract_vectors(mirror, point))", "def invert_point_on_plane(point, plane):\n _, _, proj = project_point_to_plane(point, plane)\n\n u, v = proj[0][1]\n return u, v", "def project_onto_plane(self,z):\n U=self.U\n Q=se...
[ "0.71565664", "0.67760986", "0.6685388", "0.6677545", "0.66611445", "0.6372813", "0.63392705", "0.62583184", "0.6253109", "0.61372876", "0.612526", "0.612526", "0.6121148", "0.6121148", "0.6113271", "0.6097133", "0.6086039", "0.6075026", "0.605341", "0.6046495", "0.5969498", ...
0.76001906
0
compute angle between two vectors, measured in radians within [0, pi] if v3 is not provided measured in radians within [0, 2pi) if v3 is provided
def compute_angle_v2v(v1, v2, v3=None): alpha = math.acos(dot_product(v1, v2) / (vlength(v1)*vlength(v2))) if v3 is not None: cross = cross_product(v2, v1) if dot_product(cross,v3) > 0.0: return 2*math.pi-alpha return alpha
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calc_angle(v1, v2, v3):\n v1 = v1 - v2\n v3 = v3 - v2\n return v1.angle(v3)", "def angleBetweenVectors(v1, v2):\n v2Size = vectorLength(v2)\n if not v2Size:\n theta = 0.0\n else:\n theta = math.acos(dotProduct(v1, v2) / v2Size)\n return theta", "def angle(v1: Vector, v2: ...
[ "0.84741956", "0.8296164", "0.8205863", "0.8055873", "0.805562", "0.80314547", "0.7992834", "0.7979169", "0.7962801", "0.795649", "0.79424447", "0.7937237", "0.79015785", "0.7883824", "0.7839015", "0.78255475", "0.7810004", "0.7809378", "0.77991074", "0.7781774", "0.7773379",...
0.88554674
0
This method is use to connect the ElasticSearch server
def connect_elasticsearch(): _es = None # create an instance of elasticsearch and assign it to port 9200 _es = Elasticsearch([{'host': 'localhost', 'port': 9200}]) _es.cluster.health(wait_for_status='yellow', request_timeout=1) # pings the server and returns True if gets connected. if _es.ping...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connect_elasticsearch(ip = \"localhost\"):\n _es = None\n _es = Elasticsearch([{'host': ip, 'port': 9200}])\n if _es.ping():\n print('Succesfully Connected')\n else:\n print('Failed to connection')\n return _es", "def _init_es(self):\n es = Elasticsearch([{'host': elastic_...
[ "0.7927826", "0.7733264", "0.7659889", "0.7570665", "0.7431623", "0.7340576", "0.7242035", "0.7060697", "0.6873925", "0.68355966", "0.67021406", "0.665547", "0.6562014", "0.65527004", "0.65390545", "0.6489188", "0.6444184", "0.6411389", "0.636623", "0.63366604", "0.6314665", ...
0.8208195
0
It should have an AddLabwareDefinitionRequest model.
def test_add_labware_request(well_plate_def: models.LabwareDefinition) -> None: request = AddLabwareDefinitionRequest( definition=well_plate_def, ) assert request.definition == well_plate_def
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def test_add_labware_implementation(\n well_plate_def: models.LabwareDefinition,\n mock_handlers: AsyncMock,\n) -> None:\n request = AddLabwareDefinitionRequest(\n definition=well_plate_def\n )\n\n impl = request.get_implementation()\n result = await impl.execute(mock_handlers)\n\n ...
[ "0.6190147", "0.6027513", "0.5921026", "0.58792675", "0.5688149", "0.5624537", "0.55538905", "0.5538914", "0.5526585", "0.5387325", "0.53617215", "0.52914256", "0.5254577", "0.51942605", "0.5173082", "0.51148427", "0.5098331", "0.5093142", "0.50807995", "0.5037279", "0.503200...
0.7245749
0
It should be have an AddLabwareDefinitionResult model.
def test_add_labware_result() -> None: result = AddLabwareDefinitionResult( loadName="loadname", namespace="ns", version=1, ) assert result.loadName == "loadname" assert result.namespace == "ns" assert result.version == 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_add_labware_request(well_plate_def: models.LabwareDefinition) -> None:\n request = AddLabwareDefinitionRequest(\n definition=well_plate_def,\n )\n\n assert request.definition == well_plate_def", "async def test_add_labware_implementation(\n well_plate_def: models.LabwareDefinition,\n ...
[ "0.6378661", "0.6378401", "0.6012059", "0.58740896", "0.541192", "0.5409955", "0.54081714", "0.51540506", "0.5104484", "0.50718534", "0.5071431", "0.50662804", "0.500971", "0.49539307", "0.49170685", "0.49033558", "0.49006936", "0.485272", "0.4847301", "0.48120546", "0.479319...
0.6950073
0
Test map state initalisation
def testInit(self): map_state = MapState(self.event_manager) self.assertEqual(map_state.event_manager, self.event_manager) self.assertTrue(map_state in self.event_manager.listener_groups["default"].listeners) self.assertEqual(map_state.occupied_sectors_by_actor_id, {}) self.asser...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_default_map_copy(self):\n self.assertEqual(_DEFAULT_MAP[\"initialViewState\"][\"latitude\"], 0)\n\n st.map(df1)\n self.assertEqual(_DEFAULT_MAP[\"initialViewState\"][\"latitude\"], 0)", "def testMapConstructor(self):\n # We only use one map type since they all share the same impl...
[ "0.7265246", "0.69092846", "0.6823226", "0.6821895", "0.67803544", "0.66519034", "0.6625274", "0.6577769", "0.65546983", "0.65419436", "0.65352696", "0.65162754", "0.64886796", "0.6487898", "0.6458597", "0.6433869", "0.64280206", "0.6424503", "0.6423329", "0.6420677", "0.6392...
0.79490566
0
Test charactor place notification
def testCharactorPlaceNotification(self): map_state = MapState(self.event_manager) charactor = Charactor(self.event_manager) charactor.sector = Sector() charactor_place_event = CharactorPlaceEvent(charactor) self.event_manager.post(charactor_place_event) self.assertEqual(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_actor_matches_activity(self):", "def setUp(self):\n self.message = \"notification message\"", "def test_if_fires_on_zone_appear(self):\n assert setup_component(self.hass, automation.DOMAIN, {\n automation.DOMAIN: {\n 'trigger': {\n 'platform':...
[ "0.59219193", "0.5917184", "0.590566", "0.57799864", "0.5739272", "0.56696534", "0.56668067", "0.5664857", "0.56487775", "0.5569228", "0.5566681", "0.5528", "0.5517465", "0.5512968", "0.5508632", "0.54891986", "0.54885614", "0.5478166", "0.54666233", "0.54548526", "0.54514325...
0.7563159
0
Test free section action notification
def testFreeSectorActionNotification(self): map_state = MapState(self.event_manager) sector = Sector() self.actionExecuted = False #TODO: this is no good def function(sector_is_free): if sector_is_free: self.actionExecuted = True callback_func...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_section_change(self):\n form = ComplaintActions(\n initial=self.initial_values,\n data={**self.initial_values, 'assigned_section': 'VOT'}\n )\n\n self.assertEqual(form.errors, {})\n self.assertCountEqual(form.get_actions(), [\n ('Assigned sectio...
[ "0.6198999", "0.5610769", "0.55951947", "0.54828197", "0.5441922", "0.54344755", "0.54324454", "0.5429805", "0.54294246", "0.5427339", "0.5427339", "0.54259884", "0.54064876", "0.5392552", "0.53608054", "0.53546816", "0.53256404", "0.53256404", "0.5313559", "0.5311197", "0.53...
0.5678359
1
Set grid from unstructured_grid.UnstructuredGrid instance
def set_grid(self,ug): self.grd=ug self.set_topology()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def grid(self, grid):\n\n self._grid = grid", "def _load_grid(self):\n\n grid_metrics = ['nbe', 'ntsn', 'nbsn', 'ntve', 'nbve', 'art1', 'art2', 'a1u', 'a2u']\n grid_variables = ['lon', 'lat', 'x', 'y', 'lonc', 'latc', 'xc', 'yc',\n 'h', 'siglay', 'siglev']\n\n ...
[ "0.70924187", "0.61134106", "0.5965736", "0.5831968", "0.5830156", "0.58101654", "0.5759747", "0.56962466", "0.5693362", "0.5683724", "0.56670326", "0.56269586", "0.5619845", "0.5611844", "0.5603769", "0.551005", "0.5500384", "0.5470164", "0.54357785", "0.54238737", "0.539154...
0.70702094
1
start and end should be datetime.datetime instance start+ (2003, 1, 1) end less then today save the data on db/start+end.json
def get_between(self, start, end): now = datetime.now() now = datetime(now.year, now.month, now.day) assert isinstance(start, datetime), 'start need to be datetime instance' assert isinstance(end, datetime), 'end need to be datetime instance' assert start < end, 'start n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def startend(start,end):\n \n All_temps = session.query(func.min(Measurement.tobs), func.avg(Measurement.tobs), func.max(Measurement.tobs)).\\\n filter(Measurement.date >= start).filter(Measurement.date <= end).all()\n \n session.close()\n\n return jsonify(All_temps)\n\n return json...
[ "0.7291892", "0.7013067", "0.67804277", "0.6715123", "0.6580593", "0.65523016", "0.6548323", "0.6479772", "0.6474213", "0.64688563", "0.6401303", "0.63979715", "0.6366458", "0.63545704", "0.6302838", "0.6266598", "0.6201307", "0.61916107", "0.6191002", "0.61574227", "0.614303...
0.7089704
1
A player func that can be used in the play_game method. Given a board state it chooses a move randomly from the valid moves in the current state.
def random_player(board_state, _): moves = list(available_moves(board_state)) return random.choice(moves)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def random_strategy(player, board):\n return random.choice(Othello.legal_moves(player, board))", "def move_random(self, board):\n self.get_moves(board.board)\n return random.choice(self.available_moves)", "def randomMove(board):\r\n go = True\r\n while go:\r\n y = random.randint(0...
[ "0.7818172", "0.7593907", "0.73932165", "0.7253854", "0.72194034", "0.7201982", "0.7074549", "0.7062782", "0.70347655", "0.70231247", "0.6997784", "0.69781554", "0.6972281", "0.69547147", "0.6952076", "0.69505334", "0.6949678", "0.6943139", "0.69346225", "0.6917967", "0.68817...
0.87458694
0
shape of the whole domain with the halo points.
def shape_halo(self): return [c.size for c in self.coords_halo]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shape_with_halo(self):\n # TODO: Drop me after the domain-allocation switch, as this method\n # will be provided by the superclass\n return tuple(j + i + k for i, (j, k) in zip(self.shape_domain, self._halo))", "def shape(self):", "def shape(self):", "def shape(self) -> Shape:", "d...
[ "0.7041785", "0.6348338", "0.6348338", "0.6217209", "0.60234183", "0.59201473", "0.5863797", "0.57955235", "0.5774673", "0.5743306", "0.57097733", "0.5701146", "0.5701146", "0.56974775", "0.5685528", "0.56634617", "0.56310666", "0.56310666", "0.5606582", "0.55863523", "0.5581...
0.6829687
1
x component of the coordinates in the interior domain.
def x(self): return self.coords[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def x_coord(self):\n\n return self.x0 + np.arange(self.nx) * self.dx", "def x(self):\n return self._coords[0]", "def x(self):\n if self._x is None:\n self.compute_coordinates()\n return self._x", "def get_x(self):\n return self.coords[0]", "def Getxcoord(self):...
[ "0.8358697", "0.8154594", "0.8109607", "0.8066341", "0.8036693", "0.7739915", "0.7691257", "0.7688244", "0.7548885", "0.7508032", "0.74587315", "0.74127597", "0.7358614", "0.73565143", "0.7294545", "0.7292517", "0.7270111", "0.72684973", "0.72265565", "0.72084564", "0.7204393...
0.8181522
1
y component of the coordinates in the interior domain.
def y(self): return self.coords[1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def y_coord(self):\n\n return self.y0 + np.arange(self.ny) * self.dy", "def y(self):\n return self._coords[1]", "def y(self) -> int:\n return self.data.y_centre >> 4", "def get_y(self):\n return self.coords[1]", "def y(self):\n if self._y is None:\n self.comput...
[ "0.84114426", "0.81654555", "0.80646", "0.79960674", "0.78949875", "0.7806516", "0.77400583", "0.77166253", "0.7681602", "0.7681602", "0.7681602", "0.7681602", "0.7681602", "0.7681602", "0.7681602", "0.7681602", "0.7681602", "0.7681602", "0.76600176", "0.76600176", "0.7660017...
0.82379454
1
z component of the coordinates in the interior domain.
def z(self): return self.coords[2]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_z(self):\n return self.coords[2]", "def z(self):\n return self._coords[2]", "def getZ(self):\n\t\treturn self.coords.z", "def getZCoord(self, x, y):\n n = self.normal()\n z = (-n.x * (x - self.p0.x) - n.y * (y - self.p0.y) + n.z * self.p0.z) / n.z\n return z", "de...
[ "0.8204318", "0.81756115", "0.79953474", "0.7745512", "0.7492492", "0.74836826", "0.73827064", "0.73827064", "0.73827064", "0.7358403", "0.734638", "0.7295331", "0.7255795", "0.7253108", "0.7170729", "0.71611345", "0.7105172", "0.7076959", "0.6902277", "0.6868089", "0.6856292...
0.8187841
1
x component of the coordinates of the whole domain (halo points included).
def x_halo(self): return self.coords_halo[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def x_coord(self):\n\n return self.x0 + np.arange(self.nx) * self.dx", "def x(self):\n if self._x is None:\n self.compute_coordinates()\n return self._x", "def x(self):\n return self.coords[0]", "def x(self):\n return self._coords[0]", "def get_x(self):\n ...
[ "0.7628023", "0.7627613", "0.7605079", "0.7560858", "0.75197285", "0.73364943", "0.7319262", "0.7208585", "0.7040728", "0.70402396", "0.700919", "0.6968909", "0.69673264", "0.6955738", "0.69547075", "0.69454676", "0.69199395", "0.682559", "0.681483", "0.6806043", "0.6782578",...
0.77378696
0
y component of the coordinates of the whole domain (halo points included).
def y_halo(self): return self.coords_halo[1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def y_coord(self):\n\n return self.y0 + np.arange(self.ny) * self.dy", "def y(self):\n return self.coords[1]", "def get_y(self):\n return self.__y", "def y(self):\n return self._coords[1]", "def y(self):\n if self._y is None:\n self.compute_coordinates()\n ...
[ "0.7791334", "0.7649934", "0.7597563", "0.75450903", "0.75338155", "0.75070745", "0.74508405", "0.7420105", "0.74109304", "0.7409863", "0.7409863", "0.7409863", "0.7409863", "0.7409863", "0.7409863", "0.7409863", "0.7409863", "0.7409863", "0.7409863", "0.73475975", "0.7347597...
0.80401057
0
z component of the coordinates of the whole domain (halo points included).
def z_halo(self): return self.coords_halo[2]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_z(self):\n return self.coords[2]", "def z(self):\n return self.coords[2]", "def z(self):\n return self._coords[2]", "def getZ(self):\n\t\treturn self.coords.z", "def getZCoord(self, x, y):\n n = self.normal()\n z = (-n.x * (x - self.p0.x) - n.y * (y - self.p0.y) +...
[ "0.76964957", "0.7511645", "0.74793464", "0.7448726", "0.7278982", "0.7142226", "0.70404834", "0.69665307", "0.69276017", "0.6924901", "0.68958646", "0.68958646", "0.68958646", "0.68489766", "0.68006426", "0.6787681", "0.6751956", "0.6748075", "0.6724205", "0.66953576", "0.66...
0.7551448
1
Check the validity of the dictionnary which define the domain. Parameter
def check_dictionary(self, dico): if dico is not None: self.log.info('Check the dictionary') test, aff = validate(dico, proto_domain, test_comp = False) if test: self.log.info(aff) else: self.log.error(aff) sys.exit(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_domain_additional(cls, domain: D) -> bool:\n action_space = domain.get_action_space().unwrapped()\n observation_space = domain.get_observation_space().unwrapped()\n\n if not isinstance(action_space, Iterable) and not isinstance(action_space, gym.spaces.Tuple):\n action_sp...
[ "0.65451413", "0.6538749", "0.6353704", "0.6342437", "0.6328692", "0.63006294", "0.6273927", "0.61062527", "0.60574967", "0.6056676", "0.60533655", "0.59491223", "0.5946937", "0.59356123", "0.5934907", "0.5897498", "0.5869605", "0.5868954", "0.58672255", "0.586326", "0.584886...
0.7223405
0
Create the mpi topology
def construct_mpi_topology(self, dico): period = [True]*self.dim if dico is None: comm = mpi.COMM_WORLD else: comm = dico.get('comm', mpi.COMM_WORLD) self.mpi_topo = MPI_topology(self.dim, period, comm)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def createTopology(self):\n\n # find DAG root\n dagRoot = None\n for mote in self.motes:\n if mote.id == 0:\n mote.role_setDagRoot()\n dagRoot = mote\n assert dagRoot\n\n if self.settings.mobilityModel == 'RPGM':\n # put DAG roo...
[ "0.69177186", "0.6628953", "0.6226658", "0.61995256", "0.61995256", "0.60618436", "0.60247886", "0.6013558", "0.5998706", "0.59884655", "0.5967811", "0.5916848", "0.58346283", "0.5791707", "0.57730216", "0.5722135", "0.57025063", "0.5692879", "0.56564605", "0.5617648", "0.556...
0.7762457
0
Create the coordinates of the interior domain and the whole domain with halo points.
def create_coords(self): phys_box = self.geom.bounds # the physical box where the domain lies # validation of the space step with the physical box size for k in range(self.dim): self.global_size.append((phys_box[k][1] - phys_box[k][0])/self.dx) if not self.global_size[-1...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shape_with_halo(self):\n # TODO: Drop me after the domain-allocation switch, as this method\n # will be provided by the superclass\n return tuple(j + i + k for i, (j, k) in zip(self.shape_domain, self._halo))", "def get_bounds_halo(self):\n bottom_right = np.asarray([self.coords_h...
[ "0.629629", "0.6192578", "0.6049337", "0.58665466", "0.58665466", "0.5679478", "0.5666392", "0.55614126", "0.5559982", "0.55101025", "0.5502505", "0.5448007", "0.5385942", "0.53807485", "0.5354319", "0.53424925", "0.53216344", "0.52725726", "0.5272524", "0.52718675", "0.52423...
0.68091905
0
Return the coordinates of the bottom right and upper left corner of the whole domain with halo points.
def get_bounds_halo(self): bottom_right = np.asarray([self.coords_halo[k][0] for k in range(self.dim)]) upper_left = np.asarray([self.coords_halo[k][-1] for k in range(self.dim)]) return bottom_right, upper_left
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_bounds(self):\n bottom_right = np.asarray([self.coords[k][0] for k in range(self.dim)])\n upper_left = np.asarray([self.coords[k][-1] for k in range(self.dim)])\n return bottom_right, upper_left", "def bottomLeftCorner(self):\n self._updateExtents()\n return (self._mMin...
[ "0.67394066", "0.67303276", "0.66209525", "0.65128374", "0.64220613", "0.64210343", "0.6401192", "0.63610166", "0.6264927", "0.62276", "0.6118288", "0.59756935", "0.59198815", "0.5914908", "0.5878579", "0.58711284", "0.58591115", "0.580208", "0.5798796", "0.578806", "0.577766...
0.8023142
0
Return the coordinates of the bottom right and upper left corner of the interior domain.
def get_bounds(self): bottom_right = np.asarray([self.coords[k][0] for k in range(self.dim)]) upper_left = np.asarray([self.coords[k][-1] for k in range(self.dim)]) return bottom_right, upper_left
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_bounds_halo(self):\n bottom_right = np.asarray([self.coords_halo[k][0] for k in range(self.dim)])\n upper_left = np.asarray([self.coords_halo[k][-1] for k in range(self.dim)])\n return bottom_right, upper_left", "def bottomLeftCorner(self):\n self._updateExtents()\n ret...
[ "0.76211905", "0.7292665", "0.69914323", "0.67774415", "0.6669149", "0.6615716", "0.6581587", "0.6549148", "0.6523538", "0.65019536", "0.64836305", "0.64644194", "0.64228207", "0.6417498", "0.6398502", "0.63445574", "0.63234276", "0.6316152", "0.6315162", "0.6314326", "0.6278...
0.77522284
0
Add an element if elem.isfluid = False as a solid part. (bw=0) if elem.isfluid = True as a fluid part. (bw=1)
def __add_elem(self, elem): # compute the box around the element adding vmax safety points vmax = self.stencil.vmax elem_bl, elem_ur = elem.get_bounds() phys_bl, phys_ur = self.get_bounds_halo() tmp = np.array((elem_bl - phys_bl)/self.dx, np.int) - vmax nmin = np.maximum...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sketch_und_part(self):\n if (self.dimension == '3D'):\n #Sketch Wuerfel zeichnen\n self.sketch_Wuerfel = self.model.ConstrainedSketch(\n name='Seitenansicht_Wuerfel',\n sheetSize=200.0)\n self.sketch_Wuerfel.rectangle(\n point...
[ "0.5353897", "0.52898836", "0.52194977", "0.5092196", "0.49273452", "0.48061937", "0.47618276", "0.47300842", "0.47194925", "0.4717585", "0.46338245", "0.46224457", "0.46221817", "0.46195388", "0.46033767", "0.4593283", "0.45669478", "0.45467424", "0.45268017", "0.45268017", ...
0.61179656
0
Get the list of all the labels used in the geometry.
def list_of_labels(self): L = np.unique(self.box_label) return np.union1d(L, self.geom.list_of_elements_labels())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_labels(self):\n return []", "def get_labels(self) -> List[str]:\n raise NotImplementedError()", "def get_labels(self) -> Set[str]:", "def get_labels(self) -> List[str]:\n return self.labels", "def labels(self):\n return self._labels", "def labels_all(self):\n return sel...
[ "0.78688353", "0.77143806", "0.7649815", "0.76258653", "0.7622505", "0.7539628", "0.7502521", "0.74491197", "0.74491197", "0.74491197", "0.74491197", "0.74491197", "0.74491197", "0.7397355", "0.7367742", "0.7357493", "0.73287654", "0.73217773", "0.7304837", "0.7304837", "0.73...
0.7938898
0
Create snapshot with unexpected device count for previous versions.
def test_create_with_too_many_devices(test_microvm_with_api): test_microvm = test_microvm_with_api # Create and start a microVM with `FC_V0_23_MAX_DEVICES_ATTACHED` # network devices. devices_no = FC_V0_23_MAX_DEVICES_ATTACHED _create_and_start_microvm_with_net_devices(test_microvm, devices_no) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_snapshot_compatibility(microvm_factory, guest_kernel, rootfs):\n vm = microvm_factory.build(guest_kernel, rootfs)\n vm.spawn()\n vm.basic_config(\n vcpu_count=2,\n mem_size_mib=256,\n )\n\n # Add a memory balloon with stats enabled.\n vm.api.balloon.put(amount_mib=0, deflat...
[ "0.5707831", "0.5573247", "0.5530108", "0.55096114", "0.5387642", "0.525641", "0.52525467", "0.52115786", "0.5178012", "0.51598006", "0.5086971", "0.5044647", "0.5015125", "0.49779987", "0.49674007", "0.4938787", "0.49172089", "0.49106458", "0.48969096", "0.48893365", "0.4873...
0.607721
0
Tests taking a snapshot at the version specified in Cargo.toml Check that it is possible to take a snapshot at the version of the upcoming release (during the release process this ensures that if we release version x.y, then taking a snapshot at version x.y works something we'd otherwise only be able to test once the x...
def test_snapshot_current_version(uvm_nano): vm = uvm_nano vm.start() version = get_firecracker_version_from_toml() # normalize to a snapshot version target_version = f"{version.major}.{version.minor}.0" snapshot = vm.snapshot_full(target_version=target_version) # Fetch Firecracker binary ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_pre_release(scraper, version_parts):\n\n new_version_parts = list(version_parts)\n if len(new_version_parts) > 4:\n new_version_parts[4] = int(new_version_parts[4]) + 1\n elif len(new_version_parts) > 3:\n new_version_parts.append(1)\n else:\n new_version_parts.extend(['a'...
[ "0.6502068", "0.6310254", "0.6265", "0.6260519", "0.6240066", "0.62363416", "0.6196736", "0.61603254", "0.6096417", "0.6088469", "0.60742664", "0.6066883", "0.6045832", "0.6043664", "0.603125", "0.5988045", "0.5978905", "0.5974485", "0.5948521", "0.59446055", "0.5923739", "...
0.70966417
0
Attempt to create a snapshot with newer virtio features.
def test_create_with_newer_virtio_features(uvm_nano): test_microvm = uvm_nano test_microvm.add_net_iface() test_microvm.start() # Init a ssh connection in order to wait for the VM to boot. This way # we can be sure that the block device was activated. test_microvm.ssh.run("true") # Pause m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_snapshot_compatibility(microvm_factory, guest_kernel, rootfs):\n vm = microvm_factory.build(guest_kernel, rootfs)\n vm.spawn()\n vm.basic_config(\n vcpu_count=2,\n mem_size_mib=256,\n )\n\n # Add a memory balloon with stats enabled.\n vm.api.balloon.put(amount_mib=0, deflat...
[ "0.67031753", "0.5935706", "0.5914112", "0.5762848", "0.5759202", "0.5687569", "0.5678241", "0.56615245", "0.56577706", "0.556173", "0.5539944", "0.5531928", "0.552826", "0.54974014", "0.54896766", "0.5480551", "0.54506993", "0.5432392", "0.54126745", "0.54020923", "0.5380297...
0.7215181
0
Verifies that we can't create a snapshot with target version less than 1.5 if cpu template with additional vcpu features or kvm capabilities is in use.
def test_create_with_1_5_cpu_template(uvm_plain): # We remove KVM_CAP_IOEVENTFD from kvm checks just for testing purpose. custom_cpu_template = json.loads('{"kvm_capabilities": ["!36"]}') test_microvm = uvm_plain test_microvm.spawn() test_microvm.basic_config(vcpu_count=2, mem_size_mib=256) te...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_with_newer_virtio_features(uvm_nano):\n test_microvm = uvm_nano\n test_microvm.add_net_iface()\n test_microvm.start()\n\n # Init a ssh connection in order to wait for the VM to boot. This way\n # we can be sure that the block device was activated.\n test_microvm.ssh.run(\"true\")\...
[ "0.65462935", "0.6420692", "0.6118976", "0.60601354", "0.60190666", "0.5678747", "0.5554583", "0.55517364", "0.5539511", "0.55231994", "0.54974645", "0.5484495", "0.5428318", "0.54254496", "0.54118603", "0.5407401", "0.540111", "0.5394907", "0.5390333", "0.53765833", "0.53608...
0.7106182
0
Replace all special lines with their blocks in the special config
def replace_base(base, specials): new_config = [] for line in base: new_config.append(line) if check_template_start(line): # Found template line, try to add special special = line.split(":")[1] if special in specials: new_config.extend(specials...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def replace(lines):\n for index, line in enumerate(lines):\n if not line == '\\n':\n token_line = tokenizer.tokenize_line(line)\n for ind, tok in enumerate(token_line):\n if token_line[ind][1] in replacement_dic.keys() and token_line[ind][1] not in ignore_variable:\n ...
[ "0.60071075", "0.59372526", "0.5920741", "0.57225025", "0.5639018", "0.56047815", "0.5575346", "0.5567408", "0.5562298", "0.55614144", "0.55471146", "0.55306953", "0.5528332", "0.5473518", "0.5411829", "0.54098475", "0.5369975", "0.53312016", "0.5301475", "0.5291877", "0.5289...
0.70681936
0
All possible tiers Each tier is a tuple in alphabetical order
def build_tiers(self): self.tiers = [] for size in range(1,len(self.sigma)+1): for combo in itertools.combinations(self.sigma, size): self.tiers.append(tuple(sorted(list(combo))))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def part_1():\n return itertools.permutations(range(5))", "def flip(tier: int) -> list:\n pool = load_minion_pool()\n n_to_show = tier // 2 + 3\n available_minions = []\n\n for t in range(1, tier + 1):\n for _ in range(settings.TIER_COUNTS[t]):\n available_minions += pool[str(t)]...
[ "0.5811346", "0.57635534", "0.56175697", "0.55959123", "0.5509604", "0.5472255", "0.54375213", "0.5435182", "0.5416104", "0.54044276", "0.5403584", "0.5363441", "0.5363441", "0.53515655", "0.5348641", "0.534456", "0.5333362", "0.5300959", "0.5291334", "0.5283928", "0.5224548"...
0.6834271
0
Create a fake requests.Response object.
def mocked_requests_get(): class MockResponse: def __init__(self, _content, _status): self.content = _content self.status_code = _status def content(self): return self.content return MockResponse
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def response():\n def inner(ret_code, ret_value):\n \"\"\"Set up response with the given parameters.\n\n :param ret_code: Return code for the response\n :param ret_value: Return value for the response\n :return: Mocked Responce object with the given parameters\n \"\"...
[ "0.736011", "0.71040297", "0.7098835", "0.6869094", "0.6854902", "0.6733961", "0.6733961", "0.6719025", "0.6631267", "0.6599584", "0.6549238", "0.65430015", "0.6531704", "0.6485677", "0.64722425", "0.643935", "0.64389443", "0.6423061", "0.642237", "0.6392279", "0.63886", "0...
0.73249215
1
Return all JobStates present in storage
def all_stored_job_state(self, repository_origin_id=None, job_type=None):
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_states():\n states = []\n for state in storage.all(\"State\").values():\n states.append(state.to_dict())\n return jsonify(states)", "def get_states():\n all_states = []\n states = storage.all(State).values()\n for state in states:\n all_states.append(state.to_dict())\n ...
[ "0.70959705", "0.70369786", "0.70325696", "0.6953881", "0.6952176", "0.6944491", "0.6943182", "0.68910843", "0.6842506", "0.6766063", "0.6744036", "0.6644306", "0.649214", "0.64365315", "0.6280112", "0.6280112", "0.62451684", "0.62207997", "0.62207997", "0.621835", "0.6201651...
0.732007
0
Get the ticks for a given job.
def get_job_ticks(self, job_origin_id):
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_job_tick_stats(self, job_origin_id):", "def get_ticks(self):\n return pg.time.get_ticks()", "def get_latest_job_tick(self, job_origin_id):", "def get_ticks(self, market, period):\n return self.__call__('market', 'GetTicks',\n {'marketName': market,\n ...
[ "0.6805147", "0.65050817", "0.63807094", "0.6250666", "0.5612657", "0.5576679", "0.55496687", "0.5537462", "0.5457608", "0.54030746", "0.5366965", "0.53657764", "0.5344443", "0.5304836", "0.53023386", "0.529134", "0.528076", "0.5270107", "0.52592474", "0.5257897", "0.52511895...
0.79622924
0
Get the most recent tick for a given job.
def get_latest_job_tick(self, job_origin_id):
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def last_job(self): # TOFIX model the job and return an object instead of dictionary\n return self._data.get('summary_fields', {}).get('last_job')", "def latest_job(self):\n return self.jobmanagers[self.current_network].latest_job", "def get_last_job_id():\n\n return JobDetail.query.with_enti...
[ "0.6885023", "0.68426526", "0.63668716", "0.625937", "0.61686134", "0.61422634", "0.6088384", "0.60683393", "0.60473347", "0.604174", "0.5943635", "0.5943489", "0.58863485", "0.58651054", "0.5843796", "0.58378553", "0.5831277", "0.57627594", "0.57353145", "0.5645166", "0.5631...
0.79333454
0
Add a job tick to storage.
def create_job_tick(self, job_tick_data):
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add(self, job):\r\n self.jobs.put(job)", "def update_job_tick(self, tick):", "def add_job(self, job):\n self.job_list.append(job)\n self.num_jobs += 1", "def add_job(self, job):\n self.job_list.append(job)\n return", "def add_job(self, job):\n with self._mutex:...
[ "0.68822646", "0.644974", "0.6336911", "0.60865444", "0.6081882", "0.5925319", "0.58823025", "0.5867289", "0.58074796", "0.5784127", "0.5779706", "0.5779706", "0.576042", "0.5738642", "0.5720947", "0.56882465", "0.56653124", "0.56326026", "0.561558", "0.56124854", "0.5605226"...
0.6734833
1
Update a job tick already in storage.
def update_job_tick(self, tick):
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_tick(self, tick: InstigatorTick):", "def update_job_state(self, job):", "def update(self, ticks):\n self.quantity_cursor.update(ticks)", "def on_job_update(_job):\n nonlocal job\n job = _job", "def on_job_update(_job):\n nonlocal job\n job = _job", "def on_jo...
[ "0.65579045", "0.6554705", "0.6091657", "0.6049211", "0.6049211", "0.6049211", "0.6049211", "0.5960409", "0.5899886", "0.5852035", "0.5800887", "0.5797093", "0.5778178", "0.5775377", "0.5766446", "0.57579905", "0.57497984", "0.5748029", "0.5748029", "0.5748029", "0.5717909", ...
0.78228307
0
Wipe ticks for a job for a certain status and timestamp.
def purge_job_ticks(self, job_origin_id, tick_status, before):
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def purge_ticks(self, origin_id: str, tick_status: TickStatus, before: float):", "def __delete_job_status(self, job: Job):\n\n keys = self._get_keys(f'jobstatus:{job.id}:*')\n for key in keys:\n self.redis_client.delete(key)", "def _cleanupDownCounts(self):\n now = datetime.now(...
[ "0.6632468", "0.5895949", "0.5505163", "0.5471308", "0.5446002", "0.5350745", "0.5347354", "0.53052574", "0.5266057", "0.5187827", "0.51671374", "0.516343", "0.51591295", "0.51247317", "0.5116081", "0.5100693", "0.5090704", "0.50796276", "0.5065009", "0.50444114", "0.5044082"...
0.7620381
0
Get tick stats for a given job.
def get_job_tick_stats(self, job_origin_id):
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_job_stats(self, job_name):\n return self.manager.get_job_stats(job_name)", "def get_job_ticks(self, job_origin_id):", "def stats(self):\n resp = self.server.request(\"get\", \"/jobs/%s/%s/stats\" %\n (self.sessionid, self.name))\n return self.server.json_body(resp)",...
[ "0.686602", "0.6589052", "0.61278665", "0.59427047", "0.58626354", "0.57995313", "0.5791054", "0.57735854", "0.56960267", "0.5658474", "0.56300795", "0.5602183", "0.55705327", "0.55694175", "0.5538241", "0.5442942", "0.54197836", "0.5391828", "0.53831077", "0.53716314", "0.53...
0.7929325
0
Converts a series of consumption data into a lagged, scaled sample.
def prepare_training_data(consumption_series, lag): # scale training data scaler = MinMaxScaler(feature_range=(-1, 1)) consumption_vals = scaler.fit_transform(consumption_series.values.reshape(-1, 1)) # convert consumption series to lagged features consumption_lagged = create_lagged_featu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def downsample(time_series,res = '0.2S'):\n\n Nvalues = len(time_series.index)\n samplerate = 1/ ((time_series.timestamp[Nvalues-1] - time_series.timestamp[0]) / Nvalues)\n timestart = dt.datetime(1970, 1, 1, 0, 0, 0, 0) #dt.datetime.now()\n start = pd.Timestamp(timestart)\n end = pd.Timestamp(times...
[ "0.58058953", "0.5682728", "0.5602917", "0.558418", "0.55332106", "0.5464574", "0.54036844", "0.53578377", "0.5353402", "0.52929103", "0.5281908", "0.524232", "0.52113897", "0.5205267", "0.51940095", "0.5193135", "0.51782006", "0.5166779", "0.51162773", "0.5104673", "0.508758...
0.6613549
0
Uses last hour's prediction to generate next for num_pred_hours, initialized by most recent cold start prediction. Inverts scale of predictions before return.
def generate_hourly_forecast(num_pred_hours, consumption, model, scaler, lag): # allocate prediction frame preds_scaled = np.zeros(num_pred_hours) # initial X is last lag values from the cold start X = scaler.transform(consumption.values.reshape(-1, 1))[-lag:] # forecast for i ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def predict(self):\n # format data\n df = self.normalize(self.daily)\n x = df.index.astype(np.int64).values.reshape(-1, 1)\n y = self.normalize(df[['Adj Close']]).values\n\n # format time\n one_day_time = 86400000000000\n x_tomorrow = x[-1] + one_day_time\n x...
[ "0.6147885", "0.60168874", "0.5948102", "0.59448326", "0.5736109", "0.5730648", "0.5723199", "0.5713034", "0.57063735", "0.56251585", "0.56192535", "0.5606722", "0.5595283", "0.5580066", "0.55339456", "0.5530532", "0.5509373", "0.550588", "0.54749984", "0.5469587", "0.5446055...
0.7551356
0
Recursively parse requirements from nested pip files.
def parse_reqs(req_path='./requirements.txt'): req = [] with codecs.open(req_path, 'r') as handle: # remove comments and empty lines lines = (line.strip() for line in handle if line.strip() and not line.startswith('#')) for line in lines: # check for nested ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_req_file(req_file, verbatim=False):\n req_list = []\n requirements = req_file.readlines()\n for requirement in requirements:\n requirement_no_comments = requirement.split(\"#\")[0].strip()\n\n # if matching requirement line (Thing==1.2.3), update dict, continue\n req_match =...
[ "0.6786804", "0.6664783", "0.6641698", "0.66211325", "0.66119075", "0.65428483", "0.6501512", "0.6493474", "0.63900733", "0.63147587", "0.6300729", "0.62659717", "0.61893356", "0.6095277", "0.60434747", "0.60229355", "0.6022184", "0.59152234", "0.5904207", "0.58895177", "0.58...
0.69987404
0
Parse contents of the README.
def parse_readme(): # Get the long description from the relevant file readme_path = path.join(here, 'README.md') with codecs.open(readme_path, encoding='utf-8') as handle: desc = handle.read() return desc
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_readme():\n readme = Path(README_PATH).read_text()\n Actions.read_from_md(readme)", "def readme():\n with open('README.md') as readme_file:\n return readme_file.read()", "def readme():\n with open('README.md') as _file:\n return _file.read()", "def readme():\n with open(...
[ "0.6963818", "0.68499607", "0.6843953", "0.68420315", "0.67245597", "0.6724281", "0.66542006", "0.663165", "0.65984565", "0.6555213", "0.65377915", "0.6471558", "0.6464941", "0.6371735", "0.6349831", "0.63303596", "0.6280362", "0.6276107", "0.6224707", "0.62189406", "0.621518...
0.8034528
0
get a mapping of dn and domain name, sid
def domainnames(l): mapping = {} # locate all the samba domains in the ldap r = l.search_s('dc=elex', ldap.SCOPE_SUBTREE, '(objectClass=sambaDomain)', ['sambaDomainName','sambaSID']) for dn, entry in r: mapping[dn] = (entry['sambaDomainName'][0], entry['sambaSID'][0]) return mapping
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_domain_mappings(domain_to_intents: Dict) -> Dict:\n domain2id = {}\n domains = list(domain_to_intents)\n for index, domain in enumerate(domains):\n domain2id[domain] = index\n return domain2id", "def get_ingkey_ndbno_map(session):\n alias_ndbno = {}\n\n for a...
[ "0.6582829", "0.56286347", "0.5624903", "0.5525862", "0.55090404", "0.55004203", "0.5462208", "0.5441851", "0.53912187", "0.53654265", "0.535627", "0.5353621", "0.53343844", "0.5332277", "0.5325799", "0.52989244", "0.52860177", "0.5236246", "0.51990306", "0.5192915", "0.51833...
0.7258395
0
get the domain ldap root for the given dn >>> dn = "sambaDomainName=IEPERTEST,dc=Ieper,dc=elex" >>> domainroot(dn) 'dc=Ieper,dc=elex'
def domainroot(d): dn = str2dn(d) dn.pop(0) return dn2str(dn)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_root_domain(url):\n if url is None:\n return ''\n\n http = text.find_between(url, 'http://', '/')\n https = text.find_between(url, 'https://', '/')\n if http != '':\n if http.startswith('www.'):\n return http[4:]\n else:\n return http\n else:\n ...
[ "0.59731376", "0.58926845", "0.58213747", "0.57498807", "0.5353788", "0.53386265", "0.5327255", "0.53180313", "0.52835435", "0.5229424", "0.51967984", "0.51759446", "0.5168741", "0.512568", "0.51203126", "0.5037568", "0.5010395", "0.49844295", "0.49844295", "0.49776703", "0.4...
0.78520805
0
get a list of dn's of all the sambaaccounts for a given domainroot
def sambaaccountsindomainroot(domainroot, l): dns = {} r = l.search_s(domainroot, ldap.SCOPE_SUBTREE, '(objectClass=sambaSamAccount)', ['uidNumber']) for dn, entry in r: try: dns[dn] = entry['uidNumber'][0] except KeyError: sys.stderr.write("dn %s has no uidNumber!\n" % dn) return dns
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def domainnames(l):\n mapping = {}\n # locate all the samba domains in the ldap\n r = l.search_s('dc=elex', ldap.SCOPE_SUBTREE, '(objectClass=sambaDomain)', ['sambaDomainName','sambaSID'])\n for dn, entry in r:\n mapping[dn] = (entry['sambaDomainName'][0], entry['sambaSID'][0])\n return mapping", "def ge...
[ "0.66664594", "0.6225633", "0.6047989", "0.5977809", "0.5909574", "0.58053553", "0.5803501", "0.57814616", "0.57603765", "0.57531065", "0.5686316", "0.5632562", "0.56190073", "0.5612749", "0.5571444", "0.5562495", "0.55482376", "0.55228823", "0.5510787", "0.55037886", "0.5493...
0.790107
0
update an account with a new sid number
def updatesid(dn, sid, l): mod_attrs = [(ldap.MOD_REPLACE, 'sambaSID', sid )] l.modify_s(dn, mod_attrs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(self, account):\n model = models.load('Account', account)\n return self.client.update_account(model=model)", "def updateAccount(accountNumber: int, payload: str ):\n statement = \"update account set \" + payload+ f\" where account_number = {accountNumber}\"\n cursor = connection.cu...
[ "0.68811387", "0.65051657", "0.6367951", "0.6271997", "0.62145466", "0.61361814", "0.6134124", "0.6107987", "0.60869086", "0.59739476", "0.5946718", "0.5814789", "0.5802594", "0.5763696", "0.5756033", "0.5756033", "0.5756033", "0.5756033", "0.5756033", "0.5756033", "0.5725383...
0.6992691
0
r"""Create input tensors given the list of prompt tokens.
def _create_input(inputs: List[Tensor], initial: bool = False) \ -> Dict[str, Tensor]: word_embed = torch.stack(inputs, dim=0) seq_len, batch_size, embed_dim = word_embed.size() if not initial: # Add a dummy token at the end that stands for the token # to pred...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_inputs(title, list_labels):\n print(f\"{title}\")\n # list which holds the input answers from user\n user_inputs = []\n for item in list_labels:\n user_inputs.append(input(f\"{item}: \"))\n return user_inputs", "def get_inputs(list_labels, title):\n inputs = []\n\n print(f\"\\...
[ "0.5943801", "0.5874354", "0.5750032", "0.5678299", "0.55471927", "0.55375314", "0.55304873", "0.55301905", "0.5503433", "0.55009323", "0.54978406", "0.5443688", "0.54417616", "0.5436629", "0.54334015", "0.537875", "0.53765416", "0.5369801", "0.53374743", "0.5288369", "0.5286...
0.59976834
0
given a list of system dicts and fact namespace, return a dict of comparisons, along with a dict of system data
def build_comparisons(inventory_service_systems, fact_namespace): fact_comparison = _select_applicable_info(inventory_service_systems, fact_namespace) system_mappings = [_system_mapping(system) for system in inventory_service_systems] return {'facts': fact_comparison, 'systems': system_mappings}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _select_applicable_info(systems, fact_namespace):\n # create dicts of id + info\n ids_and_info = [_system_facts_and_id(system, fact_namespace) for system in systems]\n\n # union the keys into one big set\n available_info_names = set()\n for fact_ids in ids_and_info:\n available_info_names...
[ "0.6751611", "0.64506835", "0.59273654", "0.54507446", "0.5415962", "0.53574604", "0.52777123", "0.5273807", "0.52517354", "0.5235233", "0.5234047", "0.52329373", "0.5217976", "0.5211301", "0.51864505", "0.5144741", "0.5138967", "0.51296264", "0.5087264", "0.50721955", "0.502...
0.7789255
0
return the facts for the given namespace
def _find_facts_for_namespace(system, fact_namespace): # TODO: we are assuming we just need to handle one namespace for facts in system['facts']: if facts['namespace'] == fact_namespace: dataframe = json_normalize(_flatten_list_facts(facts['facts']), sep='.') # TODO: we should tr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _facts(facts):\n return {'swift_facts': facts}", "def get_all_by_namespace(context, namespace_name, session):\n\n # namespace get raises an exception if not visible\n namespace = namespace_api.get(\n context, namespace_name, session)\n\n db_recs = (\n session.query(models.Metade...
[ "0.6179005", "0.60052156", "0.5814096", "0.57992786", "0.5792006", "0.57476157", "0.5712751", "0.56517786", "0.562293", "0.5562041", "0.55495805", "0.55207497", "0.55160123", "0.5473524", "0.5363391", "0.5360087", "0.5358159", "0.53243786", "0.53009593", "0.5258396", "0.52021...
0.71858376
0
Pull the system facts dict out from a system record and add the ID to the dict
def _system_facts_and_id(system, fact_namespace): facts_and_id = _find_facts_for_namespace(system, fact_namespace) facts_and_id[SYSTEM_ID_KEY] = system[SYSTEM_ID_KEY] return facts_and_id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _system_mapping(system):\n return {'id': system['id'], 'fqdn': system['fqdn'], 'last_updated': system['updated']}", "def create_system_data():\n system_data = dict()\n system_data['system'] = dict()\n system_data['system']['primary'] = dict()\n system_data['system']['primary']['controllers'] =...
[ "0.6592336", "0.5519249", "0.52790916", "0.52427906", "0.511191", "0.51064813", "0.5094681", "0.50490534", "0.5019681", "0.50044346", "0.49629274", "0.49606988", "0.49120373", "0.49032432", "0.48786232", "0.4853964", "0.4850545", "0.48393828", "0.483793", "0.48377714", "0.481...
0.6877349
0
Takes a parameter of a database table, database column and input value. Open a connection to the database. Inserts the given input to the given database column in the given database table. Saves and closes the connection.
def insertData(table, column, input): try: con = sqlite3.connect('PampDb.db') cur = con.cursor() cur.execute("INSERT INTO '" + table + "' (" + column + ") VALUES ('" + input + "')") con.commit() con.close() except: print('Could not run function insertData from DbController')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def commit_to_database(self, table, output):\n try:\n # TODO: Is this the correct method for this?\n with SESSION.begin_nested():\n i = insert(getattr(db, table))\n vals = i.values(output)\n SESSION.execute(vals) # TODO: What is this?\n ...
[ "0.6499374", "0.6467502", "0.6432609", "0.642731", "0.6394885", "0.6324648", "0.6303387", "0.6270057", "0.6249122", "0.6245554", "0.61839783", "0.61709726", "0.61705667", "0.61124736", "0.60817313", "0.6029818", "0.6000239", "0.5996185", "0.59731865", "0.5967328", "0.5955773"...
0.8079351
0
Takes a parameter of a database table and a name. Open a connection to the database. Selects all rows from given table where the name matches the given name. Checks if there is no rows and save the given name if not. Returns an object of the organizations data. Saves and closes the connection.
def checkIfOrganisationExists(table, name): try: con = sqlite3.connect('PampDb.db') cur = con.cursor() cur.execute("SELECT * FROM " + table + " WHERE name='" + name + "'") ob = cur.fetchall() if not ob: cur.execute("INSERT INTO '" + table + "' (name) VALUES ('" + name + "')") con.commit() cur.execu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getAllWhereNameIs2(table, name, orgName):\n\ttry:\n\t\tcon = sqlite3.connect('PampDb.db')\n\t\tcur = con.cursor()\n\t\tcur.execute(\"SELECT * FROM \" + table + \" WHERE name like'\" + name + \"%' and organisationId like (SELECT organisationId FROM Organisation WHERE name like '\" + orgName + \"' )\")\n\t\tob =...
[ "0.6584832", "0.56436473", "0.56424224", "0.5445914", "0.53992385", "0.5322616", "0.5317675", "0.5276783", "0.52582735", "0.5035784", "0.49893025", "0.49835908", "0.49494904", "0.4946467", "0.4929817", "0.49230644", "0.49134114", "0.490836", "0.48627073", "0.48460436", "0.482...
0.6698518
0
Takes a parameter of a database table, a name and a foreign key. Open a connection to the database. Selects all rows from given table where the name matches the given name. Checks if there is no rows with matching name and save the given name if not the return a object of the measurement object. Otherwise loops through...
def checkIfMeasuringObjectExists(table, name, fk): try: con = sqlite3.connect('PampDb.db') cur = con.cursor() cur.execute("SELECT * FROM " + table + " WHERE name='" + name + "'") ob = cur.fetchall() bo = False if not ob: cur.execute("INSERT INTO '" + table + "' (name, organisationId) VALUES ('" + name +...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def checkIfAntennaExists(table, name, fk):\n\ttry:\n\t\tcon = sqlite3.connect('PampDb.db')\n\t\tcur = con.cursor()\n\t\tcur.execute(\"SELECT * FROM \" + table + \" WHERE name='\" + name + \"'\")\n\t\tob = cur.fetchall()\n\t\tbo = False\n\t\tif not ob:\n\t\t\tcur.execute(\"INSERT INTO '\" + table + \"' (name, measu...
[ "0.5825028", "0.54133224", "0.52821904", "0.5057512", "0.4970804", "0.4853761", "0.483541", "0.48263484", "0.47983626", "0.47972316", "0.47867805", "0.47804394", "0.47424772", "0.473968", "0.473309", "0.4724627", "0.47091377", "0.4699343", "0.46908638", "0.46786463", "0.46757...
0.6349163
0
Takes a parameter of a database table, a name and a foreign key. Open a connection to the database. Selects all rows from given table where the name matches the given name. Checks if there is no rows with matching name and save the given name if not the return a object of the antenna. Otherwise loops through the list o...
def checkIfAntennaExists(table, name, fk): try: con = sqlite3.connect('PampDb.db') cur = con.cursor() cur.execute("SELECT * FROM " + table + " WHERE name='" + name + "'") ob = cur.fetchall() bo = False if not ob: cur.execute("INSERT INTO '" + table + "' (name, measuringObjectId) VALUES ('" + name + "', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def checkIfMeasuringObjectExists(table, name, fk):\n\ttry:\n\t\tcon = sqlite3.connect('PampDb.db')\n\t\tcur = con.cursor()\n\t\tcur.execute(\"SELECT * FROM \" + table + \" WHERE name='\" + name + \"'\")\n\t\tob = cur.fetchall()\n\t\tbo = False\n\t\tif not ob:\n\t\t\tcur.execute(\"INSERT INTO '\" + table + \"' (nam...
[ "0.5775556", "0.55818015", "0.52031857", "0.5173361", "0.51214767", "0.50995225", "0.49776843", "0.49723682", "0.49298635", "0.49137506", "0.49100566", "0.4876978", "0.48237494", "0.48185825", "0.47975516", "0.47720587", "0.47643965", "0.476333", "0.47346067", "0.47134042", "...
0.6691352
0
Takes a parameter of a database table, a name and a organization name. Open a connection to the database. Select the row from given table where name matches the given name and the foreign key matches the organisationsId from the organization with the given name. If no match returns an empty string otherwise returns an ...
def getAllWhereNameIs2(table, name, orgName): try: con = sqlite3.connect('PampDb.db') cur = con.cursor() cur.execute("SELECT * FROM " + table + " WHERE name like'" + name + "%' and organisationId like (SELECT organisationId FROM Organisation WHERE name like '" + orgName + "' )") ob = cur.fetchall() if not ob...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def checkIfOrganisationExists(table, name):\n\ttry:\n\t\tcon = sqlite3.connect('PampDb.db')\n\t\tcur = con.cursor()\n\t\tcur.execute(\"SELECT * FROM \" + table + \" WHERE name='\" + name + \"'\")\n\t\tob = cur.fetchall()\n\n\t\tif not ob:\n\t\t\tcur.execute(\"INSERT INTO '\" + table + \"' (name) VALUES ('\" + name...
[ "0.649052", "0.58591986", "0.5553993", "0.541119", "0.53702897", "0.53158283", "0.5298932", "0.52573925", "0.5228335", "0.51941264", "0.5193201", "0.51424927", "0.5105643", "0.5103786", "0.50759363", "0.50589263", "0.50571203", "0.50493544", "0.50341445", "0.50220186", "0.502...
0.6875108
0
Takes a parameter of a database table, a name, a measuring object name and a organization name. Open a connection to the database. Select the row from given table where name matches the given name and the foreign key matches the measuringObjectId from the measuring object with the given name, which foreign key should m...
def getAllWhereNameIs3(table, name, objectName, orgName): try: con = sqlite3.connect('PampDb.db') cur = con.cursor() cur.execute("SELECT * FROM " + table + " WHERE name like'" + name + "%' and measuringObjectId like (SELECT measureingObjectId FROM MeasuringObject WHERE name like'" + objectName + "' and organisat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def checkIfMeasuringObjectExists(table, name, fk):\n\ttry:\n\t\tcon = sqlite3.connect('PampDb.db')\n\t\tcur = con.cursor()\n\t\tcur.execute(\"SELECT * FROM \" + table + \" WHERE name='\" + name + \"'\")\n\t\tob = cur.fetchall()\n\t\tbo = False\n\t\tif not ob:\n\t\t\tcur.execute(\"INSERT INTO '\" + table + \"' (nam...
[ "0.647255", "0.59009075", "0.5862029", "0.5327575", "0.5271932", "0.51865", "0.51475155", "0.5062982", "0.50051904", "0.4929531", "0.48816788", "0.4817058", "0.47862557", "0.47796994", "0.47717777", "0.4741117", "0.47383088", "0.47381008", "0.47295547", "0.46936247", "0.46817...
0.6301946
1
Checks that the coolant channels are placed at the correct azimuthal placement angles for a given start angle.
def test_start_angle(self): assert self.test_shape.azimuth_placement_angle == [ 0, 45, 90, 135, 180, 225, 270, 315, ] self.test_shape.start_angle = 10 assert self.test_shape.azimuth_placement...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_angle_of_arcs(self):\n\n if self.thin_arc_start_angle >= 3600:\n self.thin_arc_start_angle %= 360\n self.thin_arc_start_angle += 360\n\n elif self.thin_arc_start_angle <= -3600:\n self.thin_arc_start_angle %= 360\n self.thin_arc_start_angle -= 360...
[ "0.64040065", "0.55662644", "0.5453842", "0.54343426", "0.542246", "0.5321511", "0.52047867", "0.5199475", "0.51695144", "0.5155091", "0.5144264", "0.5114534", "0.50843585", "0.505066", "0.50357336", "0.50191617", "0.5004695", "0.49946713", "0.4977154", "0.49758136", "0.49680...
0.610046
1
Test import dataset wine.
def test_import_wine(): X, y = wine_data() assert(X.shape[1] == 12) assert(len(y.unique().tolist()) == 3) assert(X.shape[0] == y.shape[0])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_import_data():\n\n file_path = os.path.join(CONST_ADVANTICSYS_DIR, CONST_ADVANTICSYS_TEST_1)\n\n # Bring df\n success, log, test_ingress_df = advanticsys_import(file_path)\n assert success, log\n assert isinstance(test_ingress_df, pd.DataFrame)\n\n # Test import function\n success, lo...
[ "0.6878423", "0.6717447", "0.66107994", "0.6513562", "0.64724684", "0.6419172", "0.635929", "0.63393587", "0.6322275", "0.6305654", "0.6271661", "0.6262919", "0.6250121", "0.62494475", "0.6245525", "0.6239293", "0.62058556", "0.61902046", "0.61705625", "0.615137", "0.6088381"...
0.74175483
0
Builds a tree, starting at root, of matching subsequences between sorted_nodes1 and sorted_nodes2. The subsequences match if the order of the nodes is preserved and they satisfy are_equal_nodes.
def fill_tree(root, sorted_nodes1, sorted_nodes2): for id1 in range(root.id1+1, len(sorted_nodes1)): for id2 in range(root.id2+1, len(sorted_nodes2)): if are_equal_nodes(sorted_nodes1[id1], sorted_nodes2[id2]): child_node = TreeNode(id1, id2) fill_tree(child_node,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_longest_matches(sorted_nodes1, sorted_nodes2):\n root = TreeNode(-1,-1)\n fill_tree(root, sorted_nodes1, sorted_nodes2)\n match = find_treepaths(root, [])\n\n # Remove (-1, -1) superroot.\n if isinstance(match[0], list): # More than one match of the same length.\n res = []\n f...
[ "0.6480154", "0.6017104", "0.5900179", "0.58926785", "0.57914406", "0.5785781", "0.56803095", "0.5670274", "0.5616493", "0.5585591", "0.548172", "0.5441299", "0.5415218", "0.54117894", "0.5322896", "0.53055215", "0.53055215", "0.52935976", "0.5283271", "0.5247669", "0.5240782...
0.7211512
0
Returns the longest common subsequences between sorted_nodes1 and sorted_nodes2.
def find_longest_matches(sorted_nodes1, sorted_nodes2): root = TreeNode(-1,-1) fill_tree(root, sorted_nodes1, sorted_nodes2) match = find_treepaths(root, []) # Remove (-1, -1) superroot. if isinstance(match[0], list): # More than one match of the same length. res = [] for m in match...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def longest_common_subsequence(seq1, seq2):\n mat = DPMatrix(seq1, seq2, match=1, mismatch=0, gap=0)\n mat.fill()\n\n lcs = []\n augSeq1, augSeq2 = mat.augmented_sequences()\n for c1, c2 in zip(augSeq1, augSeq2):\n if c1 == c2:\n lcs.append(c1)\n\n return ''.join(lcs)", "def l...
[ "0.7247269", "0.71503085", "0.69920135", "0.6895138", "0.68178797", "0.6648128", "0.64169645", "0.63929033", "0.6190487", "0.6148989", "0.6120559", "0.6112058", "0.6086676", "0.6060063", "0.6056009", "0.5992014", "0.5970511", "0.59483576", "0.5925975", "0.5925972", "0.5920781...
0.75042135
0