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
Given a value and a set of cutoffs returns the percentile within which the value lies
def compute_percentile(value, cutoffs): if value < cutoffs[0]: return 0.0 for i, cutoff in enumerate(cutoffs): if value < cutoff: return math.floor(100 * (float(i)/(len(cutoffs)))) break return 100.0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def percentile(self, values, percent):\r\n if not values:\r\n return None\r\n k = (len(values)-1) * percent\r\n f = math.floor(k)\r\n c = math.ceil(k)\r\n if f == c:\r\n return values[int(k)]\r\n d0 = values[int(f)] * (c-k)\r\n d1 = values[int(...
[ "0.6868181", "0.66213346", "0.65224266", "0.65193796", "0.6469502", "0.6405514", "0.634329", "0.62879926", "0.624497", "0.6234696", "0.62275577", "0.6221729", "0.6213133", "0.6212743", "0.620385", "0.62005794", "0.619086", "0.6176273", "0.61725086", "0.61725086", "0.61725086"...
0.87540716
0
Given a schema with a dataset this function reads in the numeric fields and computes the percentile cutoffs for the numerric fields. It appends this information to the schema and returns it.
def compute_schema_percentiles(schema): values = {} schemaFields = schema["fields"] for field in schemaFields: if schemaFields[field]["type"] == FIELD_TYPE_NUMERIC: values[field] = [] if(len(values) == 0): return schema def processRow(row, schemaFields, values): # cache the values for numerics for field...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_percentile_cutoff(data, cutoff=None, percentile=None, required=False):\n if percentile is not None:\n if cutoff is not None:\n raise ValueError(\n \"Only one of `cutoff` and `percentile` should be given.\"\n \"Got cutoff={}, percentile={}\".format(cutoff,...
[ "0.5477841", "0.53945166", "0.52167726", "0.520664", "0.5195709", "0.51707464", "0.5147029", "0.51339924", "0.512796", "0.5078562", "0.5057902", "0.5051038", "0.5050321", "0.5045902", "0.5032911", "0.5032037", "0.5031266", "0.5031266", "0.50205934", "0.4928174", "0.49260354",...
0.6895933
0
Reads the sentences for the given schema and passes them back to the callback function in the object given to the callback each field (key) maps to a set of sentences
def read_sentences(schema, callback, update_message=None): path = sentence_file_path(schema) with open(path, "r") as f: i = 0 while True: l = f.readline() i = i+1 if not l: break callback(json.loads(l.rstrip())) if(update_message and i%1000 == 0): print update_message + " " + str(i)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_sentences(schema):\n\twith open(sentence_file_path(schema), \"w\") as output:\n\t\tdef processKeyValue(keyValue, output, schema):\n\t\t\tsentencesByKey = {}\n\t\t\tfor key in keyValue:\n\t\t\t\twords = generate_field_features(schema, key, keyValue[key])\n\t\t\t\tif(len(words)):\n\t\t\t\t\tsentencesByKey[...
[ "0.7349332", "0.59166044", "0.58921117", "0.5867723", "0.57465756", "0.5673333", "0.56648487", "0.5643129", "0.5571568", "0.557075", "0.5552592", "0.54704106", "0.54348975", "0.5425949", "0.5424828", "0.54131097", "0.5408962", "0.53713536", "0.5322069", "0.531855", "0.5311332...
0.76368517
0
Generates a sentence file for the schema.
def build_sentences(schema): with open(sentence_file_path(schema), "w") as output: def processKeyValue(keyValue, output, schema): sentencesByKey = {} for key in keyValue: words = generate_field_features(schema, key, keyValue[key]) if(len(words)): sentencesByKey[key] = words output.write(json.du...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_sentence_embeddings():\n generate_embeddings_sentence(\"Data/en-train.json\", \"Data_Sent_Embds/en_sent.pkl\")\n generate_embeddings_sentence(\"Data/es-train.json\", \"Data_Sent_Embds/es_sent.pkl\")\n generate_embeddings_sentence(\"Data/pr-train.json\", \"Data_Sent_Embds/pr_sent.pkl\")", "d...
[ "0.6266492", "0.5929239", "0.5906028", "0.5701724", "0.5689828", "0.568831", "0.5675064", "0.5630547", "0.56043714", "0.558945", "0.5561141", "0.5503393", "0.5500739", "0.54846364", "0.54815423", "0.54734635", "0.54490584", "0.5432296", "0.54140735", "0.5397985", "0.5394088",...
0.67174476
0
Given a set of raw key values read from base data returns a sentence which can be fed to a Word2Vec model
def convert_key_value_to_sentence(schema, keyValues, fieldsToRead): features = [] for field in fieldsToRead: value = keyValues[field] features += generate_field_features(schema,field, value) return features
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_sentence(word1, word2, length, vocab, model):\n reverse_vocab = {idx: word for word, idx in vocab.items()}\n output_string = np.zeros((1, length), dtype=np.int)\n output_string[:, 0: 2] = vocab[word1], vocab[word2]\n\n for end in range(2, length):\n start = end - 2\n output_s...
[ "0.62309396", "0.61779165", "0.6035513", "0.5981647", "0.59769297", "0.59704703", "0.59587663", "0.59385157", "0.59374595", "0.5936465", "0.58732957", "0.5851733", "0.5849132", "0.5769421", "0.5748699", "0.5731799", "0.57116324", "0.5706814", "0.5692399", "0.5678421", "0.5657...
0.6748762
0
Given a keyValue where values are already sentences (keyed by field) it converts the input into a single sentence by pulling fields from fieldsToRead
def merge_sentences_to_single_sentence(keyValue, fieldsToRead): ret = [] for field in fieldsToRead: if(field in keyValue): ret += keyValue[field] return ret
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_key_value_to_sentence(schema, keyValues, fieldsToRead):\n\tfeatures = []\n\tfor field in fieldsToRead:\n\t\tvalue = keyValues[field]\n\t\tfeatures += generate_field_features(schema,field, value)\n\treturn features", "def build_sentences(schema):\n\twith open(sentence_file_path(schema), \"w\") as outp...
[ "0.72829556", "0.5446809", "0.5285536", "0.5160025", "0.50860775", "0.50808686", "0.5076239", "0.5017719", "0.49899945", "0.4984434", "0.49753162", "0.49541193", "0.4927719", "0.49174717", "0.48539212", "0.4818554", "0.4816047", "0.48135012", "0.48106462", "0.48036405", "0.47...
0.75380677
0
Given a schema and vectorSize trains the model.
def train_model(schema,fieldsToRead = None): if not fieldsToRead: fieldsToRead = schema["fields"].keys() if("vector_size" in schema): vectorSize = schema["vector_size"] else: vectorSize = DEFAULT_VECTOR_SIZE sentences = [] # build sentences: print "Building Feature vectors..." read_sentences(schema, lam...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trainNewModel():\n print \"Creating feature vectors for trainset...\"\n trainDependencies = getDependency(trainDepFilename)\n trainLabel, trainFeatureVectors = \\\n createFeatureVectors(trainFilename, trainDependencies)\n print \"Length of feature vector for trainset: %d\" \\\n % le...
[ "0.5394133", "0.5246627", "0.5002943", "0.49895066", "0.49778566", "0.49695042", "0.49686876", "0.49619806", "0.49059537", "0.4891096", "0.48482117", "0.48415786", "0.48218104", "0.48167923", "0.4812378", "0.47927174", "0.47913212", "0.47789207", "0.4758141", "0.47307435", "0...
0.58503455
0
Plots the first 100 word vectors for the given model
def plot_schema_vectors(schema, model): vectorList = map(lambda x : x.rstrip().split(' ')[0], open(weight_matrix_path(schema), "r").readlines())[1:] words = vectorList[:500] if(len(model[words[0]]) != 2): print "Vectors must be of dimension 2 to plot! ... Aborting (vector dim is : " + str(len(model[words[0]])) +...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_embeddings(M_reduced, word2Ind, words):\n\n # YOUR CODE HERE\n \n for i,type in enumerate(words):\n x_coor,y_coor = M_reduced[word2Ind[type]][0],M_reduced[word2Ind[type]][1]\n \n plt.scatter(x_coor, y_coor, marker='*', color='red')\n plt.text(x_coor+0.05, y_coor+0.05, ...
[ "0.65103555", "0.6508972", "0.63762796", "0.62669426", "0.6262705", "0.62486225", "0.61370283", "0.6116599", "0.6111513", "0.6097263", "0.6078889", "0.60512763", "0.6031963", "0.5991942", "0.59906477", "0.59884584", "0.59807247", "0.5963074", "0.58819175", "0.57805884", "0.57...
0.70840144
0
Returns the list of snippets in this document, as a TagQuery.
def snippets(self): queries = [] from tagged_document import TagQuery # start with a version of ourself that has no expanded snippets source_lines = self.cleaned_contents.split("\n") # the list of lines we're working with output_lines = [] # default to workin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getSnippets(self, asDict=False):\n\t\t\n\t\titems = self.index\n\n\t\tif asDict:\n\t\t\tsnippets = {}\n\t\telse:\n\t\t\tsnippets = []\n\n\t\tfor item in items:\n\n\t\t\t\tif asDict:\n\t\t\t\t\tsnippets[item] = self.getSnippet(item)\n\t\t\t\telse:\n\t\t\t\t\tsnippets.append(self.getSnippet(item))\n\n\t\treturn ...
[ "0.636", "0.6072174", "0.6020574", "0.6018006", "0.6007283", "0.5816023", "0.5613367", "0.5515494", "0.5372896", "0.53718394", "0.5367246", "0.53547925", "0.5341219", "0.5221058", "0.5210909", "0.52105623", "0.52105623", "0.5209823", "0.5205547", "0.5204812", "0.5154169", "...
0.73205256
0
Returns the set of all tags referred to in this document.
def tags_used(self): return set([query.all_referenced_tags for query in self.snippets])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tag_set(self):\n tag_set = set()\n for tag_token in self.tags:\n tag_set.add(tag_token['tag'])\n return tag_set", "def get_tags(self) -> Set[Text]:\r\n return {tag for tag in self.tags}", "def tags(self) -> \"IterableList[TagReference]\":\n return TagReference....
[ "0.80746084", "0.79332286", "0.7893869", "0.7770048", "0.7585213", "0.74556935", "0.7408252", "0.7406492", "0.7406492", "0.7406492", "0.7406492", "0.7406492", "0.7406492", "0.7406492", "0.7406492", "0.72961414", "0.7226713", "0.71228105", "0.7081927", "0.704197", "0.7029526",...
0.81019205
0
Shift the matrix M in upleft and upright directions and count the ones in the overlapping zone.
def shift_and_count(x_shift, y_shift, M, R): left_shift_count, right_shift_count = 0, 0 for r_row, m_row in enumerate(range(y_shift, dim)): for r_col, m_col in enumerate(range(x_shift, dim)): if M[m_row][m_col] == 1 and M[m_row][m_col] == R[r_row][r_col]: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n row, col, island = make_matrix()\n print(count_island(row, col, island))", "def _count_seen_occupied(grid: List[List[str]], row: int, col: int) -> int:\n count = 0\n for dx in [-1, 0, 1]:\n for dy in [-1, 0, 1]:\n if not (dx == 0 and dy == 0):\n count += 1 if _is_occupied(gri...
[ "0.58783764", "0.5716137", "0.56892467", "0.55931485", "0.5582088", "0.5575983", "0.55238867", "0.54613626", "0.54025465", "0.5394824", "0.5378305", "0.5376456", "0.5363574", "0.5350227", "0.53320783", "0.5330776", "0.52950704", "0.52701885", "0.52489746", "0.5239043", "0.521...
0.680968
0
Reads radio URLS and names from text file
def readRadioList(): global names, preset_list names=[] listFile = open('/home/pi/WoodStream/radio_list.txt', 'r') line = listFile.readlines() for r in range(len(line)): names.append(line[r].replace('\n','').split('|')) if names[r][0][1] == "." and names[r][0][0].isdigit():...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_links(self) -> Tuple[List[str], List[str]]:\n\n with open(URL_FILE, 'r') as txt_file:\n lines = txt_file.read().split()\n\n urls = []\n for line in lines:\n urls.append(line.split(',')[0])\n \n return lines, urls", "def __read_file(file_path):...
[ "0.5813727", "0.57740206", "0.57535976", "0.5720454", "0.56672287", "0.5645893", "0.5489458", "0.5473102", "0.5466302", "0.54643655", "0.54260415", "0.54061854", "0.5299658", "0.52563864", "0.5252227", "0.52446556", "0.523793", "0.5221839", "0.52153015", "0.52116686", "0.5210...
0.6905837
0
Search for a WPSenabled wireless lan and connects to it
def wpsConnect(): SSID = "none" # scan networks on interface wlan0, to see some nice networks subprocess.check_output(["wpa_cli", "-i", "wlan0", "scan"]) sleep(1); #get and decode results wpa = subprocess.check_output(["wpa_cli", "-i", "wlan0", "scan_results"]).decode("UTF-8") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connect():\n \n print(\"*****Starting connection*****\")\n \n ssid = id_key.network_id #hidden ssid\n key = id_key.network_key #hidden key\n \n station = network.WLAN(network.STA_IF)\n \n if station.isconnected() == True:\n print(\"*****Already connected*****\")\n return\n \n station.active...
[ "0.65665174", "0.6323279", "0.6249479", "0.624346", "0.62355316", "0.621162", "0.6174611", "0.6148843", "0.61081487", "0.6067585", "0.60079765", "0.5974527", "0.5877775", "0.5876852", "0.5786336", "0.57583773", "0.5722243", "0.57014275", "0.56911486", "0.5690687", "0.5690615"...
0.66686004
0
Draws radio list with a sliding window of 6 rows
def radioList(dev, draw, index): global menuindex global listMenuStart, listMenuEnd global names font = ImageFont.load_default() draw.rectangle(dev.bounding_box, outline="white", fill="black") if index > listMenuEnd: listMenuEnd += 1 listMenuStart += 1 elif index < listM...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sectionSelect():\r\n self.MyInput = self.buttonValue.get() # gets the value of the radiobutton that the user selected.\r\n if self.MyInput == 1: # if it was the first radio button, prepare for part a\r\n \r\n self.textLabel1.grid(row=1, column = 0, sticky = E) #...
[ "0.55484986", "0.5496551", "0.5446537", "0.5374962", "0.53620017", "0.5356297", "0.53460526", "0.53163755", "0.53129894", "0.5296983", "0.5288681", "0.5263494", "0.5233794", "0.5232299", "0.52289265", "0.52258813", "0.5196682", "0.517921", "0.51335233", "0.511363", "0.5110751...
0.64320034
0
Shows current song info (over multiple lines if needed)
def songInfo(): global songFile, currentRadio lines = songFile.readlines() if len(lines) > 0: songFile.seek(0) title = formatSong(lines[0]).strip() with canvas(device) as draw: invert(draw, 0, 0, names[currentRadio][0], True) if len(title)<...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __print_cur_playing(self):\n song = ' - '.join(str(self.player.cur_song[key])\n for key in config.SONG_INFO\n if self.player.cur_song[key])\n\n if self.player.is_paused():\n song += ' *PAUSED*'\n\n self.botwin.print_line(song)\n\...
[ "0.73993254", "0.6994567", "0.68151754", "0.66247976", "0.6122759", "0.609509", "0.60862267", "0.6076105", "0.6038144", "0.59260035", "0.5923904", "0.59217227", "0.5861666", "0.58533055", "0.5844237", "0.5840577", "0.5838934", "0.5836494", "0.582721", "0.5817052", "0.58153725...
0.76885587
0
Radio list rotary encoder reading Function is duplicated from the volume one because code and store variables must be kept separated for each rotary
def list_rotary(): global listPrevNextCode global listStore global rot_enc_table global list_dt, list_clk listPrevNextCode <<= 2; if (GPIO.input(list_dt)): listPrevNextCode |= 0x02 if (GPIO.input(list_clk)): listPrevNextCode |= 0x01 listPrevNextCode &= 0x0f # I...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vol_rotary(code, store):\n\n global volPrevNextCode\n global volStore\n global rot_enc_table\n global vol_dt, vol_clk\n\n volPrevNextCode <<= 2;\n if (GPIO.input(vol_dt)):\n volPrevNextCode |= 0x02\n if (GPIO.input(vol_clk)):\n volPrevNextCode |= 0x01\n volPrevNextCode &= ...
[ "0.6331918", "0.57667655", "0.56763124", "0.5630284", "0.5584396", "0.55779", "0.5539352", "0.5490566", "0.54863983", "0.5453055", "0.54336977", "0.5370972", "0.53695273", "0.5365914", "0.53614193", "0.53551596", "0.5348109", "0.53228146", "0.5272119", "0.52675486", "0.522709...
0.5873901
1
Radio button switch interrupt callback Select preset
def preset_callback(channel): global currentRadio global preset_sw, preset_list for i in range(6): preset_sw[i][1] = GPIO.input(preset_sw[i][0]) sleep(2) for i in range(6): if (preset_sw[i][1]) == 0: if preset_list[i] != currentRadio: curren...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_radioButton_3_clicked(self):\n print(\"您选择了C\")", "def on_radioButton_clicked(self):\r\n # TODO: not implemented yet\r", "def on_radioButton_clicked(self):\n print(\"您选择了A\")", "def on_radioButton_2_clicked(self):\n print(\"您选择了B\")", "def cbSelectSignal( BoardNum, Direct...
[ "0.6308244", "0.6274675", "0.6134303", "0.60667115", "0.60295075", "0.60130286", "0.5956558", "0.59152347", "0.5870902", "0.5774982", "0.5722981", "0.5690534", "0.56333095", "0.561468", "0.5591845", "0.55860806", "0.55730516", "0.55726427", "0.55702555", "0.55561054", "0.5540...
0.6554633
0
Song information thread. It is the prevalent one.
def showSong(): while True: if not settingsMode: sem.acquire() songInfo() sem.release() sleep(10)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def song_info(self, msg):\n if msg.voice_client is not None and msg.voice_client.is_playing() is True:\n emb = discord.Embed(colour=self.random_color, title='Currently Playing',\n description=self.player[msg.guild.id]['player'].title)\n emb.set_foot...
[ "0.6399275", "0.625296", "0.6242561", "0.62208134", "0.60628396", "0.60389555", "0.60317767", "0.602831", "0.6023342", "0.6013876", "0.6002269", "0.5991139", "0.59656113", "0.5938653", "0.5917954", "0.59090334", "0.58859795", "0.58738905", "0.58583355", "0.5828312", "0.582819...
0.70689565
0
Expects a string of order information, where each coffee order type is separated by commas, and each order information element is separated by semicolons. Returns a list with a nested list for each coffee order type, with separated information elements in each list. Validation of a proper string is not done here, but b...
def parse_order_info(self): list_parse = self.info.strip().split(',') orders_list = [] for single_order in list_parse: single_order_array = single_order.split(';') orders_list.append(single_order_array) single_order_list = [] return orders_list
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def commaStringParse(string):\n dels = []\n cur = \"\"\n length = len(string)\n for c in string:\n # skip spaces outside words\n if c == \" \" and cur == \"\":\n continue\n # new delegation found\n elif c == \",\":\n dels.append(cur)\n cur =...
[ "0.5857848", "0.58049196", "0.5723386", "0.5702327", "0.5671729", "0.56656164", "0.56559837", "0.56381756", "0.56245685", "0.5602937", "0.55811805", "0.5568506", "0.55601406", "0.5545464", "0.55362105", "0.5514411", "0.54832506", "0.54742986", "0.5431665", "0.54077226", "0.53...
0.7260585
0
Prepare should skip datasets older than the given date
def test_skips_old_datasets(l1_ls7_tarball): expected_metadata_path = ( l1_ls7_tarball.parent / "LE07_L1TP_104078_20130429_20161124_01_T1.odc-metadata.yaml" ) run_prepare_cli( landsat_l1_prepare.main, # Can't be newer than right now. "--newer-than", datetime....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_dataset_dates(self):\n # TODO: graph traverse and date checking\n pass", "def test_003_not_enough_datetimes() -> None:\n df = generate_test_data()\n df = df.head(2)\n skim(df)", "def __data_set_is_payday_negative_16_17_18(cls):\n _pay_cycle_object = pay_cycle_object(...
[ "0.64938676", "0.56868553", "0.55403125", "0.55058587", "0.5487253", "0.5451632", "0.5414697", "0.5413075", "0.5302325", "0.5297886", "0.52512944", "0.52501947", "0.5230789", "0.5219749", "0.52057123", "0.5169533", "0.5167547", "0.5163412", "0.5147108", "0.514352", "0.512824"...
0.6703071
0
Return the country code of the user company. If not exists, return XX.
def _get_country_code(self, cr, uid, context=None): context = context or {} user_company = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id return user_company.partner_id and user_company.partner_id.country_id \ and user_company.partner_id.country_id.co...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def COUNTRY_CODE():\n COUNTRY_CODE = \"us/90210\"\n return COUNTRY_CODE", "def country(self) -> Optional[str]:\n return pulumi.get(self, \"country\")", "def country(self) -> Optional[str]:\n return pulumi.get(self, \"country\")", "def get_country_code(contry_name):\n for code, name in ...
[ "0.70617425", "0.7018922", "0.7018922", "0.69923216", "0.6961784", "0.6955647", "0.68768734", "0.68755925", "0.681576", "0.6749036", "0.6689302", "0.6689302", "0.66816527", "0.66816527", "0.66816527", "0.66816527", "0.66816527", "0.66816527", "0.66816527", "0.66816527", "0.66...
0.8069475
0
Return true if the partner is a company of Venezuela and if the address is for billing.
def _check_partner_invoice_addr(self,cr,uid,ids,context={}): partner_obj = self.browse(cr,uid,ids[0]) if partner_obj.vat and partner_obj.vat[:2].upper() == 'VE' and not partner_obj.parent_id: res = partner_obj.type == 'invoice' if res: return True ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_13_company_1_address(self):\n with mock_api(company_1_address):\n import_record(self.session, 'magento.res.partner',\n self.backend_id, '9999256')\n cr, uid = self.cr, self.uid\n partner_ids = self.model.search(cr, uid,\n ...
[ "0.64225984", "0.5880995", "0.5770649", "0.54706657", "0.54565704", "0.5432842", "0.5421194", "0.5385996", "0.5361571", "0.53515327", "0.5336194", "0.53298014", "0.5324306", "0.5320534", "0.5290754", "0.5233072", "0.52117115", "0.5191587", "0.5189317", "0.51889455", "0.518126...
0.6763416
0
Check that the vat is unique in the level where the partner in the tree
def _check_vat_uniqueness(self, cr, uid, ids, context=None): if context is None: context = {} user_company = self.pool.get('res.users').browse(cr, uid, uid).company_id acc_part_brw = self._find_accounting_partner(user_company.partner_id) #User must be of VE ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_binary_search_tree_unique(tree):\r\n if not tree:\r\n return True\r\n\r\n def in_order(tree):\r\n result = []\r\n\r\n def in_order_traversal(root):\r\n if root[1] != -1:\r\n in_order_traversal(tree[root[1]])\r\n result.append(root[0])\r\n ...
[ "0.581893", "0.57848537", "0.5459213", "0.53689283", "0.53509283", "0.53443444", "0.5329999", "0.5324413", "0.529961", "0.52968466", "0.5257998", "0.5228661", "0.52188903", "0.521786", "0.5197731", "0.51933384", "0.5185793", "0.518058", "0.5178743", "0.5175824", "0.51606363",...
0.6166761
0
This method will check the vat mandatoriness in partners for those user logged on with a Venezuelan Company
def _check_vat_mandatory(self, cr, uid, ids, context=None): if context is None: context = {} # Avoiding Egg-Chicken Syndrome # TODO: Refine this approach this is big exception # One that can be handle by end user, I hope so!!! if context.get('create_company',False): r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def button_check_vat(self, cr, uid, ids, context=None):\n if context is None: context = {}\n context.update({'update_fiscal_information':True})\n super(res_partner, self).check_vat(cr, uid, ids, context=context)\n user_company = self.pool.get('res.users').browse(cr, uid, uid).company_id...
[ "0.6213219", "0.6110952", "0.558798", "0.5553842", "0.55305016", "0.55175745", "0.5513593", "0.55129254", "0.5510432", "0.5468977", "0.546072", "0.5454179", "0.5436776", "0.54244274", "0.54189074", "0.5402139", "0.5321819", "0.52599704", "0.5229172", "0.52285993", "0.51999605...
0.65651447
0
Check Venezuelan VAT number, locally called RIF.
def check_vat_ve(self, vat, context = None): if context is None: context={} if re.search(r'^[VJEGP][0-9]{9}$', vat): return True if re.search(r'^([VE][0-9]{1,8}|[D][0-9]{9})$', vat): return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vies_vat_check(self, cr, uid, country_code, vat_number, context=None):\n if country_code.upper() != \"VE\":\n return super(res_partner, self).vies_vat_check(cr, uid, country_code, vat_number,context=context)\n else:\n return super(res_partner, self).simple_vat_check(cr, uid,...
[ "0.6215033", "0.6145", "0.61001897", "0.59510183", "0.5620137", "0.55793554", "0.5524607", "0.543359", "0.5426516", "0.529501", "0.52544534", "0.5225499", "0.5162714", "0.5158818", "0.5156582", "0.51387125", "0.5123888", "0.50936705", "0.5079779", "0.5079241", "0.5063776", ...
0.6955118
0
Validate against VAT Information Exchange System (VIES)
def vies_vat_check(self, cr, uid, country_code, vat_number, context=None): if country_code.upper() != "VE": return super(res_partner, self).vies_vat_check(cr, uid, country_code, vat_number,context=context) else: return super(res_partner, self).simple_vat_check(cr, uid, country_co...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_vat_ve(self, vat, context = None):\n\n if context is None:\n context={}\n if re.search(r'^[VJEGP][0-9]{9}$', vat):\n return True\n if re.search(r'^([VE][0-9]{1,8}|[D][0-9]{9})$', vat):\n return True\n return False", "def button_check_vat(self...
[ "0.6899262", "0.6056001", "0.596347", "0.5768197", "0.5726342", "0.5675557", "0.56308377", "0.56026804", "0.55309474", "0.5523421", "0.5293411", "0.52632827", "0.52387214", "0.5199882", "0.5180262", "0.51448953", "0.5137216", "0.51322967", "0.5115641", "0.5104194", "0.5065354...
0.6633717
1
Return the rotation matrix associated with counterclockwise rotation about the given axis by theta radians.
def _get_rotation_matrix(axis, theta): #import math axis = np.asarray(axis) theta = np.asarray(theta) axis = axis/np.sqrt(np.dot(axis, axis)) a = np.cos(theta/2) b, c, d = -axis*np.sin(theta/2) aa, bb, cc, dd = a*a, b*b, c*c, d*d bc, ad, ac, ab, bd, cd = b*c, a*d, a*c, a*b, b*d, c*d ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_rotation_matrix(axis, theta):\n axis = np.asarray(axis)\n axis = axis / math.sqrt(np.dot(axis, axis))\n a = math.cos(theta / 2.0)\n b, c, d = -axis * math.sin(theta / 2.0)\n aa, bb, cc, dd = a * a, b * b, c * c, d * d\n bc, ad, ac, ab, bd, cd = b * c, a * d, a * c, a * b, b * d, c * d\n ...
[ "0.7977438", "0.7955048", "0.7778583", "0.77589536", "0.77155566", "0.77155566", "0.77155566", "0.77123857", "0.7712289", "0.7705695", "0.7694338", "0.7689674", "0.76730025", "0.75680214", "0.7557322", "0.7438136", "0.73224056", "0.7304231", "0.7298034", "0.72914284", "0.7200...
0.7962036
1
Expands list to a given length by repeating the last element.
def expand_list( l: List, length: int, with_value: Any = None, with_none: bool = False ) -> List: if with_none: l.extend([None] * (length - len(l))) elif with_value is not None: l.extend([with_value] * (length - len(l))) else: l.extend([l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __repeat_to_length(string_to_expand: str, length: int) -> str:\n return (string_to_expand * (int(length / len(string_to_expand)) + 1))[:length]", "def _maybe_repeat(x, n):\n if isinstance(x, list):\n assert len(x) == n\n return x\n else:\n return [x] * n", "def _maybe_repeat(s...
[ "0.6530027", "0.6479355", "0.6395996", "0.63587534", "0.63503283", "0.6309707", "0.60246617", "0.60153556", "0.60088956", "0.6005765", "0.59902346", "0.5989824", "0.5986422", "0.5936696", "0.5935092", "0.59313923", "0.58559996", "0.57862985", "0.5766684", "0.57540005", "0.571...
0.6572616
0
Creates a object which can be used as legend_labels and a list of the values as integers (after mapping strings to integers).
def create_categories(values: List[str]) -> Tuple[List[Tuple[int, str]], List[int]]: string_map = {} for i, value in enumerate(sorted(set(values))): string_map[value] = i legend_labels = [] for key, value in string_map.items(): legend_labels.append((value,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_labels_to_int(labels): \n if not len(labels):\n raise ValueError(\"Nothing to convert!\")\n\n if isinstance(labels[0], basestring) or isinstance(labels[0], int):\n label_legend = list(set(labels))\n converted_labels = [ label_legend.index(l) for l in labels ]\n elif is_ite...
[ "0.66924685", "0.60350275", "0.58736515", "0.54408747", "0.5426545", "0.53833926", "0.53450423", "0.53296554", "0.53291315", "0.5311162", "0.53060395", "0.5296612", "0.5264326", "0.5229604", "0.52039635", "0.518512", "0.51814663", "0.51671505", "0.5156477", "0.51532", "0.5125...
0.6291414
1
Script to convert Duplex Sequencing .mutpos file formats into valid VCF files. Currently VCF format v4.2 is outputted. A .mutpos file is
def convert_mutpos_to_vcf( mutpos_file: str, sample: str, vcf_file: str, ref_file: str, dict_file: str, min_depth: int, verbose: bool, ) -> None: header = 'CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO\tFORMAT\t{sample}\n' reference = pyfaidx.Fasta(ref_file) # .mutpos file does n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sample_vcf():\n file_content = b\"\"\"##fileformat=VCFv4.2\n##hailversion=0.2.100-2ea2615a797a\n##INFO=<ID=QUALapprox,Number=1,Type=Integer,Description=\"\">\n##INFO=<ID=SB,Number=.,Type=Integer,Description=\"\">\n##INFO=<ID=MQ,Number=1,Type=Float,Description=\"\">\n##INFO=<ID=MQRankSum,Number=1,Type=Float,...
[ "0.6234539", "0.61637384", "0.59525365", "0.5717027", "0.5668367", "0.564835", "0.5631541", "0.56063294", "0.55715346", "0.55430245", "0.54900706", "0.5455487", "0.5411157", "0.5402159", "0.5366597", "0.5365656", "0.53612477", "0.5356044", "0.5267734", "0.5267572", "0.5266436...
0.69390684
0
Divide the group in subgroups using the characteristic
def get_subgroups(group, characteristic): # Get the dataframe and group by the characteristic dataframe = group['dataframe'] groupby = dataframe.groupby(by=characteristic) # Create the new subgroups subgroups = [] hca = OntologyConversorHCA() scea = OntologyConversorSCAE() for value, su...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Group(self) -> _n_5_t_0:", "def Group(self) -> _n_5_t_0:", "def divisor_subgroups(self):\n return [Gamma0_constructor(M) for M in self.level().divisors()]", "def group(df, dvmin, dvmax, step):\n\tr = step/2\n\tres = []\n\n\tfor ticker in range(dvmin, dvmax, step):\n\t\t#select values by left-right...
[ "0.6266819", "0.6266819", "0.6239417", "0.60283136", "0.59606814", "0.5911279", "0.57251", "0.5670328", "0.56695765", "0.5662354", "0.5635692", "0.5617585", "0.56125766", "0.55598503", "0.5544851", "0.5534283", "0.54904234", "0.54812676", "0.5439492", "0.54283965", "0.5384271...
0.67139417
0
Creates a new row with the combinations of the characteristics.
def create_row(project_ID, subgroups, characteristics_used, metadata_cells, number_genes): cells = 0 for subgroup in subgroups: cells += len(subgroup['dataframe']) n_subgroups = len(subgroups) combination_name = combiation_to_name(characteristics_used) row = { 'project_ID':...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_table(self, rows):\n ...", "def _build_rows_struct(self):\n struct = []\n # Step 1 - See docstring for details\n for row in itertools.izip_longest(*self.columns, fillvalue=(\"\",)):\n # Step 2\n row_list = [dict(itertools.izip((\"v\",\"f\",\"p\"), it...
[ "0.58312434", "0.5817524", "0.5761475", "0.5613936", "0.55881566", "0.55620486", "0.54279935", "0.54197836", "0.5410569", "0.53951716", "0.53931123", "0.5388323", "0.53847986", "0.528821", "0.52657443", "0.52647746", "0.5195089", "0.5190759", "0.5172699", "0.51685154", "0.516...
0.62127197
0
Creates a list of FileParse objects for the files listed in the listfile
def mk_parses(listfile, corenlp_host): # if not listfile.endswith('.listfile'): # filetype = 'Co-Reference List file' # error = 'has incorrect file type' # raise FilenameException("Error: %s %s" % (filetype, error)) try: with open(listfile) as f: pserver ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _parse_filelist(self):\n if not os.path.exists(self.filelist):\n print \"couldn't find \",self.filelist\n return\n\n f = open( self.filelist, 'r' )\n flist = f.readlines()\n self.larlitefilelist = []\n for f in flist:\n if \".root\" in f:\n ...
[ "0.67657423", "0.63862836", "0.63492763", "0.62759095", "0.6179322", "0.6167029", "0.6157398", "0.6154409", "0.6147139", "0.6145613", "0.61268586", "0.6122044", "0.61076725", "0.61069846", "0.6082065", "0.60661703", "0.6057156", "0.6029929", "0.59860307", "0.5975995", "0.5971...
0.7360179
0
Tags given parse tree with coreferences
def tag_ptree(ptree, coreflist): pattern = r"""(?P<lp>\(?\s*) # left parenthesis (?P<tg>[a-zA-Z$]+)? # POS tag (?P<data>\s*%s) # subtree of tag (?P<rp>(?:\s*\))*) # right parenthesis """ for cid, coref in coreflist[::-1]: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tagger():", "def extract_entities_from_dependency_parse(dtrees, postag):\n sents = []\n for x in range(0,len(dtrees)):\n tok_list = []\n for node_index in dtrees[x].nodes:\n if node_index != 0:\n node = dtrees[x].nodes[node_index]\n if node['ctag']...
[ "0.60620755", "0.5938104", "0.5777599", "0.57469004", "0.5688935", "0.56744325", "0.5652321", "0.56140745", "0.5548153", "0.55136913", "0.5502653", "0.55001086", "0.54842806", "0.5393346", "0.5389617", "0.5369972", "0.5346752", "0.52565354", "0.5223434", "0.5211723", "0.51915...
0.72544825
0
Parses xml to find all tagged coreferences contained in COREF tags
def get_tagged_corefs(xml, ordered=False): nps = {} if ordered: nps = [] xml = _normalize_malformed_xml(xml) try: corefs = parseString(xml).getElementsByTagName('COREF') except ExpatError: return nps for coref in corefs: try: cid = coref.attributes[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_corenlp_coref_xml_doc(input_dir = 'CoreNLP_coref_anno/dev'):\n\n\tmentions = []\n\tfor file in os.listdir(input_dir):\n\t\ttree = ET.parse(input_dir + '/' + file)\n\t\tdocument = tree.getroot()[0]\n\t\t# sentences_node = document.find('sentences')\n\n\t\t# for sentence in enumerate(sentences_node):\n\t\t...
[ "0.7235463", "0.6117376", "0.5995195", "0.59527093", "0.58853424", "0.58095276", "0.57897663", "0.5733017", "0.5543593", "0.54734206", "0.5407381", "0.53605187", "0.5335258", "0.5314644", "0.52955043", "0.522967", "0.52284986", "0.5218453", "0.5214318", "0.52129114", "0.52052...
0.7841984
0
Tags parse tree with corefs and returns the tree, lexicon, dependencies and raw text as tuple
def _process_parse(parse, coreflist): sentence = parse.get('sentences') if sentence: ptree = Tree.parse(tag_ptree(sentence[0]['parsetree'], coreflist)) words = [(w[0], w[1]) for w in sentence[0]['words']] depends = [(d[0], d[1], d[2]) for d in sentence[0]['dependencies']] text = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tag_ptree(ptree, coreflist):\n pattern = r\"\"\"(?P<lp>\\(?\\s*) # left parenthesis\n (?P<tg>[a-zA-Z$]+)? # POS tag\n (?P<data>\\s*%s) # subtree of tag\n (?P<rp>(?:\\s*\\))*) # right parenthesis\n \"\"\"\n for cid, coref in co...
[ "0.6558229", "0.5978049", "0.58578503", "0.57997096", "0.5742127", "0.56275505", "0.56094885", "0.5503414", "0.54556304", "0.5442734", "0.54386324", "0.5437053", "0.5436228", "0.5407743", "0.53664917", "0.53568983", "0.53472793", "0.52995527", "0.529653", "0.52674514", "0.524...
0.61873215
1
Returns sets of cognitive synonyms for each of the input words
def get_synsets(words): synsets = {} for word in words: for syn in wn.synsets(word): synsets[syn.name] = tuple([lemma.name for lemma in syn.lemmas]) return synsets
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getSynonyms(self, wordSet):\n synonyms = {}\n for w in wordSet:\n # find synonyms\n synsets = wn.synsets(w, pos=wn.NOUN)\n if len(synsets) > 0: \n # there are noun senses for this word, get synonyms\n synonyms[w] = set([synset.name for synset in synsets])\n \n return synonym...
[ "0.7300424", "0.72647613", "0.693426", "0.6843779", "0.6789311", "0.6768181", "0.668799", "0.6616254", "0.65530103", "0.6498196", "0.6455689", "0.6441301", "0.6395889", "0.6341687", "0.6340739", "0.62952596", "0.62618357", "0.6215934", "0.61952794", "0.61760896", "0.61675686"...
0.73723024
0
Creates a unique coreference id tag
def _mk_coref_id(): num, alpha = int(_mk_coref_id.id[:-1]), _mk_coref_id.id[-1] if alpha == 'Z': alpha = 'A' num += 1 else: alpha = chr(ord(alpha) + 1) _mk_coref_id.id = '%s%s' % (num, alpha) return _mk_coref_id.id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_tag_id():\n return uuid.uuid1().int", "def unique_id() -> str:", "def makeid(cls):\n return str(uuid.uuid4().hex)", "def make_id():\n global _simple_id\n\n import uuid\n from ..settings import settings\n\n if settings.simple_ids(False):\n _simple_id += 1\n new_i...
[ "0.7437332", "0.6738404", "0.63834155", "0.6371057", "0.6304287", "0.63018346", "0.62964404", "0.6295917", "0.62858105", "0.62858105", "0.6249197", "0.62267005", "0.61638355", "0.61524254", "0.6149647", "0.6139366", "0.61354506", "0.612528", "0.61198694", "0.60630846", "0.605...
0.7401999
1
test for get_file_map length
def test_get_file_map_len(): file_map = sd.get_file_map("resources/") files = glob.glob("resources/" + "/**" + ".txt", recursive=True) assert len(file_map) == len(files)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __len__(self) -> int:\n return len(self.mapping)", "def __len__(self):\n return len(self._maps)", "def _get_file_length(self, file):\n self[file] = file.stat().st_size", "def _get_content_length(self) -> Optional[int]:\n self.mem_map.seek(consts.MEM_MAP_INITIALIZED_FLAG_NUM_BY...
[ "0.63363755", "0.632002", "0.631526", "0.6251473", "0.62246025", "0.62086993", "0.6192581", "0.612346", "0.61131245", "0.61064035", "0.6098549", "0.6087624", "0.60737777", "0.6053692", "0.6010846", "0.60043615", "0.6001356", "0.59373516", "0.5909265", "0.5894157", "0.588661",...
0.75081176
0
test for get_file_map filetypes
def test_get_file_map_type(): for file in sd.get_file_map("resources/"): assert file.endswith(".txt")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_file_type(self):\n file_list = {'events': 'monol_testA_nustar_fpma_ev',\n 'lc': 'monol_testA_E3-50_lc',\n 'pds': 'monol_testA_E3-50_pds',\n 'gti': 'monol_testA_E3-50_rebin4_gti',\n 'cpds': 'monol_test_E3-50_cpds'}\n...
[ "0.67927724", "0.6759587", "0.6590826", "0.6560555", "0.65343803", "0.65234524", "0.63119245", "0.6160854", "0.6137816", "0.6120894", "0.6120894", "0.61136144", "0.60679215", "0.60398746", "0.6003673", "0.5977015", "0.59422", "0.5938938", "0.593585", "0.5926794", "0.59252346"...
0.781753
0
test for texts ignorechars
def test_get_texts_ignores(): file_map = sd.get_file_map(".") texts = sd.get_texts(file_map) ingnores = "[:.,;:!?\"-()]\n".split() for text in texts: for char in ingnores: assert text.find(char) == -1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ISNONTEXT(value):\n return not ISTEXT(value)", "def _hidden_in_unicode(self, txt):", "def extract_non_ascii_words(text):\n return [w for w in text.split() if not all(ord(c) < 128 for c in w)]", "def is_special_text(text):\n return len(text) > 5 and \\\n (text[0:5] == '\"VAR:' or text[0:5] =...
[ "0.7161125", "0.6853295", "0.67469144", "0.65281326", "0.6462459", "0.642258", "0.64153326", "0.64018327", "0.6362885", "0.63566977", "0.63117754", "0.62723047", "0.62690115", "0.61884797", "0.61873764", "0.6179756", "0.61633605", "0.61601937", "0.6154627", "0.61421007", "0.6...
0.7948618
0
test get_stopwords if there are any loaded
def test_get_stopwords(): stopwords = sd.get_stopwords("resources/stopwords.de.json") assert len(stopwords) > 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_stopwords():\r\n\tglobal stopwords\r\n\tif os.path.exists(paths.path_data_stopwords_txt):\r\n\t\tprint('\\nloading stopwords')\r\n\t\twith open(paths.path_data_stopwords_txt,'r') as inf:\r\n\t\t\tstopwords = inf.read().split('\\n')\r\n\t\treturn True\r\n\telse:\r\n\t\treturn False", "def test_stopwords(...
[ "0.7854533", "0.732934", "0.7106721", "0.70151174", "0.6862212", "0.6741722", "0.67269224", "0.6673797", "0.6653463", "0.662905", "0.65657014", "0.6527875", "0.65140384", "0.6433387", "0.64028853", "0.63895845", "0.6382746", "0.6365927", "0.6260102", "0.62321216", "0.6196824"...
0.8207364
0
Assert() == and !=
def equality(): Assert(1) == 1 Assert(1) != 0 with Assert.raises(AssertionError): Assert(1) == 0 with Assert.raises(AssertionError): Assert(1) != 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def equality():\r\n\r\n Assert(1) == 1\r\n Assert(1) != 0\r\n\r\n with Assert.raises(AssertionError):\r\n Assert(1) == 0\r\n\r\n with Assert.raises(AssertionError):\r\n Assert(1) != 1", "def test_equal(self):\n self.assertTrue(self.a == self.a)\n self.assertFalse(self.a !=...
[ "0.8346528", "0.8007103", "0.76514935", "0.7639946", "0.76391506", "0.7614317", "0.7614317", "0.7581866", "0.7580627", "0.75677395", "0.7551668", "0.74757785", "0.74163777", "0.7364268", "0.73625875", "0.73209846", "0.73047805", "0.72451115", "0.7181612", "0.7153811", "0.7127...
0.8236934
1
Assert() in boolean context
def boolean(): bool(Assert(1)) with Assert.raises(AssertionError): bool(Assert(0))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def boolean():\r\n\r\n bool(Assert(1))\r\n\r\n with Assert.raises(AssertionError):\r\n bool(Assert(0))", "def assert_true(self, expr, msg=None):\r\n assert bool(expr) is True", "def test_true_is_true(self):\n self.assertEqual(True, True)", "def test_assert_truth(self):\n\n #...
[ "0.87461877", "0.7953031", "0.77666456", "0.75545913", "0.751331", "0.7499934", "0.74183244", "0.72309905", "0.7229673", "0.71422446", "0.7057117", "0.70564234", "0.7017279", "0.6969007", "0.6939093", "0.6935262", "0.6929918", "0.6905843", "0.6899669", "0.68951046", "0.682863...
0.86485225
1
Check status of game (turn, tie, win)
def check_game_status(self): for player in ("1", "2"): row_win = np.apply_along_axis( lambda x: set(x) == {player}, 1, self.board ).any() col_win = np.apply_along_axis( lambda x: set(x) == {player}, 0, self.board ).any() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_game(self):\n gameOver = None\n if self.turn > 4:\n gameOver = self.check_x_won()\n if gameOver is True:\n self.game_x_won()\n return\n\n gameOver = None\n if self.turn > 5:\n gameOver = self.check_o_won()\n ...
[ "0.80612904", "0.7915147", "0.7878563", "0.7789877", "0.7766665", "0.74999005", "0.7455551", "0.7326234", "0.72867805", "0.72417605", "0.7212286", "0.7205472", "0.71589017", "0.7152774", "0.71287376", "0.70749533", "0.6993341", "0.697916", "0.6953456", "0.6918157", "0.6915664...
0.81972736
0
Generate full game tree from initial state
def gen_game_tree(state_init): current_path = [state_init] game_tree = {} while current_path: cur_state = current_path[-1] if cur_state not in game_tree: ttt = TicTacToe(cur_state) game_tree[cur_state] = { "unexplored": ttt.next_states, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_tree(self, tree):\n # print(self)\n if len(self.available_combinations()) > 1:\n comb1 = random.choice(self.available_combinations())\n comb2 = random.choice(self.available_combinations())\n\n if self.last_move == 5:\n next_move = 7\n ...
[ "0.650333", "0.6426695", "0.6353682", "0.6247366", "0.6226953", "0.6193903", "0.6182154", "0.616572", "0.616572", "0.6146904", "0.6146904", "0.6146904", "0.6146904", "0.6146904", "0.6146904", "0.6146904", "0.6146904", "0.6146904", "0.6146904", "0.6146904", "0.6146904", "0.6...
0.8016925
0
Build game tree and export given initial state
def learn(state="_________"): game_tree = gen_game_tree(state) with open(GAME_TREE_FILE, "w") as gt_file: json.dump(game_tree, gt_file, indent=4)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gen_game_tree(state_init):\n current_path = [state_init]\n game_tree = {}\n while current_path:\n cur_state = current_path[-1]\n if cur_state not in game_tree:\n ttt = TicTacToe(cur_state)\n game_tree[cur_state] = {\n \"unexplored\": ttt.next_states,\...
[ "0.6992818", "0.62803036", "0.6121454", "0.5999283", "0.5755731", "0.5747414", "0.5741842", "0.5733358", "0.5714842", "0.5713853", "0.5682053", "0.56399035", "0.5638635", "0.5633732", "0.5546844", "0.5539687", "0.55313945", "0.55129886", "0.5512793", "0.5511461", "0.54992425"...
0.6409592
1
Prints junctions and their read counts to a specified file This is a striped down version of Beryl Cummings' printSplices()
def printSplices(path, spliceDict): for key in spliceDict: chrom, junctionStart, junctionEnd = key timesSeenInSample = str(spliceDict[key]) with open(path, "a") as out: out.write("\t".join([str(chrom),str(junctionStart),str(junctionEnd),timesSeenInSample])+"\n")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_file(list):\n chr_name_list = ['SL2.40ch00','SL2.40ch01','SL2.40ch02','SL2.40ch03','SL2.40ch04','SL2.40ch05','SL2.40ch06','SL2.40ch07','SL2.40ch08','SL2.40ch09','SL2.40ch10','SL2.40ch11','SL2.40ch12']\n for index,chr_list in enumerate(list):\n if chr_list:\n chr = chr_name_list[in...
[ "0.55524635", "0.54632056", "0.5263494", "0.5177165", "0.5173631", "0.51674557", "0.51629335", "0.51449746", "0.5098115", "0.5084178", "0.50762475", "0.50391614", "0.49811924", "0.4976644", "0.49719164", "0.49670598", "0.49643385", "0.4959343", "0.49338976", "0.49301448", "0....
0.57830656
0
Parses a CIGAR string and returns values which can used to determine an intron's 3' and 5' splice sites
def parseCIGARForIntrons(cigar): if 'N' in cigar: cigar = cigar.split('N')[0] + 'N' #remove all information after intron else: raise Exception('No intron detected') offset = 0 matchedExon = 0 intronLength = 0 for c in list(Cigar(cigar).items()): # returns list of tuples : [(20, 'N')] if c[1] == 'N': ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fromString(cls, string):\n # From SAM specification v1.5, slightly adapted for single-token parsing\n pattern = r\"^[0-9]+[MIDNSHPX=]\" \n string = string.strip()\n if string == '*':\n return CIGAR.fromList(['*'])\n parsed = []\n s = string\n # Parse ...
[ "0.61920637", "0.55732", "0.55624104", "0.55116343", "0.54264295", "0.54159015", "0.539418", "0.5283289", "0.52801025", "0.5264372", "0.52198744", "0.5206368", "0.5167345", "0.51665264", "0.5129471", "0.5112804", "0.51121867", "0.5094192", "0.5084972", "0.5078861", "0.5075326...
0.6651546
0
Return a microvm builder.
def vm_builder_fxt(bin_cloner_path): return MicrovmBuilder(bin_cloner_path)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getBuilder():", "def getBuilder(name):", "def getBuilder(name):", "def get_builder_instance(self):\n if self.framework == 'standalone':\n builder_instance = BuildStandaloneExecutionScenario(\n scenario=self.scenario,\n testcase_list=self.testcase_list,\n ...
[ "0.66513336", "0.62153226", "0.62153226", "0.6062747", "0.58661616", "0.5659723", "0.5563742", "0.5534387", "0.5384041", "0.53485197", "0.5347957", "0.5331545", "0.53157175", "0.5245275", "0.5224448", "0.52028966", "0.5130069", "0.51117736", "0.5096132", "0.5077181", "0.50658...
0.72771144
0
CPU template fixture for instruction set feature parity templates
def inst_set_cpu_template_fxt(request): return request.param
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inst_set_cpu_template_ext_fxt(request):\n return request.param", "def test_create_with_1_5_cpu_template(uvm_plain):\n\n # We remove KVM_CAP_IOEVENTFD from kvm checks just for testing purpose.\n custom_cpu_template = json.loads('{\"kvm_capabilities\": [\"!36\"]}')\n\n test_microvm = uvm_plain\n ...
[ "0.6492081", "0.6178032", "0.60896695", "0.5932851", "0.5892066", "0.5866146", "0.5837124", "0.5809687", "0.58080107", "0.58039045", "0.58007884", "0.5685072", "0.56198126", "0.55503553", "0.5546678", "0.5519641", "0.5514643", "0.54988", "0.54775137", "0.54241097", "0.5375278...
0.6581265
0
CPU template fixture for instruction set feature parity templates plus T2
def inst_set_cpu_template_ext_fxt(request): return request.param
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inst_set_cpu_template_fxt(request):\n return request.param", "def test_create_with_1_5_cpu_template(uvm_plain):\n\n # We remove KVM_CAP_IOEVENTFD from kvm checks just for testing purpose.\n custom_cpu_template = json.loads('{\"kvm_capabilities\": [\"!36\"]}')\n\n test_microvm = uvm_plain\n tes...
[ "0.6283071", "0.61095417", "0.5970126", "0.5944379", "0.57899725", "0.5788448", "0.57060117", "0.5703731", "0.56943184", "0.56769645", "0.56144947", "0.5605428", "0.55857575", "0.5540953", "0.55331457", "0.55327034", "0.5519365", "0.5440294", "0.5398402", "0.5397354", "0.5371...
0.62984467
0
Check that CPUID feature flag are set and unset as expected.
def check_cpuid_feat_flags( vm_builder, cpu_template, microvm, kernel, disk, must_be_set, must_be_unset ): vm = create_vm(vm_builder, cpu_template, microvm, kernel, disk) vm.start() cpuid = cpuid_utils.get_guest_cpuid(vm) allowed_regs = ["eax", "ebx", "ecx", "edx"] for leaf, subleaf, reg, flag...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_feat_parity_cpuid_mpx(vm_builder, cpu_template, microvm, guest_kernel, disk):\n # fmt: off\n must_be_set = []\n must_be_unset = [\n (0x7, 0x0, \"ebx\",\n (1 << 14) # MPX\n ),\n ]\n # fmt: on\n\n check_cpuid_feat_flags(\n vm_builder,\n cpu_template,\...
[ "0.6047205", "0.6046552", "0.5781436", "0.5743857", "0.56553596", "0.55999", "0.55306613", "0.55130416", "0.5501763", "0.5501028", "0.55007136", "0.54305595", "0.5428378", "0.53905046", "0.53552026", "0.5344533", "0.5331302", "0.5313447", "0.5289967", "0.5246307", "0.5229007"...
0.67364603
0
Verify that MPX (Memory Protection Extensions) is not enabled in any of the supported CPU templates.
def test_feat_parity_cpuid_mpx(vm_builder, cpu_template, microvm, guest_kernel, disk): # fmt: off must_be_set = [] must_be_unset = [ (0x7, 0x0, "ebx", (1 << 14) # MPX ), ] # fmt: on check_cpuid_feat_flags( vm_builder, cpu_template, microvm, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_xpu_available():\n xpu_count = int(os.getenv(\"FLAGS_selected_xpus\", \"-1\"))\n if xpu_count < 0:\n return False\n\n if _HAS_FLUID:\n from paddle import fluid\n if not fluid.is_compiled_with_xpu():\n logger.warning(\"Found non-empty XPU_VISIBLE_DEVICES. \\\n ...
[ "0.57419145", "0.54909056", "0.5443861", "0.5433068", "0.5350733", "0.5342966", "0.5336618", "0.53355086", "0.5295141", "0.5267374", "0.5251669", "0.5238141", "0.5228954", "0.5222384", "0.52127624", "0.521165", "0.5137828", "0.5132296", "0.5126168", "0.5078929", "0.50768656",...
0.646576
0
Verify that securityrelated CPUID feature flags are properly set for T2CL and T2A CPU templates.
def test_feat_parity_cpuid_sec( vm_builder, inst_set_cpu_template, microvm, guest_kernel, disk ): # fmt: off must_be_set_common = [ (0x7, 0x0, "edx", (1 << 26) | # IBRS/IBPB (1 << 27) | # STIBP (1 << 31) # SSBD ) # Security feature bits in 0x80000...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_cpuid_feat_flags(\n vm_builder, cpu_template, microvm, kernel, disk, must_be_set, must_be_unset\n):\n vm = create_vm(vm_builder, cpu_template, microvm, kernel, disk)\n vm.start()\n\n cpuid = cpuid_utils.get_guest_cpuid(vm)\n allowed_regs = [\"eax\", \"ebx\", \"ecx\", \"edx\"]\n\n for le...
[ "0.6894671", "0.5995641", "0.58783853", "0.586612", "0.58471763", "0.53812766", "0.53704953", "0.5313318", "0.53037494", "0.52868134", "0.5261382", "0.52320606", "0.52201504", "0.52053535", "0.5201698", "0.51455295", "0.5115424", "0.51031226", "0.50246453", "0.5019964", "0.50...
0.6124456
1
Verify availability and value of the IA32_ARCH_CAPABILITIES MSR for T2CL and T2A CPU templates.
def test_feat_parity_msr_arch_cap( vm_builder, inst_set_cpu_template, microvm, guest_kernel, disk ): vm = create_vm(vm_builder, inst_set_cpu_template, microvm, guest_kernel, disk) vm.start() ssh_conn = net_tools.SSHConnection(vm.ssh_config) arch_capabilities_addr = "0x10a" rdmsr_cmd = f"rdmsr {...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_cpu_architecture_value(self):\n \n cpu_architecture = get_cpu_information()[0]\n \n # Check to make sure the returned value is \"x86_64\"\n self.assertEqual(cpu_architecture, 'x86_64')", "def caps_init():\n global SYSTEM_CAPS\n\n if SYSTEM_CAPS:\n SYSTEM_C...
[ "0.5377127", "0.5316202", "0.5298822", "0.52873385", "0.5224889", "0.51393336", "0.5122224", "0.5099354", "0.50782216", "0.5076689", "0.4983703", "0.49749318", "0.49581584", "0.49509874", "0.4941888", "0.48740867", "0.48689002", "0.48666182", "0.48552117", "0.48470214", "0.48...
0.6546922
0
Tests that getting the household information fails.
def test_get_household_not_successful(self): res = self.client.get(HOUSEHOLD_URL) self.assertEqual(res.status_code, status.HTTP_401_UNAUTHORIZED)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_getHousehold_invalidId(self):\n self.assertTrue(self.z.getHousehold(None) is None, \"An invalid value passed to getHousehold returns None.\")\n self.assertTrue(self.z.getHousehold('') is None, \"An invalid value passed to getHousehold returns None.\")\n self.assertTrue(self.z.getHouse...
[ "0.76925397", "0.73701715", "0.7303926", "0.7219138", "0.69110453", "0.6667777", "0.64354664", "0.6435256", "0.6403394", "0.6348383", "0.6280393", "0.61155486", "0.6111117", "0.60783094", "0.59928685", "0.5989307", "0.5986472", "0.5982438", "0.59319586", "0.59300196", "0.5925...
0.7832829
0
Tests that creating a new household fails.
def test_create_household_not_successful(self): payload = { 'name': 'Test Household 1' } res = self.client.post(HOUSEHOLD_URL, payload) self.assertEqual(res.status_code, status.HTTP_401_UNAUTHORIZED)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_household_bad_create(self):\n tester = app.test_client(self)\n response = tester.post('/household/', data = {}, follow_redirects=True)\n self.assertEqual(response.status_code, 400)", "def test_createHousehold_duplicateHousehold(self):\n self.z.createHousehold('dupe')\n ...
[ "0.8241005", "0.7594697", "0.74941844", "0.7212988", "0.6878742", "0.68230265", "0.6765863", "0.6576161", "0.6555452", "0.6475804", "0.6474309", "0.6420814", "0.6411025", "0.64001477", "0.639472", "0.639415", "0.63731384", "0.63713044", "0.63557255", "0.635298", "0.6352911", ...
0.81085485
1
Tests that getting the household information succeeds.
def test_get_household_successful(self): res = self.client.get(HOUSEHOLD_URL) self.assertEqual(res.status_code, status.HTTP_200_OK) self.assertEqual(self.user.household.id, res.data[0]['id'])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_household_get(self):\n url = '/household/'+ self.test_id + '/'\n response = self.tester.get(url,\n content_type='application/json')\n self.assertEqual(response.status_code, 200)", "def test_get_household_not_successful(self):\n res = self.cli...
[ "0.8218142", "0.7450904", "0.7331442", "0.7239677", "0.7009391", "0.6946818", "0.6856664", "0.67273486", "0.6376594", "0.63082504", "0.6249649", "0.6248941", "0.62462145", "0.6209808", "0.61837524", "0.6171199", "0.61226755", "0.6055111", "0.6053376", "0.60327667", "0.5963619...
0.8438692
0
Tests that creating a new household is successful.
def test_create_new_household(self): user = get_user_model().objects.create_user( email='test1@test.com', password='TestPass1', name='Test User 1', ) self.client.force_authenticate(user) payload = { 'name': 'Test Household 1' } ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_household_not_successful(self):\n payload = {\n 'name': 'Test Household 1'\n }\n res = self.client.post(HOUSEHOLD_URL, payload)\n\n self.assertEqual(res.status_code, status.HTTP_401_UNAUTHORIZED)", "def test_createHousehold_single(self):\n h = self.z....
[ "0.8297898", "0.8104976", "0.766127", "0.72825843", "0.7262441", "0.6959269", "0.68859065", "0.6845953", "0.6807888", "0.675992", "0.6672827", "0.66552925", "0.66393405", "0.6633378", "0.6632311", "0.6608504", "0.6596012", "0.65866256", "0.65690094", "0.65679055", "0.6559909"...
0.8233622
1
Tests partial household update (PATCH).
def test_patch_household(self): payload = { 'name': 'Test Household Changed' } res = self.client.patch(get_household_detail_url( self.user.household.id), payload) self.assertEqual(res.status_code, status.HTTP_200_OK)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_partial_update(self):\n doctor = DoctorFactory.create(id=22)\n data = {'name': 'Joe'}\n self.assertNotEqual(doctor.name, data['name'])\n\n response = self.unath_client.patch(reverse('doctor-detail', args=[22]), data=data)\n self.assertEqual(response.status_code, status.H...
[ "0.7666297", "0.75013214", "0.74215907", "0.74196345", "0.7171165", "0.7092046", "0.70738345", "0.7062594", "0.70270765", "0.697513", "0.69419473", "0.69234407", "0.6922964", "0.6921961", "0.6884168", "0.68591523", "0.68510014", "0.68203735", "0.68069667", "0.67753834", "0.67...
0.8145228
0
Collect tweets from account in `acc` and save them in the file `path`
def scrape_from_user(acc, num, path='data/tweet_ids.txt'): print('Collecting tweets from {}'.format(acc[num])) tweets = [] new_tweets = [] new_tweets = _api.user_timeline(screen_name=acc[num], count=200) tweets.extend(new_tweets) oldest = tweets[-1].id - 1 while len(new_tweets) > 0: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_user_tweets(user, n, auth):\r\n t = twitter.Twitter(auth=auth)\r\n print(\"Fetching %i tweets from @%s\" % (n, user))\r\n tweets = t.statuses.user_timeline(screen_name=user, count=n)\r\n print(\" (actually fetched %i)\" % len(tweets))\r\n for tweet in tweets:\r\n save_tweet(tweet, o...
[ "0.6475069", "0.6192456", "0.60881585", "0.6087728", "0.60604256", "0.6040595", "0.6023491", "0.5927844", "0.588906", "0.5875508", "0.57867134", "0.5729353", "0.5710584", "0.5603973", "0.5562742", "0.5514144", "0.55016124", "0.5498054", "0.5494429", "0.5470366", "0.5460203", ...
0.73761916
0
Return the graph's output node.
def get_output_node(self) -> WillumpGraphNode: return self.output_node
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def output_node(self, port: int):\n return self._output_nodes_map[port]", "def output(self, name: str) -> bpy.types.NodeSocket:\n\t\treturn self.outputs[name]", "def get_output(self, **kwargs):\n with tf.variable_scope(self.layer_scope):\n return self.out", "def compute_output(self):...
[ "0.7194285", "0.70183927", "0.68669474", "0.68612355", "0.6664335", "0.662465", "0.6592259", "0.6579076", "0.6542078", "0.65351874", "0.64692736", "0.64676654", "0.64674354", "0.6466835", "0.6466835", "0.6458526", "0.64372426", "0.64298177", "0.64298177", "0.6406894", "0.6400...
0.8847338
0
Find closest point from a list of points.
def closest_point(point, points): return points[cdist([point], points).argmin()]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def closest(point, points):\n pts = [(Point.distance(point, p), p) for p in points]\n pts.sort()\n return pts[0][1]", "def find_closest_points(points):\n closest_dist = float(\"inf\")\n closest_points = None, None\n for y, point_one in enumerate(points):\n for x, point_two in...
[ "0.8613394", "0.807817", "0.8030275", "0.7700006", "0.76521796", "0.7616441", "0.7516146", "0.7491633", "0.7395205", "0.7338848", "0.7261965", "0.72440153", "0.72242737", "0.7137641", "0.71105903", "0.70331824", "0.695987", "0.6955347", "0.69221145", "0.69213814", "0.6918839"...
0.8639659
0
Plot forgetting curve, ie, memory capacity (MC) vs lag.
def plot_forgetting_curve( lags: Union[List, np.ndarray], forgetting_curve: np.ndarray, ax: plt.Axes = None, **kwargs, ) -> None: if ax is None: fig, ax = plt.subplots() ax.plot(lags, forgetting_curve, **kwargs) ax.set_xlabel("$k$") ax.set_ylabel(r"$MC_k$")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plotLoss():\n # ssr\n ssr = np.log(gradientDescent(X, y)[1])\n # number of iterations \n iterations = np.log(np.arange(1, len(ssr) + 1, 1))\n # plot reduction of ssr\n plt.plot(iterations, ssr)\n # xlabel\n plt.xlabel(\"Iteration\")\n # ylabel\n plt.ylabel(\"SSR\")\n # title\n ...
[ "0.6156715", "0.6116142", "0.59823054", "0.587003", "0.58470255", "0.5831847", "0.57537234", "0.5751461", "0.57507044", "0.56738776", "0.5621762", "0.56194127", "0.561036", "0.5610067", "0.560643", "0.5604652", "0.55791736", "0.5573717", "0.555665", "0.55557483", "0.55498445"...
0.6441113
0
Freeze layers in model that starts with keyworks in keys.
def freeze_named_layers(model, keys: Tuple = ()): for key in keys: for name, param in model.named_parameters(): if name.startswith(key): param.requires_grad = False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unfreeze_named_layers(model, keys: Tuple = ()):\n for key in keys:\n for name, param in model.named_parameters():\n if name.startswith(key):\n param.requires_grad = True", "def _set_freeze_layers(self):\n for layer in self.encoder.layers[:self.freeze_layers]:\n ...
[ "0.7178372", "0.6921216", "0.6415622", "0.62904936", "0.62353384", "0.6068036", "0.6021634", "0.6007621", "0.5946701", "0.5911531", "0.5711682", "0.56931865", "0.5566724", "0.554358", "0.5513546", "0.5485273", "0.5382348", "0.53695166", "0.5330946", "0.52211714", "0.5193284",...
0.7042381
1
Unfreeze layers in model that starts with keyworks in keys.
def unfreeze_named_layers(model, keys: Tuple = ()): for key in keys: for name, param in model.named_parameters(): if name.startswith(key): param.requires_grad = True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unfreeeze_all_layers(self):\n # Unfreeeze\n logger.info('MODEL: Unfreeze all layers.')\n for i in range(len(self.model.layers)):\n self.model.layers[i].trainable = True\n \n # Compile model\n logger.info('MODEL: Compiling...')\n self.model.compile...
[ "0.66140187", "0.63663566", "0.6356344", "0.6348949", "0.6187103", "0.57806164", "0.57754254", "0.5759289", "0.5744534", "0.5540484", "0.5462425", "0.5448688", "0.5438848", "0.5419681", "0.5405362", "0.5377553", "0.5360291", "0.5206619", "0.52049536", "0.52009994", "0.5200254...
0.70603377
0
Pad framewise_output to the same length as input frames. The pad value is the same as the value of the last frame.
def pad_framewise_output(framewise_output, frames_num): pad = framewise_output[:, -1:, :].repeat(1, frames_num - framewise_output.shape[1], 1) """tensor for padding""" output = torch.cat((framewise_output, pad), dim=1) """(batch_size, frames_num, classes_num)""" return output
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pad_framewise_output(framewise_output, frames_num):\n pad = framewise_output[:, -1 :, :].repeat(1, frames_num - framewise_output.shape[1], 1)\n \"\"\"tensor for padding\"\"\"\n\n output = torch.cat((framewise_output, pad), dim=1)\n \"\"\"(batch_size, frames_num, classes_num)\"\"\"\n\n return out...
[ "0.8212459", "0.79470396", "0.79470396", "0.6778081", "0.67006975", "0.65746564", "0.64275515", "0.63629305", "0.61833864", "0.60432905", "0.59761566", "0.59708476", "0.59547937", "0.59079987", "0.5904667", "0.57852376", "0.57253283", "0.57252175", "0.5716326", "0.5687589", "...
0.8229493
0
Virtually private constructor which initializes the Game scene. It is responsible for controlling the game features. Here all the game objects are initialized and used in one combined environment. That way we can use the physics engine behind Pymunk (chipmunk) together with the images, surfaces and userinput handlers p...
def __init__(self): # TODO: !!! EXPLAIN ALL THE TODO's in this file in the report !!! # Call the super class (SceneBase) initialization method. This # statement ensures that this class inherits its behaviour from its Superclass. # Abstract methods of all scenes (process_input(), update()...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n pygame.init()\n\n self.settings = Settings()\n\n self.scenes = {\"menu\": MenuScene(),\n \"settings\": SettingsScene(),\n \"score\": ScoreScene(),\n \"game\": GameScene(),\n \"pause\":...
[ "0.7940447", "0.76151603", "0.7565101", "0.73008966", "0.7262097", "0.7236801", "0.7155406", "0.7144603", "0.71264255", "0.7116666", "0.7082816", "0.7078165", "0.7025393", "0.70191574", "0.70105195", "0.6999743", "0.6988561", "0.6964442", "0.69564134", "0.69508475", "0.694445...
0.7689158
1
This adds all the components of the antispacecraft (cannon, wheels, chassis, pin joints), the spacecraft body and shape and the landing pad body to the Pymunk space
def add_objects_to_space(self): self.anti_spacecraft.add_to_space(self.space) # Anti-spacecraft Parts (represent the whole vehicle) self.space.add(self.spacecraft.body, self.spacecraft.shape) # Spacecraft body and shape self.space.add(self.pm_landing_pad) # Landing pad
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_spacecrafts(self):\n self.spacecraft = MPDSpacecraft.create_random(self.space, )\n self.space.spacecrafts.append(self.spacecraft)\n\n vehicles_type = utils.class_from_path(self.config[\"other_spacecrafts_type\"])\n for _ in range(self.config[\"spacecrafts_count\"]):\n ...
[ "0.604508", "0.5722112", "0.5624498", "0.5601387", "0.55546165", "0.5536274", "0.5530259", "0.5499591", "0.53977555", "0.535249", "0.52715105", "0.52538025", "0.5236009", "0.5227616", "0.5211371", "0.52076036", "0.5189478", "0.51669776", "0.5155782", "0.5133048", "0.51038384"...
0.69616634
0
Initialize all the collision handlers between different Pymunk objects.
def start_collision_handlers(self): self.missile_and_terrain.begin = self.missile_terrain_collision_begin self.missile_and_spacecraft_handler.begin = self.missile_spacecraft_collision_begin self.spacecraft_and_terrain_handler.begin = self.spacecraft_terrain_collision_begin self.missile_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _setup_collision_handlers(self):\n self._world.add_collision_handler(\"player\", \"item\", on_begin=self._handle_player_collide_item)\n self._world.add_collision_handler(\"player\", \"block\", on_begin=self._handle_player_collide_block,\n on_separate=self....
[ "0.772583", "0.6875321", "0.68106925", "0.61617273", "0.6061331", "0.60414046", "0.59459436", "0.5812129", "0.5769861", "0.56295323", "0.5611922", "0.5606012", "0.5601862", "0.55657303", "0.5516657", "0.54835796", "0.54632753", "0.5440682", "0.5439257", "0.5395418", "0.538918...
0.7669474
1
Pause the game after a player crash, correct landing or the spacecraft is out of HP. Display a message, till the 'Return' key is pressed
def pause_game(self, msg_type, screen): msg = '' if msg_type == 'landed': msg = FONT_WARNING.render("Successful Landing!", False, (13, 109, 24)) elif msg_type == 'crashed': msg = FONT_WARNING.render("The spacecraft has crashed!", False, (255, 0, 6)) elif msg_type...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def input(self, event):\n # If the window is quit.\n if event.type == pygame.QUIT:\n # Exit the game.\n return 0\n\n # If escape is hit.\n if (\n event.type == pygame.QUIT\n or event.type == pygame.KEYDOWN\n and event.key == pygame....
[ "0.65776306", "0.65102255", "0.64359254", "0.63705826", "0.6367327", "0.633588", "0.63190764", "0.6283944", "0.62810993", "0.6269252", "0.62500054", "0.62450945", "0.6238587", "0.6218917", "0.61848557", "0.61820036", "0.61752564", "0.615548", "0.61468", "0.6114484", "0.611047...
0.6634804
0
Create a random terrain from a sequence of linked Pymunk segment objects.
def random_terrain(self): terrain_segments = [] # To hold the list of segments that will be added to the space as a terrain # Generate the point tuples points = [(i, random.randint(self.screen_height // 20, self.screen_height // 7)) for i in range(0, self.screen_width + SEGME...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_topology(init_height, map_size, max_height):\n num_features = math.ceil(map_size[0] / FEATURE_SIZE)\n generators = [create_valley, create_hill, create_plateau]\n previous = [random.randrange(len(generators)), random.randrange(len(generators))]\n feature_points = []\n for i in range(num_featu...
[ "0.5876545", "0.5836625", "0.5621797", "0.5533466", "0.54986405", "0.5497006", "0.54736114", "0.5431739", "0.5419466", "0.5407001", "0.5391139", "0.53663224", "0.53523904", "0.53014797", "0.5293059", "0.5287552", "0.5279256", "0.5256157", "0.52381563", "0.5230274", "0.5221625...
0.72904426
0
Create and place the Game scene borders (Pymunk segments).
def borders(self): border_left = pm.Segment(self.space.static_body, (-5, 0), (-5, self.screen_height), 10) border_right = pm.Segment(self.space.static_body, (self.screen_width + 5, 0), (self.screen_width + 5, self.screen_height), 10) border_top = pm.Segment(self...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_scene():\n create_floor()\n if config.M != \"\":\n if config.LEVEL == 1:\n create_wall()\n create_enemy()\n create_gap()\n create_platform()\n create_marijuana()\n create_star()\n create_fish()\n elif config...
[ "0.66503435", "0.6304077", "0.62054", "0.61564815", "0.61283994", "0.6123593", "0.60563564", "0.60508305", "0.60354984", "0.5977673", "0.59397316", "0.592861", "0.5919571", "0.5914099", "0.5894322", "0.58489126", "0.58476835", "0.5834298", "0.58332974", "0.58003604", "0.57984...
0.75163996
0
Return a BugState that contains copies of all this BugState's columns, except for id.
def copy(self): # Unfortunately we can't just import copy because this comes with all kinds # of nasty SQLA internals kwargs = {} for col in self.__table__.columns: if col.name == 'id': continue kwargs[col.name] = getattr(self, col.name) re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy(self):\n return State([r[:] for r in self.values], empty_loc=self.empty_loc)", "def __getstate__(self):\r\n\r\n d = copy.copy(self.__dict__)\r\n del d['_room_table_model'] # Do not save easily re-creatable table models\r\n del d['_socket_table_model'] # Do not save easily r...
[ "0.61550415", "0.5906562", "0.5851271", "0.58279526", "0.5817731", "0.57595706", "0.572862", "0.56799626", "0.5663411", "0.5656835", "0.5614034", "0.5604049", "0.56018364", "0.5596687", "0.5553168", "0.5540622", "0.5499134", "0.5487032", "0.5481828", "0.54746485", "0.5465456"...
0.8369509
0
Return a BugState corresponding to a bug page (an object representing the results of scraping the current state of a bug on Bugzilla).
def from_bugpage(cls, bp): # Have to do this because of utterly bizarre way attr getter methods are done in BugPage... status, importance, platform, product = map( lambda att: bp._parse_attr(att), (bp.att_status(), bp.att_importance(), bp.att_platform(), bp.att_product()) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_buginfo(entry):\n bugname = entry['bug']['name'].replace(' ','').replace('/','_')\n bugsrc = entry['ent']['policyContentLocation']\n bugpattern = entry['bug']['pattern']\n try :\n bugaffiliation = entry['bug']['affiliation']\n except KeyError:\n bugaffiliation = \"\"\n bugtype = entry['bug'][...
[ "0.57829803", "0.5729143", "0.564053", "0.5417583", "0.52546793", "0.52120835", "0.51557016", "0.50550824", "0.50171345", "0.50016797", "0.4898548", "0.48602536", "0.48495334", "0.4821963", "0.47708368", "0.4753653", "0.47332275", "0.46606785", "0.46395177", "0.46315885", "0....
0.7435144
0
Given the id of a duplicate bug, create and return a delta from the perspective of the original (duplicated) bug, reflecting the addition of a new duplicate.
def from_dupid(dupid): duppage = bs.BugPage(dupid) res = Delta() res.what = 'Duplicates' res.removed = None res.added = dupid res.date = utils.datify(duppage.att_resolved()) res.datetime = utils.datetimeify(duppage.att_resolved()) res.who = None re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _add_dup(self, author, dup, master_id):\n self.env.log.debug(\"dup: dupping %s to %s\" % (dup.id, master_id))\n self._add_master(author, dup.id, master_id)\n\n # tag this ticket and close it\n cmt = u\"Duplicate of ticket #%s.\" % master_id\n self.env.log.debug(\n ...
[ "0.5511686", "0.503837", "0.5002089", "0.49717817", "0.49476832", "0.4936551", "0.49215648", "0.4918993", "0.49120146", "0.48871273", "0.4879585", "0.4842887", "0.4826319", "0.47681025", "0.47584462", "0.47341108", "0.47215885", "0.4712252", "0.4705008", "0.46984363", "0.4682...
0.7234137
0
Populate the bugstates tables. Go through each bug in All_bugs.csv and scrape its status and history from bugzilla. Then walk backwards through the history, saving a "snapshot" of the bug's status for each month in the month table that the bug existed at. If Abbrev is true, we only attempt 1 bug.
def populate_bugstates(session, abbrev=False, commit_interval=None): # This code is really, really tricky. I don't know how I could have written it more clearly. # Maybe it should have been broken up more into subroutines. bugs = utils.open_data_file('All_bugs.csv') bugs.readline() bzids = [line.s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _parse(self):\n with open(self._path, 'r') as file:\n try:\n line = file.readline()\n while line:\n if line.startswith(BUG_START):\n line = file.readline()\n if line:\n # ...
[ "0.5389092", "0.5284395", "0.5232428", "0.5179665", "0.5060118", "0.5059909", "0.50482", "0.5022069", "0.49869448", "0.4972398", "0.49662256", "0.49147817", "0.4912868", "0.48882008", "0.486439", "0.4833871", "0.48215288", "0.4810598", "0.4794038", "0.47898638", "0.47683233",...
0.81360203
0
Fill a mock cache object with some keys and values.
def fill_cache(cache, values_dict): cache.get.side_effect = lambda k, d=None: values_dict.get(k, d)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setUp(self):\n self.expire_time = 1\n self.cache = Cacher(self.expire_time)\n self.key = 'test'\n self.value = {1:2}", "def test_cache_init(case, method):\n if method == \"init\":\n cache = CacheDict(case.init, cache_len=case.cache_len)\n elif method == \"assign\":\n ...
[ "0.7392047", "0.70595115", "0.66702425", "0.66139007", "0.6501597", "0.6371279", "0.63565075", "0.6326556", "0.6280878", "0.6260089", "0.6240515", "0.6219076", "0.62121993", "0.62002456", "0.6187879", "0.61660045", "0.6145277", "0.6144331", "0.6133093", "0.6130873", "0.613010...
0.7693271
0
Setup a mock http object with some responses to given URLs. ``response_dict`` should map full URLs (including query string) to the (response, content) tuple that will be returned (equivalent to the return value of the httplib2.Http.request method).
def setup_responses(http, response_dict): url_dict = dict((Url(k), v) for k, v in response_dict.iteritems()) def request(*args, **kwargs): uri = Url(kwargs["uri"]) try: return url_dict[uri] except KeyError: return response( make_error( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_common_responses(http, response_dict):\n new_dict = COMMON_RESPONSES.copy()\n new_dict.update(response_dict)\n return setup_responses(http, new_dict)", "def __call__(self, url, **kwargs):\n self.response = MockResponse()\n self.response.url = url\n self.response.params = k...
[ "0.6296116", "0.598443", "0.58889043", "0.5835311", "0.5835311", "0.57970405", "0.5786872", "0.5752721", "0.5695687", "0.5660255", "0.56578207", "0.5593362", "0.54816055", "0.5445787", "0.5417659", "0.53933555", "0.53836966", "0.53740615", "0.5365726", "0.533541", "0.53179044...
0.81477904
0
A version of ``setup_responses`` intended for endtoend requestresponse testing. Automatically knows how to respond to the StaticCompanyMiddleware query for the current company, and to static data requests.
def setup_common_responses(http, response_dict): new_dict = COMMON_RESPONSES.copy() new_dict.update(response_dict) return setup_responses(http, new_dict)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_response_collector(self):\n pass", "def setUp(self):\n self.response = self.client.get('/')", "def setUp(self):\n\n c = Client()\n self.response = c.get('/')\n self.content = self.response.content", "def setup_responses(http, response_dict):\n url_dict = dict((...
[ "0.6006188", "0.53712475", "0.5280692", "0.52578574", "0.5240352", "0.523062", "0.5209891", "0.52083516", "0.51048607", "0.50963926", "0.5094664", "0.5085077", "0.5070761", "0.50622654", "0.5044143", "0.49751198", "0.49613914", "0.4941235", "0.4928896", "0.49287567", "0.49021...
0.5533396
1
Example Hello Redis Program
def hello_redis(): # step 3: create the Redis Connection object try: # The decode_repsonses flag here directs the client to convert the responses from Redis into Python strings # using the default encoding utf-8. This is client specific. r = redis.StrictRedis(host=redis_host, port=redis...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_redis_example():\n\n try:\n r = redis.StrictRedis(host=host, port=port, password=pw,\n decode_responses=True)\n except Exception as e:\n print(f'Error connecting to Redis DB: {e}')\n\n return r", "def run_redis_example():\n\n try:\n print('\\n...
[ "0.7401893", "0.66859937", "0.66640043", "0.6031592", "0.60190845", "0.59874654", "0.5847576", "0.576182", "0.5744966", "0.57076114", "0.5670103", "0.5621686", "0.56131256", "0.5589879", "0.55803174", "0.5576936", "0.55347294", "0.552561", "0.55203277", "0.55173105", "0.55149...
0.81699574
0
Cancel all unfilled/pending orders.
def cancel_pending_orders(self): raise NotImplementedError("Broker must implement \ `cancel_pending_orders()`")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def cancel_all_orders(self, symbol: Optional[str] = None, params={}):\n request = {\n 'all': 1,\n }\n response = await self.privatePostAuthWOrderCancelMulti(self.extend(request, params))\n orders = self.safe_value(response, 4, [])\n return self.parse_orders(order...
[ "0.76253396", "0.7515958", "0.71449804", "0.69874173", "0.6959057", "0.69456536", "0.693831", "0.6815429", "0.68123037", "0.6802091", "0.67496735", "0.6695659", "0.669136", "0.65972096", "0.65366703", "0.6487338", "0.6311444", "0.6308791", "0.6299281", "0.62735206", "0.624022...
0.7739072
0
Get geocode results from Google Maps Geocoding API. Note, that in the case of multiple google geocode reuslts, this function returns details of the FIRST result.
def get_google_results(address): # Set up your Geocoding url logging.info("[GOOGLE URL]: init") params = { "address":address, "key":GEOPY.get('AQUEDUCT_GOOGLE_PLACES_PRIVATE_KEY') } # Ping google for the reuslts: try: with requests.Session() as s: s.mount('https://',HTTPAdapter(max_retries=Retry(2, backo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_google_results(address, api_key=None, return_full_response=False):\n # Set up your Geocoding url\n geocode_url = \"https://maps.googleapis.com/maps/api/geocode/json?address={}\".format(address) + \"&sensor=false\"\n # if api_key is not None:\n # geocode_url = geocode_url + \"&key={}\".forma...
[ "0.75649035", "0.7065084", "0.69779134", "0.6943402", "0.6830641", "0.6712454", "0.66838914", "0.66516787", "0.6533931", "0.6481396", "0.6473371", "0.64733434", "0.64650655", "0.64574516", "0.6386877", "0.63286257", "0.624859", "0.6218553", "0.6167444", "0.6132696", "0.610046...
0.758322
0
List the job submission history. Normal users can only look at their own submissions.
def list_history(request): history = History.objects if not is_admin(request.user): history = history.filter(submitter=request.user) history = history.order_by('-submission_date') return render('editor/list_history.mako', request, { 'history': history, })
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getJobHistory(self,jobname):\n\t\tpass", "def get_recent_submissions(self):\n logging.info(\"Retrieving submissions from the last hour\")\n submissions = list(self.subreddit.search('subreddit:{0}'.format(self.subreddit.display_name), time_filter='hour', syntax='lucene', sort='new'))\n lo...
[ "0.6673953", "0.63877535", "0.61787397", "0.61787397", "0.6141121", "0.6050912", "0.6048702", "0.6030083", "0.60237986", "0.6017276", "0.601091", "0.59897757", "0.5980205", "0.59742534", "0.59409976", "0.5930447", "0.59263396", "0.5898872", "0.5898784", "0.5888458", "0.588845...
0.7601685
0
new_session Start a new API session via vspk an return the corresponding 'vspk.NUVSDSession` object. Note that this object is also exposed as `self()`
def new_session(self): self._session = self.vspk.NUVSDSession( username=self.user, password=self.password, enterprise=self.enterprise, api_url=self.uri) self._session.start() if not self.default_enterprise: self.default_enterprise = se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new_session(self):\n self.command(\"new\")", "def new_session(self):\n return self.Session()", "def new_session(self):\n return self._SessionLocal()", "def new_session(self):\n self.current_session = Session(self, history_channel=self.config.history_channel)\n return se...
[ "0.6570244", "0.63095933", "0.63026464", "0.600102", "0.5773425", "0.57308894", "0.5713886", "0.570551", "0.56596273", "0.55981237", "0.5566833", "0.55023867", "0.54465646", "0.54408413", "0.5427775", "0.54051745", "0.53788614", "0.5361897", "0.53095645", "0.5307867", "0.5285...
0.72100246
0
Randomly generate a token, given prev_tokens. prev_tokens the previous n1 tokens (optional only if n = 1).
def generate_token(self, prev_tokens=None): n = self._n if not prev_tokens: prev_tokens = () assert len(prev_tokens) == n - 1 r = random() probs = self._sorted_probs[prev_tokens] # WORK HERE!! token = self.sample(probs) return token
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_token(self, prev_tokens=None):\n n = self._n\n prev_tokens = prev_tokens or ()\n\n assert len(prev_tokens) == n - 1\n\n probs = self._sorted_probs[prev_tokens]\n tkns, weights = zip(*probs)\n token = random.choices(tkns, weights=weights)\n\n return toke...
[ "0.86261916", "0.83121526", "0.8085058", "0.6422335", "0.6152743", "0.61427045", "0.61427045", "0.60342056", "0.6032464", "0.5936103", "0.58780426", "0.57948256", "0.5713537", "0.5663195", "0.5625801", "0.5547147", "0.5527027", "0.54851127", "0.5457163", "0.5393783", "0.53823...
0.86576176
0
Test global service, invalid device ID.
async def test_global_service_bad_device( hass: HomeAssistant, ufp: MockUFPFixture ) -> None: nvr = ufp.api.bootstrap.nvr nvr.__fields__["add_custom_doorbell_message"] = Mock(final=False) nvr.add_custom_doorbell_message = AsyncMock() with pytest.raises(HomeAssistantError): await hass.servi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_device_by_id(self):\n pass", "def test_get_device_by_id1(self):\n pass", "def test_get_device(self):\n pass", "def test_get_device(self):\n pass", "def test_get_device_unknown():\n device = get_device(SERIAL, CREDENTIAL, \"unknown\")\n assert device is None", ...
[ "0.66781783", "0.6274601", "0.62602276", "0.62602276", "0.62065053", "0.6185159", "0.59436655", "0.59070235", "0.5876269", "0.58547413", "0.5804986", "0.5796675", "0.5763307", "0.5763307", "0.5756405", "0.5756405", "0.5709901", "0.5690766", "0.56894636", "0.56894636", "0.5681...
0.6488416
1
Returns an ANN corresponding to with given partioning, domains. Code corresponding to the AbstractLayerWise algorithm, Algorithm 3 in [1]. Arguments ========= should be a list of twotuples (weight_matrix, activation_fn) with weight_matrix a Numpy array of shape (out_dims, in_dims) and activation_function a Python funct...
def abstract_layer_wise(network, partitionings, abstract_domains): abstract_network = [] iterate = zip(network, partitionings, partitionings[1:], abstract_domains) for layer, partitions_from, partitions_to, domain in iterate: abstract_weights = alpha_hat( layer[0], partitions_from, parti...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nn_layer(input_tensor, input_dim, output_dim, layer_name, act=tf.nn.relu,method = \"xavier\"):\n # Adding a name scope ensures logical grouping of the layers in the graph.\n with tf.name_scope(layer_name):\n # This Variable will hold the state of the weights for the layer\n with tf.name_scope('weights'...
[ "0.5757156", "0.56811965", "0.56617653", "0.56148416", "0.5512362", "0.5505967", "0.54729575", "0.54463667", "0.5444837", "0.54294294", "0.5397954", "0.5393008", "0.5391947", "0.5358669", "0.5351914", "0.53509736", "0.5332045", "0.53213036", "0.52851975", "0.5280457", "0.5279...
0.60220164
0
Computes a columnscaled version of with given scales. See Definition 17 in [1].
def scale_columns(matrix, scales): return np.einsum("ij,j->ij", matrix, scales)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def col_scale(x, s):\r\n\r\n if x.format == 'csc':\r\n return ColScaleCSC()(x, s)\r\n elif x.format == 'csr':\r\n return RowScaleCSC()(x.T, s).T\r\n else:\r\n raise NotImplementedError()", "def row_scale(x, s):\r\n return col_scale(x.T, s).T", "def scale_column(self):\n retu...
[ "0.7676658", "0.69248337", "0.6706953", "0.66002136", "0.6587524", "0.6522026", "0.6519238", "0.6494547", "0.6372277", "0.6257111", "0.62033737", "0.6144659", "0.6075755", "0.6040866", "0.6037015", "0.5909714", "0.5886108", "0.58151484", "0.57927424", "0.5745484", "0.57231677...
0.7730647
0
Yields the partitioning combination matrices for . If =True, yields only the binary PCMs, i.e., acts like BinPCMs in [1].
def PCMs(partitioning, only_binary=False): if only_binary: dimensions = 1 + max( n for partition in partitioning for n in partition) for assignment in itertools.product(*partitioning): PCM = np.zeros((dimensions, len(partitioning))) for partition, partition_assign...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def makeBinaryMatrix(self):\n getPrimary = self.openFile.getPrimary()\n getSecondary = self.openFile.getSecondary()\n totalLen =len(getPrimary)*len(getSecondary)\n counterTime = 0\n counterPrimary = 0\n topList = getPrimary+getSecondary\n for p in getPrimary:\n\n ...
[ "0.56877", "0.5467097", "0.5414057", "0.5281726", "0.5238279", "0.5228525", "0.52201873", "0.5217627", "0.5195283", "0.5188665", "0.51224446", "0.5117132", "0.5116917", "0.50792176", "0.50728345", "0.50496227", "0.50490755", "0.50234807", "0.5010924", "0.50010365", "0.499432"...
0.6994
0
returns the MIC values for one set of the SCN trajectories in question
def mic_of_simulation(trajectories): avpvipsol = trajectories[:, 1:(160+1)] navsol = trajectories[:, (160+1):] per2 = np.hstack([avpvipsol[:, ::4], navsol[:, ::3]]) numcells = per2.shape[1] # set up mic calculator mic = mp.MINE(alpha=0.6, c=15, est='mic_approx') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mic_scores(self, mean='harmonic'):\n h, c, rsquare = self.entropy_scores(mean=mean)\n covsign = copysign(1, self.covar())\n mic0 = covsign * sqrt(c)\n mic1 = covsign * sqrt(h)\n mic2 = covsign * sqrt(rsquare)\n return mic0, mic1, mic2", "def mutual_information(mc_pre...
[ "0.5733125", "0.554986", "0.5386943", "0.537725", "0.53247213", "0.53233194", "0.52968353", "0.5218725", "0.5173707", "0.5152182", "0.51203096", "0.5119363", "0.5114712", "0.51004976", "0.5026691", "0.5022694", "0.50105655", "0.5005057", "0.4980165", "0.4972053", "0.49580538"...
0.63421065
0
Monta a imagem novamente e imprime
def imprime_imagem(tipo, imagem): cv.imshow(tipo, imagem) cv.waitKey(0) cv.destroyAllWindows()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recarregar_imagem(self):\n self.salvar_imagem(caminho_imagem=self.caminho_temp)\n self.carregar_imagem(caminho_imagem=self.caminho_temp)", "def unprocess(image):\n return image + MEAN_PIXEL", "def saveimage(self):\n if self.saveimageButton.isChecked():\n self.save = True\...
[ "0.70773166", "0.6282281", "0.61565465", "0.6134426", "0.60788584", "0.60608286", "0.6024218", "0.6002394", "0.59303814", "0.5894721", "0.5883957", "0.58768624", "0.5825135", "0.5825135", "0.57855976", "0.5779934", "0.5778459", "0.5775872", "0.57692444", "0.5759216", "0.57365...
0.7318433
1
return True if is instance of AbsoluteFormula
def is_absolute(self) -> bool: return isinstance(self, AbsoluteFormula)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_absolute(self):\r\n \r\n # FIXME(Ole): It is unfortunate that decision about whether points\r\n # are absolute or not lies with the georeference object. Ross pointed this out.\r\n # Moreover, this little function is responsible for a large fraction of the time\r\n # using ...
[ "0.7129019", "0.64657396", "0.6368486", "0.6290055", "0.6259203", "0.6182444", "0.60040027", "0.59767485", "0.58854014", "0.5873518", "0.5872083", "0.58645546", "0.5856013", "0.5826204", "0.5814358", "0.5709328", "0.56808233", "0.5632609", "0.5627682", "0.56043273", "0.559501...
0.891016
0
Read in the classification data from a json file.
def read_classification_json(fn): with open(fn) as f: classification_data = json.load(f) f.close() return classification_data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _load(predictions, f):\n\n # with open(f) as json_file:\n data = json.load(f)\n for p in data['predictions']:\n prediction = Prediction(p)\n predictions[prediction.example_id] = prediction", "def read_json(self, json_files):\n self.file_access.write_log(\"Att...
[ "0.6546336", "0.65244573", "0.65133315", "0.64777464", "0.64717954", "0.64518416", "0.63972396", "0.6332821", "0.62974817", "0.62596875", "0.6248037", "0.6238744", "0.62256426", "0.617831", "0.61711556", "0.6161478", "0.6161478", "0.61461806", "0.6146044", "0.61374474", "0.61...
0.8702178
0
Test default product stealability isn't so stealable.
def test_default_product_stealability(self): prod = Product('Test Product') self.assertEqual(prod.stealability(), "Kinda stealable.")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_stealable(self):\r\n prod = Product(name='Test Product',\r\n weight=100, price=1,\r\n flammability=0.5)\r\n self.assertEqual(prod.stealability(), \"Not so stealable...\")", "def test_itar_restrict_software_asset(self):\n pass", "def test...
[ "0.6909302", "0.6784504", "0.666378", "0.666378", "0.66232467", "0.6562756", "0.63320684", "0.62945056", "0.62485826", "0.62291807", "0.6169785", "0.61634314", "0.59503675", "0.59402394", "0.5859792", "0.58365923", "0.5835836", "0.5806719", "0.58029246", "0.5802565", "0.57828...
0.77149487
0
Test default number of products generated being 30.
def test_default_num_products(self): products = generate_products() self.assertEqual(len(products), 30)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_default_num_products(self):\n self.assertEqual(len(generate_products()), 30)", "def test_default_num_products(self):\r\n prod = generate_products()\r\n self.assertEqual(len(prod), 30)", "def test_default_num_products(self):\n gen_prods = generate_products()\n self.as...
[ "0.88693297", "0.8783214", "0.87470376", "0.8739366", "0.8734638", "0.87263155", "0.8505284", "0.8504188", "0.6945435", "0.681871", "0.6792255", "0.6764698", "0.672993", "0.67275596", "0.66817147", "0.66515124", "0.6647001", "0.6635753", "0.6635753", "0.6635753", "0.6635753",...
0.8806193
1
Select and render a random student group.
def home(request): group = Group.objects.random() return render_to_response('group.html', locals(), context_instance=RequestContext(request))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pickonestudent():\n pick = random.choice(students)\n print(pick)", "def draw_user_groups(self):\n group_prob = self.group_distributions.get_group_probabilities()\n self.user_groups = np.random.choice(a=self.num_groups, size=self.num_users, p=group_prob)", "def set_random_group_list(self...
[ "0.67413455", "0.6053982", "0.5966828", "0.5963867", "0.5867124", "0.5772101", "0.5760353", "0.57482", "0.57140666", "0.5693887", "0.56682026", "0.56557333", "0.5500756", "0.5469062", "0.5293242", "0.52931005", "0.529267", "0.5279222", "0.5248061", "0.52335244", "0.5196694", ...
0.62432927
1
Return the latest release revision for a job.
def _get_latest_job_revision(job): job_environment = job.get_environment() release_build_bucket_path = job_environment.get('RELEASE_BUILD_BUCKET_PATH') if not release_build_bucket_path: logs.log_error('Failed to get release build url pattern for %s.' % job.name) return None revisions = build_manager.ge...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetLastBuildRevision(self):\n last_build_revision = None\n if os.path.exists(self.last_change_file):\n last_build_revision = int(open(self.last_change_file).read())\n\n if os.path.exists(self.revisions_path):\n fp = open(self.revisions_path)\n try:\n line = fp.readline()\n\n ...
[ "0.66787237", "0.66599727", "0.655585", "0.653451", "0.6530831", "0.65038896", "0.6444833", "0.6427636", "0.6421847", "0.64184386", "0.6416032", "0.64153695", "0.64033985", "0.64033985", "0.6370781", "0.6352078", "0.63387245", "0.633101", "0.632348", "0.6317487", "0.63032985"...
0.8671837
0
Schedule the corpus pruning tasks.
def get(self): for job in data_types.Job.query(): if not utils.string_is_true(job.get_environment().get('CORPUS_PRUNE')): continue latest_revision = _get_latest_job_revision(job) if not latest_revision: continue queue = tasks.queue_for_job(job.name) for target_job in ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main(self):\n no_posts_found = 0\n while True:\n print(f\"...Searching for posts to cleanse..\")\n for post in self.reddit.subreddit(self.subreddit).stream.submissions(pause_after=1):\n if post is None:\n no_posts_found += 1\n ...
[ "0.54088664", "0.52943856", "0.5289719", "0.51948017", "0.51493746", "0.5118895", "0.50723296", "0.50587726", "0.50375617", "0.5007152", "0.4998043", "0.49947536", "0.49693736", "0.49591812", "0.49478757", "0.49423143", "0.49407235", "0.49336413", "0.49073207", "0.4875052", "...
0.54418653
0