query
stringlengths
10
2k
document
stringlengths
20
51.2k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Return tuple index from string
def string_to_index(s): s = Unquote(s) if s == ".": return () return tuple(s.split("/"))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_index(s):\n return int(s[s.find(\"[\")+1:s.find(\"]\")])", "def index(self, x):\n if isinstance(x, str):\n return self.string_to_index[x]\n elif isinstance(x, tuple):\n return self.tuple_to_index[x]\n else:\n raise ValueError('x should be tuple or ...
[ "0.7459661", "0.70794404", "0.6811724", "0.66307557", "0.65761364", "0.65267617", "0.6502999", "0.63448", "0.6311195", "0.63108635", "0.6308044", "0.62322056", "0.61838686", "0.61797583", "0.61797583", "0.61797583", "0.61420673", "0.6119358", "0.60885864", "0.60844654", "0.60...
0.79893565
0
Push item onto heap, maintaining the heap invariant.
def heappush(heap, item): heap.append(item) Heap.siftdown(heap, 0, len(heap) - 1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def push(self, item: tuple):\n self.__heap.append(item)\n self.__sift_up(self.__len__() - 1)", "def push(self, item):\n heapq.heappush(self.heap, item)", "def push(self, item):\n self.heap.append(self.m * item)\n self._sift_up()", "def insert(self, item):\n self.heap...
[ "0.90253484", "0.8933334", "0.8741391", "0.8274943", "0.82147866", "0.81077504", "0.8019698", "0.7926902", "0.7830162", "0.7817611", "0.7750294", "0.77498114", "0.7690737", "0.76804686", "0.7674637", "0.76346713", "0.7627365", "0.7624954", "0.7607674", "0.758073", "0.75679433...
0.8270626
4
Return completed sequence as reward +1 if self completed sequence Otherwise 1 if other agent completed a sequence
def rewards(self, s_p, action): r0 = GenerateSuccessor13(s_p, action, self.id).agents[self.id].completed_seqs r1 = GetReward(s_p) if self.r0 < r0: self.r0 = r0 # print("0",self.r0) return self.r0 elif self.r1 > (r1*(-1)): self.r1 = r1*(-1) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_reward(self, is_terminal_state, result, reward, is_agent_move):\n if is_terminal_state:\n reward += 0 if result == \"Tie\" else 10 if is_agent_move else -10\n #elif (not is_terminal_state and is_agent_move):\n else:\n reward += -1\n\n return reward", "def...
[ "0.660096", "0.65818244", "0.6541033", "0.6474668", "0.64602625", "0.6446884", "0.63306075", "0.627449", "0.62156755", "0.6144254", "0.6034267", "0.60057455", "0.6001978", "0.5934301", "0.5898835", "0.5897956", "0.58568347", "0.5855334", "0.585152", "0.5850956", "0.5830765", ...
0.6523937
3
Compute the best action to take in a state. Note that if there are no legal actions, at the terminal state, return None.
def best_action(self, actions, state): maxQvalue = self.valueFromQvalues(state, actions) if GameEnds13(state): return None else: maxAction = [action for action in actions if self.getQvalue(state, action) == maxQvalue] best_action = random.choice(maxAction) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_best_action(self, state):\n possible_actions = self.get_legal_actions(state)\n\n # If there are no legal actions, return None\n if len(possible_actions) == 0:\n return None\n\n #\n # INSERT CODE HERE to get best possible action in a given state (remember to bre...
[ "0.8111166", "0.80138415", "0.7906326", "0.77821064", "0.7652555", "0.7649821", "0.7626857", "0.76178986", "0.75692207", "0.756028", "0.7509545", "0.7494221", "0.7467473", "0.7442508", "0.7412597", "0.732331", "0.7310414", "0.7287622", "0.72671753", "0.72437954", "0.7240179",...
0.7579905
8
return the currently logged in user associated with this request
def get_user(self): session_key = request.get_cookie( self.conf['auth.cookie_key'], secret=self.conf['auth.cookie_secret'] ) if session_key: with atomic(self.conf['auth.dbfile']) as cursor: try: username, email = next(cursor...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def current_user(self):\n user_dict = self.auth.get_user_by_session()\n if user_dict is None:\n logging.debug(\"User dict is None.\")\n return None\n return self.auth.store.user_model.get_by_id(\n user_dict['user_id'], namespace=namespace_manager.get_namespace(...
[ "0.8463737", "0.84300995", "0.83632684", "0.8321918", "0.8317239", "0.8317239", "0.8292623", "0.82810175", "0.81991047", "0.8187159", "0.8164048", "0.8164048", "0.8164048", "0.81480056", "0.8135569", "0.8110923", "0.81096816", "0.80226153", "0.80226153", "0.80226153", "0.8022...
0.0
-1
Unload a config entry.
async def async_unload_entry_gw(hass: HomeAssistant, entry: ConfigEntry): unload_ok = all( await asyncio.gather( *( hass.config_entries.async_forward_entry_unload(entry, component) for component in GATEWAY_PLATFORMS ) ) ) hass.data[DOM...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def async_unload_entry(hass, config_entry):\n unload_ok = await hass.config_entries.async_forward_entry_unload(\n config_entry, \"climate\"\n )\n return unload_ok", "async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:\n hass.data.pop(DOMAIN)\n return True", ...
[ "0.697284", "0.6888074", "0.6779855", "0.6747459", "0.6689002", "0.6657831", "0.66162205", "0.6603433", "0.65925974", "0.65595686", "0.65411645", "0.6507643", "0.6507643", "0.6507643", "0.6507643", "0.64977276", "0.64931643", "0.6486601", "0.6486601", "0.6486601", "0.6486601"...
0.5764828
82
Return the class of this device, from component DEVICE_CLASSES.
def device_class(self): return self._device_class
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def device_class(self):\n return DEVICE_CLASSES.get(self.sensor_data[\"model\"])", "def device_class(self):\n return self.sensor_type[\"class\"]", "def device_class(self):\n return SENSOR_TYPES[self.sensor][3].get(\"device_class\")", "def get_class(self):\n return devices.get_clas...
[ "0.87266827", "0.852074", "0.8471363", "0.8442806", "0.83113384", "0.83078414", "0.8197917", "0.81939846", "0.8125181", "0.8109455", "0.8109455", "0.8109455", "0.8059611", "0.8053818", "0.8053818", "0.80360585", "0.80360585", "0.8023502", "0.7951035", "0.7926857", "0.78515744...
0.8241434
10
test base model documentation self.assertNotEqual(len(models.__doc__), 0) self.assertNotEqual(len(models.base_model.__doc__), 0)
def test_Userdoc(self): self.assertNotEqual(len(User.__doc__), 0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_module_doc(self):\n self.assertTrue(len(base_model.__doc__) > 0)", "def test_BaseModel_cls_doc(self):\n self.assertIsNotNone(BaseModel.__doc__)", "def test_docstring(self):\n self.assertIsNotNone(BaseModel.__doc__)\n self.assertIsNotNone(BaseModel.__init__.__doc__)\n ...
[ "0.853411", "0.851514", "0.83893543", "0.82619375", "0.812141", "0.786481", "0.77326053", "0.76871467", "0.73674875", "0.7243505", "0.71794033", "0.716489", "0.70583415", "0.70485944", "0.69695365", "0.6913679", "0.6836074", "0.6823692", "0.6803415", "0.67909616", "0.67525536...
0.6317256
43
Computes the precision for the specified values of k
def accuracy(output, target, topk=(1,)): maxk = max(topk) batch_size = target.size(0) _, pred = output.topk(maxk, 1, True, True) pred = pred.t() correct = pred.eq(target.view(1, -1).expand_as(pred)) res = [] for k in topk: correct_k = correct[:k].view(-1).float().sum(0, keepdim=Tru...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def precision(gt, pred, k):\n k = min(len(pred), k)\n den = min(len(gt), k)\n return sum([int(pred[i] in gt) for i in range(k)]) / den", "def precision_at_k(r, k):\n assert k >= 1\n r = np.asarray(r)[:k] != 0\n if r.size != k:\n raise ValueError('Relevance score length < k')\...
[ "0.76427615", "0.74189496", "0.7418079", "0.72710466", "0.72456723", "0.72446615", "0.7237539", "0.72213703", "0.7210107", "0.7058935", "0.6852219", "0.6786084", "0.67836976", "0.6768417", "0.67273885", "0.67181736", "0.67181736", "0.67181736", "0.67181736", "0.67181736", "0....
0.0
-1
Reparent all children to the new block
def reparent(self, new_block): for child in self.children: child.parents.remove(self) new_block.add_child(child)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_and_preserve_children(self):\r\n \r\n if self.parent and hasattr(self.parent, 'add_child)'):\r\n for child in self._children:\r\n #Correct offsets\r\n child.x += self.x\r\n child.y += self.y\r\n self.parent.add_child(ch...
[ "0.6631784", "0.6490407", "0.6353167", "0.63093984", "0.6288142", "0.6228584", "0.59935254", "0.5980885", "0.59628344", "0.59349644", "0.5917297", "0.59031016", "0.5896928", "0.58631754", "0.5781513", "0.57493854", "0.57493854", "0.57475924", "0.5735977", "0.5719167", "0.5706...
0.86628354
0
Returns True or False if the value is set or unset.
def get_bool(section, option, default=False): res = get(section, option, default) if res == default: return default if res.lower() == "true" or res == "1": return True return default
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_value(self):\n return hasattr(self, '_value')", "def isSet(self) -> bool:\n ...", "def validate_value_flag(self):\n if not self.app.args.value is None or self.app.args.value == '':\n return True\n else:\n return False", "def __bool__(self):\n r...
[ "0.69787174", "0.6920298", "0.6835076", "0.67387396", "0.66384107", "0.65920794", "0.6479605", "0.6453722", "0.64453083", "0.64453083", "0.64453083", "0.64453083", "0.64453083", "0.6417013", "0.6407997", "0.6352897", "0.6347799", "0.6342986", "0.6340991", "0.63197124", "0.630...
0.0
-1
Returns a random char using a string as it's alphabet
def random_char(alph): char = alph[rand_generator.randrange(len(alph))] return char
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_random_char(letters: str) -> str:\n return letters[random.randint(0, len(letters) - 1)]", "def get_random_alphabetic_string():\n return get_random_string(char_choice=string.ascii_letters)", "def get_random_char():\n return chr(randint(97, 122))", "def RandomAlphaNumChar():\n num = random.ra...
[ "0.85989255", "0.8566459", "0.8453621", "0.8356242", "0.82302165", "0.82215476", "0.8190683", "0.7799926", "0.7756426", "0.7650104", "0.75570405", "0.7464199", "0.74516094", "0.7404364", "0.7345983", "0.7248197", "0.71465176", "0.7106063", "0.70963585", "0.7091313", "0.707313...
0.8804219
0
Returns a string containing all characters from alphabet in random order.
def generate_line(alphabet): array = [ch for ch in alphabet] line = [] for i in range(len(alphabet)): line.append(array.pop(random_num(array))) return line
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_random_alphabetic_string():\n return get_random_string(char_choice=string.ascii_letters)", "def random_string():\n return \"\".join(random.choice(string.ascii_letters) for i in range(6))", "def password_alphabetical(i):\r\n\r\n return ''.join(_random.choice(string.ascii_letters) for x in\r\n ...
[ "0.8566082", "0.7829491", "0.78065264", "0.78030956", "0.77873456", "0.7786689", "0.76649487", "0.76349944", "0.7593901", "0.7561787", "0.7491714", "0.74399364", "0.7362568", "0.7341765", "0.7337101", "0.7289436", "0.7287332", "0.7282114", "0.726503", "0.72393346", "0.7237215...
0.0
-1
Reads first line from the file specified by filepath and returns it without the trailing new line.
def alphabet_from_file(filepath): alph = codecs.open(filepath, encoding='utf-8').readline() # Remove newline alph = alph[:-1] return alph
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_file_first_line(filename):\n result = None\n with open(filename, 'r') as f:\n result = f.readline()\n result = result.rstrip(\"\\n\")\n f.close()\n return result", "def get_first_line(file: str) -> str:\n with open(file) as f:\n return f.readline().split('\\n')[0]...
[ "0.78080046", "0.7526887", "0.74067116", "0.7003495", "0.6996447", "0.6974035", "0.6884951", "0.6541199", "0.6525618", "0.6525618", "0.6496393", "0.6460021", "0.6454461", "0.6443769", "0.6334649", "0.6317436", "0.62485236", "0.6187799", "0.61429185", "0.6129208", "0.6078065",...
0.0
-1
Compute the gram matrix of X and Y (if Y is empty we compute the gram matrix for training comparing all the elements of X) usign the rbf kernel
def RBF_Gram(X,gamma,Y=[]): if len(Y)==0: len_X = X.shape[0] gram_matrix = np.zeros((len_X, len_X), dtype=np.float32) for i in range(len_X): for j in range(i,len_X): gram_matrix[i,j] = kernel_rbf(X[i],X[j],gamma) gram_matrix[j,i] = gram_ma...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Kernel(x, y):\n\n Result = (np.dot(x_train[x, :], x_train[y, :])+1)**5 # Polynomial\n #Result = (np.dot(x_train[x, :], x_train[y, :])+1) # Linear\n #Gaussian\n \"\"\"\n sigma = 1\n if np.ndim(x_train[x, :]) == 1 and np.ndim(x_train[y, :]) == 1:\n Result = np.exp(- (np.linalg.norm(x_tra...
[ "0.63944775", "0.61379", "0.5956246", "0.59269893", "0.5923523", "0.5854087", "0.58412397", "0.5837221", "0.5820182", "0.5777014", "0.57580966", "0.57494974", "0.5733653", "0.5732807", "0.5707223", "0.56892216", "0.56879246", "0.5671535", "0.56639284", "0.56569475", "0.565046...
0.7913166
0
Get valid Offres for this Cagnotte.
def offres(self) -> QuerySet: return Offre.objects.filter(proposition__cagnotte=self, valide=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def offres(self) -> list[int]:\n filters: list[dict[str, int]] = [{}, {\"valide\": True}, {\"paye\": True}]\n return [self.offre_set.filter(**f).count() for f in filters]", "def aerosols(self):\n return self.expiration.aerosols(self.mask)", "def get_all_offices():\n return [vars(off...
[ "0.5582882", "0.54721117", "0.5402464", "0.5298141", "0.525203", "0.5212415", "0.52083105", "0.5145217", "0.51137483", "0.5109835", "0.5086796", "0.50752497", "0.5065085", "0.50401497", "0.5020969", "0.5017466", "0.50131255", "0.50005555", "0.49951112", "0.49949393", "0.49926...
0.5904981
0
Get the advancement in percent of the goal for this Cagnotte.
def progress(self) -> int: return int(round(100 * self.somme() / self.finances))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_opinion_percent(self):\n return (self.get_percent()+100)/2", "def pct(self):\n\t\treturn self.bottle.pct()", "def get_percentage(self):\n return self.percentage", "def get_percentage(self):\n return self.percentage", "def get_percent(self):\n if not (self.votes and self....
[ "0.73520815", "0.7048747", "0.6941846", "0.6941846", "0.6895525", "0.68142676", "0.6786697", "0.67595285", "0.67595285", "0.6756571", "0.6748007", "0.6687695", "0.6546592", "0.6541772", "0.65348536", "0.64870733", "0.64767617", "0.6460417", "0.6401927", "0.6399915", "0.638899...
0.65741664
12
Get a list of number of [all, valid, payed] Offres for this Proposition.
def offres(self) -> list[int]: filters: list[dict[str, int]] = [{}, {"valide": True}, {"paye": True}] return [self.offre_set.filter(**f).count() for f in filters]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_payoffs(self):\n return self.game.get_payoffs()", "def get_payoffs(self):\n raise NotImplementedError", "def _get_num_proposals(self):\n total_props = self._df['nprops'].sum()\n return total_props", "def propietarios_count(self):\n return self.expedientepersona_set....
[ "0.66346943", "0.63965905", "0.5823254", "0.5818139", "0.57787657", "0.56784976", "0.56576014", "0.56438684", "0.5620136", "0.56012595", "0.55562747", "0.55546445", "0.5526337", "0.55237144", "0.55154264", "0.549721", "0.5482786", "0.5482786", "0.54705316", "0.5456392", "0.54...
0.7000213
0
Get the sum of all Offres for this Proposition.
def somme(self) -> Numeric: return query_sum( self.offre_set.filter(valide=True), "prix", output_field=models.DecimalField(), )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sum(self):\n return sum(self.items())", "def get_total(self):\n total = 0.00\n\n for _drink in self.drinks:\n total = total + _drink.get_price()\n\n for _food in self.food:\n total = total + _food.get_price()\n\n return total", "def sum(self):\n ...
[ "0.6175785", "0.60835445", "0.60697144", "0.60564274", "0.605366", "0.5993023", "0.5979701", "0.59639686", "0.5963827", "0.5963827", "0.5963629", "0.58991766", "0.58899003", "0.58854544", "0.58044136", "0.5787844", "0.5766211", "0.5763135", "0.57045233", "0.57026976", "0.5702...
0.56026983
26
Return the description of this Demande.
def __str__(self) -> str: return self.description
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_description(self):\r\n return self.__description", "def get_description(self):\n return self.__description", "def get_description(self) -> str:\n pass", "def getDescription(self):\n return self.description", "def get_description(self):\n return self.description", ...
[ "0.83839744", "0.8378097", "0.835788", "0.8341018", "0.83334017", "0.83334017", "0.83334017", "0.83334017", "0.83248985", "0.82662314", "0.82662314", "0.82662314", "0.82662314", "0.82662314", "0.82662314", "0.82662314", "0.82662314", "0.82662314", "0.82662314", "0.82662314", ...
0.0
-1
Gets the stored of this InlineResponse2003.
def stored(self) -> int: return self._stored
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(self):\r\n return self.data", "def get(self):\n return self.data", "def get_data(self):\n return self._result", "def get(self):\n return self.get_data()", "def get_response_variable(self):\n\n return self._response_variable", "def store_data(self):\n retu...
[ "0.6243855", "0.61981964", "0.6130884", "0.60398877", "0.603954", "0.6015542", "0.5962877", "0.5939602", "0.5935533", "0.5869409", "0.5869409", "0.5869409", "0.5869409", "0.5830511", "0.5830511", "0.5830511", "0.58221245", "0.58221245", "0.58221245", "0.58017886", "0.5800307"...
0.5601515
47
This function returns True if num is even else False
def check_is_even(number): if number % 2 ==0: return True else: return False pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_even(num: int) -> bool:\n return num % 2 == 0", "def is_even(num):\n return num % 2 == 0", "def is_even(number):\n if ((number%2) == 0):\n return True\n else:\n return False", "def is_even(number: int) -> bool:\n return number % 2 == 0", "def is_even(number):\n return...
[ "0.88295573", "0.87483865", "0.85842067", "0.8510712", "0.8421976", "0.8371641", "0.8322239", "0.83186007", "0.8310539", "0.8284932", "0.820618", "0.81311196", "0.8113936", "0.80517083", "0.8040163", "0.7978397", "0.7962383", "0.7903109", "0.7902896", "0.78983", "0.78947496",...
0.8506438
4
Version versions that are longer are not equal, regardless of name
def test_b(self): v1 = versions.Version(version='1.2.3', name='foo') v2 = versions.Version(version='1.2', name='bar') self.assertFalse(v1 == v2) self.assertFalse(v2 == v1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_b(self):\n v1 = versions.Version(version='1.2.3', name='foo')\n v2 = versions.Version(version='1.2', name='bar')\n\n self.assertTrue(v1 != v2)\n self.assertTrue(v2 != v1)", "def compare_versions(a, b):\n if a:\n a = distutils.version.LooseVersion(a)\n b = dis...
[ "0.6839004", "0.68267447", "0.67950994", "0.67762035", "0.67679363", "0.6719986", "0.66870314", "0.66812545", "0.6647304", "0.66426194", "0.6610771", "0.6610771", "0.6591535", "0.65827906", "0.6570027", "0.65579885", "0.65551233", "0.65449727", "0.65377486", "0.652605", "0.65...
0.6837805
1
returns text and hashtags in a separate list removes mentions and URLs
def separate_hastags_mentions_urls(tweet): text = tweet.lower() hashtag_list = re.findall("#([a-zA-Z0-9_]{1,50})", text) text = re.sub(r'http\S+', '', text) clean_tweet = re.sub("@[A-Za-z0-9_]+","", text) clean_tweet = re.sub("#[A-Za-z0-9_]+","", clean_tweet) return clean_tweet, h...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hashtags(self, candidate_list):\n if Tweet.hashtagre is None:\n Tweet.hashtagre = re.compile('|'.join(map(re.escape, candidate_list)))\n return [\n [m.group(0).replace('#', '', 1), m.span()]\n for m in Tweet.hashtagre.finditer(self.text)\n ]", "def remove...
[ "0.72237986", "0.72097373", "0.7150658", "0.7090971", "0.7040362", "0.6964086", "0.6777448", "0.66975623", "0.65857905", "0.65670365", "0.6549303", "0.6483093", "0.6408876", "0.636152", "0.6345191", "0.6328474", "0.63196975", "0.6235232", "0.62311995", "0.62172586", "0.619169...
0.7287602
0
Escape `+ ^ % ~ { } [ ] ( )` by putting them within curly braces.
def sendkey_escape(string): return re.sub(r'([+^%~{}\[\]()])', r'{\1}', string)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _escape(var):\n return f\"({re.escape(var)})\"", "def esc_kw(kw):\n kw = kw.replace('\\\\', '\\\\\\\\') # be sure to do this first, as we inject \\!\n kw = kw.replace('(', '\\(')\n kw = kw.replace(')', '\\)')\n kw = kw.replace('+', '\\+')\n kw = kw.replace('-', '\\-')\n kw = kw.replace('...
[ "0.6206434", "0.6192753", "0.6033577", "0.58778614", "0.5805936", "0.5723644", "0.5689772", "0.56493694", "0.5648915", "0.5610038", "0.5569773", "0.55538535", "0.55222386", "0.5518014", "0.55051255", "0.5491474", "0.5488566", "0.54707247", "0.54246294", "0.53857386", "0.53746...
0.69137347
0
Return the email address to satisfy FlaskLogin's requirements.
def get_id(self): return self.id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def email(self) -> Optional[str]:\n return pulumi.get(self, \"email\")", "def email(self) -> Optional[str]:\n return pulumi.get(self, \"email\")", "def email(self) -> Optional[str]:\n return pulumi.get(self, \"email\")", "def email(self) -> Optional[str]:\n return pulumi.get(self,...
[ "0.7461588", "0.7461588", "0.7461588", "0.7461588", "0.74425983", "0.74425983", "0.74425983", "0.7438113", "0.7438113", "0.7438113", "0.7438113", "0.7438113", "0.7438113", "0.7438113", "0.7419648", "0.72887826", "0.7231647", "0.7226117", "0.7203963", "0.7173964", "0.71455765"...
0.0
-1
Return True if the user is authenticated.
def is_authenticated(self): return self.authenticated
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_authenticated(self):\n return self.user is not None and self.state == AuthenticationOptions.authenticated", "def is_authenticated(self):\n return bool(get_auth_token())", "def is_authenticated(self):\n return True", "def is_authenticated(self):\n return True", "def is_aut...
[ "0.8739372", "0.87086535", "0.86574197", "0.86574197", "0.86574197", "0.86574197", "0.86574197", "0.86574197", "0.86574197", "0.8613915", "0.8609252", "0.8578436", "0.83723366", "0.83587176", "0.8258534", "0.82273275", "0.8209421", "0.8200795", "0.8174884", "0.81280386", "0.8...
0.8580474
22
False, as anonymous users aren't supported.
def is_anonymous(self): return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_anonymous():\n return False", "def is_anonymous(self):\r\n return False", "def is_anonymous(self):\n return False", "def is_anonymous_access_allowed(self):\n return self._is_anonymous_access_allowed", "def is_authenticated(self):\n return False", "def _is_anonymous_u...
[ "0.85624325", "0.83800477", "0.82456774", "0.7815806", "0.7576082", "0.72904116", "0.72619915", "0.72347337", "0.72347337", "0.72347337", "0.72347337", "0.72347337", "0.72347337", "0.72347337", "0.72338396", "0.715833", "0.7106215", "0.70944613", "0.70567185", "0.70209265", "...
0.8360155
21
Generate an RGB colormap as a function of the lidar range.
def create_range_map(points_xyz: NDArrayFloat) -> NDArrayByte: range = points_xyz[..., 2] range = np.round(range).astype(int) color = plt.get_cmap("turbo")(np.arange(0, range.max() + 1)) color = color[range] range_cmap: NDArrayByte = (color * 255.0).astype(np.uint8) return range_cmap
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def color_map(val):\n color_code = remap_interval(val, -1, 1, 0, 255)\n return int(color_code)", "def cmap_idl4():\n r=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
[ "0.6731256", "0.66647995", "0.6652849", "0.6652849", "0.6652849", "0.6652849", "0.6648341", "0.66214395", "0.6565707", "0.6444118", "0.63473815", "0.62825024", "0.6269329", "0.62619907", "0.62564105", "0.62214714", "0.6200118", "0.6158911", "0.61488414", "0.61409956", "0.6118...
0.64667225
9
This function will bounce the ball off a horizontal surface (not a vertical one)
def bounce(self, diff): self.direction = (180 - self.direction) % 360 self.direction -= diff
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bounce(self):\n \n if self.x > width - self.size:\n self.x = 2*(width - self.size) - self.x\n self.angle = self.angle * -1\n self.speed *= elasticity # Added to all to account for elasticity\n elif self.x < self.size:\n self.x = 2*self.size - self.x\n ...
[ "0.7938347", "0.775263", "0.7560556", "0.7509976", "0.7218989", "0.71924436", "0.7166426", "0.7049132", "0.69999367", "0.69923764", "0.6980749", "0.69763756", "0.697183", "0.69567215", "0.68515444", "0.6842405", "0.6791582", "0.678786", "0.67670965", "0.67422974", "0.67243564...
0.66323644
23
Reshape a numpy array, which is input_shape=(height, width), as opposed to input_shape=(width, height) for cv2
def np_resize(img, input_shape): height, width = input_shape return cv2.resize(img, (width, height))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def img_reshape(self, input_img):\n _img = np.transpose(input_img, (1, 2, 0)) \n _img = np.flipud(_img)\n _img = np.reshape(_img, (1, img_dim[0], img_dim[1], img_dim[2]))\n return _img", "def numpyReshape(array):\n return np.array(array, dtype = float).reshape(1, len(array))",...
[ "0.75426155", "0.7538381", "0.750343", "0.74050325", "0.7379166", "0.7118144", "0.70271003", "0.69979405", "0.6938404", "0.68963325", "0.6891859", "0.68788457", "0.673821", "0.6674105", "0.663945", "0.6624979", "0.66099364", "0.6590305", "0.6543726", "0.6521954", "0.64937097"...
0.729674
6
Generate a word by putting letters together in semirandom order. Based on an old mIRC script of mine
def generateWord(self, parameters=None): # Initial set-up vowels = ['a', 'e', 'i', 'o', 'u'] specialVowels = ['y'] consonants = ['b', 'c', 'd', 'f', 'g', 'h', 'k', 'l', 'm', 'n', 'p', 'r', 's', 't'] specialConsonants = ['j', 'q', 'v', 'w', 'x', 'z'] newLetterFraction = 5 vowelChance = 50 #percent #D...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def random_word ():\n letters = [ chr(i) for i in range(ord('a'),ord('z')+1) ] + [ chr(i) for i in range(ord('A'),ord('Z')+1) ]\n length = 4 + random.randint(0,4)\n str = \"\"\n for i in range(length):\n str = str + random.choice(letters)\n return str", "async def generate(self):\n l...
[ "0.7348327", "0.72831905", "0.71383727", "0.70475894", "0.70081955", "0.7002903", "0.69867027", "0.6961003", "0.6905931", "0.6830481", "0.6811186", "0.6804953", "0.6794218", "0.6788312", "0.6758187", "0.67534137", "0.67459625", "0.6734872", "0.67283314", "0.6724369", "0.66958...
0.66741556
23
Create a Dataset with given parameters
def __init__(self, x_channels, y_channels=None, include_sources=False, contour_dicom_generator=None, contour_dicom_folder=None, on_error_action="raise", target_size=(224, 224), padding=0, crop_mode="center"): # ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def CreateDataset(all_arrays):\n dataset = Dataset()\n\n dataset._addData(all_arrays[0])\n dataset._addData(all_arrays[1])\n dataset._addData(all_arrays[3])\n dataset._addData(all_arrays[5])\n dataset._addData(all_arrays[6])\n dataset._addData(all_arrays[9])\n dataset._addData(all_arrays[8]...
[ "0.7901727", "0.751719", "0.7508082", "0.7474049", "0.74200004", "0.71773547", "0.71231073", "0.6902051", "0.6887092", "0.6882389", "0.6812367", "0.6791436", "0.6779203", "0.67541957", "0.6744004", "0.6700447", "0.6638474", "0.6637085", "0.6633394", "0.662852", "0.6613329", ...
0.0
-1
Check if two direction are the same
def is_equal(self, c): if self == c: return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sameDirection(cls, *vectors, e=10e-10):\n l = len(vectors)\n if l == 2:\n v1 = vectors[0]\n v2 = vectors[1]\n return (abs(v1.angle - v2.angle) % (2 * math.pi)) < e\n else:\n for i in range(l):\n for j in range(i + 1, l):\n ...
[ "0.67011553", "0.6545725", "0.653401", "0.64784795", "0.6411828", "0.63874024", "0.63691133", "0.63128185", "0.6271442", "0.6242837", "0.62306064", "0.6217841", "0.62128127", "0.6200708", "0.6191165", "0.61680114", "0.6160807", "0.6158463", "0.6154551", "0.6137575", "0.613511...
0.0
-1
Return absolute filename without extension
def filenameAsPath(self, app): return app.recordingsPath.child(self.filename).path
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getAbsFileName(fname):\n\tfileAbsPath=os.path.abspath(fname)\n\treturn fileAbsPath", "def filename_strip_ext(filename):\n base = os.path.basename(filename)\n # Strip file extension\n return os.path.splitext(base)[0]", "def filepath_without_ext(filepath: str) -> str:\n return str(pathlib.Path(fi...
[ "0.78481704", "0.75869185", "0.7576942", "0.75079584", "0.74541324", "0.737877", "0.73689896", "0.7278024", "0.72766817", "0.72753686", "0.72712547", "0.72666395", "0.72407055", "0.72376615", "0.7237291", "0.7233161", "0.72288567", "0.72287464", "0.72044635", "0.72007036", "0...
0.0
-1
Check to see if the player or something is standing near the bomb when it explodes
def if_near_boom(self, player_pos, boom_pos): if player_pos[0] == boom_pos[0]: if player_pos[1] in range(boom_pos[1]-2*30, boom_pos[1]+3*30, 30): return True else: return False elif player_pos[1] == boom_pos[1]: if player_pos[0] in rang...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def IsGameOver(self):\n return any(c.cX + c.width >= self.end_location for c in self.enemies)", "def game_over(self):\n return self.lives() < 0", "def gameOver(self):\n\t\treturn self.lives == 0", "def in_bomb_range(self, game_state: dict):\n is_in_bomb_range = False\n agent_position = game_s...
[ "0.6627156", "0.6428905", "0.6339003", "0.62968373", "0.6255475", "0.62122405", "0.62059975", "0.61984617", "0.61965895", "0.6184373", "0.617349", "0.61086166", "0.60775405", "0.6074266", "0.6067661", "0.6065833", "0.60267395", "0.6026282", "0.601978", "0.601434", "0.6012972"...
0.61070997
12
setting the model's dropout rate to 0
def reduce_dropout(self): def reduce_p(layer): if isinstance(layer, nn.Dropout): layer.p = 0 self.apply(reduce_p)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_drop_rate(self, drop_rate=0.0):\n zero_ary = np.zeros((1,))\n new_val = zero_ary + drop_rate\n self.drop_rate.set_value(to_fX(new_val))\n return", "def dropout(self, dropout):\n if dropout >= 1.0:\n raise ValueError('The `dropout` must be < 1.')\n self...
[ "0.73202485", "0.7097229", "0.6755646", "0.6518173", "0.6518173", "0.6518173", "0.6459747", "0.6352619", "0.630998", "0.59556454", "0.5919821", "0.58942986", "0.5875477", "0.58311474", "0.57800645", "0.57659876", "0.5748509", "0.5724652", "0.57129025", "0.570234", "0.5697805"...
0.6827436
2
returns all positions of origin for a given protein identified by its transcript_id
def get_protein_positions(self, _transcript_id): return self.proteinPos.get(_transcript_id, [])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def positions(self, run_id):\n return self._do(self._get_base, \"positions\", run_id)", "def get_positions(self):\n return position.Position.all_from_account_id(self.id)", "def get_positions(self, account_id=None) -> List[Position]:\n if account_id is None:\n account_id = self.d...
[ "0.6135871", "0.5831772", "0.56497216", "0.5620489", "0.55843717", "0.55106676", "0.54799193", "0.544478", "0.5430569", "0.5427946", "0.5398808", "0.53546363", "0.53124326", "0.5289352", "0.5264125", "0.5256786", "0.5247895", "0.52344173", "0.5188332", "0.51806706", "0.517128...
0.72142464
0
Change the `User.usrAccessExpiresAt` to today's date + 180 days
def api_extend_account(): user_id = request.form.get('user_id') today_plus_180 = get_expiration_date(180) user = UserEntity.get_by_id(user_id) user = UserEntity.update(user, access_expires_at=today_plus_180) return jsonify_success( {"message": "Updated expiration date to {}".format(today_plu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def expireDate(self)->datetime:\n return self.firstAccessDate + timedelta(seconds=self.expirePeriodInSeconds)", "def expires(self, value):\n value = util.parse_valid_date(value)\n self._set_attr('expires', value)", "def set_expiration(self):\n # This is an arbitrary decision setting...
[ "0.70153236", "0.667454", "0.65073955", "0.6476731", "0.6299011", "0.62826693", "0.6258953", "0.6243003", "0.6140046", "0.5946309", "0.5940055", "0.5932952", "0.5900719", "0.58820456", "0.58177894", "0.57764006", "0.5745565", "0.5712269", "0.56682134", "0.5653572", "0.56215",...
0.61525667
8
Retrieves the configuration value specified.
def get_config(item: str) -> Union[str, int]: file = load_config_file("config.json") value = file.get(item) if value is None: raise Exception(f"Your config is out of date! Missing a value for {item}") return value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_config_value(self, name):\r\n if name in self.config_values:\r\n return self.config_values[name]", "def _get_config_value(self, section, key):\n return config.get(section, key)", "def get(self, key):\n return self.config.get(key)", "def getconfig(self, key):\n r...
[ "0.8003153", "0.78221416", "0.77238125", "0.75071114", "0.7480084", "0.7374818", "0.73705477", "0.73699105", "0.7336914", "0.7317879", "0.73178285", "0.7293462", "0.72908235", "0.7275754", "0.7229134", "0.718197", "0.71777713", "0.71609455", "0.7141536", "0.7138206", "0.71246...
0.6916398
37
Constructor. Any message fields that are implicitly/explicitly set to None will be assigned a default value. The recommend use is keyword arguments as this is more robust to future message changes. You cannot mix inorder arguments and keyword arguments.
def __init__(self, *args, **kwds): if args or kwds: super(RxmRAW, self).__init__(*args, **kwds) #message fields cannot be None, assign default values for those that are if self.rcvTOW is None: self.rcvTOW = 0 if self.week is None: self.week = 0 if self.numSV is None: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *args, **kwds):\n if args or kwds:\n super(KomodoSpeechRecCommand, self).__init__(*args, **kwds)\n #message fields cannot be None, assign default values for those that are\n if self.header is None:\n self.header = std_msgs.msg.Header()\n if self.cmd is None:\n ...
[ "0.7794795", "0.77207875", "0.77207875", "0.7687243", "0.7625947", "0.7564293", "0.7440383", "0.74175525", "0.7352349", "0.7308313", "0.72808266", "0.72378874", "0.722805", "0.7225032", "0.7225032", "0.7219433", "0.72120637", "0.72120637", "0.72120637", "0.72120637", "0.72120...
0.0
-1
Get an embedding for a supplied string
def embed(query: str) -> dict: embedding = model.embed(query) return {"embedding": embedding, "model": model_name}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_embedding():\n\n HOST = app.config.get('EMBEDDING_HOST')\n PORT = app.config.get('EMBEDDING_PORT')\n query_params = {\n 'text' : request.args.get('text', \"\"),\n \"language\" : request.args.get('language', None)\n }\n r = requests.get(f\"http://{HOST}:{PORT}/api/v1/embeddings/...
[ "0.6789192", "0.6787894", "0.6745919", "0.6744328", "0.6724526", "0.6534897", "0.6394602", "0.63193136", "0.63009477", "0.6289545", "0.6280635", "0.621938", "0.6190343", "0.61494434", "0.6147239", "0.6094935", "0.6064261", "0.5987999", "0.59518164", "0.59514683", "0.59439796"...
0.58295786
25
Find number of eggs to bring back, using the smallest number of eggs. Assumes there is an infinite supply of eggs of each weight, and there is always a egg of value 1.
def dp_make_weight(egg_weights, target_weight, memo = {}): # construct table. outer loop: egg weights. inner loop: 0-target_weight # table will be stored in memo. key=egg_weight, value=list, indexed from 0-target_weight for i, w in enumerate(egg_weights): # initialize key-value pair for a given ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def min_number_of(g, elt, n_fuel):\n if elt == 'FUEL':\n return n_fuel\n t = sum([g.edges[elt, s]['cost'] * min_number_of(g, s, n_fuel) for s in\n g.successors(elt)])\n return divup(t, g.nodes[elt]['batch_size'])", "def max_duffel_bag_value(cakes, capacity):\n curr_w = 0 # current...
[ "0.6662027", "0.5932552", "0.5918526", "0.56802285", "0.5671168", "0.56686914", "0.56456834", "0.5641083", "0.56011915", "0.5580425", "0.5569461", "0.5535122", "0.55312604", "0.55207425", "0.5515338", "0.5471096", "0.5411348", "0.5373723", "0.5373407", "0.537054", "0.53639114...
0.621169
1
Check if the given email adress is already taken by someone.
def get(self, **kwargs) -> (dict, int): params = {"email": kwargs["email"]} if not params["email"]: return MissingInformation.get_response(), 400 taken = request_utils.value_in_database("UserTable", "email", params["email"]) return {"success": True, "taken": taken}, 200
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_email_address_already_assigned(email_address: str) -> bool:\n return _do_users_matching_filter_exist(DbUser.email_address, email_address)", "def is_duplicate_email(email):\n users = User.objects.filter(email=email).values()\n if len(users):\n return True\n return False", "def is_email...
[ "0.81772524", "0.7600871", "0.7600677", "0.7539377", "0.7236727", "0.71787477", "0.70742327", "0.7014581", "0.69838274", "0.6977851", "0.695766", "0.69394714", "0.69238675", "0.68900275", "0.68745935", "0.68352276", "0.68326586", "0.67389286", "0.66912", "0.66790843", "0.6662...
0.0
-1
Define py.test command line options for this plugin.
def pytest_addoption(parser): group = parser.getgroup('ansible-playbook') group.addoption( '--ansible-playbook-directory', action='store', dest='ansible_playbook_directory', metavar="PLAYBOOK_DIR", help='Directory where ansible playbooks are stored.', ) group....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_options(self, parser):\n parser.add_argument(\n '--pytest',\n action='store_true',\n default=False,\n dest='pytest',\n help='Use pytest runner instead of nose.')\n parser.add_argument(\n '--app',\n metavar='APP_LABEL...
[ "0.75257295", "0.72936356", "0.72087264", "0.71608716", "0.713364", "0.7099801", "0.70465946", "0.6982287", "0.6934263", "0.69197273", "0.68485343", "0.6840971", "0.6818722", "0.6773975", "0.6760837", "0.67465514", "0.67350245", "0.67309225", "0.6713253", "0.67065084", "0.670...
0.0
-1
get data[indices] safely and with optional padding to either indices.size or data.size
def _at_index(data, indices, keepdim=None, padding=np.nan): if not (keepdim is None or keepdim in ['data', 'index']): raise TypeError('unexpected argument keepdim={}'.format(keepdim)) data = np.asarray(data) indices = np.asarray(indices) i = indices[indices < data.size] if keepdim...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_data_by_indexes(indexes: list, data: np.ndarray) -> np.ndarray:\n return np.asarray([data[i, j] for i, j in indexes])", "def extract_unpadded(self, data, ind):\n batch_range = torch.arange(0, data.shape[0], dtype=torch.int64).to(self.device)\n indices = torch.stack([batch_range, ind], di...
[ "0.64515316", "0.6291412", "0.6151581", "0.60655594", "0.5989121", "0.5965736", "0.5876504", "0.5842424", "0.58177423", "0.5790873", "0.5726232", "0.57143295", "0.5708361", "0.5675591", "0.56290674", "0.5604596", "0.5579937", "0.55170494", "0.55085826", "0.5507799", "0.550575...
0.7182823
0
init Etcd3Client, close its connectionpool when teardown
def client(): _, p, _ = docker_run_etcd_main() c = Client(host, p, protocol) yield c c.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, config):\n\n self.logger = logging.getLogger(__name__)\n\n self.etcd_key_prefix = None\n hostname = \"localhost\"\n\n # This change will be moved to an argument to the function in 2.3\n # This is done now for backward compatibility\n etcd_host = os.geten...
[ "0.6394745", "0.6223009", "0.6188004", "0.6122781", "0.5872924", "0.58113235", "0.572251", "0.5680575", "0.56592935", "0.56570673", "0.56547004", "0.5588087", "0.55753064", "0.5560368", "0.55023384", "0.5501191", "0.54811597", "0.54789394", "0.54769146", "0.5468104", "0.54542...
0.61097974
4
difference with iou is we divide total area of boxes1 by its intersection with boxes2
def box_iof(boxes1, boxes2): area1 = box_area(boxes1) #[N, ] area2 = box_area(boxes2) #[M, ] lt = torch.max(boxes1[:, None, :2], boxes2[:, :2]) # [N,M,2] rb = torch.min(boxes1[:, None, 2:], boxes2[:, 2:]) # [N,M,2] wh = (rb - lt).clamp(min=0) # [N,M,2] inter = wh[:, :, 0] * wh[:, :, 1] # [...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ioa(boxes1: np.array, boxes2: np.array) -> np.array:\n\n inter = intersection(boxes1, boxes2)\n area2 = area(boxes2)\n\n return inter / area2", "def ioa(boxes1, boxes2):\n intersect = intersection(boxes1, boxes2)\n areas = np.expand_dims(area(boxes2), axis=0)\n return intersect / areas", ...
[ "0.8451533", "0.840949", "0.8243755", "0.7942563", "0.7853105", "0.77830726", "0.7693856", "0.76882285", "0.76702803", "0.7587807", "0.7538178", "0.74851453", "0.7484504", "0.74831045", "0.7469192", "0.7382318", "0.7331065", "0.7301706", "0.72732025", "0.7255938", "0.7212973"...
0.72669625
19
Compute the bounding boxes around the provided masks The masks should be in format [N, H, W] where N is the number of masks, (H, W) are the spatial dimensions. Returns a [N, 4] tensors, with the boxes in xyxy format
def masks_to_boxes(masks): if masks.numel() == 0: return torch.zeros((0, 4), device=masks.device) h, w = masks.shape[-2:] y = torch.arange(0, h, dtype=torch.float) x = torch.arange(0, w, dtype=torch.float) y, x = torch.meshgrid(y, x) x_mask = (masks * x.unsqueeze(0)) x_max = x_mas...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _batched_mask_to_box(masks: \"torch.Tensor\"):\n # torch.max below raises an error on empty inputs, just skip in this case\n\n if torch.numel(masks) == 0:\n return torch.zeros(*masks.shape[:-2], 4, device=masks.device)\n\n # Normalize shape to Cxheightxwidth\n shape = masks.shape\n height...
[ "0.80041194", "0.78250813", "0.7821831", "0.7811703", "0.76448375", "0.75730765", "0.754612", "0.69376516", "0.69044983", "0.6804093", "0.67601", "0.66304064", "0.6443853", "0.6433631", "0.6358561", "0.634099", "0.63274246", "0.6302167", "0.6295122", "0.6275535", "0.6252578",...
0.8466156
0
get standard datetime String
def get_standard_date(dt: Union[datetime, None]=None): if dt is None: return get_cur_standard_date() elif isinstance(dt, datetime): return get_standard_datetime(dt)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_datetime_str():\n return time.strftime(\"%Y-%m-%d %H:%M:%S\", time.localtime())", "def get_datetime_string():\n return datetime.now().strftime(DATETIME_FORMAT)", "def dtstr():\n return dt.strftime(dt.now(),'%Y %m %d, %H:%M:%S')", "def iso_date(self, t=None):\n if t is None:\n ...
[ "0.7965849", "0.7779492", "0.751557", "0.73982793", "0.72566646", "0.7227383", "0.7153067", "0.70970625", "0.70795083", "0.70795083", "0.7062511", "0.7049153", "0.70125234", "0.6980558", "0.69615316", "0.69607997", "0.6960537", "0.6912158", "0.69098437", "0.68727136", "0.6869...
0.0
-1
Total price without taxation and discount
def get_total_quote_price(self): return self.quoteitem_set.all().annotate( total_quote_price=F('price') * F('quantity')).aggregate( Sum('total_quote_price'))['total_quote_price__sum']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_total(self):\n if self.total_price == 0:\n for discount in self.discounts:\n for item in self.items:\n item.add_discount(discount)\n\n for item in self.items:\n self.total_price += item.final_price()\n\n return self....
[ "0.77000076", "0.76575816", "0.72955185", "0.72816265", "0.72665584", "0.72658736", "0.71764964", "0.7166359", "0.71625495", "0.7161888", "0.71541446", "0.71268743", "0.7124396", "0.70812684", "0.7048368", "0.70354915", "0.7033276", "0.7023461", "0.69899917", "0.6986364", "0....
0.0
-1
Return final quote price
def get_final_quote_price(self): total, discount, taxation = self.get_total_quote_price(), self.get_quote_discount(), self.get_quote_taxation() return (total - discount) + taxation
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_price(self):\r\n return self.price", "def get_price(self):\n return f'{self.soup.find(attrs={\"class\": \"woocommerce-Price-amount\"}).text}'", "def get_price(self):\n return self.price", "def get_price(self):\n return self.price", "def get_price(self):\n return s...
[ "0.72491926", "0.71886194", "0.71429", "0.71429", "0.71429", "0.70211214", "0.70194435", "0.6951319", "0.69328886", "0.6932559", "0.69148046", "0.6900835", "0.685845", "0.68555963", "0.68555963", "0.6837993", "0.68152875", "0.67969316", "0.6752503", "0.67521435", "0.67127484"...
0.8524689
0
Sets the url of this Document.
def url(self, url): self._url = url
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_url(self, url):\n self.url = url", "def set_url(self, url):\n if url is not None:\n self.url = url", "def set_url(self, url):\n self.data['url'] = url", "def url(self, url: str):\n self._url = url", "def url(self, url: str):\n\n self._url = url", "def...
[ "0.8412399", "0.8336629", "0.8136744", "0.8091173", "0.80271095", "0.80271095", "0.80271095", "0.79436314", "0.77633595", "0.76205", "0.74165994", "0.7305785", "0.7202988", "0.71454203", "0.71138424", "0.70245063", "0.70142025", "0.691426", "0.6762624", "0.6690353", "0.667316...
0.80568296
10
Sets the uuid of this Document.
def uuid(self, uuid): if uuid is not None and len(uuid) < 1: raise ValueError("Invalid value for `uuid`, length must be greater than or equal to `1`") # noqa: E501 self._uuid = uuid
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def uuid(self, uuid):\n\n self._uuid = uuid", "def uuid(self, uuid):\n\n self._uuid = uuid", "def uuid(self, uuid):\n\n self._uuid = uuid", "def uuid(self, uuid):\n\n self._uuid = uuid", "def uuid(self, uuid: str):\n \n self._uuid = uuid", "def uuid(self, uuid: s...
[ "0.7966575", "0.7966575", "0.7966575", "0.7966575", "0.79464763", "0.7910333", "0.7387999", "0.73772806", "0.64273643", "0.6306441", "0.6160552", "0.6091931", "0.6037679", "0.6012513", "0.5995177", "0.59551936", "0.5943602", "0.5864733", "0.5847472", "0.5785526", "0.5778248",...
0.73110586
9
Sets the user of this Document.
def user(self, user): self._user = user
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_user(self, user):\n self._user = user", "def set_user(self, user):\r\n self.user = user", "def set_user(self, user: User):\n self.__user = user", "def setUser(self, user):\n libxml2mod.xmlURISetUser(self._o, user)", "def user(self, user):\n self.user_id = user.get_id(...
[ "0.79773825", "0.79105324", "0.76266295", "0.71006274", "0.7024403", "0.70122147", "0.6886362", "0.6886362", "0.6886362", "0.6886362", "0.6886362", "0.6886362", "0.6886362", "0.6886362", "0.6886362", "0.6886362", "0.6886362", "0.6886362", "0.6886362", "0.6886362", "0.68766904...
0.7496731
11
Sets the name of this Document.
def name(self, name): if name is not None and len(name) > 255: raise ValueError("Invalid value for `name`, length must be less than or equal to `255`") # noqa: E501 self._name = name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_name(self, name):\n self._name = name", "def SetName(self, name):\n self.name = name", "def set_doc_name(self, doc, name):\n if not self.doc_name_set:\n doc.name = name\n self.doc_name_set = True\n return True\n else:\n raise Cardi...
[ "0.8255297", "0.8201001", "0.81936884", "0.8172652", "0.8130249", "0.8109488", "0.8109488", "0.8092643", "0.8082225", "0.8063818", "0.8063818", "0.8063818", "0.8063818", "0.8063818", "0.8015915", "0.7976473", "0.795167", "0.795167", "0.7941867", "0.79197055", "0.79197055", ...
0.0
-1
Sets the external_id of this Document.
def external_id(self, external_id): if external_id is not None and len(external_id) > 255: raise ValueError("Invalid value for `external_id`, length must be less than or equal to `255`") # noqa: E501 self._external_id = external_id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def external_id(self, external_id):\n\n self._external_id = external_id", "def external_id(self, external_id):\n\n self._external_id = external_id", "def external_id(self, external_id):\n\n self._external_id = external_id", "def external_id(self, external_id):\n if external_id is ...
[ "0.83748776", "0.83748776", "0.83748776", "0.7661575", "0.7374165", "0.70647997", "0.675369", "0.6514403", "0.6265823", "0.6265823", "0.60981345", "0.57731545", "0.5729093", "0.56846035", "0.5619747", "0.55755323", "0.5500711", "0.5486472", "0.54626614", "0.5437183", "0.54238...
0.76365376
4
Sets the frontend_id of this Document.
def frontend_id(self, frontend_id): if frontend_id is not None and len(frontend_id) > 255: raise ValueError("Invalid value for `frontend_id`, length must be less than or equal to `255`") # noqa: E501 self._frontend_id = frontend_id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def web_id(self, web_id):\n\n self._web_id = web_id", "def set_DocumentId(self, value):\n super(DownloadDocumentInputSet, self)._set_input('DocumentId', value)", "def set_id(self, ssc_id):\r\n self.ssc_id = ssc_id", "def set_ext_doc_id(self, doc, ext_doc_id):\n doc.add_ext_documen...
[ "0.55378383", "0.5325575", "0.52786845", "0.5251443", "0.52469516", "0.5246251", "0.51875114", "0.51875114", "0.51875114", "0.51875114", "0.5183966", "0.5183966", "0.50986695", "0.5066609", "0.50623035", "0.50598156", "0.5007953", "0.500628", "0.49780914", "0.49144825", "0.49...
0.78105503
0
Sets the events_callback_url of this Document.
def events_callback_url(self, events_callback_url): if events_callback_url is not None and len(events_callback_url) > 2100: raise ValueError("Invalid value for `events_callback_url`, length must be less than or equal to `2100`") # noqa: E501 self._events_callback_url = events_callback_url
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_callback_url(self, callback_url):\n self.callback_url = callback_url", "async def set_event_url(self, event_url: Optional[str]) -> None:\n if not event_url:\n event_url = self._server.url\n url = quote(str(event_url), safe=\"\")\n _LOGGER.info(\"Setting event update...
[ "0.75515646", "0.6580946", "0.59642255", "0.56799674", "0.56111544", "0.5601352", "0.558387", "0.5581121", "0.55357224", "0.5520516", "0.5519779", "0.54972214", "0.5437589", "0.537568", "0.5372901", "0.5320275", "0.53069943", "0.53069943", "0.53069943", "0.53069943", "0.53069...
0.7836989
0
Sets the signrequest of this Document.
def signrequest(self, signrequest): self._signrequest = signrequest
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sign_request(self, sign_request):\n\n self._sign_request = sign_request", "def signature_flag(self, signature_flag):\n\n self._signature_flag = signature_flag", "def signer_name(self, signer_name):\n\n self._signer_name = signer_name", "def signer_name(self, signer_name):\n\n ...
[ "0.79942375", "0.6228678", "0.616524", "0.616524", "0.6139709", "0.6124173", "0.6053103", "0.6053103", "0.6043794", "0.59363663", "0.59275293", "0.58878905", "0.58878905", "0.58826387", "0.5721185", "0.5591872", "0.5512092", "0.5456609", "0.5443755", "0.5378709", "0.5368341",...
0.81864744
0
Sets the signing_log of this Document.
def signing_log(self, signing_log): self._signing_log = signing_log
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setSignPDF(self, keystoreURL, keyAlias, keystorePassword, keystoreType, signingMode):\n self.PDFreactorConfiguration.in1[\"signPdfKeystoreURL\"] = keystoreURL\n self.PDFreactorConfiguration.in1[\"signPdfKeyAlias\"] = keyAlias\n self.PDFreactorConfiguration.in1[\"signPdfKeystorePassword\"] ...
[ "0.59428334", "0.58175457", "0.57036656", "0.56887096", "0.56887096", "0.56795955", "0.56219345", "0.56217515", "0.56046075", "0.56032", "0.55922824", "0.55922824", "0.5560236", "0.5513746", "0.5505159", "0.5473783", "0.54111314", "0.54080945", "0.54080945", "0.53499395", "0....
0.87596947
0
Sets the attachments of this Document.
def attachments(self, attachments): self._attachments = attachments
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setAddAttachments(self,value):\n self.PDFreactorConfiguration.in1[\"addAttachments\"] = value", "def set_attachments(self):\n self.response['attachments'] = []", "def attachments(self, val: list):\n self._attachments = []\n if val is not None:\n for item in val:\n ...
[ "0.66301376", "0.6629674", "0.63063186", "0.6266505", "0.6211472", "0.61580443", "0.61457306", "0.5954822", "0.5865942", "0.57971734", "0.57489145", "0.57373524", "0.5662363", "0.5626304", "0.5562629", "0.55603254", "0.54381", "0.5426246", "0.5356124", "0.5293208", "0.5252491...
0.80687654
0
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, Document): return False return self.__dict__ == other.__dict__
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False", "def __eq__(self, other):\n if i...
[ "0.8088132", "0.8088132", "0.8054589", "0.7982687", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", ...
0.0
-1
Returns true if both objects are not equal
def __ne__(self, other): return not self == other
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True", "def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)", "def __ne__(self, other) -> bool:\n return not self.__eq__(other)", "def __eq__(self, other):\n ...
[ "0.845611", "0.8391477", "0.8144138", "0.81410587", "0.8132492", "0.8093973", "0.80920255", "0.80920255", "0.80920255", "0.8085325", "0.8085325", "0.8076365", "0.8076365", "0.8065748" ]
0.0
-1
Return a dict with the video this method is for to keep the compatibility for old
def get_embed_dict(url, params=None): embed = EmbedFactory.get_embed(url, params) return embed.get_embed_dict() if embed else None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_video():\n video = {}\n for k, v in DB.VIDEOS.iteritems():\n video[k] = v.__dict__\n return video", "def video_dict(self):\n self.cur.execute(\"SELECT video_ID, video_title FROM videos\")\n videos = {}\n video_titles = []\n for video in self.cur...
[ "0.82025266", "0.7349134", "0.7035774", "0.67291355", "0.6574835", "0.6517849", "0.6508744", "0.647195", "0.6454397", "0.6444857", "0.64435345", "0.6405546", "0.6382915", "0.6305499", "0.6233442", "0.6219377", "0.6216433", "0.6195231", "0.6195164", "0.6187113", "0.6147258", ...
0.0
-1
Return a dict with the video.
def get_embed_dict(self): if not self.get_url() or not self.get_embed_url(): return None output = { "url": self.get_url(), "embed_url": self.get_embed_url(), "provider_url": self.get_provider_url(), "provider_name": self.get_provider_name(), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_video():\n video = {}\n for k, v in DB.VIDEOS.iteritems():\n video[k] = v.__dict__\n return video", "def video_dict(self):\n self.cur.execute(\"SELECT video_ID, video_title FROM videos\")\n videos = {}\n video_titles = []\n for video in self.cur...
[ "0.8715809", "0.760929", "0.7151687", "0.68675786", "0.68445945", "0.66078943", "0.65674424", "0.6541241", "0.6478438", "0.64718205", "0.64499915", "0.639612", "0.63326305", "0.6311286", "0.6296101", "0.6291146", "0.6280565", "0.62697464", "0.62697464", "0.62697464", "0.62697...
0.704604
3
Fixes some malformed urls that are around on some sites, which looks like
def youtube_fix_url(url): p = urlparse.urlparse(url) path = p.path if '&' in p.path: # sign of a malformed path path = re.sub('\&.+', '', p.path) return urlparse.urlunparse((p.scheme, p.netloc, path, p.params, p.query, p.fragment))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fix_url(cls, url: str):\r\n ...", "def _fix_url(url):\n\n if not url.startswith('http'):\n url = 'http://' + url\n\n return url", "def url_fix_common_typos(url):\n if url.startswith(\"http//\"):\n url = \"http://\" + url[6:]\n elif url.startswith(\"https//\"):\n url ...
[ "0.78042585", "0.7360744", "0.73024404", "0.72862786", "0.6927415", "0.6925513", "0.687715", "0.6705978", "0.66862786", "0.6643094", "0.66389006", "0.65923584", "0.6529251", "0.6512607", "0.6481778", "0.64646554", "0.6454716", "0.64415497", "0.64275753", "0.6346145", "0.63125...
0.6401412
19
Returns if the url is for users urls. also if is an valid user url but had the fragment p/1/u/video_id return False. because represent a video.
def is_youtube_user(url=None, parse_url=None): if not parse_url: if url: parse_url = urlparse.urlparse(url) else: return False if re.match('(.{1}/){3}([\w+-_^/]+)', parse_url.fragment): return False return parse_url.path.s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_url(url):\n return re.search(r\"^[a-zA-Z][-+\\.\\w]*://[^\\s]+$\", url) is not None and url[:4] != 'uuid'", "def check_url(url=None, parse_url=None):\n \n if not parse_url:\n parse_url = urlparse.urlparse(url)\n \n return parse_url.netloc.endswith('bambuser.com')\\\n ...
[ "0.6797255", "0.6776674", "0.6695254", "0.6600181", "0.6558438", "0.6511136", "0.6471161", "0.64537007", "0.64287174", "0.6398071", "0.6377049", "0.6374972", "0.6268475", "0.6253439", "0.620971", "0.616572", "0.61631346", "0.6155011", "0.6154694", "0.6147056", "0.61452335", ...
0.8035845
0
Returns a vimeo "canonical" url.
def get_url(self): if not self.get_video_id(): return '' return 'http://www.vimeo.com/%s' % self.get_video_id()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_embed_url(self):\n if not self.get_video_id():\n return ''\n \n return 'https://player.vimeo.com/video/%s' % self.get_video_id()", "def get_embed_url(self):\n if not self.original_url:\n return ''\n \n return 'https://vine.co/v/%s/embed/simple' % (self.ge...
[ "0.7192233", "0.6557044", "0.64804375", "0.6467344", "0.63553363", "0.6218523", "0.62002414", "0.61866117", "0.6112958", "0.6079552", "0.5983926", "0.5967099", "0.5799134", "0.5737427", "0.5726324", "0.5716322", "0.5704041", "0.5684439", "0.5660576", "0.5651033", "0.5608154",...
0.76509166
0
Expand tab characters in a string into spaces.
def _ExpandTabs(text, column, tabsize, mark_tabs=False): expanded = "" while True: tabpos = text.find("\t") if tabpos < 0: break fillwidth = tabsize - (tabpos + column) % tabsize column += tabpos + fillwidth if mark_tabs: fill = "\t" + " " * (fillwidth - 1) else: fill = " "...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def converttabs(text, spaces=4):\n\n return text.replace('\\t', ' ' * spaces)", "def replace_tabs(string: str, tab_width: int = 4) -> str:\n\n return string.replace('\\t', ' '*tab_width)", "def tab2space(text, tabsize=1):\n return text.expandtabs(tabsize)", "def distillTabs(someString):\n if some...
[ "0.7704402", "0.75756913", "0.7293861", "0.6853842", "0.6732741", "0.64412326", "0.628677", "0.6025947", "0.60081637", "0.6005864", "0.59091336", "0.58948296", "0.5841299", "0.5801375", "0.57646495", "0.5762307", "0.5704514", "0.5685822", "0.56365174", "0.55587494", "0.546904...
0.71988934
3
Returns all the blocks corresponding to the lines in the region.
def GetBlocks(state): result = [] last_pos = 0 for entry in state: pos = entry['pos'] # Calculate block start points from the beginning of individual lines. blocks = [(s[0]-last_pos, s[1]-s[0]) for s in entry['blocks']] # Add one end marker block. blocks.append((pos-last_pos, 0)) result.ap...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_blocks(lines):\n # nalezneme v obsahu cisla stranek\n page_marks = [idx for idx, l in enumerate(lines) if PAGING_RE.match(l)]\n\n # rozdelime obsah na bloky podle stranek\n blocks, from_pm = [], 0\n for pm in page_marks:\n blocks.append(lines[from_pm:pm])\n from_pm = pm + 1\n ...
[ "0.7326278", "0.69235015", "0.6890726", "0.6847235", "0.662264", "0.65536696", "0.64290226", "0.6395803", "0.631637", "0.62798375", "0.627069", "0.6252505", "0.6214526", "0.62134707", "0.61772335", "0.614175", "0.61267143", "0.6081043", "0.6074623", "0.60600126", "0.60487306"...
0.7424399
0
Return the position of the most significant digit. 0 means 1's place, 1 means 10's place, 1 means 0.1's place, etc.
def _msd_from_val(val): if not val: return 0 return math.floor(math.log10(abs(val)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pos_number(self):\n return self._pos_number.zfill(2)", "def _my_digitize(the_input):\n return np.searchsorted(the_input[1:], the_input[0])", "def PFirstDigit(d):\r\n return math.log(1.0+ 1.0/float(d)) / math.log(10)", "def get_num(digits):\r\n\r\n number = 0\r\n sign = 1\r\n digit_n...
[ "0.62555724", "0.6162614", "0.61577386", "0.60454047", "0.59892374", "0.59852195", "0.5983845", "0.5983076", "0.5972174", "0.59253937", "0.5864846", "0.5800455", "0.57597715", "0.57448214", "0.57143694", "0.5688247", "0.5662061", "0.56425166", "0.56129336", "0.5587425", "0.55...
0.0
-1
Return the position of the most significant digit. 0 means 1's place, 1 means 10's place, 1 means 0.1's place, etc.
def _msd(self): return math.floor(math.log10(abs(self._val)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pos_number(self):\n return self._pos_number.zfill(2)", "def _my_digitize(the_input):\n return np.searchsorted(the_input[1:], the_input[0])", "def PFirstDigit(d):\r\n return math.log(1.0+ 1.0/float(d)) / math.log(10)", "def get_num(digits):\r\n\r\n number = 0\r\n sign = 1\r\n digit_n...
[ "0.6254771", "0.61622", "0.6158704", "0.6045698", "0.598721", "0.598524", "0.5982183", "0.5981973", "0.59718096", "0.5924583", "0.586324", "0.5800375", "0.5760931", "0.5744544", "0.57132316", "0.5688763", "0.56613684", "0.5642242", "0.56123924", "0.5586677", "0.5579431", "0...
0.0
-1
it returns list of given number of colors
def some_colors(number = 5): import colorsys N = number HSV_tuples = [(x*1.0/N, 1.0, 1.0) for x in range(N)] RGB_tuples = map(lambda x: colorsys.hsv_to_rgb(*x), HSV_tuples) # if only one color is required don't put in in the list if number == 1: RGB_tuples = RGB_tuples return RGB_tu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def colors(k): \n ret = []\n for i in range(k):\n ret.append((random.uniform(0, 1), random.uniform(0, 1), random.uniform(0, 1)))\n return ret", "def get_colors(num_colors):\n import colorsys\n colors = []\n for i in np.arange(0., 360., 360. / num_colors):\n hue = i/360.\n ...
[ "0.7956679", "0.7936606", "0.779266", "0.7730483", "0.7703664", "0.768577", "0.75030977", "0.74811244", "0.7479576", "0.7421606", "0.74136955", "0.7380331", "0.7347177", "0.7334211", "0.7229836", "0.7227842", "0.7217518", "0.71872324", "0.717211", "0.71673256", "0.71641874", ...
0.7682016
6
Return kilometers converted to miles.
def km_to_mi(r: Number, scale: int = 6) -> float: if not isinstance(r, (float, int)): raise ValueError("Float or integer value expected.") return round(r / KM_PER_MI, scale)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def kilometers_to_miles(km):\n #convert km to miles:\n return km*0.621371", "def miles_to_kilometers(miles):\n #convert miles to km:\n return miles*1.60934", "def meters_to_miles(meters):\n miles = meters / 1609.344\n return miles", "def kilometer_to_miles(kilometers: float) -> float:\n ...
[ "0.85204375", "0.8409632", "0.8382595", "0.8361742", "0.813403", "0.7848914", "0.7368488", "0.71962035", "0.71519965", "0.7077874", "0.70574766", "0.69708043", "0.69686466", "0.6918244", "0.68268144", "0.68182606", "0.6801564", "0.6759867", "0.6694112", "0.6678816", "0.667535...
0.6835919
14
Return the equivalent field name in the file format for a standard geolocation field (lat, lon, time, z). Used for internal purpose and should not be called directly.
def get_geolocation_field(self, fieldname): return fieldname
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_location_name(lat, lon):\n for shapeRecords in sf.iterShapeRecords():\n shape, record = shapeRecords.shape, shapeRecords.record\n bbox, points = shape.bbox, shape.points\n if point_inside_polygon((lon, lat), [(bbox[0], bbox[1]), (bbox[2], bbox[1]), (bbox[2], bbox[3]...
[ "0.5895857", "0.5769432", "0.56786984", "0.56513333", "0.5647745", "0.56222594", "0.5617634", "0.5617229", "0.5598112", "0.5521769", "0.5517996", "0.5513703", "0.5467093", "0.5438111", "0.54005414", "0.539231", "0.537227", "0.5340862", "0.53050864", "0.530451", "0.5293425", ...
0.74658877
0
Returns the bounding box of the feature, as a tuple.
def get_bbox(self): dimsizes = self.get_full_dimensions('lon').values() slices = [slice(None, None, dimsizes[0] - 1), slice(None, None, dimsizes[1] - 1)] lon = self.read_values('lon', slices=slices) lat = self.read_values('lat', slices=slices) return (lon.min(),...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def boundingBox(self):\n y_max = np.max(self.points[:,0])\n x_max = np.max(self.points[:,1])\n y_min = np.min(self.points[:,0])\n x_min = np.min(self.points[:,1])\n \n return ((x_max, y_max), (x_min, y_min))", "def get_bbox(self) -> Tuple[Vec, Vec]:\n if self.is_b...
[ "0.78971106", "0.7867348", "0.77681565", "0.7715258", "0.76766145", "0.76009524", "0.75598633", "0.7506213", "0.7473114", "0.744594", "0.74406433", "0.74406433", "0.7418034", "0.7404445", "0.736192", "0.736192", "0.73381007", "0.7314084", "0.7272144", "0.72178125", "0.7213776...
0.6969831
32
Appends the specified transition to the memory.
def append(self, state, action, reward, done): assert state.shape == self._state_shape, \ 'Invalid state shape (required: %s, got: %s)' % (self._state_shape, state.shape) self._states[self._pos] = state self._actions[self._pos] = action self._rewards[self._pos] = reward ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def storeTransition(self, transition):\n self.buffer.append(transition)", "def update_replay_memory(self, transition: Tuple[np.array, int, int,\r\n np.array, bool]) -> None:\r\n self.replay_memory.append(transition)", "def push(self, transition,...
[ "0.8132843", "0.792192", "0.77726907", "0.75853884", "0.71884996", "0.7046272", "0.70148134", "0.70004374", "0.69907516", "0.69736516", "0.6941401", "0.68760645", "0.687369", "0.67795897", "0.6755102", "0.6755102", "0.66875243", "0.6650613", "0.656368", "0.6556201", "0.648782...
0.6040921
34
List the manifest that should be regsitered when the main Ecpy app is started.
def list_manifests(): import enaml with enaml.imports(): from .pulses.manifest import PulsesManagerManifest from .tasks.manifest import PulsesTasksManifest from .measure.manifest import PulsesMeasureManifest return [PulsesManagerManifest, PulsesTasksManifest, PulsesMeasureManifest]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def readManifestEntries(context):\n return GenericMetadata._readEntriesForSection(context.projectDir, GenericMetadata.MANIFEST_SECTION)", "def load_app_manifests(self):\n self.app_manifests = []\n apps_lib_path = os.path.join(self.apps_dir_path, \"lib\")\n for app_dir in os.listdir(ap...
[ "0.6822402", "0.6748621", "0.6674137", "0.64820325", "0.64424783", "0.6272776", "0.62469447", "0.6175232", "0.6144232", "0.6143908", "0.6143908", "0.6017375", "0.6006644", "0.6003636", "0.6000731", "0.59922254", "0.593581", "0.5889177", "0.5864841", "0.581836", "0.58062243", ...
0.68570423
0
returns a dictionary of fields which contain empty values
def get_empty_values(self): values_dict = self.__class__.objects.values().get(pk=self.pk) d = { k: v for k, v in zip(values_dict.keys(), values_dict.values()) if v is None or v is u'' } return d
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_empty_fields(obj: dict) -> dict:\n return {k: v for k, v in obj.items() if v is not None}", "def get_empty_fields(self):\n return [f for f in self.__dict__ if not self.__dict__[f]]", "def _remove_none_fields(klass, d):\n\n return dict((k, v) for k, v in d.iteritems() if v is not Non...
[ "0.7983259", "0.7941192", "0.7639726", "0.746539", "0.73698676", "0.6927214", "0.6896085", "0.67924005", "0.67747486", "0.67715764", "0.662057", "0.6573854", "0.6554528", "0.65203387", "0.6458828", "0.6446863", "0.6426083", "0.64000857", "0.63668996", "0.6316774", "0.62832195...
0.78172976
2
Sets the learning rate to the initial LR decayed by 10 every 30 epochs
def adjust_learning_rate(self, opt, epoch): lr = opt.learning_rate * 0.1 ** (epoch // opt.lr_update) for param_group in self.optimizer.param_groups: param_group['lr'] = lr
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def adjust_learning_rate(init_lr, optimizer, epoch, n=100):\n init_lr = init_lr * (0.1 ** (epoch // n))\n print('learning rate : ', init_lr)\n for param_group in optimizer.param_groups:\n param_group['lr'] = init_lr", "def adjust_learning_rate(start_lr, optimizer, epoch, total_epoch_num):\n #l...
[ "0.7913536", "0.7906521", "0.7849834", "0.777524", "0.77338326", "0.77306354", "0.7722718", "0.77224237", "0.771982", "0.77092624", "0.7693604", "0.76742035", "0.7665748", "0.7665748", "0.7665748", "0.7655329", "0.76419765", "0.76399755", "0.7637868", "0.7626077", "0.76247585...
0.732454
86
returns onehot encoded action
def action(self, id_): return np.eye(self.action_space)[id_]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def one_hot(a, actions, dtype=t.float32):\n assert 1 == a.shape[-1]\n return (a == t.arange(actions, device=a.device)).to(dtype=dtype)", "def one_hot_encode(x):\n # TODO: Implement Function\n output = np.zeros((len(x), 10))\n \n for i, j in enumerate(x):\n output[i,j] = 1\n \n ...
[ "0.7803888", "0.77997535", "0.77748996", "0.77598214", "0.77598214", "0.75943583", "0.75904423", "0.7542067", "0.74882495", "0.74628276", "0.7456401", "0.74519724", "0.74468255", "0.7442785", "0.7379645", "0.73758435", "0.7364575", "0.7344589", "0.73437077", "0.7299576", "0.7...
0.0
-1
A method that load a JSON file.
def load(self, path): with open(path, "rt") as open_file: data = json.load(open_file) return data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_json(file_name):\n return json.load(open(file_name))", "def loadJsonFromFile(filename):\n with open(filename) as f:\n return json.loads(f.read())", "def json_load(file_path):\n\n with open(file_path) as f:\n return json_loads(f.read())", "def load_json(filename):\n with ope...
[ "0.83633", "0.8256155", "0.82382756", "0.82305276", "0.82032794", "0.8193304", "0.818521", "0.81823885", "0.8172648", "0.8162192", "0.8151449", "0.81493753", "0.81493753", "0.8145307", "0.81450677", "0.81305826", "0.81234866", "0.8105768", "0.8104503", "0.8097091", "0.8084463...
0.79184186
32
Calculates the cdf values for the generate_cdf function
def __calculate_cdf(self): for (f, dist) in self.__dists.iteritems(): for dict in self.__queries: dict['rss_lower_cdf']=(dict[qs.QRY_LRSS]/self.__db_size) dict['rss_upper_cdf']=(dict[qs.QRY_URSS]/self.__db_size)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cdf(self,x):\n if hasattr(x,'__len__'):\n returnCdf = np.array([self.cdf(i) for i in x])\n else:\n returnCdf = self._distribution.cdf(x)\n return returnCdf", "def cdf(self, value=None):\n if value is None:\n value = self.value\n return self.rv.cdf(\n ...
[ "0.7880744", "0.77626157", "0.77579534", "0.76733917", "0.75176334", "0.74449193", "0.74449193", "0.7443677", "0.74034524", "0.7279149", "0.726381", "0.72613597", "0.7246009", "0.7064074", "0.70593214", "0.70334816", "0.69956577", "0.69546115", "0.6932023", "0.69054836", "0.6...
0.7402563
9
Remove speaker names and the first utterance from dialogue
def remove_speaker_and_first_u(words, losses, speakers): first_u = [] clean_words = [] clean_losses = [] for word, loss in zip(words, losses): if word in speakers and (loss == 100 or loss == -100): continue if word == ":" and (loss == 100 or loss == -100): continu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_dialog_text(dialogs):\n\n # Replace thing with object throughout with probability 0.5.\n thing = 'thing' if random.random() > 0.5 else 'object'\n for index, dialog_datum in enumerate(dialogs):\n # Clean the caption.\n text = dialog_datum['caption']\n dialogs[index]['caption'] = clean_text_sub...
[ "0.60985166", "0.6002549", "0.55941844", "0.55934334", "0.5578986", "0.55637485", "0.553348", "0.53715837", "0.53666514", "0.5334621", "0.52376544", "0.52326286", "0.5224764", "0.52162284", "0.5195054", "0.5191454", "0.5151477", "0.50407106", "0.50406885", "0.5033438", "0.503...
0.6401526
0
Recursively turn mapping into nested `types.MappingProxyTypes`
def _freeze_mapping(d): d = dict(d) for k in d.keys(): if hasattr(d[k], '__getitem__') and hasattr(d[k], 'keys'): d[k] = _freeze_mapping(d[k]) d = types.MappingProxyType(d) return d
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_mapping(mapping, parents=None):\n if parents is None:\n parents = []\n for addr, val in mapping.items():\n if isinstance(addr, (str,)) and isinstance(val, (str,)):\n yield (addr, PhysicalAddress(val))\n else:\n cur = parents + [addr]\n if isinst...
[ "0.6313534", "0.57938516", "0.5754199", "0.5752322", "0.5725024", "0.56901246", "0.56665444", "0.5643556", "0.5601905", "0.5561394", "0.55355215", "0.5421475", "0.5410307", "0.5360019", "0.5313919", "0.5280264", "0.5251168", "0.5235689", "0.5233986", "0.5225589", "0.521427", ...
0.5478922
11
Initialize an object that contains the visible routines. Link the pi and gpio pins necessary and provide a function that controls the growth lighting.
def __init__(self, *args, light_control = light_control_dummy, light_channels = [LC.GROWTH], settings, working_directory = os.getcwd(), **kwargs): # set up the camera super class super().__init__(light_control = light_control, working_directory = working_directory) # give the camera a unique I...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n GPIO.setmode(GPIO.BOARD)\n for light in self.all:\n GPIO.setup(light, GPIO.OUT)", "def __init__(self):\n GPIO.setmode(GPIO.BOARD) # Set's GPIO referencing to RPi Board Refdes\n self.chanlist = [29, 31, 33, 35, 37] # chanlist 0, 1, 2, 3, 4\n GP...
[ "0.74019915", "0.7265144", "0.72364", "0.7109603", "0.7031701", "0.6993921", "0.68408257", "0.6820979", "0.6786727", "0.67469424", "0.67213744", "0.6720505", "0.668183", "0.66169983", "0.66029096", "0.6590681", "0.65724903", "0.65525204", "0.65111274", "0.65042925", "0.647631...
0.58720434
70
Function that calibrates the white balance for certain lighting specified in the channel parameter. This is camera specific, so it needs to be specified for each camera.
def calibrate_white_balance(self, channel: LC): d_print("Warming up camera sensor...", 1) # turn on channel light self.light_control(channel, 1) if channel == LC.WHITE: with picamera.PiCamera() as sensor: # set up the sensor with all its settings ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_brightness(self, channel=None):\n return float(self.getSensorData(\"ILLUMINATION\", channel))", "def white_balance(image, perc):\n new_channel = []\n for channel in cv2.split(image):\n mi, ma = (np.percentile(channel, perc), np.percentile(channel, 100.0 - perc))\n channel = np....
[ "0.61250806", "0.5965167", "0.5808294", "0.5722662", "0.5578191", "0.5549312", "0.5513952", "0.54621667", "0.5446234", "0.53895867", "0.53544164", "0.52993697", "0.52919817", "0.5266026", "0.52444756", "0.524326", "0.522411", "0.5221587", "0.52102345", "0.5171049", "0.516117"...
0.7945288
0
Make the string by concatenating 10 characters
def make_line(self, char: str, count: int): return char * count
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_str(n, len):\r\n\ts=\"\"\r\n\tfor i in xrange(0,n):\r\n\t\ts+=\"1\"\r\n\tfor i in xrange(n,len):\r\n\t\ts+=\"0\"\r\n\treturn s", "def create(char, length):\n if is_null_or_empty(char):\n char = DEFAULT_PAD_CHAR\n\n string_buf = EMPTY\n for the_char in itertools.repeat(char, length):\n ...
[ "0.67154586", "0.6604242", "0.65211594", "0.64415324", "0.6398398", "0.6345512", "0.6304692", "0.6245096", "0.6243254", "0.62368506", "0.62165385", "0.62158006", "0.6182434", "0.6179776", "0.6167445", "0.6162779", "0.6157869", "0.61573946", "0.6146108", "0.6106913", "0.607111...
0.0
-1
Get the installed version for this project.
def get_installed_version(vcs): version_path = _get_version_path(vcs) if not os.path.exists(version_path): raise VersionNotInstalledError with open(version_path, 'r') as f: return f.read().strip()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def installed_version(self):\n state = self.coordinator.data\n\n try:\n return dict_get(state, \"firmware_update_info.base.installed_version\")\n except KeyError:\n return None", "def version(self):\n if self.installed and not self._version:\n output =...
[ "0.7820845", "0.7573568", "0.75185996", "0.7504568", "0.74173695", "0.7417229", "0.7375602", "0.7361621", "0.73463887", "0.7324919", "0.731229", "0.72636425", "0.7257509", "0.7255835", "0.7255835", "0.72463197", "0.72237104", "0.7223102", "0.722015", "0.7211256", "0.72073174"...
0.6736342
87
Checks if a keyvalue pair is overridden.
def custom_added(self, key: _K) -> bool: return key in self._customs
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_overridden(self, setting_name):\n return setting_name in self._explicit_settings", "def isOverride(self) -> bool:\n ...", "def is_override(self) -> bool:\n if self.parent is not None:\n return False\n return any(self.elem in x for x in self.schema.root if x.tag == ...
[ "0.67183137", "0.6225687", "0.6050497", "0.59912413", "0.58764154", "0.5763726", "0.5761076", "0.574152", "0.5589279", "0.5531325", "0.5529704", "0.5516081", "0.5505543", "0.5501006", "0.5500598", "0.54891133", "0.5485341", "0.54730964", "0.5397111", "0.5395002", "0.5384455",...
0.0
-1
Adds a symbolic function.
def add(self, func: Callable, opset: OpsetVersion) -> None: # FIXME(titaiwang): Check if the "function" is ducplicated. self._functions.set_base(opset, func)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_function(self, function=None, name=\"main\"):\n if not isinstance(function, SSAFunction):\n print(\"Failed adding function! The input is not a SSAFunction.\")\n elif name in self.ssa.functions:\n print(\"Failed adding function! Name already exist in the NNSSA network!\")...
[ "0.69114876", "0.67881477", "0.67881477", "0.6768395", "0.6540673", "0.6528086", "0.632356", "0.6312063", "0.62504023", "0.61514604", "0.6104824", "0.6044929", "0.60346407", "0.5983935", "0.59323126", "0.592068", "0.5906884", "0.58918697", "0.58825797", "0.5847118", "0.584201...
0.6087199
11
Get current position in bounding box format `(top left x, top left y, width, height)`.
def tlwh(mean): ret = mean[:4].copy() ret[2] *= ret[3] ret[:2] -= ret[2:]/2 return ret
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getLocation(bounding_box):\n ymin, xmin, ymax, xmax = bounding_box\n w=1280\n h=720\n left, right, top, bottom = (xmin * w, xmax * w,\n ymin * h, ymax * h)\n ###############################################\n\n top = max(0, np.floor(top ...
[ "0.78299105", "0.7808465", "0.7656338", "0.7539508", "0.7469358", "0.74591184", "0.74350125", "0.7391066", "0.7290741", "0.72883403", "0.7165338", "0.714176", "0.71285486", "0.709847", "0.7097389", "0.7097389", "0.7083763", "0.7083763", "0.70822966", "0.7071966", "0.7064618",...
0.0
-1
Returns number of gems of the user
def getGems(self): return self.gems
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def headcount(self):\n self.cleanup()\n return len([True for u in self.users if not u.name.startswith('System/')])", "def getUserCount(self):\n logger.debug('Getting the number of users discovered...')\n return get_text(get_element_by_css(\"span[data-nsmodule='usersdiscovered']\"))", "def c...
[ "0.63939273", "0.617394", "0.61286867", "0.61275655", "0.6074947", "0.6023079", "0.60116863", "0.5996377", "0.5897199", "0.58710957", "0.586125", "0.5840047", "0.5837006", "0.5795334", "0.5790401", "0.57717955", "0.5756756", "0.57475865", "0.5732999", "0.57158947", "0.570542"...
0.5380569
52
Return the length of the data inserted at pos.
def get_insertion_length(self, pos): if pos in self.insertions: return self.insertions[pos] return 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getLen(self):\n return len(self.data)", "def length(self):\n return len(self._data) if self._data else 0", "def len (self):\n\t\treturn len (self.data)", "def length(self) -> int:\n return len(self.data)", "def length(self):\n return len(self.data)", "def length(self):...
[ "0.64747965", "0.6352307", "0.6288425", "0.6252985", "0.6224766", "0.6224766", "0.6224766", "0.61958516", "0.61939985", "0.6155615", "0.6120838", "0.6089486", "0.6052351", "0.6050647", "0.6050647", "0.6050647", "0.6046272", "0.60322696", "0.6031389", "0.6025278", "0.6025278",...
0.79796803
0
Return a list of all nodes with the given cursor kind.
def find_cursor_kind(node, kind): def visitor(node, parent, found): if node.kind == kind: found.append(node) return 2 found = [] cindex.Cursor_visit(node, cindex.Cursor_visit_callback(visitor), found) return found
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_cursor_kinds(node, kinds):\n def visitor(node, parent, found):\n if node.kind in kinds:\n found.append(node)\n return 2\n\n found = []\n cindex.Cursor_visit(node,\n cindex.Cursor_visit_callback(visitor),\n found)\n\n return...
[ "0.69339275", "0.61247975", "0.6049354", "0.6036378", "0.59437424", "0.5733899", "0.5629998", "0.55007434", "0.5495847", "0.54852235", "0.5484781", "0.5468732", "0.5421211", "0.54094577", "0.5379108", "0.5315027", "0.53092724", "0.52947426", "0.5277855", "0.52556694", "0.5247...
0.679692
1
Return a list of all nodes with one of the given kinds.
def find_cursor_kinds(node, kinds): def visitor(node, parent, found): if node.kind in kinds: found.append(node) return 2 found = [] cindex.Cursor_visit(node, cindex.Cursor_visit_callback(visitor), found) return found
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def iterate_nodes(self, allowed_kinds):\n for node, node_data in self._execution_graph.nodes_iter(data=True):\n if node_data['kind'] in allowed_kinds:\n yield node", "def get_nodes_by_type(ntwrk, typ='switch'):\r\n return {k: v for el in ntwrk\r\n for k, v in ...
[ "0.66526467", "0.5960975", "0.59491485", "0.579626", "0.579363", "0.5780786", "0.56611025", "0.55858386", "0.5585554", "0.5550465", "0.55432415", "0.5536144", "0.54632044", "0.54180396", "0.5393017", "0.53753716", "0.5347973", "0.5342732", "0.5285149", "0.52699256", "0.526762...
0.5877766
3
Add a tag around the given source range. The 'tag' argument is the type of HTML tag to add. Attributes is a list of pairs, where the first element is the attribute name, and the second is the attribute value.
def add_tag(self, tag, attributes, extent): self.tags.append((tag, attributes, extent))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_tag(self, tag):\n self.tags.append(tag)", "def add_tag(self, tag):\n cp = self.copy()\n cp.tags.add(tag)\n return cp", "def add_tag(self, tag):\n if tag not in self._tag:\n self._tag.append(tag)\n\n return self", "def add_tag(*, tag='tag!', f=DECOR...
[ "0.6237614", "0.62363", "0.6118091", "0.60898703", "0.604354", "0.6036695", "0.5933094", "0.5858743", "0.58373415", "0.56728524", "0.5649009", "0.5648591", "0.5643544", "0.5584881", "0.55269784", "0.549094", "0.54548544", "0.5401982", "0.5391238", "0.538289", "0.53532255", ...
0.6789945
0
Recursively find all source files in the given directory. Filenames are all given as absolute paths.
def get_source_file_list(dir): extensions = ['h', 'c', 'cc', 'cpp', 'm', 'mm'] extensions = tuple(['.' + x for x in extensions]) files = set() for (dirpath, dirnames, filenames) in os.walk(dir): files.update([os.path.join(dirpath, name) for name in filenames if name.endswi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_src_files(kem_dir):\n for dirpath, _, filenames in os.walk(kem_dir):\n for fn in filenames:\n if fn.endswith('.c'):\n if dirpath != kem_dir:\n ndir = dirpath[len(kem_dir) + 1:]\n yield os.path.join(ndir, fn)\n else:\n...
[ "0.739287", "0.7017929", "0.6990493", "0.6988693", "0.67914504", "0.67714125", "0.67694056", "0.67431784", "0.6726342", "0.6668429", "0.6651442", "0.6627994", "0.6588584", "0.658678", "0.6584782", "0.6575987", "0.6546709", "0.6535129", "0.6530092", "0.6501476", "0.64707786", ...
0.68940085
4
Return a copy of the filter. All attributes are copied aside from the integration and channels which are referenced only. Returns Filter
def copy(self): new = self.__class__(integration=None, data=None) for attribute, value in self.__dict__.items(): if attribute in self.referenced_attributes: setattr(new, attribute, value) elif hasattr(value, 'copy'): setattr(new, attribute, value.c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy(self):\n new_filter = BloomFilter(self.capacity, self.error_rate)\n new_filter.filter = self.filter.copy()\n return new_filter", "def copy(self) -> \"FilterAlgorithmState\":\n\n # NB: This is untested and might not be optimal tbh\n return deepcopy(self)", "def allow_...
[ "0.7904287", "0.7236204", "0.71982616", "0.6469615", "0.63807416", "0.6281001", "0.6264682", "0.62618846", "0.6240955", "0.6240955", "0.6194326", "0.6176442", "0.61553276", "0.606434", "0.6047419", "0.6035076", "0.5963126", "0.59589064", "0.5956324", "0.5930615", "0.59087825"...
0.5929971
20