query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Get the description of a project role.
def get_description(cls, role: "ProjectRole"): return { cls.READER.name: "Can view project, but not make edits or share with others.", cls.REVIEWER.name: "Can view project files and leave comments, but not edit project or share with others.", cls.EDITOR.name: "Can edit projec...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_description(cls, role: \"AccountRole\"):\n return {\n cls.MEMBER.name: \"Can create, update and delete projects.\",\n cls.MANAGER.name: \"As for member and can create, update and delete teams.\",\n cls.OWNER.name: \"As for manager and can also add and remove users an...
[ "0.7792207", "0.6987312", "0.69184756", "0.68976855", "0.67182356", "0.65315354", "0.643556", "0.62512106", "0.62512106", "0.62512106", "0.62512106", "0.62512106", "0.62512106", "0.62512106", "0.62512106", "0.62512106", "0.62512106", "0.62512106", "0.62512106", "0.62512106", ...
0.7914427
0
Get the role from a string.
def from_string(cls, role: str) -> "ProjectRole": role = role.lower() for r in cls: if role == r.name.lower(): return r raise ValueError('No project role matching "{}"'.format(role))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_role(text, guild = None):\n parsed = ID_RP.fullmatch(text)\n if (parsed is not None):\n role_id = int(parsed.group(1))\n try:\n role = ROLES[role_id]\n except KeyError:\n pass\n else:\n return role\n \n role = parse_role_mention(tex...
[ "0.71190786", "0.6835649", "0.6639244", "0.6453106", "0.64529836", "0.6413376", "0.63951063", "0.63896227", "0.6259766", "0.62412035", "0.62352717", "0.62352717", "0.62352717", "0.6211062", "0.6178344", "0.61578375", "0.6108778", "0.6107524", "0.6080702", "0.6046944", "0.6037...
0.72234476
0
Get a list including the role and all the roles above it.
def and_above(cls, role: "ProjectRole") -> List["ProjectRole"]: roles: List["ProjectRole"] = [] for r in cls: if r == role or len(roles) > 0: roles.append(r) return roles
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_roles(role):", "def get_roles(self):\n return [role.role_id for role in self.roles if role]", "def list(self):\n return self.client.find_all_roles()", "def getRoles(self):", "def _get_roles(self):\n return api.tuskar.OvercloudRole.list(self.request)", "def listRoleInfo(self):...
[ "0.7725698", "0.77047676", "0.7497046", "0.7463976", "0.74393654", "0.74121076", "0.7370461", "0.7294655", "0.7176104", "0.7117975", "0.7076488", "0.7068002", "0.70587707", "0.697626", "0.69535", "0.6922518", "0.68621874", "0.6845246", "0.6834762", "0.6792989", "0.67892647", ...
0.6669463
27
Method invoked for each test
def setUp(self): Base._Base__nb_objects = 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def runTests(self):\n \n pass", "def runtest(self):", "def tests():", "def run_tests(self):\n raise NotImplementedError", "def _test(self):\n pass", "def _test(self):\n pass", "def _test(self):\n pass", "def _test(self):", "def _test(self):", "def _test(self)...
[ "0.81400365", "0.7882675", "0.7873703", "0.774665", "0.757824", "0.757824", "0.757824", "0.75570375", "0.75570375", "0.75570375", "0.75570375", "0.75570375", "0.7549015", "0.7503381", "0.7434714", "0.73975575", "0.7370559", "0.728662", "0.7259475", "0.72425836", "0.7227512", ...
0.0
-1
Test __str__ return value
def test_str(self): r1 = Rectangle(2, 5, 2, 4) res = "[Rectangle] (1) 2/4 - 2/5\n" with patch('sys.stdout', new=StringIO()) as str_out: print(r1) self.assertEqual(str_out.getvalue(), res)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test___str__(self):\n self.assertEqual(\n str(self.mineral),\n 'mineralxy')", "def test_str_magic_method(self):\n correct_output = \"[User] ({}) {}\".format(\n self.user_1.id, self.user_1.__dict__)\n\n self.assertEqual(correct_output, self.user_1.__str__(...
[ "0.7859693", "0.776864", "0.7764631", "0.7750261", "0.77095324", "0.7639797", "0.7624004", "0.7599196", "0.75717705", "0.7536674", "0.75020593", "0.75015897", "0.74916494", "0.7461137", "0.74482304", "0.7443819", "0.7377785", "0.73032033", "0.7275035", "0.72579426", "0.725008...
0.0
-1
Returns the raw corpus as a long string. 'nr_files' says how much of the corpus is returned; default is 199, which is the whole corpus.
def get_corpus_text(nr_files=199): fileids = nltk.corpus.treebank_raw.fileids()[:nr_files] corpus_text = nltk.corpus.treebank_raw.raw(fileids) corpus_text = corpus_text.replace(".START", "") return corpus_text
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_raw_corpus():\n with open(RAW_CORPUS_PATH, 'r') as f:\n return f.read().splitlines()", "def constructReadCountsStr(samplesList, resultsPath, outRoot, stype):\n files = []\n for i in range(len(samplesList)):\n files.append(os.path.join(resultsPath, outRoot) + \".\" + stype + \".\" +...
[ "0.5845489", "0.5356129", "0.52977467", "0.51715916", "0.51683617", "0.51463205", "0.5103877", "0.5073599", "0.50058883", "0.49874315", "0.49868163", "0.4972849", "0.4881852", "0.4833174", "0.4830412", "0.48244664", "0.48116353", "0.475429", "0.4750338", "0.47492743", "0.4739...
0.72962815
0
Replace tokens so that they are similar to the raw corpus text.
def fix_treebank_tokens(tokens): return [token.replace("''", '"').replace("``", '"').replace(r"\/", "/") for token in tokens]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def synonym_token_replace(tokens, ignored_tokens=stopwords.words('english'), excluded_token_regex=None,\n max_frequency=None, min_occurrences=None,\n # min_frequency=None, max_occurrences=None,\n # min_document_frequency=None, max_document...
[ "0.7236169", "0.6687444", "0.66722614", "0.66083133", "0.6374409", "0.6263672", "0.62550956", "0.6186998", "0.61464214", "0.6079747", "0.6061732", "0.6003219", "0.59858936", "0.5894842", "0.58880955", "0.5814573", "0.57831126", "0.57650256", "0.5752088", "0.57195556", "0.5708...
0.0
-1
Returns the gold corpus as a list of strings. 'nr_files' says how much of the corpus is returned; default is 199, which is the whole corpus.
def get_gold_tokens(nr_files=199): fileids = nltk.corpus.treebank_chunk.fileids()[:nr_files] gold_tokens = nltk.corpus.treebank_chunk.words(fileids) return fix_treebank_tokens(gold_tokens)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_corpus_text(nr_files=199):\n fileids = nltk.corpus.treebank_raw.fileids()[:nr_files]\n corpus_text = nltk.corpus.treebank_raw.raw(fileids)\n corpus_text = corpus_text.replace(\".START\", \"\")\n return corpus_text", "def get_corpus():\n corpus_raw = []\n files = os.listdir()\n\n for ...
[ "0.68941635", "0.6100084", "0.5768867", "0.5508093", "0.55005074", "0.54668933", "0.54602385", "0.54518676", "0.5420774", "0.54132926", "0.5386534", "0.5351961", "0.5336444", "0.52829045", "0.5270027", "0.5254968", "0.5234643", "0.52127033", "0.520838", "0.5193462", "0.518718...
0.6930744
0
tokenize the text input with the regular expression in pattern
def tokenize_corpus(text, pattern): tokens = nltk.regexp_tokenize(text, pattern) return tokens
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tokenize(text):\n return tokens_re.findall(text)", "def tokenize1(text):\n return TOKEN_PATTERN1.findall(text)", "def tokenize(text):\n return text.split(' ')", "def _tokenize(self, text: str) -> List[str]:\n tokens = []\n for token in re.findall(self._pat, text):\n tokens....
[ "0.77592725", "0.7440341", "0.7378161", "0.73769784", "0.72975975", "0.7251162", "0.72435606", "0.71764994", "0.70684946", "0.7046779", "0.7045376", "0.70448273", "0.70386964", "0.69939196", "0.6929224", "0.68926865", "0.6884807", "0.6877445", "0.6869554", "0.68493074", "0.68...
0.7196912
7
Finds the chunks where test_tokens differs from gold_tokens. Prints the errors and calculates similarity measures.
def evaluate_tokenization(test_tokens, gold_tokens): matcher = difflib.SequenceMatcher() matcher.set_seqs(test_tokens, gold_tokens) error_chunks = true_positives = false_positives = false_negatives = 0 print(" Token%30s | %-30sToken" % ("Error", "Correct")) print("-" * 38 + "+" + "-" * 38) for d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _diff(gold_tokens, pred_tokens):\n matcher = difflib.SequenceMatcher(None, gold_tokens, pred_tokens)\n a_lo = b_lo = 0\n for a_hi, b_hi, n in matcher.get_matching_blocks():\n if a_lo < a_hi or b_lo < b_hi:\n yield gold_tokens[a_lo:a_hi], pred_tokens[b_lo:b_hi]\n a_lo = a_hi + ...
[ "0.6527174", "0.62255156", "0.6006039", "0.59620684", "0.5928861", "0.587654", "0.5874386", "0.5815653", "0.58089805", "0.57442725", "0.564411", "0.5521066", "0.55191135", "0.5479484", "0.54474944", "0.5424343", "0.5417302", "0.5396069", "0.53927183", "0.53886485", "0.5379245...
0.75287586
0
Returns the length of the corpus
def corpus_length(corpus): corpus_len = len(corpus) return corpus_len
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def corpus_size():\n return ix.doc_count()", "def get_length(self):\r\n return len(self.tweets)", "def __len__(self):\n if self._words is None:\n return 0\n return len(self._words)", "def __len__(self):\n return len(self.words)", "def get_length_of_article(self):\n...
[ "0.86246103", "0.7128457", "0.711803", "0.70741546", "0.70083636", "0.6877699", "0.6864959", "0.68288773", "0.6719017", "0.6706363", "0.6685086", "0.66821533", "0.6680235", "0.66707677", "0.6659052", "0.6654295", "0.66518724", "0.6644698", "0.6623218", "0.65752524", "0.657241...
0.9156975
0
Returns the number of types of the corpus
def number_types(corpus): number_of_types = len(set(corpus)) return number_of_types
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def corpus_size():\n return ix.doc_count()", "def corpus_stats(self):\n print(\"Number of sentences: {}\".format(len(self.corpus.sents())))\n print(\"Token: {}\".format(len(self.corpus.words())))\n types = FreqDist(self.corpus.words())\n print(\"Types: {}\".format(len(types)))", ...
[ "0.762349", "0.71802056", "0.69813615", "0.68990517", "0.68193585", "0.6785418", "0.6478397", "0.64172184", "0.6361729", "0.63225734", "0.63215053", "0.63175625", "0.6286316", "0.6242273", "0.6241575", "0.62144715", "0.62034416", "0.61651814", "0.6163551", "0.6149904", "0.612...
0.86536777
0
Returns the average token length of the corpus
def average_length(corpus): token_size = 0 for i in corpus: token_size += len(i) return token_size/len(corpus)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mean_word_len(text):\r\n return np.mean(np.array([len(word) for word in tokenization(text)]))", "def get_avg_word_length(self):\n words = self.blob.words\n average_word_length = np.mean(np.array([len(word) for word in words]))\n return average_word_length", "def get_avg_sentence_len...
[ "0.7740834", "0.76111984", "0.7465189", "0.7424989", "0.73925495", "0.7379742", "0.7154015", "0.7079485", "0.69219846", "0.6788959", "0.6713551", "0.6628082", "0.6622776", "0.65117276", "0.6499887", "0.648808", "0.64503044", "0.63774174", "0.63654184", "0.63253933", "0.632013...
0.91032505
0
Returns a tuple with the token with longest length and its length
def longest_token(corpus): token_length = max([(len(x), x) for x in corpus]) long_token = [(len(i), i) for i in corpus if len(i) == token_length[0]] return long_token
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def longest_word_length(words):", "def token_length(self):\n return 32", "def longest_word_len(text):\r\n return np.max(np.array([len(word) for word in tokenization(text)]))", "def longest(self, n):\n return big_tags", "def parse_len_token(self, token, context):\n match = Ftype_char...
[ "0.6989448", "0.6604611", "0.65495056", "0.6322947", "0.6315792", "0.6271042", "0.6225847", "0.6206488", "0.6204552", "0.6153764", "0.6150393", "0.6148043", "0.6115631", "0.6096827", "0.60948676", "0.60551727", "0.6030734", "0.6026074", "0.6018043", "0.6005589", "0.60053426",...
0.79787576
0
calculate frequency distribution of tokens
def freq_dist(corpus): fd = nltk.FreqDist(corpus) return fd
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def freq():", "def freq(self) -> int:", "def computeWordsFrequencies(self):\n token_stream = self._tokenize(self.readable)\n token_map = self._countTokens(token_stream)\n # print token_map.items()\n return sorted(token_map.items(), key = lambda x : x[1], reverse = True)", "def get...
[ "0.7763537", "0.7534712", "0.73347753", "0.72629035", "0.72449934", "0.7134781", "0.71052575", "0.7017025", "0.697178", "0.6875278", "0.6874523", "0.6868458", "0.68494785", "0.68474996", "0.68288034", "0.6792781", "0.67580354", "0.6756086", "0.6730572", "0.6726487", "0.671023...
0.6375431
46
Returns the number of hapaxes
def hapaxes(corpus): fd = freq_dist(corpus) length_hapaxes = len(fd.hapaxes()) return length_hapaxes
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hapax(self):\n return self.nlegomena(1)", "def hapaxes_parts(corpus_parts):\n hapaxes = [] \n l = [] \n for part in corpus_parts:\n fd = freq_dist(part)\n hapaxes.append(fd.hapaxes())\n \n for x in range(len(hapaxes)): \n p = []\n for hapax in hapaxes[x]:\n ...
[ "0.71300244", "0.69368875", "0.6899001", "0.67700213", "0.6713909", "0.66338396", "0.66306466", "0.6584287", "0.6531329", "0.6471116", "0.64255387", "0.63993526", "0.63469976", "0.6336948", "0.6327612", "0.6278651", "0.6271024", "0.62702435", "0.62528473", "0.62366015", "0.62...
0.77868515
0
Returns the 10 most frequent types of the corpus
def most_frequent(corpus): fd = nltk.FreqDist(corpus) return fd.most_common(10)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_10_most_frequent_words(tokens):\n\n return FreqDist(word.lower() for word in tokens).most_common(10)", "def print_most_frequent(ngrams, num=10):\r\n for n in sorted(ngrams):\r\n print('----- {} most common {}-grams -----'.format(num, n))\r\n for gram, count in ngrams[n].most_common(nu...
[ "0.7420908", "0.68801576", "0.6863302", "0.6863302", "0.6793732", "0.6789225", "0.6789225", "0.67334443", "0.67113686", "0.67021793", "0.66943693", "0.66930974", "0.66756886", "0.6594498", "0.6594149", "0.6593065", "0.65787506", "0.6552879", "0.64887744", "0.6478066", "0.6448...
0.76018584
0
Calculates the percent of the total tokens in the corpus that constist of these types
def percentage_common_types (corpus): total = sum([t[1] for t in most_frequent(corpus)]) return percentage(total, corpus_length(corpus))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def token_percentage(word, text):\n word_count = text.count(word)\n text_len = len(text)\n return percentage(word_count, text_len)", "def _get_token_cnts(self, doc, doc_type):\n tokenized_doc = self.nlp(doc)\n self.stat_dict[doc_type][0].append(len([s for s in tokenized_doc.sents]))\n ...
[ "0.7122834", "0.6609406", "0.6508489", "0.6426509", "0.6370771", "0.6364847", "0.6266487", "0.6084241", "0.60529697", "0.6052734", "0.6027012", "0.60187364", "0.5996216", "0.59940755", "0.5989834", "0.5947879", "0.5946035", "0.59456563", "0.5928288", "0.58380187", "0.58172226...
0.76858276
0
Returns a list that divides the corpus in 10 equally large subcorpora starting in 0
def divide_corpus(corpus, number_of_partitions): partition_length = corpus_length(corpus) / number_of_partitions list_of_index = [] for i in range(number_of_partitions + 1): list_of_index.append(partition_length*i) list_of_index = [int(i) for i in list_of_index] ind_bigr = nltk.bigrams(list_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_frequencies(num_words, documents):\n res = [0 for i in range(num_words)]\n sum = 0\n for word in documents:\n sum += 1\n tmp = set(word)\n for number in tmp:\n res[number] += 1\n \n res = [i / sum for i in res]\n return res", "def strech_list(sector, subgraphs_):\n\n strechs=[]...
[ "0.55991673", "0.5596885", "0.5583748", "0.5540588", "0.55019647", "0.5501352", "0.5467884", "0.54672116", "0.5459272", "0.54368347", "0.5429263", "0.54035556", "0.53881025", "0.5382939", "0.53346455", "0.5332272", "0.5328042", "0.53276277", "0.53100634", "0.5303269", "0.5279...
0.66362506
0
Returns the number of hapaxes per partition
def hapaxes_parts(corpus_parts): hapaxes = [] l = [] for part in corpus_parts: fd = freq_dist(part) hapaxes.append(fd.hapaxes()) for x in range(len(hapaxes)): p = [] for hapax in hapaxes[x]: if hapax not in l: p.append(hapax) ha...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def num_partitions(self): # -> int:\n ...", "def num_partitions(self): # -> None:\n ...", "def num_partitions(self): # -> Unknown:\n ...", "def hapaxes(corpus):\n fd = freq_dist(corpus)\n length_hapaxes = len(fd.hapaxes()) \n return length_hapaxes", "def get_partitions_count(s...
[ "0.72854185", "0.7181093", "0.7122296", "0.6590926", "0.6523009", "0.6504831", "0.6496085", "0.6496085", "0.64901686", "0.6476173", "0.64444524", "0.63706654", "0.6361087", "0.63602793", "0.6326059", "0.62231356", "0.6188901", "0.6148755", "0.607684", "0.60508156", "0.6044671...
0.69107884
3
Returns the percentage of hapaxes for every partition
def percentage_hapaxes(corpus_parts, corpus): percentage_h = [] count = 0 dv = divide_corpus(corpus, 10) hapax_parts = hapaxes_parts(corpus_parts) for x in hapax_parts: percentage_h.append(percentage(x, len(dv[count]))) count += 1 return percentage_h
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ps (H) :\n p = np.array ([np.mean (np.diagonal (H, offset=k))\n for k in range (H.shape[0])])\n return p/np.sum(p)", "def hapaxes_parts(corpus_parts):\n hapaxes = [] \n l = [] \n for part in corpus_parts:\n fd = freq_dist(part)\n hapaxes.append(fd.hapaxes())\n ...
[ "0.5896968", "0.5892362", "0.5866959", "0.58635896", "0.5844549", "0.57622796", "0.57277703", "0.5724019", "0.5721638", "0.5704809", "0.5675501", "0.56264746", "0.56017643", "0.5570609", "0.5560135", "0.55325496", "0.55276257", "0.550061", "0.54999614", "0.5493106", "0.548825...
0.79433656
0
given the data obtained by the functions divide_corpus(corpus, number_of_partitions) and hapaxes_parts(corpus_parts), the graphic for the number of hapaxes per partition is plotted
def plots(corpus_parts, corpus): """ given the data obtained by the function percentage_hapaxes(dv_corpus, tokenized_corpus), the graphic for the percentage of hapaxes per partition is plotted """ h_parts = hapaxes_parts(corpus_parts) part_size = [x for x in range(len(h_parts))] percent...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hapaxes_parts(corpus_parts):\n hapaxes = [] \n l = [] \n for part in corpus_parts:\n fd = freq_dist(part)\n hapaxes.append(fd.hapaxes())\n \n for x in range(len(hapaxes)): \n p = []\n for hapax in hapaxes[x]:\n if hapax not in l:\n p.append(h...
[ "0.63274544", "0.6236243", "0.60902673", "0.60751843", "0.6013556", "0.5849579", "0.5765388", "0.5748273", "0.5698169", "0.56906366", "0.56627107", "0.56146663", "0.5596817", "0.55957896", "0.55932474", "0.55843383", "0.5578917", "0.5569549", "0.5569478", "0.5563574", "0.5557...
0.806501
0
prints the result of each function in the corpus statistics part
def corpus_statistics(corpus, d_corp): print('There are {} types of a total of {} tokens in the corpus.\n' .format(number_types(corpus), corpus_length(corpus))) print('There average token length is {}.\n' .format(average_length(corpus))) print('The longest token is {}.\n' .format(longest_token(corpus))) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def corpus_stats(self):\n print(\"Number of sentences: {}\".format(len(self.corpus.sents())))\n print(\"Token: {}\".format(len(self.corpus.words())))\n types = FreqDist(self.corpus.words())\n print(\"Types: {}\".format(len(types)))", "def compute_statistics(self):", "def main():\n ...
[ "0.6597699", "0.6429246", "0.63254446", "0.63020265", "0.62856656", "0.624625", "0.62422293", "0.61852133", "0.61593163", "0.6144798", "0.612338", "0.6114669", "0.6085939", "0.60662675", "0.60401654", "0.60325223", "0.60199016", "0.6014599", "0.6006987", "0.59975606", "0.5994...
0.6906636
0
Given a state dict, load the model's state.
def load_from_state_dict(self, state_dict): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_model_state(model, model_state):\n model.load_state_dict(model_state, strict=True)", "def _load_state(self, model_state: dict) -> bool:\n raise NotImplementedError", "def load_state_dict(self, state_dict: Dict[str, torch.Tensor]):\n pass", "def load_state(self, state):\n rais...
[ "0.8597909", "0.77825034", "0.77680033", "0.76157165", "0.75413203", "0.7495061", "0.74915165", "0.7475301", "0.7467834", "0.7421826", "0.7397422", "0.738471", "0.738471", "0.7383446", "0.7383446", "0.7383446", "0.73804945", "0.73804945", "0.7286066", "0.7211727", "0.7208458"...
0.817902
1
Given paths to data, process and read them accordingly.
def read_data(self): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_data(*args, **kwargs):\n\n filepath = kwargs[\"filepath\"]\n func = kwargs[\"func\"]\n \n # get all files matching extension from directory\n all_files = []\n for root, dirs, files in os.walk(filepath):\n files = glob.glob(os.path.join(root,'*.json'))\n for f in files :\...
[ "0.63515806", "0.6297035", "0.6283056", "0.6253584", "0.6253584", "0.6253584", "0.6253584", "0.6253584", "0.6253584", "0.6253584", "0.6226981", "0.60704017", "0.60156614", "0.5980469", "0.5973019", "0.5949962", "0.5911201", "0.5910075", "0.58618027", "0.58236605", "0.5811464"...
0.0
-1
Given a file, predict translations for each data example (line of file).
def translate_file(self, oov_path, show_progbar=True, n_jobs=1): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def predict(self, datafile):", "def test_predict_from_file():\n f = open('vw.file.txt', 'w')\n examples = []\n for i in xrange(len(DATA)):\n (value, all_sections) = DATA[i]\n ex = VowpalExample(i, value)\n for (namespace, section) in all_sections.items():\n ex.add_section...
[ "0.7367588", "0.6501738", "0.64498425", "0.6441113", "0.6436072", "0.63360226", "0.6219642", "0.6152739", "0.6119679", "0.6116119", "0.6074203", "0.60738134", "0.6063423", "0.6058663", "0.6049587", "0.6035114", "0.5966793", "0.5934395", "0.5933101", "0.5932569", "0.58694667",...
0.0
-1
Given a list of OOV words, predict translations for each of them.
def translate_list(self, oov_list, show_progbar=True, n_jobs=1, debug=False): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def predict(self, phrases):\n Z = self.pipeline.transform(phrases)\n labels = self.classifier.predict(Z)\n if self.duplicates:\n for i, phrase in enumerate(phrases):\n label = self.dupes.get(phrase)\n if label is not None:\n labels[i]...
[ "0.6411905", "0.6252193", "0.6237185", "0.6228212", "0.6152056", "0.6139844", "0.6092754", "0.608949", "0.60863596", "0.60637313", "0.6010705", "0.597738", "0.59731144", "0.59731144", "0.59572995", "0.59563386", "0.59405434", "0.59176236", "0.59051466", "0.58935076", "0.58333...
0.0
-1
the main method of the shell running the infinite loop, continuesly prompting for a command, then attempting to execute the issued command
def run(self): # opening the infinite loop inside of a try statement, so that the SystemExit Exception can be caught try: while True: # first fetching the user input print(colors.magenta(colors.bold(self.prompt)), end="") command = input() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _run_as_shell(self):\n\n while True:\n self.command = self.line_edition.run(self.history)\n if self.command:\n self.history.append(' '.join(self.command))\n\n self.command = self.command_parser.run(self.command)\n if not self.command:\n ...
[ "0.7212018", "0.71252775", "0.69162244", "0.68478006", "0.6828391", "0.6728153", "0.6725586", "0.6681274", "0.6654319", "0.664994", "0.6621521", "0.66023403", "0.66004086", "0.6572758", "0.6559836", "0.6502827", "0.64146936", "0.6412568", "0.6411801", "0.6390982", "0.63907796...
0.7400878
0
013106 copied from MdbId2GeneId.py
def setup_acc2gene_id(self, gene2acc_file, acc_tax_id2tf_acc): sys.stderr.write("Setting up acc2gene_id...") p_gb_acc_version = re.compile(r'(^\w+)\.\d+') tf_acc2gene_id_bridge_acc_ls = {} reader = csv.reader(open(gene2acc_file, 'r'), delimiter ='\t') for row in reader: tax_id, gene_id, status, rna_nuc_acc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_symbol_to_entrez_gene_id(row):\r\n\tgene_entry = annotation_client.get_entrez_gene_id_from_symbol(row['symb'])\r\n\t# import pdb; pdb.set_trace()\r\n\tegid = str(gene_entry['entrez_gene_id'][0]) if gene_entry is not None else \"0\"\r\n\treturn egid", "def get_geneID(header):\n geneID = header[31:43]....
[ "0.67189693", "0.629634", "0.62582123", "0.61686176", "0.61625546", "0.612441", "0.60631144", "0.59937054", "0.5957086", "0.5951994", "0.5950149", "0.5881173", "0.58800197", "0.5878754", "0.58357894", "0.58036816", "0.5794605", "0.5794605", "0.5756333", "0.57497114", "0.57381...
0.54544914
36
013106 disregard those tf_acc's with >1 gene_id
def submit_result(self, curs, tf_acc2entrezgene_id_set, output_table): sys.stderr.write("Submitting to %s..."%output_table) for tf_acc, entrezgene_id_set in tf_acc2entrezgene_id_set.iteritems(): if len(entrezgene_id_set)==1: #only those with 1 gene_id curs.execute("insert into %s(tf_acc, gene_id) values('%s'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter_cobra_model_genes():\n model_genes = [str(x.id) for x in self.base_cobra_model.genes]\n keep_alleles = []\n for col in strain_allele_df.columns:\n if col.split(allele_gene_sep)[0] in model_genes:\n keep_alleles.append(col)\n #...
[ "0.5610524", "0.5339462", "0.527953", "0.5255752", "0.52526873", "0.51950836", "0.5149032", "0.5112244", "0.5108109", "0.5098332", "0.5070774", "0.50513226", "0.5001364", "0.5001158", "0.49697113", "0.49166286", "0.48940355", "0.48894823", "0.48867777", "0.48658827", "0.48645...
0.0
-1
HPE includes whitespace padding in its service tags. Strip that.
def get_slug(self): slug = self.kwargs.get(self.slug_url_kwarg, None) if slug is not None: return slug.strip() else: return slug
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def html_strip(html, pad_l=True, pad_r=True, none_to_empty_string=True):\n if html is None and none_to_empty_string:\n html = \"\"\n lstripped = html.lstrip()\n if len(lstripped) < len(html) and pad_l:\n lstripped = \" \" + lstripped\n stripped = lstripped.rstrip()\n if len(stripped) <...
[ "0.58050746", "0.5800003", "0.55145043", "0.54998195", "0.54998195", "0.54971963", "0.5478673", "0.5448392", "0.54413724", "0.5400161", "0.5393959", "0.53831697", "0.5368185", "0.53266376", "0.5321837", "0.53157914", "0.5294355", "0.52929866", "0.5289057", "0.52752215", "0.52...
0.0
-1
Returns an iterator of number of code points in each grapheme of the string.
def grapheme_lengths(string): return iter(len(g) for g in graphemes(string))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __iter__(self) -> Iterator[Tuple[int, str]]:\n length = \"\"\n for c in super().__iter__():\n if c in CIGAR_CHARS:\n yield (int(length), c)\n length = \"\"\n else:\n length += c", "def get_char_counts(string):\n counts = {}\n...
[ "0.63102376", "0.6066801", "0.58364946", "0.5682218", "0.56752527", "0.5587007", "0.5516279", "0.5483019", "0.5476278", "0.5476278", "0.5432439", "0.54060763", "0.5371684", "0.5355845", "0.5348796", "0.5294735", "0.5293246", "0.5278698", "0.5262752", "0.5248184", "0.52327317"...
0.82796204
0
Implements hashing functionality to on a Python PCB Object. This is useful when using object as a key on a dictionary.
def __hash__(self): return hash(f'{self.job_id},{self.job_size},{self.priority}')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hash(space, w_object):\n return space.hash(w_object)", "def hashcode(o):", "def deep_hash(obj):\n pass", "def hash_key(self):", "def hash(obj):\n \n import hashlib\n import pickle\n \n sha = hashlib.sha256()\n sha.update(pickle.dumps(obj))\n \n return sha.hexdigest()", "...
[ "0.7433865", "0.73609596", "0.73235834", "0.7214958", "0.7206181", "0.71242714", "0.705491", "0.70526046", "0.7036159", "0.70321566", "0.69963425", "0.6991622", "0.6974673", "0.69741863", "0.69423044", "0.69423044", "0.6919625", "0.6898553", "0.68854207", "0.68818533", "0.687...
0.0
-1
Implements Less Then or Equal to on a Python PCB Object
def __lt__(self, other) -> bool: if SCHEDULING_TYPE == 'SJF': return self.job_size < other.job_size elif SCHEDULING_TYPE == 'Priority': return self.priority < other.priority elif SCHEDULING_TYPE == 'FIFO': return self.job_id < other.job_id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def less_than_or_equal(self) -> global___Expression:", "def __ge__(self, obj):\r\n return assert_(self.obj >= obj, '%r < %r' % (self.obj, obj))", "def __le__(self, obj):\r\n return assert_(self.obj <= obj, '%r > %r' % (self.obj, obj))", "def less_than(self) -> global___Expression:", "def __lt...
[ "0.70527965", "0.698733", "0.68991494", "0.68841517", "0.67920387", "0.67019844", "0.67019844", "0.6689682", "0.6659046", "0.6621845", "0.6612608", "0.6559243", "0.6536115", "0.6529632", "0.65113235", "0.6507936", "0.6483007", "0.64644825", "0.64490235", "0.64486253", "0.6446...
0.0
-1
Implements Equal to on a Python PCB Object
def __eq__(self, other) -> bool: return self.job_id == other.job_id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_eq(self):\n dummy = DummyCryptographicObject()\n self.assertTrue(dummy == dummy)", "def __eq__(self, other):\n return self.master.abs2phy(pos=other)", "def __eq__(self, other):\n if isinstance(other, CNPJ):\n return self.cnpj == other.cnpj\n return False",...
[ "0.64601266", "0.6082609", "0.6022548", "0.5972658", "0.5972658", "0.59251875", "0.5915798", "0.5887527", "0.58371365", "0.58139795", "0.5803571", "0.5803571", "0.5803571", "0.5795821", "0.57624626", "0.5751984", "0.5749736", "0.5749461", "0.5748199", "0.57460403", "0.5746040...
0.0
-1
Call this function when your robot's endCompetition function is called
def endCompetition(self): self.robot_exit = True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def endGame(self):\n pass", "def end(self, won, reason):\n pass\n # replace with your end logic", "def api_end_game(self):\n pass", "def end(self):\n winners = mafia.str_player_list(self.game.winners())\n logging.info(\"Game over! Winners: %s\" % winners)\n\n subject = \"...
[ "0.7232599", "0.7144199", "0.71317685", "0.6907059", "0.6723826", "0.67085814", "0.6685554", "0.6543566", "0.6540756", "0.64884466", "0.6481509", "0.6480941", "0.64758396", "0.64678586", "0.6394599", "0.63707036", "0.63701093", "0.63545465", "0.63460165", "0.6345414", "0.6324...
0.8943719
0
This method implements the entire autonomous loop. Do not call this from ``TimedRobot`` as this will break the timing of your control loop when your robot switches to teleop. This function will NOT exit until autonomous mode has ended. If you need to execute code in all autonomous modes, pass a function or list of func...
def run( self, control_loop_wait_time: float = 0.020, iter_fn: Union[Callable[[], None], Sequence[Callable[[], None]]] = None, on_exception: Callable = None, watchdog: Union[wpilib.Watchdog, SimpleWatchdog] = None, ) -> None: if watchdog is not None: watch...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loop(self):\n\n # Set loop frequency\n rate = rospy.Rate(LOOP_FREQUENCY)\n\n # While the system is active...\n while not rospy.is_shutdown():\n\n # If current pose and waypoints are known...\n if not None in (self.pose, self.waypoints, self.waypoints_2d, self.w...
[ "0.57772887", "0.571012", "0.5682816", "0.56716055", "0.55617225", "0.55325687", "0.549369", "0.5488872", "0.54072434", "0.5394649", "0.5375031", "0.53742313", "0.53269994", "0.5281366", "0.5257357", "0.5238456", "0.522742", "0.5222745", "0.5217429", "0.5214553", "0.5200336",...
0.7719447
0
Start autonomous mode. This initialises the selected autonomous mode. Call this from your ``autonomousInit`` method.
def start(self) -> None: self.timer = wpilib.Timer() self.timer.start() self._on_autonomous_enable()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def autonomousInit(self):\n self.globalInit()\n self.autonomous.start()", "def _on_autonomous_enable(self) -> None:\n\n # XXX: FRC Dashboard compatibility\n # -> if you set it here, you're stuck using it. The FRC Dashboard\n # doesn't seem to have a default (nor will it show...
[ "0.7841093", "0.71122485", "0.628487", "0.6095509", "0.60859686", "0.60364497", "0.60302883", "0.60259026", "0.59982705", "0.5997922", "0.59907854", "0.5944252", "0.5905381", "0.584049", "0.58149403", "0.5811002", "0.58014745", "0.57960796", "0.5778222", "0.57653964", "0.5742...
0.6558177
2
Execute one control loop iteration of the active autonomous mode. Call this from your ``autonomousPeriodic`` method.
def periodic(self) -> None: self._on_iteration(self.timer.get())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def AutonomousPeriodic(self):\n Scheduler.GetInstance().Run()", "def autonomousPeriodic(self):\n self.teleopPeriodic()", "def run(\n self,\n control_loop_wait_time: float = 0.020,\n iter_fn: Union[Callable[[], None], Sequence[Callable[[], None]]] = None,\n on_exception...
[ "0.71827805", "0.7142766", "0.70364314", "0.658388", "0.62564766", "0.612732", "0.61129", "0.6005135", "0.60009474", "0.6000426", "0.5930901", "0.5875943", "0.5874298", "0.5874298", "0.586804", "0.58562267", "0.58425", "0.58231753", "0.58173865", "0.58153737", "0.57796377", ...
0.6030376
7
Disables the active autonomous mode. You can call this from your ``disabledInit`` method to call your autonomous mode's ``on_disable`` method.
def disable(self) -> None: if self.active_mode is not None: logger.info("Disabling '%s'", self.active_mode.MODE_NAME) self.active_mode.on_disable() self.active_mode = None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_disable(self) -> None:\n self._cancel_automation()", "def _disable(self):\n self.enabled = False", "def disable(self):\n self._enabled = False", "def disable(self):\n self.enabled = False", "def disable(self):\n logging.debug(\"Disabling switch %s\" % self.name)\n ...
[ "0.77082705", "0.76330733", "0.75106084", "0.7497728", "0.7336437", "0.7231306", "0.72285575", "0.7021192", "0.69935936", "0.6988324", "0.69738656", "0.6952372", "0.69420177", "0.6940569", "0.68873125", "0.6846576", "0.6828831", "0.6814721", "0.6798325", "0.6734701", "0.67340...
0.823199
0
Selects the active autonomous mode and enables it
def _on_autonomous_enable(self) -> None: # XXX: FRC Dashboard compatibility # -> if you set it here, you're stuck using it. The FRC Dashboard # doesn't seem to have a default (nor will it show a default), # so the key will only get set if you set it. auto_mode = wpilib.Sma...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _select_mode(self):\n self.__check_mode()\n if self.mode[\"auto_mode\"]:\n self.mode_auto()\n elif self.mode[\"auto_mode\"] is None: # Do Nothing\n self.mode_standby()\n else:\n self.mode_manual()", "def mode_auto(self):\n if self.__check_m...
[ "0.7211197", "0.7209405", "0.72089565", "0.69817746", "0.68681234", "0.6654427", "0.6608431", "0.6602831", "0.65308183", "0.6469202", "0.64663786", "0.64315754", "0.6398777", "0.6318559", "0.6315171", "0.6285268", "0.6250911", "0.6247391", "0.6247391", "0.62450135", "0.622641...
0.85152936
0
Run the code for the current autonomous mode
def _on_iteration(self, time_elapsed: float) -> None: if self.active_mode is not None: self.active_mode.on_iteration(time_elapsed)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def runauto(self):\n\n self.arcdisplay.dc=0.5*self.arcdisplay.rms*self.arcdisplay.ndstep\n self.arcdisplay.autoidentify()", "def run():\r\n autostartup()", "def _on_autonomous_enable(self) -> None:\n\n # XXX: FRC Dashboard compatibility\n # -> if you set it here, you're stuck usi...
[ "0.7043331", "0.69735026", "0.69144344", "0.6796002", "0.66754746", "0.66554374", "0.6594951", "0.6582033", "0.6360206", "0.6308326", "0.6260983", "0.62419343", "0.62011045", "0.61814076", "0.6112531", "0.6099749", "0.60875654", "0.60862297", "0.60823053", "0.6078582", "0.606...
0.0
-1
This function inits the class.
def __init__(self, c): # make the config available in this class from modules.Helpers import Helpers self.config = c self.helpers = Helpers
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(cls):", "def init(self) -> None:", "def init(self):", "def init(self):", "def __init__():", "def initialize(self):", "def initialize(self):", "def initialize(self):", "def initialize(self):", "def _init(self):", "def _init(self):\n pass", "def init(self):\n pass",...
[ "0.80887526", "0.8025049", "0.79045975", "0.79045975", "0.79026437", "0.78983355", "0.78983355", "0.78983355", "0.78983355", "0.789141", "0.7849785", "0.7839894", "0.7839894", "0.7839894", "0.7839894", "0.7839894", "0.7839894", "0.7839894", "0.7839894", "0.7825583", "0.782503...
0.0
-1
This function pings a Weaviate to see if it is online.
def Ping(self): self.helpers(self.config).Info("Ping Weaviate...") # get the meta endpoint _, _ = self.Get("/meta") # would fail is not available. self.helpers(self.config).Info("Pong from Weaviate...")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ping():\n return ping_response()", "def ping():\n return ping_response()", "def ping():\n return ping_response()", "def ping():\n return ping_response()", "def ping():\n api_online = bool(check_url(\"https://rest.ensembl.org/info/ping?\"))\n vertebrate_url_online = bool(check_...
[ "0.7343835", "0.7343835", "0.7343835", "0.7343835", "0.7305754", "0.7249538", "0.72393966", "0.72393966", "0.72127193", "0.7188551", "0.70891887", "0.7037186", "0.7018444", "0.7017418", "0.70129824", "0.6980183", "0.69678986", "0.69369406", "0.69295627", "0.68623286", "0.6805...
0.68768156
19
This function deletes from a Weaviate.
def Delete(self, path): # try to request try: request = requests.delete(self.config["url"] + "/weaviate/v1" + path) except urllib.error.HTTPError as error: return None return request.status_code
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete():", "def delete(self):\n ...", "def delete(self):\n pass", "def delete(self):\n pass", "def delete(self):\n pass", "def delete(self):\n pass", "def delete(self, application_id):", "def delete(self, _id):", "def delete(self):\n raise NotImplement...
[ "0.8096133", "0.7558571", "0.74173623", "0.74173623", "0.74173623", "0.74173623", "0.7146245", "0.70985603", "0.70927036", "0.70277286", "0.7016644", "0.696315", "0.69479144", "0.69425386", "0.69425386", "0.69360965", "0.6849264", "0.68364006", "0.68364006", "0.6786149", "0.6...
0.0
-1
This function posts to a Weaviate.
def Post(self, path, body): # try to request try: request = requests.post(self.config["url"] + "/weaviate/v1" + path, json.dumps(body), headers={"content-type": "application/json"}) except urllib.error.HTTPError as error: return 0, json.loads(error.read().decode('utf-8')...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post(self):", "def post():\n pass", "def post(self):\n pass", "def post(self):\n pass", "def post(self):\n pass", "def post(self):\n pass", "def post(self):\n pass", "def post(self):\n pass", "def post(self):\n pass", "def post(self):\n ...
[ "0.7546052", "0.7405562", "0.7398628", "0.7398628", "0.7398628", "0.7398628", "0.7398628", "0.7398628", "0.7398628", "0.7398628", "0.7398628", "0.7398628", "0.7398628", "0.7398628", "0.7398628", "0.7398628", "0.72481066", "0.7058141", "0.69942224", "0.6944643", "0.6802247", ...
0.0
-1
This function GETS from a Weaviate Weaviate.
def Get(self, path): # try to request try: request = requests.get(self.config["url"] + "/weaviate/v1" + path) except urllib.error.HTTPError as error: return None, json.loads(error.read().decode('utf-8')) return request.status_code, request.json()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_data_from_web():\n pass", "def get():", "def get():", "def getVotacion(self, url):", "def get_data(self):", "def _get_one(self,url):\n pass", "def get(self, data):\n pass", "def get(self, *args):", "def service_response(drink):\n\n #create url\n drink2 = introcs.repla...
[ "0.6562135", "0.64611423", "0.64611423", "0.6213684", "0.57589746", "0.56968194", "0.5676659", "0.56051505", "0.55462044", "0.545312", "0.54040724", "0.5397253", "0.5379226", "0.5367939", "0.5363003", "0.53605574", "0.5311478", "0.5307167", "0.52994716", "0.5297537", "0.52975...
0.0
-1
Derivative of the sigmoid function.
def sigmoid_prime(z): #计算 σ函数的导数 return 1.716*(1-np.tanh(2/3*z)**2)*2/3
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sigmoid_derivative(x):\n return x * (1-x)", "def sigmoid_derivative(x):\n return x * (1.0 - x)", "def sigmoid_derivative(x):\n\n return sigmoid(x) * (1 - sigmoid(x))", "def derivative_sigmoid(x):\n return x * (1 - x)", "def derivative_sigmoid(x):\n return x * (1 - x)", "def sigmoid_der...
[ "0.847575", "0.8451228", "0.83970946", "0.8348836", "0.8348836", "0.8298695", "0.8054636", "0.7753853", "0.77075475", "0.7498936", "0.74652743", "0.74541104", "0.74023646", "0.73854893", "0.7383694", "0.7347074", "0.73223907", "0.73099685", "0.71926326", "0.71140707", "0.7092...
0.0
-1
Create a chunked hdf5 dataset in a temporary directory for use in tests.
def fixture_chunked_hdf5_data(tmp_path_factory, request): # Make root dir root = tmp_path_factory.mktemp("data") # Set params num_chunks = request.param.num_chunks chunk_size = request.param.chunk_size data_shape = (1,) # Seed hdf5 data paths = [root / Path(f"{idx}.h5") for idx in rang...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prepare_hdf5_file(hdf5_file, n_train, n_valid, n_test):\n n_total = n_train + n_valid + n_test\n splits = create_splits(n_train, n_valid, n_test)\n hdf5_file.attrs['split'] = H5PYDataset.create_split_array(splits)\n vlen_dtype = h5py.special_dtype(vlen=numpy.dtype('uint8'))\n hdf5_file.create_da...
[ "0.701501", "0.6853009", "0.6639542", "0.6613534", "0.6424932", "0.6371469", "0.63680524", "0.63611555", "0.6336317", "0.6271188", "0.6250077", "0.6228745", "0.616856", "0.6167873", "0.61268145", "0.61167353", "0.60741633", "0.6038323", "0.60328007", "0.6025898", "0.6020997",...
0.86750126
0
Create a chunked json dataset in a temporary directory for use in tests.
def fixture_chunked_json_data(tmp_path_factory, request): # Make root dir root = tmp_path_factory.mktemp("data") # Set params num_chunks = request.param.num_chunks chunk_size = request.param.chunk_size # Seed JSON data paths = [root / Path(f"{idx}.json") for idx in range(num_chunks)] f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fixture_chunked_hdf5_data(tmp_path_factory, request):\n # Make root dir\n root = tmp_path_factory.mktemp(\"data\")\n\n # Set params\n num_chunks = request.param.num_chunks\n chunk_size = request.param.chunk_size\n data_shape = (1,)\n\n # Seed hdf5 data\n paths = [root / Path(f\"{idx}.h5...
[ "0.70258194", "0.6218852", "0.6163091", "0.6123663", "0.60687613", "0.6043297", "0.59850633", "0.59793377", "0.59119284", "0.58738595", "0.5853754", "0.5810511", "0.5795334", "0.57883775", "0.57807326", "0.57653546", "0.5723074", "0.56702757", "0.565525", "0.5654163", "0.5602...
0.8353137
0
Create a image folder dataset in a temporary directory for use in tests.
def fixture_image_data(tmp_path_factory, request): # Make root dir root = tmp_path_factory.mktemp("data") # Set params num_images = request.param # Create image files paths = [root / Path(f"{idx}.png") for idx in range(num_images)] dimensions = [(idx % 10 + 1, (10 - idx) % 10 + 1) for idx ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_directories(train_path, test_path):\n train_path.joinpath(\"images\").mkdir(parents=True)\n test_path.joinpath(\"images\").mkdir(parents=True)", "def make_directory_dataset(directory_path: str) -> None:\n dataset_path = Path(directory_path)\n test_path = dataset_path / 'test'\n train_pa...
[ "0.71932167", "0.71284103", "0.69951254", "0.69644856", "0.6944171", "0.6929569", "0.6812385", "0.6766725", "0.673779", "0.6720452", "0.67042", "0.6691994", "0.6689989", "0.65835524", "0.65601933", "0.65417504", "0.65079594", "0.64762", "0.6473956", "0.6467302", "0.64517516",...
0.7515927
0
Assigns lists of player objects to Lineup object attributes based on game_id and team
def get_lineups(self): [players, positions, ids] = scrape.get_lu_table(self.game_id) lu = compile_lineups(players, positions, ids, self.team) self.lineup = lu['lineup'] self.subs = lu['subs']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_player_stats(tournament, lineups):\n positions = find_player_positions(lineups)\n positions = positions.set_index('player_id')[['player_position']]\n player_stats = load_player_stats(tournament)\n player_stats.set_index('player_id', inplace=True)\n mask = player_stats['goals'] > player_stat...
[ "0.63850033", "0.6338678", "0.63227457", "0.6285311", "0.6119352", "0.60775614", "0.60551685", "0.60473454", "0.5991345", "0.59744817", "0.5960008", "0.590644", "0.58917046", "0.58873177", "0.5851603", "0.5847841", "0.5840884", "0.58140904", "0.5770197", "0.5744363", "0.57298...
0.57492363
19
Get the batter at a particular position in the batting order given top/bottom of inning
def get_batter(self, half, order): return self.lineup[order-1].id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __getxyB(x, y):\n\t\treturn x*3+y", "def _get_loc_top_left_end_b(end_button_number):\r\n if end_button_number == 0:\r\n return 19 / 2, 25 / 2 # 0 is the end button while orientation == \"width\"\r\n\r\n elif end_button_number == 1:\r\n return 25 / 2, 23 / 2 # 1 is the end button while o...
[ "0.5775039", "0.5769451", "0.5739678", "0.56741536", "0.5642245", "0.5635222", "0.56308234", "0.56305456", "0.56302994", "0.5580484", "0.55689114", "0.556663", "0.5557171", "0.5522821", "0.55116755", "0.54655975", "0.54113954", "0.540188", "0.5387999", "0.5366533", "0.5350712...
0.6736391
0
makes lineup change based on Sub object
def make_sub(self, sub): [lu, subs] = [self.lineup, self.subs] if 'PositionSwitch' in str(type(sub)): done = False for player in lu: if player.id == sub.player: done = True player.switch.append(player.pos) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def makeChange(aligner, change):\n\tif len(change[1]) == 0:\n\t\taligner.delBase(change[0])\n\telif len(change[1]) == 1:\n\t\taligner.subBase(change[0], change[1])\n\telse:\n\t\taligner.insBase(change[0], change[1][:-1])", "def update_subway(BeiJingSubway):\n BeiJingSubway['西直门']['积水潭'] = 'line2'\n BeiJing...
[ "0.57067615", "0.56136876", "0.5431107", "0.5336604", "0.53345376", "0.53304523", "0.53304523", "0.5295087", "0.52895117", "0.5196379", "0.5177456", "0.5176448", "0.5148774", "0.5121558", "0.5111484", "0.5097203", "0.50917596", "0.50849277", "0.50813663", "0.507889", "0.50635...
0.6093217
0
given lists of names and positions returns two lists populated with Player objects
def compile_lineups(players, pos, id_list, team): lu = [] subs = [] names = players[team] positions = pos[team] ids = id_list[team] for n in range(len(names)): if names[n][-1] == ' ': names[n] = names[n][0:-1] for i in range(0, len(names)): names[i] = names[i].rep...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_player_list(player_arg):\n\n players = []\n\n names_pieces = player_arg.split(',')\n for name_piece in names_pieces:\n player_name, piece_name = name_piece.split(':')\n piece = PIECE_MAP[piece_name]\n players.append(player.Player(player_name, piece))\n\n return players", "def _player_list(s...
[ "0.6961973", "0.68312776", "0.6758845", "0.6330063", "0.62476397", "0.6098362", "0.6092818", "0.60861766", "0.60596436", "0.60412306", "0.6034209", "0.6027136", "0.6012479", "0.5982444", "0.59562457", "0.5945529", "0.5922364", "0.5899824", "0.5885866", "0.5881992", "0.5858835...
0.52888656
91
ensure task cleanaction is executed only once
def clean_tasks(self, tasks, dryrun, cleanforget): cleaned = set() forget_tasks = cleanforget and not dryrun for task in tasks: if task.name not in cleaned: cleaned.add(task.name) task.clean(self.outstream, dryrun) if forget_tasks: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def clean_up(self) -> None:", "def finalize_task(self):\n pass", "def clean_up(self) -> None:\n print('Doing some clean-up work...')", "def purge() -> None:\r\n _purge_func(False)", "async def cleanup(self):\n if self.preparing_task:\n self.preparing_task.cancel()",...
[ "0.67164695", "0.66661847", "0.6652028", "0.65358365", "0.6485451", "0.6427739", "0.63522935", "0.62534803", "0.6226809", "0.621118", "0.6208394", "0.61655223", "0.6165104", "0.61582613", "0.6151519", "0.61300945", "0.6117578", "0.6113343", "0.6100788", "0.60949796", "0.60949...
0.6569924
3
build node including task_dep's
def build_nodes_with_deps(self, tasks, task_name): if task_name in self._processed: return else: self._processed.add(task_name) # add node itself if not in list of nodes self.nodes.setdefault(task_name, []) task = tasks[task_name] # reversing not ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def task_build(argv):\n pytaskmaster.generator(\"setup.py.in\", \"setup.py\", config)\n pytaskmaster.generator(\"pytaskmaster/version.py.in\", \"pytaskmaster/version.py\", config)\n shell(\"python setup.py bdist_wheel\")\n if \"--sign\" in argv:\n for file in os.listdir(\"dist\"):\n a...
[ "0.66064805", "0.6304529", "0.6274259", "0.615437", "0.614353", "0.6101664", "0.6060883", "0.6047356", "0.6025223", "0.6014415", "0.5908902", "0.59042233", "0.58654684", "0.5841239", "0.58313036", "0.58256507", "0.57700115", "0.5733592", "0.5722518", "0.570495", "0.5691519", ...
0.63929623
1
build nodes with subtasks but no other task_dep
def build_nodes(self, tasks, clean_list): for name in clean_list: # add node itself if not in list of nodes self.nodes.setdefault(name, []) task = tasks[name] # reversing not required for dep_name in reversed(task.task_dep): if tasks[de...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_nodes_with_deps(self, tasks, task_name):\n if task_name in self._processed:\n return\n else:\n self._processed.add(task_name)\n\n # add node itself if not in list of nodes\n self.nodes.setdefault(task_name, [])\n task = tasks[task_name]\n # ...
[ "0.70941085", "0.63707393", "0.59613657", "0.59554327", "0.59195566", "0.5885454", "0.5755916", "0.56664574", "0.5637033", "0.56342274", "0.55506593", "0.5529892", "0.55278635", "0.55210596", "0.55037177", "0.55002755", "0.5493501", "0.54913247", "0.54896176", "0.5485859", "0...
0.7119548
0
return list of tasks in the order they should be `clean`
def flat(self): to_clean = [] while self.nodes: head, children = self.nodes.popitem(0) to_clean.extend([x for x in self._get_leafs(head, children)]) return to_clean
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_tasks(self, tasks, dryrun, cleanforget):\n cleaned = set()\n forget_tasks = cleanforget and not dryrun\n for task in tasks:\n if task.name not in cleaned:\n cleaned.add(task.name)\n task.clean(self.outstream, dryrun)\n if forget...
[ "0.6891145", "0.647056", "0.6442044", "0.64314896", "0.6394435", "0.6357911", "0.62649375", "0.6251138", "0.62314373", "0.62143195", "0.62033397", "0.6192663", "0.6186887", "0.6144595", "0.6113532", "0.6112252", "0.60972387", "0.60958344", "0.60923725", "0.60854495", "0.60797...
0.0
-1
Use a basic Resolver to find the IP Addresses of specific nameservers This allows the porgram to be less dependant on hard coded IP Addresses
def public_ip_dns(resolv, nameservers, rdatatype, server, responsetype): for ns in nameservers: try: answer = resolv.query(ns, rdatatype) nameserver = answer[0].to_text() except Exception as e: print(e) continue resolve_public_ip(nameserver, se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _resolve(addresses):\n\n for addr in addresses:\n _, _, ips = socket.gethostbyname_ex(addr)\n for ip in ips:\n yield ip", "def get_resolvers(default: str = \"127.0.0.1\") -> str:\n resolvers: List = []\n try:\n with open(\"/etc/resolv.conf\", encoding=...
[ "0.6936479", "0.65642786", "0.6545789", "0.6440717", "0.64311206", "0.6364885", "0.6236591", "0.62123275", "0.6156122", "0.6147866", "0.6130928", "0.6101797", "0.6088958", "0.6075119", "0.60378224", "0.6004433", "0.59624976", "0.593056", "0.58989966", "0.5869352", "0.5858242"...
0.7494848
0
Using the resolved IP Address of a nameserver, query a specific server for the public IP Address of the host running this program
def resolve_public_ip(nameserver, server, responsetype): request_resolver = dns.resolver.Resolver() request_resolver.nameservers = [nameserver,] try: answer = request_resolver.query(server, responsetype) ip = answer[0].to_text().replace('"','').strip() ipaddress.ip_address(ip) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def public_ip_dns(resolv, nameservers, rdatatype, server, responsetype):\n for ns in nameservers:\n try:\n answer = resolv.query(ns, rdatatype)\n nameserver = answer[0].to_text()\n except Exception as e:\n print(e)\n continue\n resolve_public_ip(n...
[ "0.7237525", "0.6862172", "0.6637621", "0.6637621", "0.66072834", "0.66016024", "0.65239745", "0.65031326", "0.64731175", "0.6432121", "0.6424992", "0.6422536", "0.6409547", "0.6387513", "0.637834", "0.63011277", "0.62938577", "0.6290494", "0.6286547", "0.62517244", "0.624607...
0.7485398
0
Send HTTP GET to a URL, parse and verify the reply
def public_ip_url(url, sanitize=(lambda x:x)): reply = requests.get(url) if reply.status_code == 200: try: ip = sanitize(reply.text.strip()) ipaddress.ip_address(ip) print(ip) sys.exit() except Exception as e: print(e)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def http_request(url):\n try:\n response = requests.get(url, proxies=PROXIES, cookies=COOKIES, auth=HTTP_AUTH, verify=False)\n return response.status_code, response.text\n\n except requests.exceptions.RequestException:\n writer(f\"\\nError: Connection failed for {url}\\n\", FORMAT['ERROR...
[ "0.72406715", "0.7059548", "0.70519984", "0.6994186", "0.6984207", "0.69838876", "0.692338", "0.6913169", "0.6913169", "0.6913169", "0.69109505", "0.6865941", "0.68572", "0.68286324", "0.68284273", "0.68002164", "0.679507", "0.67939806", "0.67939806", "0.67910236", "0.6777957...
0.0
-1
Load player statistics, make sure goals at least equals shots and set indices according to players in lineups. Player not in lineups won't be included.
def make_player_stats(tournament, lineups): positions = find_player_positions(lineups) positions = positions.set_index('player_id')[['player_position']] player_stats = load_player_stats(tournament) player_stats.set_index('player_id', inplace=True) mask = player_stats['goals'] > player_stats['shots']...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def readPlayerFileAndFillStats(players_data_filename, game_stats):\n\tplayer_stats = {}\n\tteam_stats = {}\n\tgame_stats_clean = {}\n\tgame_stats = fillGameStats(players_data_filename, game_stats)\n\n\twith open(players_data_filename) as csvfile:\n\t reader = csv.DictReader(csvfile)\n\t for row in reader:\n\...
[ "0.6473567", "0.6369928", "0.6316587", "0.59145224", "0.5905105", "0.5772", "0.5766758", "0.57366437", "0.5711018", "0.57037127", "0.56874764", "0.5683247", "0.56676143", "0.5653891", "0.5648855", "0.5629543", "0.5604311", "0.55853164", "0.55709386", "0.5567451", "0.55339485"...
0.71618724
0
r""" Helper function that is used to calculate parallel permuted test statistics.
def _perm_stat(self, index): # pragma: no cover permu = np.random.permutation(self.u) permv = np.random.permutation(self.v) # calculate permuted statics, store in null distribution perm_stat = self.indep_test._statistic(permu, permv) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _run_permutation(self, params):\n iter_df, iter_xyz = params\n iter_xyz = np.squeeze(iter_xyz)\n iter_df[[\"x\", \"y\", \"z\"]] = iter_xyz\n stat_values = self._compute_summarystat(iter_df)\n return stat_values", "def speedup(n0,l,ntarray=np.arange(100),marray=np.arange(100...
[ "0.62865835", "0.6221984", "0.60531986", "0.5995771", "0.5801195", "0.5758665", "0.57484293", "0.5713397", "0.5654646", "0.5652738", "0.5635182", "0.5577867", "0.55623806", "0.54586506", "0.5447104", "0.5443916", "0.5383097", "0.536124", "0.534885", "0.5339623", "0.53299505",...
0.5963931
4
r""" Calulates the ksample test pvalue.
def test(self, inputs, reps=1000, workers=-1): # calculate observed test statistic u, v = k_sample_transform(inputs) self.u = u self.v = v obs_stat = self.indep_test._statistic(u, v) # use all cores to create function that parallelizes over number of reps mapwra...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_kpa_conversion(self):\n\n result = get_kpa(5.6, 25)\n\n self.assertTrue(result == -34.281679)", "def ks_pval(data):\n n,p = np.shape(data)\n pvals = [None] * p\n for i in range(p):\n foo, pvals[i] = stats.kstest(data[:,i], \"beta\", args = (1,p-i))\n return pvals", "de...
[ "0.620177", "0.6123925", "0.5984024", "0.5976934", "0.59642625", "0.5910731", "0.5895889", "0.5882294", "0.587519", "0.58484674", "0.5833276", "0.58204883", "0.5785098", "0.576951", "0.57473797", "0.5734136", "0.57062143", "0.5690596", "0.56749064", "0.5669565", "0.5650536", ...
0.0
-1
Ensure that if no arguments are given, then the color defaults to black.
def test_init_no_args(self): fill = FillColor() self.assertEqual((0, 0, 0), fill.color)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def defaultColor(self, p_int=None): # real signature unknown; restored from __doc__ with multiple overloads\r\n pass", "def color(*args, rgbColor: List[float, float, float]=None, userDefined: int=0, **kwargs)->None:\n pass", "def bgcolor(self, *args):\n if args:\n color = self._colo...
[ "0.71374637", "0.68124783", "0.66890544", "0.662122", "0.65990454", "0.65003735", "0.64815617", "0.6463677", "0.6463677", "0.6463677", "0.6463677", "0.6463677", "0.6463677", "0.6463677", "0.6463677", "0.6463677", "0.6463677", "0.6463677", "0.6463677", "0.6463677", "0.6463677"...
0.6419757
38
Speech to text from WAV file(s).
async def transcribe_wav(args: argparse.Namespace, core: Voice2JsonCore) -> None: from rhasspyasr import Transcription # Make sure profile has been trained assert core.check_trained(), "Not trained" # Get speech to text transcriber for profile transcriber = core.get_transcriber(open_transcription=...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_wav_file(self, ):\n\n f_out = open(self.wav_file, 'w')\n u_utt2spk = open(self.utt2spk, 'w')\n for file in glob.glob(self.wav_folder+'/*.wav'):\n base = os.path.basename(file).split('.')[0]\n # write to scp file\n f_out.write(base + '\\t' + file + '\...
[ "0.68305916", "0.6656905", "0.6639847", "0.6593684", "0.65917593", "0.6555283", "0.6533535", "0.63963157", "0.6349328", "0.63342345", "0.62841815", "0.62485176", "0.624121", "0.624039", "0.6170744", "0.6162298", "0.61547387", "0.6142499", "0.61416465", "0.6132796", "0.6121526...
0.5788705
68
Speech to text from WAV file(s).
async def transcribe_stream(args: argparse.Namespace, core: Voice2JsonCore) -> None: from rhasspyasr import Transcription from rhasspysilence import VoiceCommand, VoiceCommandResult # Make sure profile has been trained assert core.check_trained(), "Not trained" wav_sink = None wav_dir = None ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_wav_file(self, ):\n\n f_out = open(self.wav_file, 'w')\n u_utt2spk = open(self.utt2spk, 'w')\n for file in glob.glob(self.wav_folder+'/*.wav'):\n base = os.path.basename(file).split('.')[0]\n # write to scp file\n f_out.write(base + '\\t' + file + '\...
[ "0.68299735", "0.6655554", "0.66381735", "0.6594547", "0.65914816", "0.6554458", "0.6533944", "0.63962066", "0.6348706", "0.6333919", "0.6283082", "0.62477344", "0.624167", "0.62379485", "0.6170096", "0.6161666", "0.61545223", "0.61422753", "0.6141122", "0.6133157", "0.611769...
0.0
-1
Read audio chunks from queue and yield.
def audio_stream() -> typing.Iterable[bytes]: frames = frame_queue.get() while frames: yield frames frames = frame_queue.get()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_audio():\n\tbuf = None\n\tnum_new_bytes = BUFFER_SIZE // REFRESH_BUFFER_FACTOR\n\twith open(INFILE) as fifo:\n\t\twhile True:\n\t\t\tif buf is None:\n\t\t\t\tbuf = fifo.read(BUFFER_SIZE)\n\t\t\telse:\n\t\t\t\tbuf = buf[num_new_bytes:] + fifo.read(num_new_bytes)\n\t\t\tyield buf", "async def async_readchu...
[ "0.7123791", "0.68189037", "0.6682187", "0.6352251", "0.6322491", "0.62974507", "0.6286665", "0.62764674", "0.62634826", "0.62544084", "0.6230898", "0.61809504", "0.61534625", "0.60943", "0.60639846", "0.6044643", "0.6019628", "0.6015428", "0.60127366", "0.5972718", "0.595726...
0.7560682
0
Transcribe live audio stream indefinitely.
def transcribe_proc(): while True: # Get result of transcription transcribe_result = transcriber.transcribe_stream( audio_stream(), sample_rate, sample_width, channels ) _LOGGER.debug("Transcription result: %s", transcribe_result) tra...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def transcribe_stream(args: argparse.Namespace, core: Voice2JsonCore) -> None:\n from rhasspyasr import Transcription\n from rhasspysilence import VoiceCommand, VoiceCommandResult\n\n # Make sure profile has been trained\n assert core.check_trained(), \"Not trained\"\n\n wav_sink = None\n w...
[ "0.6472893", "0.61215985", "0.6067832", "0.5947168", "0.59419954", "0.59041303", "0.58980197", "0.5896212", "0.5856194", "0.5832167", "0.5821672", "0.576574", "0.57346904", "0.57230276", "0.5704431", "0.5703715", "0.56770855", "0.56737936", "0.56722736", "0.566129", "0.565257...
0.7335401
0
Compute ECDF for a onedimensional array of measurements.
def ecdf(data): # Number of data points: n n = len(data) # x-data for the ECDF: x x = np.sort(data) # y-data for the ECDF: y y = np.arange(1, n+1) / n return x, y
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ecdf(arr, **kwargs):\n\t\"\"\" arr is assumed to be a single dimension array \"\"\"\n\t\n\tissortedVal = True\n\tzdispVal = False\n\n\tif \"issorted\" in kwargs:\n\t\tissortedVal = kwargs[\"issorted\"]\n\t\n\tif \"zdisp\" in kwargs:\n\t\tzdispVal = kwargs[\"zdisp\"]\n\t\n\tif issortedVal == False:\n\t\tarr.sor...
[ "0.720311", "0.7046862", "0.7046862", "0.69788665", "0.6909434", "0.69083554", "0.6897698", "0.6897698", "0.68887347", "0.68844676", "0.6881855", "0.6879231", "0.6875579", "0.6875579", "0.6865484", "0.67179096", "0.64047563", "0.626837", "0.6176467", "0.61669254", "0.60031134...
0.68733174
15
Create a new instance of the GetCategories Choreo. A TembooSession object, containing a valid set of Temboo credentials, must be supplied.
def __init__(self, temboo_session): super(GetCategories, self).__init__(temboo_session, '/Library/eBay/Trading/GetCategories')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_categories(self):\n\n self.search([]).unlink()\n token = self.env['odoo.moodle'].search([('create_uid', '=', self.env.user.id)]).token\n domain = \"http://localhost:8888\"\n webservice_url = \"/webservice/rest/server.php?\"\n parameters = {\n \"wstoken\":token,...
[ "0.6183504", "0.6007984", "0.56724036", "0.56522274", "0.556909", "0.55014086", "0.5392511", "0.53890383", "0.5248067", "0.5222362", "0.52026653", "0.51939017", "0.51903385", "0.5187185", "0.5185729", "0.517458", "0.5135385", "0.5077549", "0.5069093", "0.50079566", "0.4993274...
0.45352626
78
Set the value of the CategoryParent input for this Choreo. ((optional, string) Indicates the ID of the highestlevel category to return. Multiple CategoryParent IDs can be specified in a commaseparated list.)
def set_CategoryParent(self, value): super(GetCategoriesInputSet, self)._set_input('CategoryParent', value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_sub_category(self, name, category_id, parent_category_id, **kwargs):\n kwargs[\"parent_category_id\"] = parent_category_id\n self.client._put(f\"/categories/{category_id}.json\", **kwargs)", "def parent_id(self, parent_id: int):\n if parent_id is None:\n raise ValueError(\...
[ "0.6129967", "0.5472301", "0.5323792", "0.52963334", "0.5156003", "0.5122369", "0.51155204", "0.51121783", "0.51076823", "0.51076823", "0.51076823", "0.51076823", "0.5062186", "0.50444716", "0.49758205", "0.4972529", "0.49427202", "0.49028528", "0.48824716", "0.4873548", "0.4...
0.73892105
0
Set the value of the CategorySiteID input for this Choreo. ((optional, string) The ID for the site for which to retrieve the category hierarchy. Use the numeric site code (e.g., 0 for US, 77 for eBay Germany, etc).)
def set_CategorySiteID(self, value): super(GetCategoriesInputSet, self)._set_input('CategorySiteID', value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_SiteID(self, value):\n super(GetCategoriesInputSet, self)._set_input('SiteID', value)", "def site_id(self, site_id):\n\n self._site_id = site_id", "def site_id(self, site_id):\n\n self._site_id = site_id", "def categories_id(self, categories_id):\n\n self._categories_id = ...
[ "0.6707115", "0.5398025", "0.5398025", "0.5373852", "0.5183332", "0.49956957", "0.46219173", "0.45263055", "0.4510416", "0.44572973", "0.44089535", "0.43879732", "0.4354011", "0.41838205", "0.40762675", "0.40462708", "0.4037234", "0.39882267", "0.39651904", "0.39525023", "0.3...
0.743803
0
Set the value of the LevelLimit input for this Choreo. ((optional, string) Indicates the maximum depth of the category hierarchy to retrieve, where the toplevel categories (metacategories) are at level 1. Default is 0.)
def set_LevelLimit(self, value): super(GetCategoriesInputSet, self)._set_input('LevelLimit', value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def SetLimit(self, *args):\n return _BRepAlgo.BRepAlgo_NormalProjection_SetLimit(self, *args)", "def categories_level(self, categories_level):\n\n self._categories_level = categories_level", "def set_limit(self, limit):\n self.limit = limit\n self._prune()", "def setRevisionLimit(...
[ "0.59802634", "0.5946763", "0.5711779", "0.5509778", "0.5490343", "0.54478884", "0.54478884", "0.54478884", "0.5437157", "0.54352576", "0.5423509", "0.5397781", "0.5367426", "0.5363926", "0.53585196", "0.53347886", "0.5326937", "0.53143334", "0.5291554", "0.52813643", "0.5179...
0.78116244
0
Set the value of the SandboxMode input for this Choreo. ((conditional, boolean) Indicates that the request should be made to the sandbox endpoint instead of the production endpoint. Set to 1 to enable sandbox mode.)
def set_SandboxMode(self, value): super(GetCategoriesInputSet, self)._set_input('SandboxMode', value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sandbox(self, sandbox):\n\n self._sandbox = sandbox", "def is_sandbox_environment(self) -> Optional[pulumi.Input[bool]]:\n return pulumi.get(self, \"is_sandbox_environment\")", "def CreateSandbox() -> Sandbox:\n global _sandbox_name\n if _sandbox_name is None:\n return NullSandbox()\n e...
[ "0.5614144", "0.5567158", "0.51500666", "0.51233065", "0.51149535", "0.50982213", "0.49350753", "0.48719332", "0.48414156", "0.48161337", "0.46198162", "0.44927067", "0.44751006", "0.44662586", "0.44561806", "0.44053355", "0.43435562", "0.4293769", "0.4281894", "0.42796412", ...
0.67555255
0
Set the value of the SiteID input for this Choreo. ((optional, string) The eBay site ID that you want to access. Defaults to 0 indicating the US site.)
def set_SiteID(self, value): super(GetCategoriesInputSet, self)._set_input('SiteID', value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def site_id(self, site_id):\n\n self._site_id = site_id", "def site_id(self, site_id):\n\n self._site_id = site_id", "def web_site_id(self, web_site_id):\n\n self._web_site_id = web_site_id", "def set_CategorySiteID(self, value):\n super(GetCategoriesInputSet, self)._set_input('Ca...
[ "0.7500939", "0.7500939", "0.6129336", "0.6034459", "0.5938549", "0.5903619", "0.5803138", "0.54688704", "0.5419744", "0.536414", "0.5242638", "0.4969907", "0.49572378", "0.49247172", "0.4897453", "0.4897453", "0.4870887", "0.48449123", "0.4842923", "0.484094", "0.4771758", ...
0.6480584
2
Set the value of the UserToken input for this Choreo. ((required, string) A valid eBay Auth Token.)
def set_UserToken(self, value): super(GetCategoriesInputSet, self)._set_input('UserToken', value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user(self, user_token, user_device=None):\n\n self.user_token = user_token\n self.user_device = user_device", "def user(self, user_token, user_device=None):\n self.set('user', user_token)\n self.set('device', user_device)", "def set_user_api_token(connection, api_url, token):\n\...
[ "0.66497695", "0.63058317", "0.58796537", "0.58653057", "0.5778395", "0.5624388", "0.5522572", "0.5495309", "0.54718363", "0.53511024", "0.5306627", "0.52830744", "0.5225", "0.5205493", "0.5196284", "0.5194925", "0.5191801", "0.5144547", "0.50857335", "0.5083931", "0.5067435"...
0.66259897
1
Set the value of the ViewAllNodes input for this Choreo. ((optional, boolean) A flag that controls whether all eBay categories are returned, or only leaf categories are returned. To retrieve leaf categories, set this parameter to 'false'.)
def set_ViewAllNodes(self, value): super(GetCategoriesInputSet, self)._set_input('ViewAllNodes', value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_nodes(self):\n return self._get_all_nodes()", "def add_nodes_from(self, nodes):\n self._Impl._nodes[\"all_nodes\"] = cudf.Series(nodes)", "def all_nodes(self, namespace=None):\n source = self._source(namespace)\n return self._list(source, 'all')", "def deactivate_all(s...
[ "0.5391109", "0.5390056", "0.52510315", "0.50688076", "0.50596285", "0.49692878", "0.49534097", "0.4930699", "0.48903552", "0.4888203", "0.48538244", "0.48459598", "0.47947457", "0.47933027", "0.47827104", "0.4774255", "0.47677267", "0.47593287", "0.47422218", "0.4693059", "0...
0.7972372
0
Retrieve the value for the "Response" output from this Choreo execution. (The response from eBay.)
def get_Response(self): return self._output.get('Response', None)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def response(self):\n return self._response", "def get_response(self):\n result = self.get_response_impl()\n if self.log_dest is not None:\n is_error, response = result\n if is_error:\n response = \"? \" + response\n else:\n resp...
[ "0.683632", "0.6558822", "0.651575", "0.6512072", "0.64753896", "0.6440545", "0.61910367", "0.6162101", "0.6142276", "0.61182255", "0.61182255", "0.61121666", "0.60660565", "0.6032021", "0.5943504", "0.5908895", "0.5865184", "0.5833423", "0.58037376", "0.57420945", "0.5729490...
0.8008721
9
setup any state specific to the execution of the given class (which usually contains tests).
def setup_class(self): # Initialize instance variable(s) self.log = logging.getLogger() self.log.level = logging.DEBUG
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setUpClass(cls):\n cls.state_f = inspect.getmembers(State, inspect.isfunction)", "def test_class_started(self, cls):", "def setup_class(klass):", "def setup_class(klass):", "def setUp(self):\n self._class = State()\n self._class2 = State()\n self._name = \"State\"", "def s...
[ "0.7307002", "0.72859484", "0.7094503", "0.7094503", "0.7075876", "0.7004987", "0.6988122", "0.6871592", "0.67499554", "0.6723976", "0.6723976", "0.6695145", "0.6621887", "0.6610172", "0.6603963", "0.6595152", "0.6595152", "0.6595152", "0.6595152", "0.65886074", "0.6576717", ...
0.0
-1
teardown any state that was previously setup with a call to setup_class.
def teardown_class(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def teardown_class(klass):", "def teardown_class(klass):", "def teardown_class(self):\n self._tester = None\n self._sut = None", "def teardown_class(cls):\n pass", "def teardown_class(cls):\n pass", "def teardown_class(cls):", "def teardown_class(cls):", "def teardown_clas...
[ "0.81003416", "0.81003416", "0.8079559", "0.7988477", "0.7988477", "0.79816633", "0.79816633", "0.79816633", "0.7741436", "0.76517147", "0.7570522", "0.7541752", "0.75215787", "0.7399094", "0.73822033", "0.73822033", "0.73822033", "0.7380316", "0.7341067", "0.7341067", "0.733...
0.8194173
0
Return an instance of N2VC.VNF.
def get_n2vc(self, params={}): # Extract parameters from the environment in order to run our test vca_host = params['VCA_HOST'] vca_port = params['VCA_PORT'] vca_user = params['VCA_USER'] vca_charms = params['VCA_CHARMS'] vca_secret = params['VCA_SECRET'] vca_ca...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vnD(self):\n return self.source_field.vnD", "def ResNet18_FPN():\n return FPN(BasicBlock, [2, 2, 2, 2])", "def vnF(self):\n return np.array(\n [x for x in [self.nFx, self.nFy, self.nFz] if x is not None],\n dtype=int\n )", "def get_vnic(options, index):\n ...
[ "0.56160605", "0.5584905", "0.5534586", "0.55259895", "0.5516764", "0.54576254", "0.54379493", "0.54006445", "0.5384686", "0.53768134", "0.5371969", "0.53596884", "0.5349871", "0.5338815", "0.531186", "0.5296598", "0.52106416", "0.52086425", "0.5202934", "0.51912224", "0.5188...
0.5357924
12
Test the module import for our vendored version of libjuju. Test and verify that the version of libjuju being imported by N2VC is our vendored version, not one installed externally.
def test_vendored_libjuju(self): for name in sys.modules: if name.startswith("juju"): module = sys.modules[name] if getattr(module, "__file__"): print(getattr(module, "__file__")) assert re.search('n2vc', module.__file__, re.IGN...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_importable():\n root_path = os.path.dirname(MY_DIRECTORY)\n\n for version in versioning.get_all_versions():\n v = version.label.replace(\".\", \"_\")\n path = os.path.join(root_path, v)\n module_names = [m[:-3] for m in os.listdir(path) if m.endswith(\".py\")]\n for name ...
[ "0.6707853", "0.6500896", "0.6209891", "0.60962284", "0.6059041", "0.60238165", "0.599417", "0.5978221", "0.5883265", "0.586116", "0.58340436", "0.5832928", "0.57998675", "0.57977194", "0.57901615", "0.5789333", "0.57761467", "0.5762795", "0.5745518", "0.572795", "0.57217455"...
0.77674305
0
Test connecting to libjuju.
async def test_login(self): params = { 'VCA_HOST': os.getenv('VCA_HOST', '127.0.0.1'), 'VCA_PORT': os.getenv('VCA_PORT', 17070), 'VCA_USER': os.getenv('VCA_USER', 'admin'), 'VCA_SECRET': os.getenv('VCA_SECRET', 'admin'), 'VCA_CHARMS': os.getenv('VCA_CH...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_connection():\n result = run(\"uname -a\")\n if result.failed:\n _pretty_output(\"Could not connect to remote server. Please check your configuration\")\n abort(\"Cannot continue. Aborting...\")", "def init(opts):\n opts[\"multiprocessing\"] = False\n log.debug(\"Opening connec...
[ "0.64286137", "0.6058007", "0.5980885", "0.5939209", "0.58861566", "0.58828473", "0.57959145", "0.57664436", "0.55795634", "0.5523262", "0.5509891", "0.54844207", "0.5455142", "0.54343414", "0.5419855", "0.53483045", "0.5333737", "0.5326842", "0.5270051", "0.5265136", "0.5264...
0.0
-1
Compute negative log likelihood of ground truth traversed edges under learned policy.
def compute(self, predictions: Dict, ground_truth: Union[torch.Tensor, Dict]) -> torch.Tensor: # Unpack arguments pi = predictions['pi'] evf_gt = ground_truth['evf_gt'] loss = -torch.sum(pi[evf_gt.bool()]) / pi.shape[0] return loss
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _negative_log_likelihood(self, y_true, y_pred):\n logL = 0\n # pre-calculate cumsum\n cumsum_y_pred = tf.cumsum(y_pred)\n hazard_ratio = tf.exp(y_pred)\n cumsum_hazard_ratio = tf.cumsum(hazard_ratio)\n if self.train_data['ties'] == 'noties':\n log_risk = tf....
[ "0.71119565", "0.7009083", "0.69208413", "0.691134", "0.6889458", "0.68333507", "0.68170094", "0.68170094", "0.68084395", "0.6783639", "0.6783639", "0.67021817", "0.6615301", "0.6590805", "0.65847456", "0.6568487", "0.654197", "0.6522183", "0.65138394", "0.649379", "0.6462665...
0.0
-1
Ensure that the type and dimensions of the value are as expected. If from_string is True, the value is expected to be a unit symbol string.
def verify_dimensions(self, value, exception=True, from_string=False): if from_string: value = Quantity(1, value) try: if self.units is not None: try: value.assert_dimensions(self.units) except AttributeError: raise TypeError('Expected a Quantity, not "{0}"'.format(value)) except Incom...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_value_empty_string(self):\n raw = [\n 0x00,\n 0x00,\n 0x00,\n 0x00,\n 0x00,\n 0x00,\n 0x00,\n 0x00,\n 0x00,\n 0x00,\n 0x00,\n 0x00,\n 0x00,\n 0x0...
[ "0.6058552", "0.5902661", "0.58640677", "0.584069", "0.5795408", "0.57693225", "0.5753926", "0.5752173", "0.57210684", "0.5688301", "0.56866753", "0.567307", "0.5672647", "0.5659424", "0.56070775", "0.5603871", "0.5602504", "0.5601414", "0.55882144", "0.5556388", "0.55380595"...
0.6568141
0
The value of the resource.
def value(self): if self.getter is None: raise NotReadable('Resource not readable.') if callable(self.getter): result = self.getter() elif self.obj is not None: result = getattr(self.obj, self.getter) else: raise NotReadable('Cannot read from resource.') self.verify_dimensions(result) # Appl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def value(self):\n return self.get_data(\"value\")", "def value(self) -> str:\n return pulumi.get(self, \"value\")", "def value(self) -> str:\n return pulumi.get(self, \"value\")", "def value(self) -> str:\n return pulumi.get(self, \"value\")", "def value(self) -> str:\n ...
[ "0.74665505", "0.7334829", "0.7334829", "0.7334829", "0.7334829", "0.7334829", "0.7334829", "0.7334829", "0.7334829", "0.7334829", "0.7334829", "0.7334829", "0.7334829", "0.7334829", "0.7334829", "0.732872", "0.72743225", "0.722479", "0.7208811", "0.7181056", "0.7146232", "...
0.0
-1
Either use the specified converter, treat as a quantity, or do nothing.
def convert(self, value): if self.converter is not None: return self.converter(value) elif self.units is not None: q = Quantity(value) q.assert_dimensions(self.units) return q else: return value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def converter(item):\n pass", "def set_units_converter(self, converter):\n self._units_converter = converter", "def converterValue(self, converter):\n pass", "def get_quantity(item: dict):\n qty = item.get('quantity')\n if isinstance(qty, dict):\n return Decimal(qty[\"value\...
[ "0.6080261", "0.5783019", "0.5745135", "0.5397822", "0.53845406", "0.53512806", "0.52714175", "0.52201015", "0.520989", "0.52045816", "0.5190917", "0.5171038", "0.50769126", "0.5057457", "0.5053004", "0.5047589", "0.504609", "0.4977945", "0.49526244", "0.4933274", "0.49012908...
0.66022456
0
Return the last index of the given wrapper.
def _find_wrapper_by_name(self, name): for i, (n, _, _) in reversed(list(enumerate(self.wrappers))): if n == name: return i raise ValueError('Wrapper not found: {0}'.format(name))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def last_index(self) -> int:\n return self._last_index", "def last_index(self, item):\n return _(self.size()._ - 1 - self.reverse().index(item)._)", "def get_last_index(self):\n return len(self.chain) - 1", "def last_item_index(self) -> int:\n return len(self.all_items) - 1", "d...
[ "0.7722745", "0.7491697", "0.7319964", "0.7001158", "0.6974439", "0.68805635", "0.6858701", "0.6707663", "0.66818964", "0.660478", "0.6588947", "0.64949995", "0.649241", "0.6442181", "0.64361817", "0.6405807", "0.6373571", "0.6352519", "0.63181746", "0.63141847", "0.62466836"...
0.0
-1
Determine whether the given wrapper already wraps this Resource.
def is_wrapped_by(self, name): try: self._find_wrapper_by_name(name) except ValueError: return False else: return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_wrapable(mcs, attribute):\n return isfunction(attribute) and not isinstance(attribute, (classmethod, staticmethod))", "def wrap(wrapper, wrapped):\r\n if decorator:\r\n return decorator.decorator(wrapper, wrapped)\r\n return update_wrapper(wrapper, wrapped)", "def register(self, wrap...
[ "0.5660551", "0.56040525", "0.5594782", "0.55533165", "0.55367464", "0.55265677", "0.55185264", "0.5416225", "0.53686476", "0.5338563", "0.52991587", "0.5257137", "0.5256876", "0.52147627", "0.519328", "0.5120308", "0.5110175", "0.5081303", "0.50668675", "0.5045929", "0.49721...
0.71655154
0
Produce a Resource which is a wrapper around this Resource.
def wrapped(self, name, getter_filter=None, setter_filter=None): result = copy(self) result.wrappers = self.wrappers + [(name, getter_filter, setter_filter)] return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _wrap(self, resource):\n\t\treturn ResourceWrapper(self, resource)", "def make_instance(self, include_optional):\n # model = yapily.models.resource.Resource() # noqa: E501\n if include_optional :\n return Resource(\n description = '0', \n file = yapily....
[ "0.7497035", "0.68926394", "0.67446154", "0.66210735", "0.6620925", "0.64650744", "0.6292766", "0.6151775", "0.6151398", "0.6121766", "0.60489506", "0.60388047", "0.6012709", "0.5981098", "0.59604263", "0.590962", "0.5886807", "0.5848324", "0.58403087", "0.58258355", "0.58189...
0.0
-1
Produce a Resource with the last instance of the given wrapper removed.
def unwrapped(self, name): result = copy(self) idx = self._find_wrapper_by_name(name) result.wrappers = self.wrappers[:idx] + self.wrappers[idx+1:] return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove(self, resource, _no_min=False):\n\t\tif isinstance(resource, ResourceWrapper):\n\t\t\twrapper, resource = resource, resource._resource\n\t\t\twrapper._pool = None\n\t\tif resource not in self.members:\n\t\t\traise ValueError(\"Given resource is not owned by this pool\")\n\t\tfor collection in (self.to_c...
[ "0.55796355", "0.5277009", "0.52132344", "0.51140046", "0.5002756", "0.5000172", "0.49343887", "0.49055848", "0.48910737", "0.48910737", "0.48910737", "0.48139253", "0.48046777", "0.4798738", "0.4791886", "0.47863352", "0.47694337", "0.47565082", "0.47349957", "0.47349957", "...
0.5125389
3
Sweep the Resource slowly over a linear space.
def sweep(self, value_from, value_to, steps, delay=0.1, exception_callback=None): # Check for dimension mismatches. if isinstance(value_from, Quantity) and not isinstance(value_to, Quantity) and value_to == 0: value_to = Quantity(0, value_from.original_units) elif isinstance(value_to, Quantity) and not isinst...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sweep(self) -> None:\n self._resource.clear()\n was_continuous = self.is_continuous\n self.is_continuous = False\n self.write(\"INIT\")\n self.is_continuous = was_continuous", "def crossing_minimization(self):\n self.layer_sweep()", "def shrink(self):\n old ...
[ "0.5686641", "0.51861966", "0.49760246", "0.49219525", "0.49194282", "0.4908059", "0.48912", "0.48896736", "0.4852079", "0.48343167", "0.48270506", "0.4786538", "0.47749016", "0.4712809", "0.4708203", "0.47011054", "0.46770087", "0.46524978", "0.46503225", "0.464922", "0.4644...
0.0
-1
The problems are of the form min funObj(x) s.t. x in C The projected quasiNewton subproblems are solved using the spectral projected gradient algorithm
def minConf_PQN(funObj, x, funProj, options=None): # number of variables/parameters nVars = len(x) # set default optimization settings options_default = {'verbose':2, 'numDiff':0, 'optTol':1e-5, 'progTol':1e-9, \ 'maxIter':500, 'maxProject':100000, 'suffDec':1e-4, \ ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solve_l1(y, A_fun, AT_fun, lambda_l1, reshape_img_fun, show_img_progress=False, alpha=0.2, max_iter=100, solver_tol=1e-6):\n\n\n obj_lss = np.zeros(max_iter)\n x_zs = np.zeros(max_iter)\n u_norms = np.zeros(max_iter)\n times = np.zeros(max_iter)\n\n ATy = AT_fun(y)\n x_shape = ATy.shape\n ...
[ "0.6546414", "0.65157187", "0.6503629", "0.6416568", "0.63758284", "0.6352917", "0.63333297", "0.6304057", "0.6299338", "0.6288639", "0.6283527", "0.62825793", "0.6221241", "0.6204255", "0.6187098", "0.61783713", "0.61578256", "0.6129122", "0.6120274", "0.6084701", "0.6055298...
0.588684
39
gets the absolute path to the file
def get_abs_path(filename): dirname = os.path.dirname(os.path.abspath(__file__)) return os.path.join(dirname, filename)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_absolute_path(self):\n\t\treturn call_sdk_function('PrlFsEntry_GetAbsolutePath', self.handle)", "def _get_path(): # THIS IS JUST FOR GETTING THE FILE\n return os.path.dirname(os.path.abspath(__file__)) + '/'", "def _abs_path(fn):\n return os.path.join(os.path.dirname(__file__), fn)", "def get_fu...
[ "0.7887799", "0.78053993", "0.77804095", "0.7762283", "0.7761981", "0.77285194", "0.76814115", "0.76741165", "0.7560067", "0.75413364", "0.7526306", "0.7487459", "0.746613", "0.7463732", "0.74426347", "0.7432694", "0.74262834", "0.7422942", "0.7370598", "0.7369104", "0.736023...
0.809167
0
Copy the data of the next node into this node and delete the next node.
def del_middle_node(node): if node == None or node.next == None: return node.data = node.next.data node.next = node.next.next
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete(self, data):\n if self.head.data == data:\n self.head = self.head.next\n return\n prev, curr = self.lookup(data)\n if curr is None:\n raise AttributeError('Data node not found.')\n prev.next = curr.next\n curr = None\n return", ...
[ "0.732606", "0.704605", "0.6969342", "0.6800882", "0.6780404", "0.66766715", "0.6637315", "0.656788", "0.65572", "0.6542901", "0.6426972", "0.633599", "0.6334978", "0.6333533", "0.6327293", "0.6326656", "0.63245857", "0.6296128", "0.6294251", "0.6285607", "0.6262375", "0.62...
0.6112076
33
Overriding the default create method of the Model serializer.
def create(self, validated_data): user_data = validated_data.pop('user') user = User.object.get(id=user_data.id) restaurant, created = Restaurant.objects.update_or_create(user=user, data=validated_data) return restaurant
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create(self, validated_data):\n\n return serializers.ModelSerializer.create(self, validated_data)", "def perform_create(self, serializer):\n extra_data = self.get_additional_data(True)\n serializer.save(**extra_data)", "def perform_create(self, serializer):\n serializer.save()",...
[ "0.7564856", "0.73483485", "0.72935075", "0.72935075", "0.72935075", "0.72935075", "0.72935075", "0.72935075", "0.72935075", "0.72935075", "0.72935075", "0.72935075", "0.72935075", "0.72935075", "0.72935075", "0.72935075", "0.72935075", "0.72935075", "0.72935075", "0.72935075",...
0.0
-1
Get the state of a previously configured CAN bus.
def can_state(send, bus): response = {'r': 'can_state', 'state': None} can = can_bus_map.get(bus, None) if can is not None: response['state'] = { pyb.CAN.STOPPED: 'stopped', pyb.CAN.ERROR_ACTIVE: 'error_active', pyb.CAN.ERROR_WARNING: 'error_warning', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _read_device_state():\n \n try:\n _debug_print(\"Connecting to bus...\")\n i2c_bus = smbus.SMBus(_bus_id)\n\n current_state = i2c_bus.read_byte(_device_addr) & 0x0F\n\n return int(current_state)\n\n except:\n print(\"Error: There was a problem reading from the device...
[ "0.6698612", "0.6196475", "0.6130076", "0.61101615", "0.6062818", "0.6031746", "0.6006805", "0.59833187", "0.59467405", "0.5912973", "0.5870844", "0.5869142", "0.58660966", "0.5829685", "0.5827593", "0.5827593", "0.5827593", "0.5827593", "0.5827593", "0.5827593", "0.5827593",...
0.7267014
0
Send a CAN message periodically
def can_tx_p(send, bus, id, data, period): can = can_bus_map[bus] if bus not in can_tx_msg: can_tx_msg[bus] = {} start_async = True if id in can_tx_msg[bus]: start_async = False # should already be running, # just change data & period can_tx_msg[bus][id...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_msg():\n\tmessage = \"%s %s %d\\n\" % (metric, activeDAHDIChannels, int(time.time()))\n\t# print 'sending message:\\n%s' % message\n\tcarbonSocket = socket.socket()\n\tcarbonSocket.connect((CARBON_HOST, CARBON_PORT))\n\tcarbonSocket.sendall(message)\n\tcarbonSocket.close()\n\tlast_send = int(time.time())"...
[ "0.6526071", "0.62512463", "0.59974897", "0.599467", "0.58895826", "0.58140033", "0.5782924", "0.5780217", "0.5776115", "0.57629436", "0.5690511", "0.56660223", "0.56446224", "0.56438905", "0.5594162", "0.5580959", "0.5551353", "0.55138683", "0.54459417", "0.5443024", "0.5418...
0.0
-1