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
Test put request that lacks authorization header
def test_update_restaurant_unauthorized(self): from espresso import db from espresso import Restaurant name = 'Restaurant Pho 2000' db.session.add(Restaurant(name=name, creator='test-user@gmail.com')) db.session.commit() headers = {'Content-Type': 'application/json'} ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_put_unauthenticated(self):\n\n url = reverse('file')\n\n data = {}\n\n response = self.client.put(url, data)\n\n self.assertEqual(response.status_code, status.HTTP_401_UNAUTHORIZED)", "def test_PUT(self):\n if not self.url:\n return\n response = self....
[ "0.8219277", "0.81385034", "0.76043105", "0.75561446", "0.7546201", "0.74603117", "0.73930216", "0.7288313", "0.7287579", "0.7271832", "0.7248393", "0.72455657", "0.7161328", "0.7131661", "0.70852363", "0.7061233", "0.7051016", "0.69993466", "0.6959493", "0.6958941", "0.69411...
0.7059662
16
Test delete request that lacks authorization header
def test_delete_restaurant_unauthorized(self): from espresso import db from espresso import Restaurant name = 'Restaurant Pandemic Plaza' db.session.add(Restaurant(name=name, creator='test-user@gmail.com')) db.session.commit() # Since this is a freshly created table, th...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_delete_unauthenticated(self):\n\n url = reverse('file')\n\n data = {}\n\n response = self.client.delete(url, data)\n\n self.assertEqual(response.status_code, status.HTTP_401_UNAUTHORIZED)", "def test_DELETE(self):\n if not self.url:\n return\n respons...
[ "0.82418334", "0.8100495", "0.76601547", "0.7654358", "0.7626185", "0.7605876", "0.7579169", "0.7563034", "0.7486684", "0.7393692", "0.73798585", "0.7345264", "0.7324629", "0.7307584", "0.7272983", "0.7248154", "0.72391975", "0.7234803", "0.7226264", "0.7216723", "0.7209334",...
0.68173075
52
this test is only to call tearDown for last
def test_9999_last(self): self.lasttest = True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tearDown(self):\n\t\tpass", "def tearDown(self):\n pass", "def tearDown(self) :\n pass", "def tearDown(self) :\n pass", "def tearDown(self) :\n pass", "def tearDown(self):\r\n pass", "def tearDown(self):\r\n pass", "def tearDown(self):\r\n pass...
[ "0.8973465", "0.89305085", "0.89072907", "0.89072907", "0.89072907", "0.8894844", "0.8894844", "0.8894844", "0.8894844", "0.8894844", "0.8867175", "0.8859265", "0.8859265", "0.8859265", "0.8859265", "0.8859265", "0.8859265", "0.8859265", "0.8859265", "0.8859265", "0.8859265",...
0.0
-1
Get the specific config key
def get(self, target_key: str, default_value: Any = None) -> Any: _keys = target_key.split('.') iteration = len(_keys) if iteration > 1: result = None counter = 1 for key_holder in _keys: if counter == 1: result = self._data...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getKey( self, key ):\n if key in self.conf:\n return self.conf[key]\n else:\n return None", "def get_config(self, key):\n return getattr(self.args, 'conf.{}'.format(key))", "def get(self, key):\n return self.config.get(key)", "def getconfig(self, key):\n ...
[ "0.8074716", "0.7811012", "0.768878", "0.7523581", "0.7507415", "0.7426547", "0.7290503", "0.72611684", "0.7176533", "0.7147605", "0.7061338", "0.70091444", "0.70052725", "0.69857496", "0.6959535", "0.68893516", "0.6847201", "0.6782263", "0.6777762", "0.67684025", "0.67622083...
0.0
-1
converts scipy sparse matrix to pytorch sparse matrix
def scipysp_to_pytorchsp(sp_mx): if not sp.isspmatrix_coo(sp_mx): sp_mx = sp_mx.tocoo() coords = np.vstack((sp_mx.row, sp_mx.col)).transpose() values = sp_mx.data shape = sp_mx.shape pyt_sp_mx = torch.sparse.FloatTensor(torch.LongTensor(coords.T), tor...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sparse_mx_to_torch_sparse_tensor(sparse_mx):\n \n # sparse_mx = sparse_mx.astype(np.float32)\n indices = torch.from_numpy(\n np.vstack((sparse_mx.row, sparse_mx.col)).astype(np.int64))\n values = torch.from_numpy(sparse_mx.data)\n shape = torch.Size(sparse_mx.shape)\n return torch.spars...
[ "0.77674377", "0.76159346", "0.74340236", "0.7406437", "0.73998225", "0.73998225", "0.73998225", "0.73998225", "0.73998225", "0.73998225", "0.73998225", "0.73998225", "0.73998225", "0.73998225", "0.73998225", "0.73998225", "0.73998225", "0.73817235", "0.73600703", "0.73600703",...
0.73203886
25
Compare structural equality This method should be used only when deep structural equality checks are actually needed, and not for all equality checks. Typically the default implmentation of __eq__, which checks pointer equality, is
def deep_eq(self, other): if not isinstance(other, AuxDataContainer): return False if ( self.uuid != other.uuid or self.aux_data.keys() != other.aux_data.keys() ): return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other: Any) -> bool:\n return (\n super().__eq__(other)\n and isinstance(other, Struct)\n and self._valid_struct_metadata().fields == other._valid_struct_metadata().fields\n and list(self._valid_struct_metadata().fields.keys()) == list(other._vali...
[ "0.75430477", "0.68294096", "0.6763503", "0.67519224", "0.6751524", "0.6710562", "0.6694197", "0.6675667", "0.6648754", "0.6641783", "0.6641783", "0.6641783", "0.6641783", "0.6641783", "0.6624067", "0.66170835", "0.6616474", "0.661255", "0.6611706", "0.66116923", "0.65812916"...
0.0
-1
Get and cache an example batch of `inputs, labels` for plotting.
def example(self): result = getattr(self, '_example', None) if result is None: # No example batch was found, so get one from the `.train` dataset result = next(iter(self.train)) # And cache it for next time self._example = result return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def instantiate_batch(self, inputs):\n return inputs", "def train_input_fn(features, labels, batch):\n # Convert the inputs to a Dataset.\n dataset = tf.data.Dataset.from_tensor_slices((dict(features), labels))\n\n # Shuffle, repeat, and batch the examples.\n return dataset.batch(batch)", "def p...
[ "0.6369013", "0.62388337", "0.6229535", "0.6229535", "0.62281907", "0.61593646", "0.6137396", "0.61306596", "0.61035913", "0.6094535", "0.60919744", "0.607866", "0.6076077", "0.6064496", "0.6051889", "0.6024423", "0.59806055", "0.59686154", "0.59668773", "0.59559965", "0.5954...
0.0
-1
Return the path to the file holding the currently applied configuration. If no configuration is applied, the file should not exist.
def get_config_file(self): return os.path.join(self.cloudletdir, "applied_config")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_config_filepath(self):\n\t\tif self.configfilepath is None:\n\t\t\treturn os.path.join(self.workdir, \"config.txt\")\n\t\telse:\n\t\t\treturn self.configfilepath", "def full_path(self, config_path=CONFIG_PATH):\n return os.path.join(config_path, self.filename)", "def getConfigFile(self):\n ...
[ "0.75602216", "0.7283077", "0.7259527", "0.7187205", "0.7181478", "0.7156296", "0.70767206", "0.7043788", "0.704047", "0.7016742", "0.6959687", "0.69504124", "0.6939785", "0.6927641", "0.69026655", "0.68227136", "0.6794443", "0.6793703", "0.67565596", "0.6742962", "0.6593512"...
0.7714502
0
Perform canny edge detection for the given image
def edge_detection(image, sigma=0.33): # compute the median of the single channel pixel intensities v = np.median(image) # apply automatic Canny edge detection using the computed median lower = int(max(0, (1.0 - sigma) * v)) upper = int(min(255, (1.0 + sigma) * v)) edged = cv2.Canny(image, lower...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_canny_edge_detection(image, min_threshold=100, max_threshold=150):\n return cv2.Canny(image, min_threshold, max_threshold)", "def perform_edge_detection(img):\n lower, upper = get_canny_thresholds(img)\n\n blur_img = cv.GaussianBlur(img, (7, 7), cv.BORDER_DEFAULT)\n\n edges_img = cv.Canny(blu...
[ "0.86345", "0.8511235", "0.82839733", "0.8151199", "0.8103302", "0.79969984", "0.7973058", "0.79687303", "0.7912679", "0.7912679", "0.7912679", "0.7912679", "0.7912679", "0.7912679", "0.7912679", "0.7912679", "0.7912679", "0.7912679", "0.7912679", "0.7912679", "0.7912679", ...
0.6974965
43
true, if the user making the request is a workshop contact, otherwise false
def get_is_workshop_contact(self, obj): user = self.context['request'].user if not user.is_authenticated: return False # pylint: disable=no-member profile = UserProfile.objects.get(user=user) return profile in obj.contacts.all()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_customer(self):\n return self.user_type == 'C'", "def has_view_permission(self, request, obj=None):\n user = request.user\n if obj and type(obj) is Client:\n return obj.is_user_in_sales_contacts_of_client(user) or obj.is_user_in_support_contacts_of_client(user)\n ret...
[ "0.6154161", "0.6126311", "0.6123491", "0.5908577", "0.5899939", "0.5810381", "0.572367", "0.5705393", "0.5695254", "0.5665383", "0.56634945", "0.56212705", "0.56204695", "0.5615299", "0.56088257", "0.56049836", "0.5589522", "0.55646783", "0.55400664", "0.55267364", "0.552442...
0.79111147
0
Returns the item corresponding to the int w where item[1] is its weight.
def getByWeight(list, w): itemId = 0 partialWeight = list[0][1] while partialWeight < w: itemId += 1 partialWeight += list[itemId][1] return list[itemId]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def weighted_random_item(items, weight):\n if not items:\n return None\n\n weight_sum = sum(weight(item) for item in items)\n if weight_sum <= 0:\n return None\n\n choice = random.random() * weight_sum\n for item in items:\n choice -= weight(item)\n if choice < 0:\n ...
[ "0.6808156", "0.67339885", "0.65599847", "0.6547899", "0.6509515", "0.6470214", "0.6464248", "0.61489886", "0.6100368", "0.60713285", "0.60669535", "0.5990098", "0.5945571", "0.5930912", "0.5897772", "0.58686405", "0.5858001", "0.5812967", "0.5809362", "0.5794877", "0.5790223...
0.79470766
0
FindSmallest element in the tree
def test_find_smallest_element(self): smallestValue = min(self.values) valueFound = self.tree.findSmallest(self.tree.root) self.assertEqual(smallestValue, valueFound)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _find_smallest(node):\n if node.left:\n return BinarySearchTree._find_smallest(node.left)\n else:\n return node", "def find_smallest(self):\n return self._find_smallest(self.root)", "def find_smallest(node):\n smallest = node.value\n\n while node.lef...
[ "0.82073605", "0.8178883", "0.8110074", "0.7962785", "0.7797918", "0.7655078", "0.76372546", "0.76195335", "0.75676394", "0.7536055", "0.750011", "0.7479726", "0.74674207", "0.74401844", "0.7404642", "0.7371038", "0.7350525", "0.733797", "0.73188895", "0.7229432", "0.7219386"...
0.7910918
4
Find the second smallest value
def test_find_second_smallest(self): secondSmallestValue = sorted(self.values)[1] valueFound = self.tree.findSecondSmallest(self.tree.root) self.assertEquals(secondSmallestValue, valueFound)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def secondSmallest(d_diff_pts):\n tmp_inds = np.arange(len(d_diff_pts))\n tmp_inds_min0 = np.argmin(d_diff_pts)\n tmp_inds = np.delete(tmp_inds, tmp_inds_min0)\n tmp_d_diff_pts =np.delete(d_diff_pts, tmp_inds_min0)\n secondSmallest_value = min(tmp_d_diff_pts)\n secondSmallest_ind = np.argmin(np.a...
[ "0.7242769", "0.68707734", "0.6814374", "0.6742284", "0.66932535", "0.6680455", "0.6664402", "0.665205", "0.6638381", "0.66290003", "0.66219544", "0.6611311", "0.6498995", "0.6492467", "0.6475887", "0.6413694", "0.6391913", "0.6281708", "0.6277807", "0.6277421", "0.6267607", ...
0.75088274
0
declare the new min variable and check if min stack holds values. If it does, we need to compare the current number to be pushed with recent entry in min stack in order to update min value In either case (whether min stack holds values or is empty, append the min value to the min stack and append number to stack)
def push(self, x: int) -> None: new_min = x if self.minStack: last_min = self.minStack[-1] new_min = min(last_min, x) self.minStack.append(new_min) self.stack.append(x)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n self.stack = []\n self.currentMin = float(\"-inf\")", "def sort_stack(stk: MyStack) -> MyStack:\n temp_stack = MyStack()\n\n while stk.is_empty() is False:\n curr_val = stk.pop()\n if temp_stack.top() is not None and curr_val >= int(temp_stack.top()):\n ...
[ "0.661721", "0.6556882", "0.63958097", "0.63913655", "0.6233521", "0.61784446", "0.61757475", "0.6139187", "0.6124339", "0.6119457", "0.6111156", "0.6085982", "0.6058196", "0.604469", "0.59292495", "0.5923163", "0.5884398", "0.58825237", "0.5871226", "0.5851434", "0.5846011",...
0.68916386
0
return last element from [] or top element from stack (LIFO)
def top(self) -> int: return self.stack[-1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def top(self) -> object:\n if self.is_empty()== True: # if size of array is 0, raise exception\n raise StackException\n return self.da.get_at_index(self.size()-1) # return the top of the stack (last element)\n pass", "def remove_last_item_from_stack(self):\n if self.length...
[ "0.7615601", "0.75714296", "0.74301463", "0.74067", "0.7336468", "0.73218465", "0.72721", "0.7266203", "0.7253656", "0.72334874", "0.7231203", "0.7201661", "0.7200565", "0.7187911", "0.71574193", "0.7145977", "0.713428", "0.71179134", "0.7115027", "0.7101934", "0.7098952", ...
0.0
-1
return last entry from min stack
def getMin(self) -> int: return self.minStack[-1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def max_stack(self):\n if self.maxx == []:\n return None\n return self.maxx[-1]", "def top(self):\n if self.stack == []:\n return None\n return self.stack[-1]", "def top(self):\n return self.stack[-1]", "def peek(self):\n return self.the_stack[-...
[ "0.7611403", "0.74267566", "0.7364067", "0.7227407", "0.71940744", "0.71912694", "0.7141873", "0.7141873", "0.7141873", "0.71339905", "0.71094394", "0.70984787", "0.70932937", "0.7081411", "0.7036137", "0.69928306", "0.6982336", "0.6974163", "0.6974163", "0.69733983", "0.6946...
0.7272136
3
Computes the accuracy for the specified values of k
def get_negative_idx(self, outputs, targets, topk=(1, )): max_k = max(topk) _, pred = outputs.topk(max_k, 1, True, True) pred = pred.t() correct = pred.eq(targets.view(1, -1).expand_as(pred)) res = [] for k in topk: negative_idx = (correct[:k].view(-...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_accuracy(self, k=None):\n k = 1 if k is None else k\n n_correct = 0\n \n for query, answer in tqdm(zip(self.test_queries, self.results)):\n correct_set = self.correct_answers[query]\n is_correct = False\n for candidate in answer[:k]:\n ...
[ "0.77260184", "0.7489935", "0.7489935", "0.7489935", "0.7247535", "0.72364694", "0.7115022", "0.7100411", "0.70968854", "0.7088704", "0.708722", "0.7086801", "0.7082005", "0.7082005", "0.7077323", "0.70487505", "0.70470345", "0.70419353", "0.70382833", "0.70382833", "0.703819...
0.0
-1
This function prints and plots the confusion matrix. Normalization can be applied by setting `normalize=True`.
def plot_confusion_matrix(cm, classes, normalize=False, title='Confusion matrix', cmap=plt.cm.Blues): if normalize: cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis] print("Normalized confusion matrix") else: p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_confusion_matrix(cm, classes=[0,1], normalize=False, title='Confusion matrix', print_matrix=False):\n\n if normalize:\n cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis]\n print(\"Normalized confusion matrix\")\n else:\n print('Confusion matrix, without normalization')\n\n...
[ "0.8194862", "0.80949175", "0.8029915", "0.8019153", "0.79941195", "0.7991258", "0.7980955", "0.7976606", "0.79610753", "0.79590565", "0.79378676", "0.7934962", "0.7934504", "0.79313844", "0.7926313", "0.7924577", "0.79241234", "0.7923211", "0.7923023", "0.7921931", "0.791787...
0.7847642
47
Delete this crawler object and properly free the used resources.
def __del__(self): # close socket try: self.socket.shutdown(socket.SHUT_RDWR) self.socket.close() except OSError: pass # quit selenium driver if self.driver: self.driver.quit() # make sure to delete linkfinder temporary f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __del__(self):\n self._cleanup()", "def __del__(self):\r\n self.cleanup()", "def __del__(self) -> None:\n self.delete()", "def __del__(self):\n shutil.rmtree('tmp')\n self.quit_browser()", "def __del__(self):\n if self.__database_connection:\n self._...
[ "0.74714595", "0.7254336", "0.7125767", "0.70617694", "0.6999953", "0.6936757", "0.6928526", "0.6928526", "0.6928526", "0.6928526", "0.6928526", "0.6928526", "0.68960375", "0.6861052", "0.6856186", "0.679702", "0.67759156", "0.67566735", "0.67097104", "0.6685942", "0.6665202"...
0.6820504
15
test already used email
def test_register_existing_email(self): response = self.client.post('/api/v2/auth/signup', data=json.dumps(users[0]), headers=self.admin_headers, content_type='application/json') self.assertEqual(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_duplicate_email(self):\n self.signup('Bo', 'Theo', 'Bo_theo5@example.com', 'Bo1995', 'Bo1995')\n rv = self.signup('Bo', 'Theo', 'Bo_theo5@example.com', 'Bo1995', 'Bo1995')\n self.assertIn(b'Sorry email already exist', rv.data)", "def check_duplicate_email(self, email):\r\n re...
[ "0.76198804", "0.75595206", "0.73519176", "0.7202967", "0.7082485", "0.70301807", "0.7015599", "0.69065064", "0.68943477", "0.68929374", "0.6863265", "0.68616337", "0.6860934", "0.6860934", "0.68567973", "0.6847087", "0.68324393", "0.67946994", "0.6776414", "0.67558825", "0.6...
0.6447767
48
test resgister invalid email
def test_register_invalid_email(self): response = self.client.post('/api/v2/auth/signup', data=json.dumps(users[3]), headers=self.admin_headers, content_type='application/json') self.assertEqual(r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_is_invalid_email(self):\n self.assertFalse(is_valid_email('helloworld'))", "def test_invalid_email_when_logging_in(self):\n pass", "def test_invalid_email(self):\n rv = self.login('Bo_wrong@example.com', 'Bo1995')\n self.assertIn(b'Invalid email! Please try again', rv.data)...
[ "0.82027185", "0.8188234", "0.80019844", "0.79532915", "0.79104507", "0.78299177", "0.7778266", "0.7752785", "0.7714714", "0.7679159", "0.75695974", "0.75613135", "0.7557446", "0.75516695", "0.7551251", "0.7528325", "0.74853534", "0.7462079", "0.74602276", "0.7426714", "0.741...
0.73026997
29
test login invalid email
def test_login_invalid_password(self): response = self.client.post('/api/v2/auth/login', data=json.dumps(users[5]), content_type='application/json') self.assertEqual(response.status_code, 422) self.assertIn('invalid credenti...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_sad_login_wrong_email(self):\n\n rv = self.login(\"wrong@email.com\")\n assert rv.status_code in [404]\n assert b\"The provided email is invalid\" in rv.data", "def test_invalid_email(self):\n rv = self.login('Bo_wrong@example.com', 'Bo1995')\n self.assertIn(b'Invalid ...
[ "0.8743506", "0.8687062", "0.8599527", "0.8579673", "0.82863444", "0.8060929", "0.80323905", "0.7924116", "0.7921799", "0.7910541", "0.79017353", "0.7858385", "0.78553873", "0.78442335", "0.77081645", "0.75630546", "0.754606", "0.7504398", "0.74717873", "0.74657243", "0.74454...
0.6908862
75
Tests that events conforming to string queries are returned
def test_query_events_by_text_search(self): events = list(query_events_by_text_search(Event.objects.all(), 'Film')) self.assertTrue(self.event_film in events) self.assertFalse(self.event_show1 in events)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_query_events(self):\n query_list = {\n 'q': 'test',\n 'type': 'show'\n }\n results = query_events(query_list)\n events = list(results['events'])\n showcase = list(results['showcase_events'])\n self.assertTrue(self.event_show1 in events)\n ...
[ "0.75579286", "0.68505645", "0.6762481", "0.6658069", "0.6607486", "0.6446209", "0.6434576", "0.6357096", "0.632592", "0.6279772", "0.62537444", "0.62406003", "0.6127644", "0.6096756", "0.6066213", "0.6055026", "0.6040843", "0.6012588", "0.5992469", "0.59918445", "0.5982417",...
0.6837877
2
Create a mock Hue bridge.
def create_mock_bridge(): bridge = Mock( available=True, allow_unreachable=False, allow_groups=False, api=Mock(), spec=hue.HueBridge ) bridge.mock_requests = [] # We're using a deque so we can schedule multiple responses # and also means that `popleft()` will ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mock_bridge(hass):\n return create_mock_bridge()", "async def test_hue_bridge_setup(hass):\n accessories = await setup_accessories_from_file(hass, \"hue_bridge.json\")\n config_entry, pairing = await setup_test_accessories(hass, accessories)\n\n entity_registry = await hass.helpers.entity_registr...
[ "0.76612836", "0.7170115", "0.7112733", "0.6501393", "0.638152", "0.6303694", "0.61823136", "0.60383654", "0.6035404", "0.59657604", "0.5910633", "0.58577", "0.5840861", "0.5806066", "0.5799553", "0.5788887", "0.5722134", "0.5721093", "0.57163197", "0.57156295", "0.57132155",...
0.74970704
1
Generate a sample static React application.
def generate_sample_static_react(env_root): repo_dir = os.path.join(env_root, 'static-react') if os.path.isdir(repo_dir): LOGGER.error("Error generating sample repo -- directory %s " "already exists!", repo_dir) sys.exit(1) shutil.copytree( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_app():\n app = Flask(__name__)\n\n settings = {\n 'DEBUG': True,\n 'WEBPACK_MANIFEST_PATH': './build/manifest.json',\n 'SECRET_KEY': 'the quick brown fox jumps over the lazy dog',\n 'SQLALCHEMY_DATABASE_URI': 'sqlite:///db.sqlite',\n 'SQLALCHEMY_COMMIT_ON_TEARDOW...
[ "0.6643457", "0.6353099", "0.63418156", "0.6284694", "0.6196394", "0.6196394", "0.6060801", "0.6055373", "0.6045188", "0.59819436", "0.5967713", "0.59084", "0.5887365", "0.58845866", "0.5864085", "0.5805739", "0.57898957", "0.57879746", "0.57686937", "0.5766021", "0.5741608",...
0.78804713
0
Step function activation that in backward pass acts as if it was a function given in the `pseudoderivative_of` parameter.
def step_function(x, pseudoderivative_of=tf.nn.tanh): # forward pass: step function (entire expression is evaluated) # backward pass: tanh derivative - triangle (-2,2) (only the first part is considered) return pseudoderivative_of(x) + tf.stop_gradient(-pseudoderivative_of(x) + tf.nn.relu(tf.sign(x)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def linear_activation_forward(A_prev, W, b, activation):\n pass", "def backward(cls, grad_out, activated_out):\n raise Exception(\"Unimplemented\")", "def backward(cls, grad_out, activated_out):\n raise Exception(\"Unimplemented\")", "def derivative_activation(z):\n return activation(z) *...
[ "0.60895324", "0.6041764", "0.6041764", "0.6018972", "0.6011782", "0.59771794", "0.5922997", "0.5906574", "0.59033567", "0.5900355", "0.5894251", "0.58475006", "0.5805008", "0.5777626", "0.57695657", "0.57609296", "0.57434684", "0.5740475", "0.5708426", "0.57046837", "0.57015...
0.78861594
0
Leaky_relu activation with alpha changed to 0.1 by default.
def leaky_rel(x, alpha=0.1): return tf.nn.leaky_relu(x, alpha=alpha)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def leaky_relu(x, alpha=0.01):\n return tf.maximum(x,alpha*x)", "def leaky_relu(x, alpha, name=None):\n import tensorflow as tf\n with tf.name_scope(name, 'leaky_relu_{}'.format(alpha)):\n return tf.nn.relu(x) - alpha * tf.nn.relu(-x)", "def leaky_relu(x, alpha=0.01):\n return tf.maximum(x, ...
[ "0.80525506", "0.79926425", "0.79449296", "0.7752299", "0.7493365", "0.74143517", "0.7252294", "0.7196845", "0.70634973", "0.6996927", "0.69214845", "0.6861359", "0.6680064", "0.6650479", "0.6591281", "0.6586597", "0.64699894", "0.6449589", "0.64443", "0.638058", "0.6357944",...
0.7905869
3
Do a quick gaussian blur on an image.
def blur(img, kern=(3, 3)): return cv2.GaussianBlur(img, kern, 0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def smooth_gauss(image, variance=2, kernel_size=(9, 9)):\n return cv2.GaussianBlur(image, kernel_size, variance)", "def run_gaussian_smoothing(image, kernel_size=5):\n return cv2.GaussianBlur(image, (kernel_size, kernel_size), 0)", "def gaussian_blur(img, kernel_size):\n return cv2.GaussianBlur(img, (...
[ "0.8126518", "0.7797927", "0.77884144", "0.77884144", "0.77884144", "0.77884144", "0.77884144", "0.77884144", "0.77884144", "0.77884144", "0.77884144", "0.77884144", "0.77884144", "0.77884144", "0.77884144", "0.77884144", "0.77884144", "0.7773319", "0.7741339", "0.7693843", "...
0.7297827
28
Calculates the apparent magnitude of an object given the measured and catalog values of some standard candle.
def compute_obj_mag(obj_flux, candle_flux, candle_mag): instrument_mag = -2.5 * np.log10(candle_flux) offset = instrument_mag - candle_mag return -2.5 * np.log10(obj_flux) - offset
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apparent_magnitude(sat, topos, earth, sun, time):\n\n position = earth + sat\n observer = earth + topos\n barycentric_o = position.at(time).observe(observer)\n barycentric_s = position.at(time).observe(sun)\n phase_angle = barycentric_o.separation_from(barycentric_s).radians\n _, _, distance ...
[ "0.6531491", "0.6211478", "0.61837965", "0.6045733", "0.6015871", "0.5945818", "0.5897963", "0.58891606", "0.58810604", "0.57912004", "0.57692724", "0.5756854", "0.57400006", "0.57351846", "0.5706006", "0.57059735", "0.56903374", "0.5670171", "0.56684154", "0.5656018", "0.559...
0.7379322
0
Plots subimage to a window.
def show(self): plt.close() # Remove any existing plot plt.imshow( self.data, extent=[ self.c - self.radius, self.c + self.radius, self.r + self.radius, self.r - self.radius, ], ) plt.col...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot(self):\n self.fig = plt.figure('black hole')\n self.fig.clf() #clear the graph to avoir superposing data from the same set (can be deactivated if need to superpose)\n self.ax = plt.subplot()\n\n if self.img2 is not None:\n self.ax.imshow(self.img2)\n else:\n ...
[ "0.6585604", "0.6476631", "0.646777", "0.63921666", "0.63867915", "0.6375552", "0.62475246", "0.6098657", "0.6098657", "0.6098657", "0.6098135", "0.60468364", "0.602167", "0.5978065", "0.5967192", "0.59639806", "0.5942982", "0.5904141", "0.59006065", "0.5898086", "0.5890351",...
0.0
-1
String representation of the City model instance.
def __repr__(self): return f'<Venue {self.id} {self.name} {self.state_name}>'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_string(self):\n return \"Address: {city} {state} {country}\".format(\n city=self.city,\n state=self.state,\n country=self.country\n )", "def __str__(self):\n return super().__str__() + self.model.__str__()", "def __str__ (self) :\n\n return se...
[ "0.7304293", "0.6916136", "0.6912027", "0.69046444", "0.6883636", "0.6883636", "0.68643653", "0.68110955", "0.6763266", "0.6754198", "0.67477196", "0.67440134", "0.6717281", "0.6716404", "0.6708341", "0.67007923", "0.6694687", "0.6676734", "0.66614", "0.6646527", "0.66329914"...
0.0
-1
String representation of the Venue model instance.
def __repr__(self): return f'<Venue {self.id} {self.name}>'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __repr__(self):\n return f'<Venue {self.id} {self.name} {self.state_name}>'", "def __repr__(self):\n\n\t\treturn f\"<Venue id={self.venue_id} city={self.city} name={self.city} country={self.country_code} description={self.description} status={self.status} length={self.length} turns={self.turns} latitu...
[ "0.77340204", "0.7712625", "0.7271824", "0.7016513", "0.7004695", "0.6943402", "0.68710244", "0.6862498", "0.6862498", "0.68609613", "0.6812589", "0.6811955", "0.6789128", "0.67781144", "0.6772795", "0.6735792", "0.6735792", "0.6735792", "0.6735792", "0.6735792", "0.6735792",...
0.79395324
0
Get upcoming shows list of current artist.
def upcoming_shows(self): upcoming_shows = Show.query.filter(Show.start_time > datetime.now(), Show.artist_id == self.id).all() return [show.serialized_data for show in upcoming_shows]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def past_shows(self):\n upcoming_shows = Show.query.filter(Show.start_time < datetime.now(), Show.artist_id == self.id).all()\n return [show.serialized_data for show in upcoming_shows]", "def upcoming_shows(self):\n upcoming_shows = Show.query.filter(Show.start_time > datetime.now(), Show.ve...
[ "0.76951236", "0.7589596", "0.72486675", "0.6503909", "0.6481537", "0.6454226", "0.644768", "0.6444269", "0.6391697", "0.6347712", "0.62461483", "0.6217654", "0.6139426", "0.6067543", "0.60469717", "0.6035985", "0.60318226", "0.60066307", "0.5958003", "0.59344584", "0.592027"...
0.8177529
0
String representation of the Artist model instance.
def __repr__(self): return f'<Artist {self.id} {self.name}>'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __repr__(self):\n\n mod = f\"{self.__class__.__name__} Model\"\n try:\n mod += f': {self.filename}'\n except AttributeError:\n pass\n s = [mod]\n for name, v in self.metadata.items():\n s += [f\"{name:16} : {v}\"]\n return '\\n'.join(s)...
[ "0.72941595", "0.71699774", "0.7030813", "0.69912463", "0.68484235", "0.68144685", "0.6812806", "0.68028337", "0.6789436", "0.6789286", "0.67453915", "0.6656143", "0.66371936", "0.6595155", "0.6595155", "0.6595155", "0.6595155", "0.6595155", "0.65605164", "0.6544952", "0.6537...
0.7856273
0
String representation of the Show model instance.
def __repr__(self): return f'<Show {self.id} {str(self.start_time)}>'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n return super().__str__() + self.model.__str__()", "def __str__(self):\n model = self._meta.verbose_name.title()\n title = self.extended_object.get_title()\n return f\"{model:s}: {title:s}\"", "def __str__(self):\n return \"DataModel(name={},attributes={},...
[ "0.77951896", "0.7482265", "0.74616283", "0.74577326", "0.7442753", "0.7442753", "0.7426323", "0.74237216", "0.7422453", "0.7393438", "0.7393438", "0.73930997", "0.7350342", "0.73491806", "0.73491806", "0.73491806", "0.73491806", "0.73491806", "0.7344203", "0.73250407", "0.73...
0.7213092
27
Compare with another object.
def __eq__(self, other: Any) -> bool: return isinstance(other, URI) and str(self) == str(other)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cmp ( self, object1, object2 ):\n return cmp( self.get_raw_value( object1 ),\n self.get_raw_value( object2 ) )", "def cmp ( self, object1, object2 ):\n return cmp( object1[ self.index ], object2[ self.index ] )", "def __cmp__(self, other_code_object):\n # If our 'com...
[ "0.762473", "0.7613882", "0.7363944", "0.73189265", "0.73189265", "0.73189265", "0.7303699", "0.7303699", "0.7216503", "0.7216503", "0.719504", "0.71596247", "0.7152792", "0.71477723", "0.71477723", "0.71477723", "0.71477723", "0.71477723", "0.71477723", "0.71477723", "0.7147...
0.0
-1
Compare with another object.
def __eq__(self, other: Any) -> bool: return ( isinstance(other, EnvelopeContext) and self.connection_id == other.connection_id and self.uri == other.uri )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cmp ( self, object1, object2 ):\n return cmp( self.get_raw_value( object1 ),\n self.get_raw_value( object2 ) )", "def cmp ( self, object1, object2 ):\n return cmp( object1[ self.index ], object2[ self.index ] )", "def __cmp__(self, other_code_object):\n # If our 'com...
[ "0.762473", "0.7613882", "0.7363944", "0.73189265", "0.73189265", "0.73189265", "0.7303699", "0.7303699", "0.7216503", "0.7216503", "0.719504", "0.71596247", "0.7152792", "0.71477723", "0.71477723", "0.71477723", "0.71477723", "0.71477723", "0.71477723", "0.71477723", "0.7147...
0.0
-1
Get address of receiver.
def to(self) -> Address: return self._to
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_address(self):\n \n return self._addr", "def get_address(self):\n \n return self._addr", "def get_address(self):\n \n if self._addr == None:\n return self._socket.getpeername()\n return self._addr", "def get_address(self):\n if self.a...
[ "0.7618283", "0.7618283", "0.746994", "0.7261091", "0.7188633", "0.7112171", "0.69569093", "0.69393903", "0.6905081", "0.68309414", "0.6828146", "0.67971253", "0.67554", "0.6751669", "0.6751669", "0.6751669", "0.6751669", "0.6751669", "0.67439055", "0.6729098", "0.6716069", ...
0.6202332
55
Get address of sender.
def sender(self) -> Address: return self._sender
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sender(self):\n key, alt = ('Sender', 'From') if not self.resent else \\\n ('Resent-Sender', 'Resent-From')\n value = self.get(key) or self.get(alt)\n _, addr = getaddresses([value])[0]\n return addr", "def get_address(self):\n \n if self._addr == N...
[ "0.8083071", "0.76276594", "0.7247431", "0.7247431", "0.71350235", "0.708967", "0.6983083", "0.6948125", "0.69183254", "0.6910468", "0.67712796", "0.6724256", "0.6711023", "0.67036957", "0.6691818", "0.6643035", "0.66367733", "0.6610175", "0.65805316", "0.6574633", "0.6534134...
0.7855265
1
Get the protocolspecific message.
def message(self) -> Union[Message, bytes]: return self._message
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_message(self):\n return self.msg", "def get_message(self):\n data = self.socket.recv(1024)\n if not data:\n logging.error('Failed to read data from socket')\n return\n\n return self.decode_message(data)", "def protocol(self) -> MessageProtocol:\n ...
[ "0.72864074", "0.71999866", "0.7192544", "0.7158122", "0.7081583", "0.7081583", "0.69952434", "0.69528997", "0.68255633", "0.6751695", "0.6751695", "0.67385274", "0.67339796", "0.67339796", "0.67138207", "0.67053795", "0.66678864", "0.6621161", "0.6617188", "0.6613193", "0.65...
0.6310122
33
Get the protocolspecific message.
def message_bytes(self) -> bytes: if isinstance(self._message, Message): return self._message.encode() return self._message
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_message(self):\n return self.msg", "def get_message(self):\n data = self.socket.recv(1024)\n if not data:\n logging.error('Failed to read data from socket')\n return\n\n return self.decode_message(data)", "def protocol(self) -> MessageProtocol:\n ...
[ "0.72864074", "0.71999866", "0.7192544", "0.7158122", "0.7081583", "0.7081583", "0.69952434", "0.69528997", "0.68255633", "0.6751695", "0.6751695", "0.67385274", "0.67339796", "0.67339796", "0.67138207", "0.67053795", "0.66678864", "0.6621161", "0.6617188", "0.6613193", "0.65...
0.0
-1
Compare with another object.
def __eq__(self, other: Any) -> bool: return ( isinstance(other, Envelope) and self.to == other.to and self.sender == other.sender and self.protocol_specification_id == other.protocol_specification_id and self.message == other.message and s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cmp ( self, object1, object2 ):\n return cmp( self.get_raw_value( object1 ),\n self.get_raw_value( object2 ) )", "def cmp ( self, object1, object2 ):\n return cmp( object1[ self.index ], object2[ self.index ] )", "def __cmp__(self, other_code_object):\n # If our 'com...
[ "0.762473", "0.7613882", "0.7363944", "0.73189265", "0.73189265", "0.73189265", "0.7303699", "0.7303699", "0.7216503", "0.7216503", "0.719504", "0.71596247", "0.7152792", "0.71477723", "0.71477723", "0.71477723", "0.71477723", "0.71477723", "0.71477723", "0.71477723", "0.7147...
0.0
-1
Get the string representation of an envelope.
def __str__(self) -> str: return "Envelope(to={to}, sender={sender}, protocol_specification_id={protocol_specification_id}, message={message})".format( to=self.to, sender=self.sender, protocol_specification_id=self.protocol_specification_id, message="{!r}".format(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dumps(structure):\n buffer = []\n env = { 'envelope': structure }\n __descend(buffer, 0, env)\n return \"\".join(buffer)", "def tostring(self):\n header, body = None, None\n\n if self._header:\n header = b'<?xml version=\"1.0\" encoding=\"utf-8\"?>'\n\n if self._ma...
[ "0.674651", "0.63018584", "0.6250627", "0.61731416", "0.59367156", "0.59367156", "0.5827394", "0.579237", "0.57641184", "0.57167494", "0.57167494", "0.57167494", "0.57167494", "0.57167494", "0.57167494", "0.57167494", "0.57167494", "0.57167494", "0.57167494", "0.57167494", "0...
0.7034442
0
return list of elements that exists only in list A but not in B
def difference(a, b): c = [i for i in a + b if i not in a or i not in b] return c
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def difference(a, b):\n return list(filterfalse(lambda x: x in b, a))", "def list_subtract(a, b):\n a_only = list(a)\n for x in b:\n if x in a_only:\n a_only.remove(x)\n return a_only", "def subtraction_list(a , b):\n\n c = [i for i in list_a if i not in list_b]\n\n return(c...
[ "0.7633952", "0.7135928", "0.7069993", "0.6961386", "0.6897351", "0.6894724", "0.68783104", "0.67009443", "0.6613386", "0.6610032", "0.6600514", "0.65871257", "0.65689933", "0.65508705", "0.6535918", "0.65235204", "0.64354485", "0.6414254", "0.6395312", "0.63871044", "0.63856...
0.68996155
4
Make x y two dim list with '' values in it
def make_two_dim_list(number_of_lists, number_of_points_in_list): z = [[''] * number_of_points_in_list for i in range(number_of_lists)] return z
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create2d(row_count, col_count, value=None):\n a = [None] * row_count\n for row in range(row_count):\n a[row] = [value] * col_count\n return a", "def lrepr(self):\n return [self.coord1, self.coord2] if self.__dim == 2 else \\\n [self.coord1, self.coord2, self.coord3]", "...
[ "0.633943", "0.6227869", "0.6193736", "0.6169322", "0.607285", "0.60409284", "0.6020129", "0.5997472", "0.5912802", "0.5862278", "0.5857195", "0.58335567", "0.5829755", "0.5783023", "0.578225", "0.57819974", "0.575235", "0.5746532", "0.57448775", "0.5719083", "0.57106006", ...
0.6370906
0
Return a string representing the type of vehicle this is.
def print_abs_type(self): return 'HI'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vehicle_type():\n pass", "def vehicle_type(self):\n pass", "def vehicle_type(self):\n return 'car'", "def vehicle_type(self):\n return 'car'", "def vehicle_type(self):\n return 'car'", "def vehicle_type(self):\n return 'truck'", "def vehicle_type(self):\n ...
[ "0.8265945", "0.8171127", "0.79946303", "0.79946303", "0.79946303", "0.78402793", "0.78402793", "0.7387936", "0.7387936", "0.7387936", "0.7387936", "0.7387936", "0.7387936", "0.7387936", "0.7387936", "0.7387936", "0.7387936", "0.7387936", "0.7387936", "0.7387936", "0.7387936"...
0.0
-1
Return a string representing the type of vehicle this is.
def print_abs_type(self): return 'SubSystem'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vehicle_type():\n pass", "def vehicle_type(self):\n pass", "def vehicle_type(self):\n return 'car'", "def vehicle_type(self):\n return 'car'", "def vehicle_type(self):\n return 'car'", "def vehicle_type(self):\n return 'truck'", "def vehicle_type(self):\n ...
[ "0.8264676", "0.81698346", "0.7994656", "0.7994656", "0.7994656", "0.78400844", "0.78400844", "0.738759", "0.738759", "0.738759", "0.738759", "0.738759", "0.738759", "0.738759", "0.738759", "0.738759", "0.738759", "0.738759", "0.738759", "0.738759", "0.738759", "0.738759", ...
0.0
-1
Updates the view offset based on the center of the screen.
def setCenter(self, value): self._viewCenter = b2.b2Vec2(*value) self._viewCenter *= self._viewZoom self._viewOffset = self._viewCenter - self.screenSize/2
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def center(self):\r\n self.centerx = self.screen_rect.centerx \r\n self.centery = self.screen_rect.centery", "def update(self): \n super().update()\n if self.center_x < constants.left_limit:\n self.center_x = self.screen_width + constants.offscreen_space\n if self.cen...
[ "0.73102534", "0.72775304", "0.70998013", "0.6961202", "0.6942405", "0.6860998", "0.68110615", "0.6777373", "0.6732383", "0.6708982", "0.66924673", "0.66924673", "0.6674286", "0.6643728", "0.6643728", "0.66400164", "0.6606953", "0.65825343", "0.65825343", "0.65825343", "0.651...
0.730855
1
Store the start time
def set_start_time(self, timestamp): self.start_day = int(timestamp[8:10]) hour = int(timestamp[11:13]) minute = int(timestamp[14:16]) second = int(timestamp[17:19]) usecond = float(int(timestamp[21:])) / 1000000 self.start_time = float(hour * 3600 + minute * 60 + second)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_start_time():\n __start = current_time_milli()", "def start_time(self):\n pass", "def start_time(self) -> float:\r\n ...", "def start(self):\r\n self.start_time = time.time()", "def start_time(self, start_time):\n self._start_time = start_time", "def start_time(self, st...
[ "0.82752585", "0.82677233", "0.81328845", "0.8125686", "0.8039249", "0.8039249", "0.7970167", "0.78758496", "0.78758496", "0.78758496", "0.78758496", "0.78758496", "0.7862989", "0.7824047", "0.77697295", "0.7720857", "0.7720857", "0.7720857", "0.7720857", "0.7720857", "0.7720...
0.725419
48
Returns starting state of the board.
def initial_state(): return [[EMPTY, EMPTY, EMPTY], [EMPTY, EMPTY, EMPTY], [EMPTY, EMPTY, EMPTY]]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_state(self):\r\n return np.zeros(self.board_size, dtype=np.int8)", "def start_state():\n return chess.Board()", "def startingState(self):\n # Returns starting position and 4 false because no corners are visited yet\n return (self.startingPosition, (False, False, False, False))...
[ "0.8081514", "0.7890486", "0.7534929", "0.72789717", "0.72789717", "0.72262055", "0.72262055", "0.72262055", "0.72262055", "0.72262055", "0.72262055", "0.72262055", "0.72262055", "0.72262055", "0.72262055", "0.72262055", "0.72262055", "0.72262055", "0.72262055", "0.72262055", ...
0.0
-1
Returns player who has the next turn on a board.
def player(board): if terminal(board) == True: return None countO, countX = 0, 0 for i in range(3): for j in range(3): if board[i][j] == X: countX += 1 elif board[i][j] == O: countO += 1 if countO >= countX: return X ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next_player(board, prev_player):\n opp = Othello.opponent(prev_player)\n if Othello.any_legal_move(opp, board):\n return opp\n elif Othello.any_legal_move(prev_player, board):\n return prev_player\n return None", "def next_player(self,board, prev_player):\r\n...
[ "0.79088944", "0.75199264", "0.7417399", "0.73678493", "0.719489", "0.6975714", "0.6962515", "0.69239026", "0.6918084", "0.6898119", "0.68501276", "0.68410057", "0.6837679", "0.6824917", "0.67710704", "0.67710704", "0.6766936", "0.6711427", "0.67082745", "0.66566026", "0.6611...
0.0
-1
Returns the optimal action for the current player on the board.
def minimax(board): if terminal(board) == True: return None elif player(board) == X: action = maxit(board)[1:] elif player(board) == O: action = minit(board)[1:] return action
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_best_action(self):\n if self.bestAction is None:\n self.calculate_best_action()\n return self.bestAction", "def getAction(self, gameState: GameState):\n _max = float(\"-inf\")\n action = None\n for move in gameState.getLegalActions(0):\n util = min...
[ "0.7766856", "0.76323676", "0.75855315", "0.75285065", "0.75175256", "0.74667144", "0.7460485", "0.74263537", "0.7416421", "0.73943585", "0.7375846", "0.7333894", "0.73147565", "0.7306611", "0.7284639", "0.72650313", "0.72650313", "0.7250975", "0.72331834", "0.7203267", "0.71...
0.7144644
24
Return tuple (utility, i, j) where (i, j) represents the move with the minimum utility and utility represents that minimum utility, given the board board.
def minit(board): minval = 2 row_index = None col_index = None # if terminal board, terminate the function. if terminal(board) == True: result = utility(board) return (result, 0, 0) # for each possible move, calculate its utility, saving the minimum. for i in range(0, 3): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def firstMove(board):\r\n x = board.size / 2\r\n return (x, x)", "def utility(board):\n return utility_map[winner(board)]", "def _min(self, board: Board) -> (float, int):\n\n #\n # First we check if we have seen this board position before, and if yes just return the cached value\n ...
[ "0.6896989", "0.6810057", "0.6700318", "0.6450558", "0.6429713", "0.64233893", "0.6407684", "0.6405761", "0.6383748", "0.6382555", "0.6351855", "0.63290083", "0.62967384", "0.62944794", "0.6292816", "0.62923044", "0.6264656", "0.62461305", "0.6224251", "0.6211949", "0.6192992...
0.7353371
0
Sets the charge_group_id of this RefundRequestBreakUpItem.
def charge_group_id(self, charge_group_id): self._charge_group_id = charge_group_id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def group_id(self, group_id):\n\n self._group_id = group_id", "def group_id(self, group_id):\n\n self._group_id = group_id", "def group_id(self, group_id):\n\n self._group_id = group_id", "def group_id(self, group_id):\n\n self._group_id = group_id", "def group_id(self, group_id...
[ "0.668687", "0.668687", "0.668687", "0.668687", "0.668687", "0.668687", "0.6168282", "0.6028392", "0.6028392", "0.6028392", "0.6018705", "0.59898925", "0.5987983", "0.5912117", "0.5900073", "0.58515054", "0.5842612", "0.5811728", "0.58039033", "0.57326233", "0.57115966", "0...
0.8028447
0
Sets the security_user_id of this RefundRequestBreakUpItem.
def security_user_id(self, security_user_id): self._security_user_id = security_user_id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_id(self, user_id):\n\n self._user_id = user_id", "def user_id(self, user_id):\n\n self._user_id = user_id", "def user_id(self, user_id):\n\n self._user_id = user_id", "def user_id(self, user_id):\n\n self._user_id = user_id", "def user_id(self, user_id):\n\n self...
[ "0.6214704", "0.6214704", "0.6214704", "0.6214704", "0.6214704", "0.6214704", "0.6214704", "0.6214704", "0.6214704", "0.6214704", "0.6214704", "0.6214704", "0.6214704", "0.6214704", "0.6119607", "0.59191567", "0.5782431", "0.563117", "0.5561852", "0.55523545", "0.55523545", ...
0.761579
0
Sets the created_by_security_user_id of this RefundRequestBreakUpItem.
def created_by_security_user_id(self, created_by_security_user_id): self._created_by_security_user_id = created_by_security_user_id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def created_by(self, created_by):\n\n self._created_by = created_by", "def created_by(self, created_by):\n\n self._created_by = created_by", "def created_by(self, created_by):\n\n self._created_by = created_by", "def created_by(self, created_by):\n\n self._created_by = created_by"...
[ "0.6548153", "0.6548153", "0.6548153", "0.6548153", "0.6548153", "0.6548153", "0.64006186", "0.63229865", "0.62986654", "0.61275554", "0.61150676", "0.61150676", "0.5920104", "0.5920104", "0.5920104", "0.5920104", "0.5832952", "0.58056253", "0.5644031", "0.56397736", "0.55688...
0.7538895
0
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, RefundRequestBreakUpItem): 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.84568954", "0.83923674", "0.81447554", "0.81407183", "0.81326675", "0.80941343", "0.8092415", "0.8092415", "0.8092415", "0.8085536", "0.8085536", "0.8076502", "0.8076502", "0.8066026" ]
0.0
-1
Check the query string parameter is allowed or should be removed.
def _is_param_allowed(self, param, value): if param.startswith("utm_"): return False if param == "spref" and value == "tw": return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_uncased(request) -> bool:\n return request.param", "def query_params_sanitize(query_params):\n def allow_func(n, v):\n # This gets rid of any params beginning with \"oauth_\"\n if not n.startswith(\"oauth_\"):\n return True\n else:\n logging.warning(\"Protoco...
[ "0.668178", "0.667525", "0.64733666", "0.6468181", "0.63959676", "0.6314691", "0.6279993", "0.62287086", "0.61140823", "0.6099023", "0.60848767", "0.6079547", "0.601698", "0.601698", "0.60128665", "0.6008308", "0.59997356", "0.599811", "0.595535", "0.5944981", "0.59124076", ...
0.6577006
2
Clean the given URL.
def clean_url(self, url): if self.is_blacklisted(url): return None # If the URL was untinyfied we need to start over. extracted = self.untiny.extract(url) if extracted != url: return self.clean_url(extracted) redirects_to = self.follow_redirects(extracte...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_url(url):\n scheme, netloc, path, query, fragment = url_parse.urlsplit(url)\n path = url_parse.quote(path)\n url = url_parse.urlunsplit((scheme, netloc, path, query, fragment))\n return url", "def _clean_url(self, url):\n return \"\".join(url.split(\"?\")[:1])", "def clean_url(url)...
[ "0.801504", "0.79892147", "0.7761624", "0.76837766", "0.75280935", "0.7390052", "0.7334529", "0.72802687", "0.7245754", "0.7230822", "0.72074914", "0.7204729", "0.7145431", "0.7137376", "0.71047664", "0.6884523", "0.68456733", "0.6833181", "0.6807046", "0.67996746", "0.676993...
0.77442855
3
Makes sure the absolute path is added to the bottle template files global
def include_abs_path_in_templates(file_path): template_path = get_abs_path(file_path, 'views') TEMPLATE_PATH.insert(0, template_path)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_templates(self):\n self.libs[\"template\"] = (\"#libs/templates/include\", None, \"\")\n self[\"CPPPATH\"].append(\"#libs/templates/include\")", "def get_template_path(relative_path, **kwargs): # lint-amnesty, pylint: disable=unused-argument\n return relative_path", "def html_templa...
[ "0.64122564", "0.6379324", "0.63452774", "0.6175168", "0.61669165", "0.6155688", "0.6089532", "0.60713017", "0.603411", "0.60281646", "0.6013094", "0.6001903", "0.5901084", "0.5901002", "0.5877754", "0.5831337", "0.5822694", "0.5819203", "0.5794728", "0.5781366", "0.5759009",...
0.69305766
0
Get enum element by core mask.
def fromCoreEmotion(coreMask: CoreMask) -> "MaskState": if coreMask == CoreMask.NoMask: return MaskState.Missing if coreMask == CoreMask.Mask: return MaskState.MedicalMask if coreMask == CoreMask.OccludedFace: return MaskState.Occluded raise RuntimeErr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_enumerations_from_bit_mask(enumeration, mask):\n return [x for x in enumeration if (x.value & mask) == x.value]", "def __getitem__(self, key):\n try:\n if utils.is_str(key):\n key = utils.force_name_case(key)\n return next(enum for enum in self if enum.n...
[ "0.6204872", "0.5842061", "0.56393087", "0.5600411", "0.5474189", "0.54355806", "0.5324193", "0.53138506", "0.52949286", "0.5244011", "0.52304053", "0.5228535", "0.52173483", "0.5181734", "0.5162053", "0.51483774", "0.5113189", "0.5094201", "0.5089052", "0.5089052", "0.504170...
0.58328825
2
Get a Product by it's Type instead of Name.
def GetProductByType(self, sProductType): for p in self.Products.itervalues(): if p.Type == sProductType: return p return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_product(self):\n try:\n return self.activities[industry.MANUFACTURING].products[0].typeID\n except (KeyError, IndexError):\n return None", "def get(self, typename):\n return self.products.setdefault(typename, Products.ProductMapping(typename))", "def get_product(...
[ "0.68648094", "0.6820259", "0.6774459", "0.6762229", "0.6700315", "0.6675385", "0.658021", "0.64660287", "0.64358795", "0.6319597", "0.62767184", "0.6232248", "0.6218744", "0.62163055", "0.6171077", "0.6106671", "0.6040627", "0.5998399", "0.5995556", "0.5966858", "0.5959658",...
0.7740967
0
Return the first nonNone value from the iterator.
def _first_non_none_value(items: Iterable[tuple[bool | None, str] | None]) -> tuple[bool, str]: for item_opt in items: if item_opt is not None: item, reason = item_opt if item is not None: return item, reason return False, "default"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_next_as_optional(iterator):\n return iterator.get_next_as_optional()", "def first(self):\n try:\n return self.next()\n except StopIteration:\n return None", "def first_value(self):\n if not self.is_empty():\n return self.data[self.head]\n re...
[ "0.81334937", "0.7775944", "0.76339", "0.74998116", "0.7386747", "0.7325384", "0.7305718", "0.72354954", "0.72288877", "0.7223604", "0.7182362", "0.7094297", "0.7094297", "0.6998806", "0.6958998", "0.6917823", "0.68897766", "0.6870175", "0.6838372", "0.68376744", "0.6809466",...
0.71926254
10
Repeat elements of an array.
def repeat(a, repeats, axis=0): a = numpoly.aspolynomial(a) result = numpy.repeat(a.values, repeats=repeats, axis=axis) return numpoly.aspolynomial(result, names=a.indeterminants)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def repeat(a, repeats, axis=None):\n return afnumpy.asarray(a).repeat(repeats, axis=axis)", "def rep(\n x: Any,\n times: IntOrIter = 1,\n length: int = None, # pylint: disable=redefined-outer-name\n each: int = 1,\n) -> ArrayLikeType:\n if is_scalar(x):\n x = [x]\n if is_iterable(tim...
[ "0.77669495", "0.6952881", "0.68815815", "0.67514676", "0.6715123", "0.6682219", "0.66743696", "0.65719515", "0.65643", "0.6558338", "0.65580964", "0.6512198", "0.64070255", "0.6353142", "0.62469375", "0.62239957", "0.6217", "0.6207992", "0.618354", "0.6103445", "0.6020468", ...
0.661403
7
Draw detected bounding boxes.
def get_max(im, class_name, dets, thresh=0.5): inds = np.where(dets[:, -1] >= thresh)[0] max_inds = 0 max_score = 0.0 if len(inds) == 0: # print('Warning: no target detected!') return elif len(inds) > 1: # print('Warning: ' + str(len(inds)) + ' targets detected! Choose the high...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw_bounding_boxes(self, bounding_boxes, output):\n for i, bb in enumerate(bounding_boxes):\n\n if bb[2] > output.shape[1] or bb[3] > output.shape[0] or bb[0] < 0 or bb[1] < 0:\n continue\n cv2.rectangle(\n np.asarray(output), (bb[0], bb[1]), (bb[2], ...
[ "0.77598673", "0.7638101", "0.7510348", "0.72977304", "0.7150563", "0.7103931", "0.7101873", "0.7083905", "0.7020769", "0.6993739", "0.6974172", "0.69637305", "0.6859061", "0.68521667", "0.68319523", "0.6830371", "0.6809837", "0.6805064", "0.67750585", "0.6774759", "0.6742592...
0.0
-1
Draw detected bounding boxes.
def vis_detections(im, class_name, dets, image_name, thresh=0.5): inds = np.where(dets[:, -1] >= thresh)[0] max_inds = 0 max_score = 0.0 if len(inds) == 0: # print('Warning: no target detected!') return elif len(inds) > 1: # print('Warning: ' + str(len(inds)) + ' targets detect...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw_bounding_boxes(self, bounding_boxes, output):\n for i, bb in enumerate(bounding_boxes):\n\n if bb[2] > output.shape[1] or bb[3] > output.shape[0] or bb[0] < 0 or bb[1] < 0:\n continue\n cv2.rectangle(\n np.asarray(output), (bb[0], bb[1]), (bb[2], ...
[ "0.7760377", "0.7638606", "0.7509239", "0.7299291", "0.7151098", "0.7104516", "0.7102629", "0.7085159", "0.7021271", "0.69941986", "0.697518", "0.69644916", "0.6859386", "0.6853273", "0.68326604", "0.68315536", "0.68102115", "0.68052995", "0.6775847", "0.6775714", "0.67440426...
0.0
-1
Return the number of arcs in the DAG.
def num_arcs(self): return len(self.arcs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_num_arcs(self):\n num_arcs = 0\n for node in self._nodes.values(): num_arcs += node._deg\n return (num_arcs / 2) + 1", "def get_num_arcs(self):\n num_arcs = 0\n for node in self._nodes.values(): num_arcs += node._deg\n return (num_arcs / 2) + 1", "def num_arcs(...
[ "0.77381676", "0.77381676", "0.76919484", "0.72843695", "0.7006593", "0.6996576", "0.6918832", "0.6716626", "0.67080903", "0.67025733", "0.66952705", "0.66868395", "0.66809255", "0.66662467", "0.66513133", "0.66351557", "0.66348517", "0.6629658", "0.6626222", "0.6624958", "0....
0.76032966
3
Compute backward variable for all arcs in the lattice. Store beta value on each arc.
def backward(self, aw, lw): # This can be accelerated by storing beta for nodes without recomputing for vx in self.traverse_arcs_topo(reverse=True): # Beta for arcs into </s> = 1.0 if len(vx.dest.exits) == 0: beta = 0 else: beta = LOGZE...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def backwardVariableGeneration(self):\n self.beta = zeros((self.noOfEmmittingStates+2, self.T + 1))\n\n # initialisation\n for j in range(self.noOfEmmittingStates+1):\n self.beta[j,-1] = self.transitionMatrix[j,-1]\n self.beta[-1,-1] = 1.0\n\n # main recursion\n for t in range(self.T, 1, -1)...
[ "0.6616474", "0.6533678", "0.6272543", "0.6272543", "0.6272154", "0.6137506", "0.61235636", "0.6106762", "0.60796076", "0.6060276", "0.6039843", "0.6026853", "0.600505", "0.5973358", "0.5966961", "0.5937605", "0.5894681", "0.58945334", "0.5889684", "0.58734095", "0.5868023", ...
0.6948557
0
This is the constructor for the Main Window class
def __init__(self, *args, **kwargs): super(MainWindow, self).__init__(*args, **kwargs) self.setupUi(self) self.outputString = "" #this will be the content of the textEdit widget self.stopSim = False self.numBarriers = 10 #the default number of barriers self.createSim() self.sld...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n self.window = Tk() # The main window\n self.__initialize_variables__() # Initialize the variables\n self.__initialize_menu__() # Initialize the Menu\n self.__initialize_status_bar__()\n self.__initialize_gui__() # Initialize the GUI widgets",...
[ "0.76982", "0.7693823", "0.74358517", "0.74062794", "0.739473", "0.7377134", "0.7264559", "0.7252969", "0.7206408", "0.7173788", "0.71735656", "0.7131486", "0.7131486", "0.7131486", "0.7131486", "0.7131486", "0.71152717", "0.7086129", "0.70764524", "0.70517886", "0.70286393",...
0.0
-1
Asks user to specify a city, month, and day to analyze.
def get_filters(): print('Hello! Let\'s explore some US bikeshare data!') # get user input for city (chicago, new york city, washington). HINT: Use a while loop to handle invalid inputs while True: city = input("Please enter a city ('chicago', 'new york city' or 'washington'): ").lower() if ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Raw_Data(city,month,day):\n print(\"The city you have entered is: \",city)\n print(\"The month you have entered is: \",month)\n print(\"The day you have entered is: \",day)", "def get_filters():\n city = None\n month = None\n day = None\n while day == None:\n # TO DO: get user input f...
[ "0.66709363", "0.6536631", "0.6460791", "0.6373951", "0.6349272", "0.6310802", "0.6287722", "0.62607133", "0.6230896", "0.6212277", "0.62065274", "0.61828023", "0.6171454", "0.61700225", "0.6159926", "0.6158883", "0.6154618", "0.61455905", "0.6130836", "0.61063856", "0.610411...
0.5691864
93
Loads data for the specified city and filters by month and day if applicable.
def load_data(city, month, day): #load the data of the specified city in a dataframe: df = pd.read_csv(CITY_DATA[city]) #convert the type of data in 'Start Time' column to datetime: df['Start Time'] = pd.to_datetime(df['Start Time']) #create new columns required to calculate time_stats: df['mo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_data(city, month, day):\n df = pd.read_csv(CITY_DATA [city])\n \n # convert the Start Time column to datetime\n df['Start Time'] = pd.to_datetime(df['Start Time'])\n \n # extract month and day of week from Start Time to create new columns\n df['month'] = df['Start Time'].dt.month\n ...
[ "0.81320685", "0.8108889", "0.8045821", "0.8042514", "0.80090284", "0.80071104", "0.79991937", "0.7998333", "0.7988789", "0.797905", "0.79737365", "0.79610896", "0.7956163", "0.7947432", "0.79463065", "0.7908287", "0.7908229", "0.7904569", "0.7900715", "0.78930074", "0.788921...
0.7666826
70
Displays statistics on the most frequent times of travel.
def time_stats(df): print('\nCalculating The Most Frequent Times of Travel...\n') start_time = time.time() # display the most common month print('Most Common Month:', months[df['month'].mode()[0] - 1].title()) # display the most common day of week print('Most Common Day of Week:', df['weekday...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def time_stats(df):\n\n print('\\nDisplaying the statistics on the most frequent times of '\n 'travel...\\n')\n start_time = time.time()\n\n # display the most common month\n most_common_month = df['Month'].mode()[0]\n print('For the selected filter, the month with the most travels is: ' +\...
[ "0.8023237", "0.8021888", "0.79149604", "0.78255546", "0.78211224", "0.78133345", "0.7739481", "0.773519", "0.77332956", "0.7685631", "0.7667726", "0.7650597", "0.76435405", "0.7638843", "0.76357967", "0.76242906", "0.762238", "0.7612054", "0.7599205", "0.75824374", "0.757876...
0.77648497
6
Displays statistics on the most popular stations and trip.
def station_stats(df): print('\nCalculating The Most Popular Stations and Trip...\n') start_time = time.time() # display most commonly used start station print('Most Common Start Station:', df['Start Station'].mode()[0]) # display most commonly used end station print('Most Common End Station:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def station_stats(df):\n\n print('\\nCalculating The Most Popular Stations and Trip...\\n')\n start_time = time.time()\n\n # display most commonly used start station\n print(popular_start_station(df))\n\n # display most commonly used end station\n print(popular_end_station(df))\n\n # display m...
[ "0.7815502", "0.76617634", "0.7553331", "0.7491147", "0.74459386", "0.7431019", "0.7423337", "0.74172765", "0.7400016", "0.7387015", "0.7385145", "0.73644745", "0.735896", "0.7356297", "0.73543596", "0.73516876", "0.73508674", "0.73499984", "0.7341763", "0.7340006", "0.733685...
0.747456
4
Displays statistics on the total and average trip duration.
def trip_duration_stats(df): print('\nCalculating Trip Duration...\n') start_time = time.time() # display total travel time print('Total Travel Time: {:.2f} minutes ({:.2f} hours)'.format((df['Trip Duration'].sum() / 60), (df['Trip Duration'].sum() / 3600))) # display mean travel time print('...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trip_duration_stats(data):\n print('\\nCalculating Trip Duration...\\n')\n start_time = time.time()\n # display total travel time\n total_trip_time= data['Trip Duration'].sum()\n print('The Total Travel Time is {} Hours'. format(total_trip_time/3600))\n # display mean travel time\n avg_tri...
[ "0.8143032", "0.8024939", "0.8004003", "0.7949475", "0.79372776", "0.79307956", "0.7926507", "0.79149866", "0.79077655", "0.79054105", "0.7900338", "0.78913456", "0.78892654", "0.78863764", "0.7884846", "0.78839767", "0.7882144", "0.7873669", "0.7868308", "0.78662425", "0.786...
0.7914229
8
Description of runway surface type. `None` if not available.
def surface_type(self) -> typing.Union[None, str]: surface_type = self.data[3] surface_type = re.findall(r'RWY surface: (.+)', surface_type) return surface_type[0] if surface_type else None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def surface_type(self):\n surf_type = BRepAdaptor_Surface(self.topods_shape()).GetType()\n if surf_type == GeomAbs_Plane:\n return \"plane\"\n if surf_type == GeomAbs_Cylinder:\n return \"cylinder\"\n if surf_type == GeomAbs_Cone:\n return \"cone\"\n ...
[ "0.7507535", "0.72148424", "0.7195458", "0.6143751", "0.6143751", "0.6143751", "0.6143751", "0.6143751", "0.6143751", "0.6143751", "0.6084334", "0.6082406", "0.6082406", "0.6082406", "0.6082406", "0.5947492", "0.5945889", "0.5938052", "0.5927999", "0.59271294", "0.58862174", ...
0.8337988
0
Helper to create an initialized Variable with weight decay. Note that the Variable is initialized with a truncated normal distribution. A weight decay is added only if one is specified.
def _variable_with_weight_decay(self, shape, stddev, wd): initializer = tf.truncated_normal_initializer(stddev=stddev) var = tf.get_variable('weights', shape=shape, initializer=initializer) # if wd and (not tf.get_variable_scope().reuse): # weight_decay ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _variable_with_weight_decay(name, shape, stddev, wd):\n var = variable(\n name,\n shape,\n initializer=tf.truncated_normal_initializer(stddev=stddev, dtype=tf.float32))\n if wd is not None:\n weight_decay = tf.multiply(tf.nn.l2_loss(var), wd, name='weight_loss')\n tf.ad...
[ "0.75140905", "0.74296427", "0.74266", "0.7331382", "0.7331382", "0.7315894", "0.7274919", "0.7273354", "0.7264724", "0.72545445", "0.7236805", "0.71951693", "0.7103249", "0.6969054", "0.6798497", "0.6731886", "0.67170817", "0.667655", "0.65635747", "0.6550742", "0.6547196", ...
0.7316302
5
Creates a new vertex with the provided information, unless a duplicate already exists in the database.
def create_vertex(c, gene_id, genome_build, chromosome, pos, vertices): # Check if the vertex exists. If yes, add current gene ID to it query = ",".join([genome_build, chromosome, str(pos)]) if query in vertices.keys(): vertices[query][-1].add(gene_id) existing_vertex_id = vertices[query][0]...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_vertex(self, vertex):\n if vertex.id not in self.vertices.keys():\n self.vertices[vertex.id] = vertex", "def add_vertex(self, vertex_id): # O(1) time complexity\n self.vertices[vertex_id] = set() \n\n # additional options (class)\n '''\n if vertex_id not in s...
[ "0.7023341", "0.69997436", "0.66771257", "0.6499531", "0.6479964", "0.64189965", "0.63731503", "0.63593644", "0.6349896", "0.63497716", "0.6342363", "0.63273233", "0.628484", "0.628484", "0.6282862", "0.62793756", "0.6236824", "0.62117344", "0.6182089", "0.6170562", "0.616551...
0.69866663
2
Adds double quotes around the input string
def str_wrap_double(s): s = str(s) return '"' + s + '"'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def quot(string):\r\n return string.replace('\"', \"'\")", "def DoubleQuote(s):\n if not s:\n return '\"\"'\n elif all(c in _SafeShellChars for c in s):\n return s\n else:\n return '\"' + s.replace('\"', '\\\\\"') + '\"'", "def wrap_with_in_single_quote(s):\n return \"'{}'\".format(s)...
[ "0.80197185", "0.75778174", "0.7558612", "0.7558612", "0.75216377", "0.7357164", "0.7242684", "0.72044283", "0.71444243", "0.7127985", "0.71047366", "0.7084999", "0.7076033", "0.7063414", "0.703575", "0.7034108", "0.70278805", "0.6994871", "0.6902698", "0.68954045", "0.684385...
0.7693009
1
Plot confusion matrix given X and y Note If X and y not given, use training data Return matplotlib figure object can be saved as obj.savefig('')
def plot_cmatrix(self, X=None, y=None, ): if X is None and y is None: y = self.ytrain elif X is not None and y is not None: if isinstance(y, pd.Series): y = self.le.transform(y) else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plotConfusionMatrix(y, pred, title, labels, outfile, cmap=plt.cm.Blues):\n \n cm = confusion_matrix(y, pred);\n ncm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis]\n accuracy = accuracy_score(y, pred)\n \n fig = plt.figure(figsize=(10, 10))\n plt.imshow(ncm, interpolation='nearest',...
[ "0.7488487", "0.7452592", "0.7442257", "0.73370373", "0.73056525", "0.7177896", "0.7162475", "0.7128709", "0.7097752", "0.7097081", "0.7062196", "0.7054716", "0.7037424", "0.7029118", "0.7016283", "0.70129234", "0.69759333", "0.69716394", "0.6941338", "0.6933181", "0.69289416...
0.0
-1
Reshape a `tensor` to conform to a given shape.Currently torch doesn't support 16 bit tensors on cpu.
def resize_3d(tensor: Tensor, output_shape: Sequence[int], resize_mode: str = 'nearest') -> Tensor: assert resize_mode in ['nearest', 'area'], "Only following resize modes are supported: 'nearest', 'area' " if tf.is_tensor(tensor): return resize_tensorflow_tensor(tensor, output_shape, resize_mode) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reshape(tensor, newshape):\n raise NotImplementedError", "def reshape(tensor):\n row = tf.shape(tensor)[0]\n shape_list = [row, -1]\n out = tf.reshape(tensor, shape_list)\n return out", "def _eager_reshape(tensor, shape, ctx):\n attr_t = tensor._datatype_enum() # pylint: disable=protec...
[ "0.7532104", "0.72616476", "0.6938396", "0.68288803", "0.6818953", "0.6656605", "0.6647852", "0.66264313", "0.64843637", "0.6467933", "0.6433559", "0.6390068", "0.63693494", "0.6363407", "0.63532853", "0.6296335", "0.62292653", "0.61924976", "0.6176196", "0.6147967", "0.61161...
0.5358701
77
Ensure that the user is not passing wrong keywords when using policy_kwargs.
def _kwargs_check(feature_extraction, kwargs): # When using policy_kwargs parameter on model creation, # all keywords arguments must be consumed by the policy constructor except # the ones for the cnn_extractor network (cf nature_cnn()), where the keywords arguments # are not passed expl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def permitted_kwargs(permitted):\n def _wraps(func):\n @functools.wraps(func)\n def _inner(name, description, kwargs):\n bad = [a for a in kwargs.keys() if a not in permitted]\n if bad:\n raise OptionException('Invalid kwargs for option \"{}\": \"{}\"'.format(\...
[ "0.6334507", "0.6229454", "0.61721796", "0.61313355", "0.6009598", "0.5985709", "0.59315604", "0.5828801", "0.5779185", "0.5775942", "0.5766666", "0.57441235", "0.57232225", "0.5720929", "0.5711281", "0.566734", "0.55992997", "0.5595112", "0.5579894", "0.5568484", "0.5567242"...
0.7995728
0
ground truth, in onehot format
def y_(self): return tf.placeholder(dtype=tf.float32, shape=(None, self._n_class), name='label')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def onehot(isTrue):\n if isTrue:\n return [1, 0]\n else:\n return [0, 1]", "def one_hot(y_):\n y_ = y_.reshape(len(y_))\n n_values = int(np.max(y_)) + 1\n n_values = 6\n return np.eye(n_values)[np.array(y_, dtype=np.int32)] # Returns FLOATS", "def one_hot(x, dtype=np.float32):\...
[ "0.81171966", "0.7639157", "0.76262224", "0.754561", "0.7503727", "0.72696173", "0.7254412", "0.72134036", "0.72008246", "0.71987766", "0.7193573", "0.7192733", "0.7190283", "0.7176916", "0.7162557", "0.7151551", "0.71450466", "0.7123999", "0.7106279", "0.7093663", "0.7090800...
0.0
-1
Densely Connected Layer with hyperparamters and activation. Batch normalization inserted after nonlinearity as opposed to before as cited in Ioffe and Szegedy 2015.
def add_dense_layer(self, input_layer, hyperparams, func='relu', bn=True): W = self._weight_variable(shape=hyperparams[0]) b = self._bias_variable(shape=hyperparams[1]) x_ravel = tf.reshape(input_layer, shape=[-1, hyperparams[0][0]]) if bn: return self._batch_normalize( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dense(in_layer):\n return Dense(neurons,\n kernel_initializer=initializer())(in_layer)", "def dense_layer(self, img, weights, bias):\n # 1: Flattening step\n img_w, img_h, img_c = img.shape\n flat = img.reshape((img_w * img_h * img_c, 1))\n ...
[ "0.7225758", "0.68559605", "0.6607964", "0.6587362", "0.65731734", "0.655351", "0.6544834", "0.6480813", "0.6450547", "0.6435771", "0.64159715", "0.64090854", "0.64044195", "0.6397249", "0.63936937", "0.6392438", "0.6385677", "0.6379117", "0.63715446", "0.63371986", "0.630498...
0.7072137
1
Loads data for the specified city and filters by month and day if applicable.
def load_data(city, month, day): if city.lower() == "chicago" or city.lower() == "c": filename = 'C:\\Neha\\Udacity\\BikeShare\\chicago.csv' elif city.lower() == "New York" or city.lower() == "new york": filename = 'C:\\Neha\\Udacity\\BikeShare\\new_york_city.csv' elif city.lower() == "...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_data(city, month, day):\n df = pd.read_csv(CITY_DATA [city])\n \n # convert the Start Time column to datetime\n df['Start Time'] = pd.to_datetime(df['Start Time'])\n \n # extract month and day of week from Start Time to create new columns\n df['month'] = df['Start Time'].dt.month\n ...
[ "0.8133254", "0.8109751", "0.8046614", "0.804365", "0.8009928", "0.8008326", "0.8000499", "0.7999591", "0.79899186", "0.7980696", "0.7974759", "0.7962582", "0.795736", "0.7948513", "0.7947427", "0.79095644", "0.7909091", "0.7905773", "0.7902028", "0.7894143", "0.7890243", "...
0.7461542
92
Displays statistics on the most frequent times of travel.
def time_stats(df): print('\nCalculating The Most Frequent Times of Travel...\n') start_time = time.time() df['Start Time'] = pd.to_datetime(df['Start Time']) # extract hour from the Start Time column to create an hour column df['hour'] = df['Start Time'].dt.hour # find the most popula...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def time_stats(df):\n\n print('\\nDisplaying the statistics on the most frequent times of '\n 'travel...\\n')\n start_time = time.time()\n\n # display the most common month\n most_common_month = df['Month'].mode()[0]\n print('For the selected filter, the month with the most travels is: ' +\...
[ "0.80247396", "0.80233026", "0.7915788", "0.78266186", "0.7822246", "0.78143597", "0.77659196", "0.7740343", "0.773628", "0.77344066", "0.76867086", "0.7668633", "0.7651731", "0.7644636", "0.76399267", "0.76367253", "0.7625196", "0.7623158", "0.7612803", "0.76002145", "0.7583...
0.7275329
59
Displays statistics on the most popular stations and trip.
def station_stats(df): print('\nCalculating The Most Popular Stations and Trip...\n') start_time = time.time() # display most commonly used start station start_station_counts = df.groupby('Start Station')['Start Station'].count() sorted_start_stations = start_station_counts.sort_values(asce...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def station_stats(df):\n\n print('\\nCalculating The Most Popular Stations and Trip...\\n')\n start_time = time.time()\n\n # display most commonly used start station\n print(popular_start_station(df))\n\n # display most commonly used end station\n print(popular_end_station(df))\n\n # display m...
[ "0.7816376", "0.7662779", "0.7554007", "0.749191", "0.7475349", "0.7446666", "0.7431475", "0.7424602", "0.74180853", "0.74006534", "0.7387897", "0.73860437", "0.73657554", "0.7359602", "0.73570734", "0.7355466", "0.7352646", "0.7351677", "0.7350823", "0.73425794", "0.7341161"...
0.72893006
30
Displays statistics on the total and average trip duration.
def trip_duration_stats(df): print('\nCalculating Trip Duration...\n') start_time = time.time() # display total travel time # display mean travel time total_trip_duration = df['Trip Duration'].sum() avg_trip_duration = df['Trip Duration'].mean() m, s = divmod(total_trip_durati...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trip_duration_stats(data):\n print('\\nCalculating Trip Duration...\\n')\n start_time = time.time()\n # display total travel time\n total_trip_time= data['Trip Duration'].sum()\n print('The Total Travel Time is {} Hours'. format(total_trip_time/3600))\n # display mean travel time\n avg_tri...
[ "0.8145283", "0.80273277", "0.800625", "0.79516613", "0.79394716", "0.7933188", "0.79289365", "0.7917429", "0.79167455", "0.79100615", "0.79077137", "0.7902854", "0.7893696", "0.7891645", "0.7888904", "0.7887135", "0.78862405", "0.7884963", "0.78764445", "0.7870734", "0.78687...
0.76926875
71
Return a file path relative to config.base_dir.
def shortpath(path): import os if path.startswith(base_dir): return path[len(base_dir) + len(os.path.sep) : ] return path
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def basepath():\n return os.path.abspath(\n os.path.join(\n os.path.dirname(__file__),\n '..'\n )\n )", "def full_path(self, config_path=CONFIG_PATH):\n return os.path.join(config_path, self.filename)", "def get_base_dir(self):\n dir_of_this_file = os.pat...
[ "0.7749423", "0.76793826", "0.76746416", "0.75920844", "0.75519174", "0.75457096", "0.74822664", "0.72584325", "0.7217989", "0.7212018", "0.72045124", "0.7176792", "0.71549654", "0.7151723", "0.71445584", "0.7128008", "0.7123869", "0.70996827", "0.70885736", "0.70471776", "0....
0.0
-1
Join a room. This function puts the user in a room, under the current namespace. The user and the namespace are obtained from the event context. This is a
def join_room(room): return request.namespace.join_room(room)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_join(data):\n username = request.sid\n room = data\n join_room(room)\n logging.info(username + ' has entered the room.')\n send(username + ' has entered the room.', room=room)", "def join(self, username=None, password=None):\n if username is not None:\n logging.debug(\"Ign...
[ "0.69718987", "0.6957941", "0.6855671", "0.68236625", "0.68236625", "0.6760418", "0.67351365", "0.6723652", "0.67204285", "0.6649734", "0.6625155", "0.66217905", "0.6597199", "0.6554095", "0.648366", "0.64610386", "0.64596605", "0.62364256", "0.6228655", "0.62136847", "0.6208...
0.7588918
0
Constructor from a dictionary representation of the object.
def from_dict(cls, dict_, players=None): rosters = {"home": roster.Roster.from_dict(dict_["rosters"]["home"]), "away": roster.Roster.from_dict(dict_["rosters"]["away"])} metadata_ = metadata.GameMetadata.from_dict(dict_["metadata"]) events = [] for event_dict in dict_[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_dict(cls, obj):\r\n raise NotImplementedError", "def from_dict(cls, data):\n return cls(**data)", "def from_dict(cls, d):\n return cls(**d)", "def from_dict(cls, dictionary: Dict[str, Any]):\n return cls(**dictionary)", "def _from_dict(cls, _dict):\n return cls.f...
[ "0.81675386", "0.7939909", "0.7925378", "0.7887648", "0.78722537", "0.78722537", "0.78722537", "0.78722537", "0.78722537", "0.78722537", "0.78722537", "0.78722537", "0.78722537", "0.78722537", "0.78722537", "0.78722537", "0.78722537", "0.78722537", "0.78722537", "0.78722537", ...
0.0
-1
Replace invalid characters for a file path within the ``file_path``
def sanitize_file_path(file_path, replacement_text=""): return __RE_INVALID_PATH.sub(replacement_text, file_path.strip())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_path(file_path):\n\n pass", "def processFilename(filename):\n\n badchars = [\" \", \",\", \"+\", \"$\", \"_\", \"{\", \"}\", \"/\", \"&\"]\n fn = filename\n for bc in badchars:\n fn = fn.replace(bc, \"\")\n return fn", "def __clean_path(self, path):\n matches = re.findite...
[ "0.705184", "0.6921472", "0.685994", "0.68242306", "0.6715941", "0.66662794", "0.6581501", "0.6580239", "0.6498151", "0.64948034", "0.64843345", "0.6355011", "0.62640214", "0.6217536", "0.6130287", "0.61046135", "0.6037171", "0.59908324", "0.5888645", "0.58840257", "0.5880445...
0.7909114
0
Tests the addition method for the case that the flle we are testing is not indexed.
def test_add_tested_path_does_not_exists(self, datetime_patch): self.inactive_db.database = {} our_value = datetime(1970, 1, 1, 1, 0, 2, 0, tzinfo=TZ("+", hours=1).get()) datetime_patch = Mock(wraps=datetime) datetime_patch.utcnow = Mock(return_value=our_value) patcher = patch(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_add(self):\n print('test_add')\n \n self.assertEqual(120, add(100, 20))\n self.assertNotEqual(3, add(10, 10))", "def test_add(self):\n self.assertEqual(3, foo.add(1, 2))\n self.assertNotEqual(3, foo.add(2, 2))", "def test_add(self):\n self.assertEqual(3...
[ "0.668218", "0.6668109", "0.6655388", "0.65338737", "0.65218854", "0.6499926", "0.6483115", "0.64665204", "0.6419772", "0.63010716", "0.62950045", "0.62094855", "0.6133426", "0.6090148", "0.60828644", "0.60505605", "0.6024647", "0.602135", "0.60194373", "0.60194373", "0.60194...
0.0
-1
Return list of Boxes.
def get_boxes(self) -> List[Box]: return [Box.from_npbox(npbox) for npbox in self.boxlist.get()]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_boxes(self):\n return self._boxes", "def get_boxes(self):\r\n\r\n boxes = [(\" \", self.worldbox.tl, self.worldbox.br)]\r\n# boxes = []\r\n boxes += [(\".\", b.tl, b.br) for b in self.wallboxes]\r\n boxes += [(\"x\", b.tl, b.br) for b in self.targetboxes]\r\n ag...
[ "0.79607993", "0.765342", "0.7435186", "0.74128634", "0.73214257", "0.7180941", "0.7139856", "0.6799742", "0.67231417", "0.67105025", "0.6701294", "0.667834", "0.64548504", "0.63983184", "0.63847095", "0.63523287", "0.634871", "0.6344889", "0.6282498", "0.6259063", "0.6213999...
0.8418227
0
Creates an instance of this model from a dictionary
def from_dictionary(cls, dictionary): if dictionary is None: return None # Extract variables from the dictionary application_parameters = cohesity_management_sdk.models.application_parameters.ApplicationParameters.from_dictionary(dictionary.get('applicationPa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_dictionary(cls,\n dictionary):\n if dictionary is None:\n return None\n\n # Extract variables from the dictionary\n id = dictionary.get('id')\n name = dictionary.get('name')\n mtype = dictionary.get('type')\n usage_bytes = diction...
[ "0.83180064", "0.81692255", "0.81692255", "0.81188524", "0.8089153", "0.7978471", "0.7949498", "0.7922631", "0.78985846", "0.7894865", "0.78879577", "0.78826904", "0.78814775", "0.78771174", "0.78584737", "0.78399473", "0.7803621", "0.7803621", "0.7803621", "0.7803621", "0.78...
0.0
-1
Whether the course is likely to be offered in the future semester
def likely_to_be_offered(self): if self.score >= 5: return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eligible(CGPA:float, Year:int, program:str) -> bool:\n return CGPA >= 2 and Year == (2 or 3) and program == \"CS\"", "def from_new_banner_api(self):\n return self.semester > \"2022A\"", "def student_is_available(target_student, target_time, target_duration):\n for exam, exam_time in target...
[ "0.6813464", "0.6636036", "0.61553955", "0.6137581", "0.6125385", "0.61212665", "0.6110093", "0.6083633", "0.6083135", "0.6070616", "0.6009461", "0.59633106", "0.5963247", "0.59465426", "0.5932103", "0.5923425", "0.58640134", "0.5856844", "0.5846142", "0.5819533", "0.57442725...
0.5745183
20
Returns a QuerySet of Comic objects that a user can follow. Includes ended comics.
def active_comics(): # FUTURE: Should not include ended comics? return Comic.objects.exclude(active=False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def follows(self):\r\n return relationships.Follows(self)", "def feeds(self):\n return Order.objects.filter(customer__in=self.following.all())", "def resolve_following(self, info):\n user = info.context.user\n follow_request = FollowRequest.objects.filter(follower=user.id, pending=F...
[ "0.5666129", "0.5524653", "0.5524334", "0.5520189", "0.5514745", "0.5514533", "0.54982233", "0.5471906", "0.5469596", "0.53893137", "0.5379109", "0.5358484", "0.5350618", "0.5344652", "0.5304118", "0.52893806", "0.52867645", "0.5278242", "0.52769315", "0.52633667", "0.5214156...
0.58848065
0
True if `pos` is a position inside the picture, i.e. it is valid coordinates.
def is_inside(pos): row, col = pos return 0 <= row and row < num_rows and \ 0 <= col and col < num_cols
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_inside(self, pos):\n x,y = pos\n return x >= self.posx and x <= self.posx + self.sizex and y >= self.posy and y <= self.posy + self.sizey", "def valid(self, pos):\n\t\tpos = Point(pos)\n\t\treturn 0 <= pos.x < self.dims.width and 0 <= pos.y < self.dims.height", "def is_pos_valid(pos, shape):\n ...
[ "0.8039734", "0.8032641", "0.77321994", "0.7407808", "0.7394166", "0.73731244", "0.73541284", "0.7316801", "0.7276194", "0.7261473", "0.72025096", "0.715476", "0.71473926", "0.7144952", "0.7128135", "0.7121988", "0.71028787", "0.7054023", "0.7021065", "0.6980572", "0.6908801"...
0.7929574
2
Testing with valid user and valid perms.
def test_add_category_with_perms(self): self.client.login(username='hodor', password='hodor') Perms.objects.create(user=self.user, access_level=2).save() response = self.client.post('/categories/add/', {'categoryType': 'tr0npr0n'}) self.assertRedirects(response, '/categories/')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_filter_user_permissions(self):\n data = {\n \"users\": {\n 1: \"view\",\n 2: \"NONE\",\n }\n }\n\n with self.assertRaises(exceptions.PermissionDenied):\n check_user_permissions(data, 1)\n\n with self.assertRaises(ex...
[ "0.7235732", "0.6979977", "0.6947357", "0.67851806", "0.6714532", "0.6711313", "0.66932464", "0.6651339", "0.663046", "0.66159356", "0.66043603", "0.6602387", "0.66009283", "0.65911335", "0.6587814", "0.65618485", "0.6526881", "0.64902717", "0.64871144", "0.6484826", "0.64596...
0.0
-1
Check that we do not accept edit with duplicate category name
def test_edit_with_duplicate_name(self): self.client.login(username='hodor', password='hodor') Perms.objects.create(user=self.user, access_level=2).save() # Edit the category response = self.client.post('/categories/edit/%s' % self.category1.id, {'categoryType': 'AnotherTestCategoryType'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_unique_insesitive(self, cr, uid, ids, context=None):\n for category in self.browse(cr, uid, ids, context=context):\n if len(self.search(cr, uid, [('name','=ilike',category.name)], context=context)) > 1:\n raise osv.except_osv(_('Constraint Error'), _(\"The Name Must Be ...
[ "0.7429591", "0.712183", "0.711979", "0.68612355", "0.67351437", "0.662806", "0.66199476", "0.6533732", "0.6521902", "0.64852035", "0.6462641", "0.6460746", "0.6418229", "0.63512856", "0.634182", "0.62515837", "0.6117465", "0.6107377", "0.61037683", "0.60956603", "0.60841376"...
0.781898
0