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
Sets the content_size of this BundleVersionMetadata. The size of the binary content for this version in bytes
def content_size(self, content_size): if content_size is None: raise ValueError("Invalid value for `content_size`, must not be `None`") if content_size is not None and content_size < 0: raise ValueError("Invalid value for `content_size`, must be a value greater than or equal to `...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def content_length(self, content_length):\n self._content_length = content_length", "def content_size(self):\n return self._content_size", "def setsize(self, size):\n self.__size = size", "def size(self, size):\n self._size = size", "def size(self, size):\n\n self._size =...
[ "0.602021", "0.580481", "0.5607178", "0.5441315", "0.5438872", "0.5438872", "0.5438872", "0.5438872", "0.53287935", "0.5216796", "0.5211139", "0.5209023", "0.51987535", "0.5167334", "0.5074894", "0.5074894", "0.50654227", "0.50654227", "0.5060574", "0.50214547", "0.5014738", ...
0.72237986
0
Gets the system_api_version of this BundleVersionMetadata. The version of the system API that this bundle version was built against
def system_api_version(self): return self._system_api_version
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def api_version(self):\n\n return self._api_version", "def api_version(self):\n\n\t\treturn self._api_version", "def get_version(self):\n return self.api_version", "def get_api_version(self):\n major, minor, patch = self.client.config['api_version']\n return '%s.%s.%s' % (major, m...
[ "0.7444967", "0.7402878", "0.73288107", "0.7326583", "0.7194403", "0.7194403", "0.7194403", "0.7194403", "0.7194403", "0.7194403", "0.7194403", "0.7194403", "0.7194403", "0.7194403", "0.7194403", "0.7194403", "0.7194403", "0.7194403", "0.7194403", "0.7194403", "0.7194403", ...
0.8632691
0
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, BundleVersionMetadata): 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.8089204", "0.8089204", "0.8055265", "0.7983358", "0.7967577", "0.7967577", "0.7967577", "0.7967577", "0.7967577", "0.7967577", "0.7967577", "0.7967577", "0.7967577", "0.7967577", "0.7967577", "0.7967577", "0.7967577", "0.7967577", "0.7967577", "0.7967577", "0.7967577", "...
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
Test that mismatched inputs raise a ValueError exception.
def test_err(): nt.assert_raises(ValueError,trapz,range(2),range(3))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_wrong_input(self):\r\n self.assertRaises(Exception, self.validate, (3, 2, 8, 8), (4, 2, 5, 5),\r\n 'valid', input=T.dmatrix())\r\n self.assertRaises(Exception, self.validate, (3, 2, 8, 8), (4, 2, 5, 5),\r\n 'valid', filters=T.dvector())\r\n ...
[ "0.76098806", "0.7472543", "0.73724145", "0.7326687", "0.7275428", "0.7229716", "0.71496904", "0.7145529", "0.7109386", "0.70808893", "0.70609236", "0.70254517", "0.7010932", "0.6967671", "0.69315004", "0.69139", "0.6889506", "0.68809414", "0.6880022", "0.6878568", "0.6843852...
0.6581845
38
Perform a query operation on the table. Can specify filter_key (col name) and its value to be filtered.
def query_table(table_name, filter_key=None, filter_value=None): table = dynamodb.Table(table_name) if filter_key and filter_value: filtering_exp = Key(filter_key).eq(filter_value) response = table.query(KeyConditionExpression=filtering_exp) else: response = table.query() retur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter():\n return get_filter_data(db, MyTable)", "def filter(self, **args ):\n query = TXLOG.select('*')\n for key, value in args.items():\n if '__' in key:\n key, op = key.split('__')\n else:\n op = 'eq'\n\n if not key in self....
[ "0.6917118", "0.65447927", "0.62532765", "0.6109888", "0.5859692", "0.585528", "0.58517504", "0.5815374", "0.579017", "0.5779572", "0.5779572", "0.5745922", "0.5637053", "0.5620694", "0.558602", "0.55833745", "0.5561753", "0.5533214", "0.55292225", "0.54796076", "0.54634", ...
0.76945084
0
Tests that a click returns a small bbox.
def testGetClickBbox(self): # pixel coords for fake click self.prepareTestCanvas() myPoint = QgsPoint(50, 15) myBox = self.bucketFill.getClickBbox(myPoint) myExpectedBox = QgsRectangle(49.99850465, 14.99850465, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def click(self, event):\n now = time.time() * 1000\n if self.time - now > 1000: \n return None\n if distance(self.x, event.x, self.y, event.y) > self.size:\n return False\n elif self.time - now > 500:\n return 50\n elif self.time - now > 200:\n ...
[ "0.63942456", "0.62798303", "0.62417287", "0.6092591", "0.59464395", "0.57955563", "0.5743221", "0.5691474", "0.567109", "0.5638329", "0.5621989", "0.5621793", "0.55788696", "0.55785525", "0.5567176", "0.5535327", "0.54888535", "0.54698867", "0.54323786", "0.5423435", "0.5418...
0.7296945
0
Converts quaternion (w in last place) to euler roll, pitch, yaw quaternion = [x, y, z, w] Bellow should be replaced when porting for ROS 2 Python tf_conversions is done.
def euler_from_quaternion(self, quaternion): x = quaternion.x y = quaternion.y z = quaternion.z w = quaternion.w sinr_cosp = 2 * (w * x + y * z) cosr_cosp = 1 - 2 * (x * x + y * y) roll = np.arctan2(sinr_cosp, cosr_cosp) sinp = 2 * (w * y - z * x) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def euler_from_quaternion(x, y, z, w):\n t0 = +2.0 * (w * x + y * z)\n t1 = +1.0 - 2.0 * (x * x + y * y)\n roll_x = math.atan2(t0, t1)\n \n t2 = +2.0 * (w * y - z * x)\n t2 = +1.0 if t2 > +1.0 else t2\n t2 = -1.0 if t2 < -1.0 else t2\n pitch_y = math.asin(t2)\n ...
[ "0.7667931", "0.7634372", "0.75958705", "0.7562809", "0.7554075", "0.75178874", "0.7305435", "0.7304392", "0.725026", "0.7244478", "0.7244478", "0.72071797", "0.71386635", "0.7126469", "0.7082506", "0.7069661", "0.70621", "0.6943571", "0.6837402", "0.6833792", "0.6807912", ...
0.70269316
17
Plots the training and test data, and the associated error produced by a certain model.
def plot_model_error(x_train, x_test, y_train, y_test, model, \ save_fig_fname, label): # Assertions assert isinstance(x_train, np.ndarray) assert isinstance(x_test, np.ndarray) assert isinstance(y_train, np.ndarray) assert isinstance(y_test, np.ndarray) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_errors(self):\n\n plt.title(\"Prediction Error\")\n plt.plot(self.errors)\n plt.ylabel(\"MSE (Mean Squared Error)\")\n plt.xlabel(\"Iteration\")\n plt.show()", "def plotErrors(losses, model_title ='Shallow Network, SGD, Batch Size = 10'):\n fig, axes = plt.subplots(...
[ "0.7723527", "0.7649733", "0.75653374", "0.7439751", "0.74290276", "0.73577344", "0.73402554", "0.72749007", "0.723029", "0.7227402", "0.7223185", "0.7179483", "0.7108062", "0.70985985", "0.7092843", "0.7042836", "0.7006909", "0.6994837", "0.6985129", "0.6933574", "0.6894656"...
0.77155495
1
Combine the columns from an array of arrays into arrays themselves.
def combine_columns(nd_arrays): # Assertions assert isinstance(nd_arrays, list), \ 'Input must be a list' for i in nd_arrays: assert isinstance(i, np.ndarray), \ 'Each element in list must be a numpy ndarray' l_prev = len(nd_arrays[0]) for ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _concat_arrays(arrays):\n # torch\n if isinstance(arrays[0], torch.Tensor):\n return torch.cat(arrays)\n\n # numpy\n if not isinstance(arrays[0], np.ndarray):\n arrays = np.asarray(arrays)\n\n return np.concatenate(arrays)", "def add_columns(array, cols=1):\n # TODO: error han...
[ "0.6336707", "0.6295602", "0.62792516", "0.62483174", "0.6243256", "0.62142247", "0.62014043", "0.6126386", "0.6063569", "0.6039031", "0.6023724", "0.6001468", "0.5991344", "0.5988282", "0.591313", "0.5908789", "0.59040743", "0.5889101", "0.5879778", "0.58595914", "0.58595544...
0.705785
0
Divide continuous y_actual into discrete classes/bins.
def get_y_category(y_actual, min_edge, bin_width): # Assertions assert max(y_actual) > min_edge, \ 'min_edge has to be smaller than maximum y_actual' assert isinstance(y_actual, np.ndarray), \ 'Input array must be a numpy ndarray.' assert isinstance(min_edge, (int...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _class_distribution(y):\n unique, counts = np.unique(y, return_counts = True)\n\n percentages = counts / np.sum(counts)\n\n return unique, counts, percentages", "def make_classes(y,thresholds,exact_value=False,reverse=False):\n nthres = len(thresholds)\n if ~exact_value: # Scale thresholds by ...
[ "0.5875795", "0.57360566", "0.5415973", "0.5392439", "0.53776103", "0.53216904", "0.53037596", "0.5298477", "0.52812976", "0.52684754", "0.5243871", "0.5196837", "0.5187598", "0.5136283", "0.51233286", "0.5079107", "0.50521624", "0.50027597", "0.49977162", "0.49945593", "0.49...
0.5899118
0
Onehot encoding of the categories y
def onehot_encode_y(y, num_class): # Assertions assert isinstance(y, np.ndarray), \ 'y must be a numpy ndarray' assert isinstance(num_class, int), \ 'num_class must be an int' # Functionality one_hot = np.zeros((y.shape[0],num_class),dtype=np.int8) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def onehot_encode_labels(y):\n\treturn OneHotEncoder(categories=\"auto\", sparse=False).fit_transform(y.reshape(y.shape[0],1))", "def one_hot_encoding(y):\n\n y_oh = np.zeros((y.shape[0], y.max() - y.min() + 1))\n\n # currently only works in min is actually 0\n for j in range(0, y_oh.shape[1]):\n ...
[ "0.8671377", "0.85436434", "0.84839106", "0.8453375", "0.845165", "0.83928204", "0.8326153", "0.8225588", "0.8147074", "0.81149673", "0.8096358", "0.8093862", "0.807086", "0.802638", "0.80242354", "0.79495424", "0.79462683", "0.794366", "0.7932847", "0.79270613", "0.7906792",...
0.79116154
20
Returns the learning rate from optimizer.
def get_lr_metric(optimizer): def lr(y_true, y_pred): return optimizer.lr return lr
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_learning_rate():\n return 0.00001", "def learning_rate(epoch):\n self.lr = self.lr / 1.00000001\n return self.lr", "def get_learning_rate(self):\n config = self.config\n cur_lr = Train_model_pipeline.adjust_learning_rate(\n self.optimizer,\n ...
[ "0.79552567", "0.786904", "0.77423716", "0.7657538", "0.7548933", "0.7548933", "0.7414675", "0.7388794", "0.73810875", "0.7378523", "0.7377975", "0.7377975", "0.7310753", "0.73048645", "0.71629024", "0.71409476", "0.7140186", "0.7132856", "0.7122929", "0.7115563", "0.7108377"...
0.73378587
12
initialize the linked list with a head
def __init__(self): self.head = None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, head=None):\n\n self.head = head", "def __init__(self, head: ListNode):\n self.nodes = []\n\n while(head):\n self.nodes.append(head)\n head = head.next", "def __init__(self, head=None):\r\n self.head = head", "def __init__(self, head):\n ...
[ "0.79416037", "0.78489876", "0.78165245", "0.7808905", "0.7808905", "0.7808905", "0.7808905", "0.7794664", "0.7794664", "0.7794664", "0.7794664", "0.7794664", "0.7789348", "0.7717144", "0.7553293", "0.7530354", "0.7517689", "0.75107497", "0.7480946", "0.7470325", "0.7470325",...
0.745069
33
place the node as the head of the linked list
def prepend(self, data): self.head = SinglyLLNode(data=data , next=self.head)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insert_start(self, data):\n\n if self.head is None:\n self.head = ListNode(data)\n else:\n temp = self.head\n self.head = ListNode(data)\n self.head.next = temp", "def add_first(self, node_to_add):\n node_to_add.next = self.head\n self.h...
[ "0.77859837", "0.76070863", "0.75978833", "0.75607127", "0.74936455", "0.7453167", "0.72986794", "0.7298269", "0.7233087", "0.721493", "0.7213593", "0.7213593", "0.7213593", "0.7213593", "0.7213593", "0.7170956", "0.7164141", "0.71614397", "0.7085516", "0.70735955", "0.707029...
0.70661294
21
inserting the element at the end of the list if head is not present then we want to insert the element at the head . else we have to iterate till the end and append the element in he end
def append(self, data): if not self.head : self.head = SinglyLLNode(data = data, next = None) return current = self.head while current.next: current = current.next current.next = SinglyLLNode(data = data ,next = None) return current.next
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insertAtEnd(self, e):\n # self.insertBeforeHeader(e) # this is not true since the head will be changed\n \n if self.is_empty(): # if this is the first insert method call,\n print(\"As you do not have any start node yet, the given element will be a start node.\")\n self._first_insert(e)\...
[ "0.6960841", "0.68912464", "0.6837521", "0.6786558", "0.6775292", "0.65085393", "0.6497608", "0.64862406", "0.6457636", "0.64334136", "0.6427756", "0.6366582", "0.63004416", "0.6291906", "0.6276477", "0.6266562", "0.62611985", "0.62383777", "0.61720765", "0.61631733", "0.6153...
0.60773724
26
inserting a new element at the begining of the list
def prepend(self ,data): new_head = DoublyLLNode(data = data, next = self.head) if self.head: self.head.prev = new_head self.head = new_head
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insert_element(some_list, index, new_el):\n return some_list.insert(index, new_el)", "def prepend(self, item: Any):\n self.insert(0, item)", "def insert_first(self, item):\n if self.is_empty():\n self._first = item\n self._rest = LinkedListRec([None])\n else:\n...
[ "0.7689262", "0.7453939", "0.7389664", "0.7360488", "0.73460215", "0.73097533", "0.72898185", "0.71789604", "0.716782", "0.7158661", "0.7136484", "0.7029361", "0.70255834", "0.7019971", "0.70163655", "0.7006856", "0.7000093", "0.6959969", "0.6932877", "0.6922844", "0.69133806...
0.6210187
94
insert the new element at the end of the list
def append(self, data): if not self.head : new_element = DoublyLLNode(data = data) self.head = new_element return current = self.head while current.next is not None: current = current.next new_node = DoublyLLNode(data = data) curre...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add(self, elem):\n self.add_last(elem)", "def insert_element(some_list, index, new_el):\n return some_list.insert(index, new_el)", "def push(self, new_element):\n self.ll.insert_first(new_element)", "def push(self, item):\n self.list.prepend(item)", "def add_last(self, e):\n ...
[ "0.7316215", "0.7231735", "0.7138381", "0.70537686", "0.6945183", "0.6928864", "0.6911495", "0.69073564", "0.6896698", "0.6847086", "0.679995", "0.6745507", "0.67044973", "0.6654654", "0.66505426", "0.66459024", "0.66204375", "0.6615489", "0.66046184", "0.6601483", "0.6601483...
0.0
-1
List the courses that the user has enrolled.
def display_courses(courses): _print('You can access %d courses' % len(courses)) for i, course in enumerate(courses, 1): _print('%d - [%s] - %s' % (i, course.state, course.name))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def see_teaching_courses(self, username: str, token: str) -> List[Dict[str, object]]:\n\n # Validate user first\n if not self.validate(username=username, token=token, check_privilege='instructor'):\n raise RuntimeError(\"User not verified!\")\n\n # Get UID from user's username\n ...
[ "0.7631263", "0.7055115", "0.70228314", "0.7006284", "0.7005273", "0.69918746", "0.6961836", "0.69362885", "0.69360477", "0.6880938", "0.6861267", "0.682425", "0.6730766", "0.6681261", "0.6656965", "0.6648978", "0.65955794", "0.6567497", "0.65440357", "0.65380585", "0.6519788...
0.5933253
42
Return the basename for the corresponding filename_prefix.
def get_filename(target_dir, filename_prefix): # This whole function is not the nicest thing, but isolating it makes # things clearer. A good refactoring would be to get the info from the # video_url or the current output, to avoid the iteration from the # current dir. filenames = os.listdir(target_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def basename(self):\n return self._getbyspec(\"basename\")[0]", "def basename(self):\n return get_basename(self.filename)", "def get_filename(target_dir, filename_prefix):\n # this whole function is not the nicest thing, but isolating it makes\n # things clearer , a good refactoring would b...
[ "0.74310637", "0.7391377", "0.7389686", "0.7338109", "0.7272586", "0.7214509", "0.7133712", "0.71196115", "0.7058001", "0.7054978", "0.7045096", "0.69853073", "0.6981064", "0.6979379", "0.6950083", "0.6946026", "0.68949723", "0.68884635", "0.68859386", "0.68739104", "0.686093...
0.71237016
7
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): plt.imshow(cm, interpolation='nearest', cmap=cmap) plt.title(title) plt.colorbar() tick_marks = np.arange(len(classes)) plt.xticks(tick_marks, classes, rotation=45) plt.yticks(tick_marks, classes...
{ "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.8194366", "0.8095442", "0.8029135", "0.8019134", "0.7993755", "0.7991176", "0.79808146", "0.79755133", "0.79609716", "0.7956584", "0.79375756", "0.79346216", "0.79343396", "0.7931212", "0.7926087", "0.7924503", "0.79228765", "0.79227114", "0.7921956", "0.79178125", "0.7915...
0.7923946
16
Load a pickled dictionary.
def _load_dict(local_path): with open(local_path, "rb") as f: d = pickle.load(f) print(f"SidechainNet was loaded from {local_path}.") return d
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_dictionary(filepath):\r\n # context manager read binary\r\n with open(filepath, 'rb') as file:\r\n # pickle load\r\n return pickle.load(file)", "def _load(self, load_dict):\n try:\n self.v_protocol = load_dict.pop(PickleParameter.PROTOCOL)\n except KeyError:\...
[ "0.744936", "0.7314949", "0.7302617", "0.71504724", "0.6997208", "0.69032377", "0.6895748", "0.68796283", "0.6853177", "0.6755191", "0.6727787", "0.67276263", "0.6714951", "0.669329", "0.6685709", "0.66768354", "0.66553706", "0.6612314", "0.65986735", "0.6590711", "0.6583909"...
0.7291537
3
Load and return the specified SidechainNet dataset as a dictionary or DataLoaders. This function flexibly allows the user to load SidechainNet in a format that is most convenient to them. The user can specify which version and "thinning" of the dataset to load, and whether or not they would like the data prepared as a ...
def load(casp_version=12, thinning=30, scn_dir="./sidechainnet_data", force_download=False, with_pytorch=None, aggregate_model_input=True, collate_fn=None, batch_size=32, seq_as_onehot=None, dynamic_batching=True, num_workers=2, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_loader(\n data_source: Iterable[dict],\n open_fn: Callable,\n dict_transform: Callable = None,\n sampler=None,\n collate_fn: Callable = default_collate_fn,\n batch_size: int = 32,\n num_workers: int = 4,\n shuffle: bool = False,\n drop_last: bool = False,\n):\n from catalyst.d...
[ "0.60510147", "0.60058916", "0.59642565", "0.57627064", "0.5720478", "0.5699642", "0.5690512", "0.56817615", "0.5618097", "0.556779", "0.5557263", "0.55352026", "0.5505538", "0.55018103", "0.54849553", "0.5482737", "0.5477257", "0.5460679", "0.5456197", "0.5437535", "0.541064...
0.6639369
0
Return all the addons installed for this application.
def get(self, request, app_id, addon_name): addon = Addon.objects.get(app__app_id=app_id, display_name=addon_name, state__in=visible_states) return self.respond(addon.to_dict())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def get_addons(self, only_installed=True):\n try:\n result = await self.send_command(COMMAND_GET_ADDONS, method=\"get\")\n\n addons = result.get(\"data\", {}).get(\"addons\")\n if addons is None:\n raise HassioAPIError(\"No addons were returned.\")\n\n ...
[ "0.731581", "0.69772774", "0.6963094", "0.6857461", "0.673829", "0.6702672", "0.6664763", "0.65831494", "0.6386265", "0.6384737", "0.6378459", "0.6354611", "0.63481957", "0.62887484", "0.6175771", "0.61618954", "0.6119122", "0.60896313", "0.6082011", "0.6047446", "0.60394895"...
0.0
-1
Return all the addons installed for this application.
def delete(self, request, app_id, addon_name): addon = Addon.objects.get(app__app_id=app_id, display_name=addon_name) provider = get_provider_from_provider_name(addon.provider_name) result = provider.deprovision(addon.provider_uuid) manager = StateMachineManager() with manager.tr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def get_addons(self, only_installed=True):\n try:\n result = await self.send_command(COMMAND_GET_ADDONS, method=\"get\")\n\n addons = result.get(\"data\", {}).get(\"addons\")\n if addons is None:\n raise HassioAPIError(\"No addons were returned.\")\n\n ...
[ "0.73145586", "0.69757617", "0.6962982", "0.6856843", "0.6737163", "0.67015314", "0.66634744", "0.6582195", "0.6385097", "0.6384374", "0.6378237", "0.63543165", "0.63477063", "0.62876606", "0.61743927", "0.61627185", "0.6118853", "0.60891545", "0.6080717", "0.6047478", "0.603...
0.0
-1
Renders a simple html page with some basic css. In addition it places a pixelimage in the header and puts a tracking cookie in the client browser.
def render_simple_page(self, title): # This is an ok route, so send 200 self.send_response(200) self.send_header('Content-Type', 'text/html') # Get hold of the cookie, or create one if it is missing. cookie = self.get_cookie() # All headers must be sent at this point. self.end_headers() # Generate...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display():\n\n #still needs some cleanup on imagry and what the site is about. \n\n return render_template(\"index.html\")", "def main_page():\n return render_template(\"index.html\")", "def renderPage():\n return render_template(\"index.html\")", "def landing_page():\n\n return render_templ...
[ "0.6390018", "0.6143895", "0.6052742", "0.60006654", "0.598944", "0.595025", "0.59399104", "0.5926091", "0.59220827", "0.59041035", "0.5892484", "0.58814085", "0.5879925", "0.5879925", "0.5879925", "0.58787805", "0.5861115", "0.5861115", "0.58610606", "0.5845353", "0.58436215...
0.75484437
0
Adds other to self
def __add__(self, other): # other is scalar if isinstance(other, (int, float, complex, Fraction)) and not isinstance(other, bool): return Matrix([[p + other for p in row] for row in self.data]) # other is Matrix elif isinstance(other, Matrix): if self.n_cols == ot...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __add__(self, other):\n raise NotImplementedError(\"Implement this if needed\")", "def __iadd__(self, other):\n self.MergeWith(other)\n return self", "def add(self, other):\n self._check_item(other)\n self._set.add(other)", "def _add(self, other):\n raise NotImpl...
[ "0.8405552", "0.83828807", "0.827689", "0.8266176", "0.82576275", "0.81789166", "0.8172069", "0.811267", "0.80922073", "0.80922073", "0.8088367", "0.8067727", "0.8042112", "0.80188924", "0.8017595", "0.7993452", "0.7993452", "0.79734707", "0.78302675", "0.7793163", "0.7793163...
0.0
-1
Validate a phone number
def validate_phone_number(value, country_code='VN'): msg = _('Invalid phone number format.') try: phone = phonenumbers.parse(value, country_code) except: raise ValidationError(msg) if not phonenumbers.is_valid_number_for_region(phone, country_code): raise ValidationError(msg) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_phone_number(value):\n\n try:\n z = phonenumbers.parse(value, None)\n except phonenumbers.NumberParseException:\n raise forms.ValidationError(\"Enter a valid phone number.\")\n\n if not phonenumbers.is_valid_number(z):\n raise forms.ValidationError(\"Enter a valid phone n...
[ "0.86364424", "0.8494945", "0.8441424", "0.83460087", "0.8295371", "0.82576275", "0.8218727", "0.8209212", "0.81748736", "0.804384", "0.8017404", "0.7982516", "0.79191744", "0.7897664", "0.7861812", "0.7798445", "0.77693796", "0.76992404", "0.76975477", "0.7651694", "0.764195...
0.78855497
14
Copy a dimension from nc1 to nc2.
def copy_dim(nc1, nc2, name, direction): if (name == direction): return dim1 = nc1.dimensions[name] dim2 = nc2.createDimension(name, len(dim1))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_cpy2d(self):\n # Reference\n o1 = self.offset1\n o2 = self.offset2\n T = self.transfer_shape\n logger.info(\"\"\"Testing D->D rectangular copy with (N1_y, N1_x) = %s,\n (N2_y, N2_x) = %s:\n array2[%d:%d, %d:%d] = array1[%d:%d, %d:%d]...
[ "0.6103899", "0.5860351", "0.56982964", "0.56534034", "0.541844", "0.5284578", "0.5276318", "0.5212222", "0.5148384", "0.5120476", "0.510933", "0.5095391", "0.5077345", "0.50753784", "0.5068038", "0.50577754", "0.5047619", "0.50472707", "0.5026026", "0.50068355", "0.49781066"...
0.8276057
0
Checks if a thing is an array or maybe a number
def is_array(a): try: shape = a.shape return len(shape) >= 1 except AttributeError: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_array(val):\n return (\n isinstance(val, tuple) or \\\n isinstance(val, dict) or \\\n isinstance(val, list)\n )", "def is_array(t):\n return isinstance(t, ast.Array)", "def IsArray(obj):\n return isinstance(obj, (list, tuple))", "def _is_number(data):\n return len(data) and np.issu...
[ "0.7517828", "0.72538084", "0.7238563", "0.7040829", "0.69015574", "0.6868806", "0.6806678", "0.6751605", "0.67312884", "0.6625751", "0.66252357", "0.65444046", "0.6516574", "0.6500458", "0.64570844", "0.6453265", "0.636747", "0.6280608", "0.62688416", "0.6182129", "0.6179207...
0.6364077
17
Set up the test data used in the specific tests
def setUp(self): super().setUp() self.client = Client() # Create two accounts self.password = 'abc' self.student = UserFactory.create( username='student', email='student@test.com', password=self.password, ) self.student2 = UserFactory.create( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setUp(self):\n\n self.test_data_path = 'testing/test_data/'", "def setUpTestData(cls):\n # volunteer user\n common.initialize_empty_volunteer()", "def setUp(self):\n self.dataset = get_test_dataset()", "def setUpTestData(cls):\n data_gen.run()", "def setUpTestData(cls...
[ "0.81202143", "0.8055535", "0.8018625", "0.80140793", "0.80140793", "0.80140793", "0.80140793", "0.7673785", "0.7670255", "0.7638416", "0.75666314", "0.7563694", "0.75613576", "0.75568604", "0.7531407", "0.7518274", "0.749713", "0.74606305", "0.7458917", "0.7433875", "0.74277...
0.0
-1
returns number of pairs in a sequence seq. which equals to sum of arphmetic progression (n1)...1 where n is length of seq
def get_num_pairs(seq): n = len(seq) return int(n * (n-1)/2) # sum of arphmetic progression (n-1)...1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def howmany_sequences(listOfTuples):\r\n #initialize number of pairs as 0\r\n pairs = 0\r\n #count pairs\r\n for n in listOfTuples:\r\n pairs += 1\r\n k = 1\r\n #find number of initial sequences \r\n while k*(k-1) != pairs*2:\r\n k += 1\r\n return(k)", "def number_of_pair...
[ "0.73527473", "0.7297841", "0.7236932", "0.6532151", "0.6451968", "0.63941336", "0.63623786", "0.6356894", "0.6215435", "0.62129545", "0.6183038", "0.6156908", "0.6087411", "0.6072769", "0.60038096", "0.59933627", "0.59892863", "0.59744585", "0.5952584", "0.5931359", "0.59304...
0.93724173
0
Returns torch.utils.data.DataLoader for custom coco dataset.
def get_precomp_loader(data_path, data_split, vocab, opt, batch_size=100, shuffle=True, num_workers=2): dset = PrecompDataset(data_path, data_split, vocab) data_loader = torch.utils.data.DataLoader(dataset=dset, batch_size=batch_size, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _custom_data_loader(self) -> DataLoader:\n dataloaders = DataLoader(self.dataset, batch_size=1)\n return dataloaders", "def get_loader(root, path, vocab_con,transform, batch_size, shuffle, num_workers):\n # COCO caption dataset\n clef = ClefDataset(root=root,\n csv= ...
[ "0.706697", "0.67358375", "0.66989386", "0.6609966", "0.6598338", "0.64210665", "0.6350301", "0.631162", "0.62589985", "0.6243968", "0.6240935", "0.6180331", "0.6157964", "0.6151057", "0.613919", "0.61267656", "0.61259216", "0.60921896", "0.6081883", "0.6079314", "0.60172963"...
0.6307879
8
Update Gaussian parameters with diagonal covariance
def updateMeanAndVar(X, log_gamma, varianceFloor=5.0): N,D=X.shape M=log_gamma.shape[1] means=np.zeros((M,D)) covars=np.zeros((M,D)) gamma=np.exp(log_gamma) for m in range(M): means[m]=np.sum(gamma[:,m].reshape(-1,1)*X,axis=0)/np.sum(gamma[:,m]) covars[m]=np.sum(gamma[:,m].reshap...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_covariance(self):\n raise RuntimeError(\"Internal cosmosis error in SingleValueGaussianLikelihood\")", "def build_covariance(self):\n raise RuntimeError(\"Your Gaussian covariance code needs to \"\n \"over-ride the build_covariance method so it knows how to \"\n \"lo...
[ "0.6520932", "0.6244814", "0.6132422", "0.6097101", "0.5980771", "0.59680223", "0.5890005", "0.58773696", "0.5821621", "0.5801322", "0.579809", "0.5795447", "0.57706726", "0.5733653", "0.573118", "0.57129925", "0.5638596", "0.5636483", "0.5631603", "0.5613267", "0.56101966", ...
0.0
-1
Creates and places the main frames and labels of the viewer.
def crear_elements_viewer(self): self.p2_frame_list = tk.Frame(self.list_frame, borderwidth=2, relief="groove") self.p2_label_info = ttk.Label(self.p2_frame_list, text=self.lang.VP_PAC_ID, font=FONT_TITOL) self.p2_label_info.pack() scrollbar = tk.Scrollbar(self.p2_frame_list) sc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_frame_viewer(self):\n if not hasattr(self, \"frame_viewer1\"):\n self.frame_viewer1 = dialog.FrameViewer()\n self.frame_viewer1.setWindowTitle(\"Frame viewer #1\")\n self.frame_viewer1.setWindowFlags(Qt.WindowStaysOnTopHint)\n if self.frame_viewer1_mem_...
[ "0.70081437", "0.6935744", "0.6563822", "0.65289366", "0.6500408", "0.6460954", "0.6371969", "0.6363094", "0.63221115", "0.6304854", "0.6292779", "0.6283935", "0.6282174", "0.6280685", "0.6275214", "0.625353", "0.6249344", "0.62423205", "0.6210394", "0.61956865", "0.61352533"...
0.0
-1
Close the connection now.
def close(self): self.closed = True for cursor in self.cursors: try: cursor.close() except exceptions.Error: pass # already closed
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close_connection(self):\n\n self._connection.close()\n print(\"Closed connection....\")", "def close_connection(self):\n self.conn.close()", "def close_connection(self):\n self.connection.close()", "def close_connection(self):\n self.connection.close()", "def close(se...
[ "0.8491097", "0.844666", "0.842315", "0.842315", "0.8420109", "0.84166676", "0.8409664", "0.8401634", "0.8401634", "0.8401634", "0.8401634", "0.8401634", "0.8401634", "0.8401634", "0.8395791", "0.8388887", "0.8372228", "0.83681434", "0.8341415", "0.83291346", "0.8326645", "...
0.0
-1
Get the front element.
def peek(self): print(self.a, self.b) if self.a: return self.a[0] return self.b[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getFront(self):\n\t\tfront = self.queue[self.front]\n\t\treturn front\n\t\tpass", "def getFront(self):\n if not self.isEmpty():\n return self._data[0]\n else:\n return -1", "def front(self):\n return self.queue[0] if not self.empty() else None", "def peek_front(...
[ "0.82009244", "0.79261875", "0.7852642", "0.7791182", "0.77886623", "0.75723046", "0.752337", "0.7510604", "0.7478953", "0.7379256", "0.7379256", "0.734284", "0.7323573", "0.7320296", "0.7291721", "0.72772557", "0.7269801", "0.72657627", "0.7253295", "0.72355044", "0.72213495...
0.0
-1
Returns whether the queue is empty.
def empty(self): print(self.a, self.b) return not self.a and not self.b
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_empty(self):\n return len(self.the_queue) == 0", "def is_empty(self):\n return len(self.__queue) > 0", "def is_empty(self):\n return len(self.queue) == 0", "def is_empty(self):\n return len(self.queue) == 0", "def is_empty(self):\n return self.queue == []", "def ...
[ "0.9270249", "0.92506766", "0.923635", "0.923635", "0.9155843", "0.9098441", "0.9095006", "0.90922606", "0.90731245", "0.9053733", "0.89205354", "0.89137155", "0.8877591", "0.88436323", "0.88436323", "0.8835949", "0.88038146", "0.8758203", "0.87577534", "0.87310195", "0.86462...
0.0
-1
Return the egg path of the module. Must be redefined in server class. Used to find alembic migration scripts.
def _get_egg_path(self): try: _dist = get_distribution('janitoo_nut') return _dist.__file__ except AttributeError: return 'src-nut/config'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def go_mod_path(self):\n return self.full_path() + \"/go.mod\"", "def _get_module_path():\n\n return os.path.dirname(os.path.realpath(__file__))", "def modulePath(self, name):\n return os.path.join(self.modulesDir, name)", "def module_path():\n return os.path.dirname(unicode(__file__, sys.get...
[ "0.71504897", "0.67346203", "0.67230743", "0.66746724", "0.66235334", "0.65865576", "0.65578735", "0.65162206", "0.6423549", "0.6371399", "0.6334599", "0.6327907", "0.62229806", "0.6210366", "0.61498797", "0.6145402", "0.6142044", "0.6131555", "0.61180747", "0.609622", "0.607...
0.6979709
1
Return ciphertext byte string containing Header|IV|Ciph|Sig.
def Encrypt(self, data): data = self.__Pad(data) iv_bytes = util.RandBytes(self.block_size) ciph_bytes = AES.new(self.key_bytes, AES.MODE_CBC, iv_bytes).encrypt(data) msg_bytes = self.Header() + iv_bytes + ciph_bytes sig_bytes = self.hmac_key.Sign(msg_bytes) # Sign bytes return msg_bytes + sig_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pack(self):\n return self.iv + self.ciphertext", "def extract_ciphertext(self):\n return b64decode(self.cipherblock[\"ciphertext\"])", "def ciphertext(self, be_secure=True):\n if be_secure and not self.__is_obfuscated:\n self.obfuscate()\n\n return self.__ciphertext",...
[ "0.67226404", "0.66454685", "0.61130905", "0.5878112", "0.5861873", "0.58587164", "0.57964534", "0.57710576", "0.5683404", "0.5601819", "0.55982846", "0.55982846", "0.55907506", "0.55756044", "0.5562725", "0.55533373", "0.5516319", "0.55025405", "0.54746825", "0.5432048", "0....
0.55983573
10
Return raw byte string of signature on the message.
def Sign(self, msg): return hmac.new(self.key_bytes, msg, sha1).digest()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sign_message(self, message):\n if self.private_key:\n if isinstance(message, str):\n utf8 = message.encode('utf-8')\n else:\n raise TypeError(\"message must be a string.\")\n signature = self.private_key.sign(utf8).to_base64()\n r...
[ "0.7263324", "0.7220175", "0.7114331", "0.70867014", "0.6996299", "0.6943845", "0.69089293", "0.6905976", "0.6871449", "0.68423533", "0.683805", "0.683805", "0.683805", "0.68136364", "0.6779988", "0.67471147", "0.6739992", "0.67395", "0.67135775", "0.66955715", "0.6690904", ...
0.62563264
44
Return True if the signature corresponds to the message.
def Verify(self, msg, sig_bytes): correctMac = self.Sign(msg) if len(sig_bytes) != len(correctMac): return False result = 0 for x, y in zip(correctMac, sig_bytes): result |= ord(x) ^ ord(y) return result == 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verify(self, message, signature):\n try:\n self._pk.verify(signature.bytes, message)\n return True\n except InvalidSignature:\n return False", "async def verify_signature(self, message: BasePendingMessage) -> bool:\n\n if message.signature is None:\n ...
[ "0.7866142", "0.78531224", "0.73745686", "0.7371476", "0.7331748", "0.7254607", "0.7248216", "0.7226003", "0.7141111", "0.7071093", "0.70532674", "0.6999354", "0.69937575", "0.69493365", "0.68184286", "0.68102866", "0.67925686", "0.6784461", "0.67737865", "0.67622554", "0.670...
0.616711
48
Return raw byte string of signature on the message.
def Sign(self, msg): # Need to chose a random k per-message, SystemRandom() is available # since Python 2.4. k = random.SystemRandom().randint(2, self.key.q-1) (r, s) = self.key.sign(util.Hash(msg), k) return util.MakeDsaSig(r, s)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sign_message(self, message):\n if self.private_key:\n if isinstance(message, str):\n utf8 = message.encode('utf-8')\n else:\n raise TypeError(\"message must be a string.\")\n signature = self.private_key.sign(utf8).to_base64()\n r...
[ "0.7263324", "0.7220175", "0.7114331", "0.70867014", "0.6996299", "0.6943845", "0.69089293", "0.6905976", "0.6871449", "0.68423533", "0.683805", "0.683805", "0.683805", "0.68136364", "0.6779988", "0.67471147", "0.6739992", "0.67395", "0.67135775", "0.66955715", "0.6690904", ...
0.5945893
92
Return True if the signature corresponds to the message.
def Verify(self, msg, sig): try: (r, s) = util.ParseDsaSig(sig) return self.key.verify(util.Hash(msg), (r, s)) except errors.KeyczarError: # if signature is not in correct format return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verify(self, message, signature):\n try:\n self._pk.verify(signature.bytes, message)\n return True\n except InvalidSignature:\n return False", "async def verify_signature(self, message: BasePendingMessage) -> bool:\n\n if message.signature is None:\n ...
[ "0.7865884", "0.78531116", "0.7376482", "0.73737025", "0.7330545", "0.7254905", "0.72266763", "0.7141309", "0.70713574", "0.70529634", "0.7001385", "0.6993236", "0.69511", "0.6819011", "0.68124074", "0.67931896", "0.67871815", "0.6776881", "0.67636055", "0.67069787", "0.67024...
0.7248867
6
Return a raw byte string of the ciphertext in the form Header|Ciph.
def Encrypt(self, data): data = self.__Encode(data) ciph_bytes = self.key.encrypt(data, None)[0] # PyCrypto returns 1-tuple return self.Header() + ciph_bytes
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_ciphertext(self):\n return b64decode(self.cipherblock[\"ciphertext\"])", "def pack(self):\n return self.iv + self.ciphertext", "def ciphertext(self, be_secure=True):\n if be_secure and not self.__is_obfuscated:\n self.obfuscate()\n\n return self.__ciphertext",...
[ "0.67029226", "0.6500447", "0.6139295", "0.61347026", "0.60735536", "0.60735536", "0.59915143", "0.5961482", "0.59423834", "0.59360045", "0.5888082", "0.587244", "0.5855291", "0.58021283", "0.5783862", "0.5768904", "0.5765662", "0.5745862", "0.5742264", "0.5728551", "0.570613...
0.61006653
4
Return True if the signature corresponds to the message.
def Verify(self, msg, sig): try: return self.key.verify(util.MakeEmsaMessage(msg, self.size), (util.BytesToLong(sig),)) except ValueError: # if sig is not a long, it's invalid return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verify(self, message, signature):\n try:\n self._pk.verify(signature.bytes, message)\n return True\n except InvalidSignature:\n return False", "async def verify_signature(self, message: BasePendingMessage) -> bool:\n\n if message.signature is None:\n ...
[ "0.7866142", "0.78531224", "0.73745686", "0.7371476", "0.7331748", "0.7254607", "0.7248216", "0.7226003", "0.7141111", "0.7071093", "0.70532674", "0.6999354", "0.69937575", "0.69493365", "0.68102866", "0.67925686", "0.6784461", "0.67737865", "0.67622554", "0.67041826", "0.670...
0.68184286
14
Return a km representation (with 2 decimal points) of a distance in meters.
def test_convert_to_km(self): assert meters_to_km(100) == "0.10" assert meters_to_km(494) == "0.49" assert meters_to_km(495) == "0.49" assert meters_to_km(496) == "0.50" assert meters_to_km(10000) == "10.00" assert meters_to_km(10200) == "10.20"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def km2m(km):\n return km * 1000", "def miles_to_kilometers(miles):\n #convert miles to km:\n return miles*1.60934", "def kilometers_to_miles(km):\n #convert km to miles:\n return km*0.621371", "def distmeter(self):\n return self._distance.to(\"m\").value", "def get_distance_meters(aL...
[ "0.76066816", "0.7159828", "0.7119762", "0.681522", "0.67269355", "0.6723148", "0.6688799", "0.66761106", "0.6616688", "0.6573686", "0.65677816", "0.65463686", "0.6544979", "0.65193456", "0.6492224", "0.64844435", "0.64104", "0.6402224", "0.6351492", "0.6346346", "0.6336152",...
0.69067466
3
Return whether this agent can be collected.
def can_be_collected(self): return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_collecting(self) -> bool:\n return self.orders and self.orders[0].ability.id in {AbilityId.HARVEST_GATHER, AbilityId.HARVEST_RETURN}", "def IsAllowed(self):\r\n\r\n return self.notify.IsAllowed()", "def IsAllowed(self):\r\n\r\n return self.notify.IsAllowed()", "def IsAllowed(self)...
[ "0.6605633", "0.6209676", "0.6209676", "0.6209676", "0.61448175", "0.61448175", "0.61253357", "0.61177486", "0.6101881", "0.6101881", "0.60915625", "0.6082362", "0.6082362", "0.60730577", "0.60730577", "0.6054565", "0.60386235", "0.5991761", "0.59821266", "0.59817386", "0.598...
0.7565364
0
Checks whether average performance falls below determined threshold.
def check_performance(self): self.lg.debug('Checking performance.') avg_up = (sum(self.results_up)) / len(self.results_up) avg_down = (sum(self.results_down)) / len(self.results_down) if ( avg_up < self.tolerance * self.up or avg_down < self.tolerance * self.down ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def belowThresholdAlarm(self, data):\n\n if(self.belowThreshold and self.calculateAverage(data) < self.threshold):\n message = \"Average below acceptable amount for \" + self.subjectName + \".\"\n if(self.log):\n logging.info(message)\n\n ...
[ "0.7263092", "0.7230794", "0.70135915", "0.6669357", "0.66546345", "0.64845896", "0.63859266", "0.6330419", "0.62496316", "0.6238454", "0.6215174", "0.6196904", "0.6182188", "0.61290866", "0.6117391", "0.6101035", "0.6061729", "0.60499746", "0.6044922", "0.60185677", "0.59969...
0.70939666
2
Check if the string contains a digit
def has_num(text): return any(str.isdigit(c) for c in text)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __has_numbers(self, input_string):\n return bool(re.search(r'\\d', input_string))", "def string_contains_digits(self, string):\n return bool(self.compiledDigitRegex.search(string))", "def hasNumbers(inputString):\n return any(char.isdigit() for char in inputString)", "def has_number(any_...
[ "0.8172344", "0.79365283", "0.7920436", "0.77395236", "0.76186305", "0.76108015", "0.7579923", "0.75246334", "0.752053", "0.74952775", "0.7424687", "0.7417321", "0.7388705", "0.7380551", "0.73604095", "0.73341787", "0.7302326", "0.7294237", "0.7280134", "0.7265637", "0.725564...
0.7755749
3
Lookup colors in the interpolated ranges
def _generate_colors( self, x: NDArrayFloat ) -> Sequence[RGBHexColor | None]: x = np.asarray(x) idx = np.round((x * 255) + ROUNDING_JITTER).astype(int) arr = np.column_stack( [self._r_lookup[idx], self._g_lookup[idx], self._b_lookup[idx]] ) return [rgb_to...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def color(self, data):\n\n red = np.interp(data, self.range, self.r)\n blue = np.interp(data, self.range, self.b)\n green = np.interp(data, self.range, self.g)\n # Style plot to return a grey color when value is 'nan'\n red[np.isnan(red)] = 240\n blue[np.isnan(blue)] = 240...
[ "0.7168324", "0.6621914", "0.6489006", "0.64465886", "0.64451146", "0.6430015", "0.642802", "0.63608456", "0.63608456", "0.63608456", "0.63608456", "0.6359832", "0.63452655", "0.63382024", "0.6230783", "0.62205803", "0.6198044", "0.6189087", "0.61712176", "0.6115988", "0.6106...
0.55385965
82
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 mor_item = dictionary.get('morItem') mor_type = dictionary.get('morType') uuid = dictionary.get('uuid') # Return an objec...
{ "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.8317533", "0.81689686", "0.81689686", "0.81188685", "0.808892", "0.7977596", "0.7949056", "0.79225504", "0.78983366", "0.7893884", "0.7887517", "0.7882494", "0.7881197", "0.7876339", "0.78581846", "0.78387725", "0.78037786", "0.78037786", "0.78037786", "0.78037786", "0.780...
0.76598775
71
Yield successive nsized chunks from l.
def chunks(l): for i in range(0, len(l), concurrent): yield l[i:i + concurrent]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _chunk(self, l, n):\n for i in range(0, len(l) + 1, n):\n yield l[i:i + n]", "def chunks(self, l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]", "def __chunks(l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]", "def get_chunks(self, ...
[ "0.8038813", "0.79248375", "0.7923423", "0.7885103", "0.78773195", "0.7815877", "0.77655786", "0.77556044", "0.77441615", "0.7731815", "0.77288336", "0.772473", "0.77028215", "0.76889825", "0.76889825", "0.7664208", "0.76570904", "0.7655856", "0.7655856", "0.76458347", "0.764...
0.0
-1
Get the absolute path of the ``sitepackages`` directory.
def get_sp_dir(): # pragma: no cover for p in sys.path[::-1]: if p.endswith("site-packages"): return p raise Exception("'site-package' directory not found!")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def path(self):\n installed_packages_folder_path = site.getsitepackages()[0]\n return f'{installed_packages_folder_path}/{SITE_PACKAGES_FOLDER_NAME}'", "def user_site_packages() -> str:\n if os.name == 'nt':\n return os.path.join(user_plugin_dir(), 'Lib', 'site-packages')\n\n python_di...
[ "0.79512745", "0.79062295", "0.7685186", "0.756079", "0.70923513", "0.69586945", "0.6912531", "0.6832663", "0.6766113", "0.6646042", "0.6600975", "0.6571977", "0.6550356", "0.6524058", "0.65064216", "0.6486803", "0.64243525", "0.64028996", "0.6361537", "0.63540614", "0.634636...
0.77620167
2
Computes the accuracy over the k top predictions for the specified values of k
def accuracy(output, target, topk=(1,)): with torch.no_grad(): 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).floa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def topk_accuracy(y, y_pred, k=2):\n pred = []\n for i in range(len(y)):\n if y[i] in y_pred[i][:k]:\n pred.append(1)\n else:\n pred.append(0)\n return sum(pred) / len(pred)", "def accuracy(y_pred, y_actual, topk=(1, )):\n maxk = max(topk)\n batch_size = y_actua...
[ "0.8330462", "0.828432", "0.82377493", "0.8229689", "0.82198155", "0.8186224", "0.8184685", "0.81749374", "0.8171418", "0.81700104", "0.8166419", "0.8164397", "0.8163624", "0.8162058", "0.8162058", "0.8162058", "0.8162058", "0.8162058", "0.8162058", "0.8162058", "0.8162058", ...
0.78612626
75
Returns IDs of all attached disks.
def disk_ids(self): return list(self._disks)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_disk_ids(disk_names):\n return [get_disk_obj(disk_name).get_id() for disk_name in disk_names]", "def getAttachIds(self):\n return self._attachments.keys()", "def get_all_disks():\n return DISKS_API.get(abs_link=False)", "def get_disks():\n disks = []\n\n try:\n # Run script\n res...
[ "0.672024", "0.66599137", "0.6567812", "0.64278257", "0.63502854", "0.6282658", "0.62476546", "0.6156233", "0.6099", "0.60058296", "0.59742755", "0.5946755", "0.58215255", "0.57833606", "0.57782954", "0.57057995", "0.5705078", "0.570014", "0.56879455", "0.56781983", "0.566385...
0.79639286
0
Return the datastore id of the disk.
def disk_datastore_id(self, disk_id): try: return self.disk(disk_id).find("DATASTORE_ID").text except AttributeError: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_id(disk):\n\n #TODO\n return \"Unknown\"", "def get_datastore_id(options):\n service_instance = get_vc_content(options)\n datastore = options.datastore\n datacenter = get_datacenter(options)\n for item in datacenter.datastoreFolder.childEntity:\n if (item.name == datastore):\n ...
[ "0.7739558", "0.7404281", "0.72293514", "0.71313775", "0.69537127", "0.67419755", "0.67419755", "0.67245305", "0.67245305", "0.6614154", "0.66139466", "0.6607355", "0.6564186", "0.6520358", "0.6350659", "0.6343349", "0.63243634", "0.63226104", "0.6304181", "0.62755764", "0.62...
0.82589585
0
Test class `__eq__` method
def test_class_eq_method(self, test_instances): a, b, _ = test_instances assert a == b
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self,*args):\r\n pass", "def __eq__(self,*args):\r\n pass", "def __eq__(self,*args):\r\n pass", "def __eq__(self,*args):\r\n pass", "def __eq__(self,*args):\r\n pass", "def __eq__(self,*args):\r\n pass", "def __eq__(self,*args):\r\n pass", "def __eq__(self,*args):\r\n pass", "def...
[ "0.8660917", "0.8660917", "0.8660917", "0.8660917", "0.8660917", "0.8660917", "0.8660917", "0.8660917", "0.8660917", "0.8660917", "0.8660917", "0.8660917", "0.8660917", "0.8660917", "0.8660917", "0.8660917", "0.8660917", "0.8660917", "0.8660917", "0.8660917", "0.8534341", "...
0.83141685
42
Test class `__ne__` method
def test_class_ne_method(self, test_instances): a, b, c = test_instances assert a != c assert b != c a.__dict__.update(baz=True) assert a != b
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__(self, other):\n pass", "def __ne__(self, other):\n return self.isNot(other)", "def __ne__(self: _TT, other: object) -> bool:\n return self.ne(other) # type: ignore", "def __ne__(self, other):\n return not_equal(self, other)", "def __ne__(self, other):\n return not...
[ "0.8294736", "0.81899023", "0.8164965", "0.810767", "0.80923873", "0.80829924", "0.8028293", "0.80182505", "0.80182123", "0.7949711", "0.7942892", "0.7936812", "0.7936812", "0.7936812", "0.79276395", "0.7921599", "0.7921599", "0.7921599", "0.7921599", "0.789217", "0.7888317",...
0.0
-1
start showing the dialogs ont the display To pause the display, use `xkcd pause`.
def play(): xd = display.XKCDDisplayService() if xd.is_running(): click.echo("showing the dialogs") xd.send_signal(signal.SIGUSR1) else: click.echo("xkcd service not running")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pause():\n xd = display.XKCDDisplayService()\n if xd.is_running():\n click.echo(\"pausing the dialogs\")\n xd.send_signal(signal.SIGUSR2)\n else:\n click.echo(\"xkcd service not running\")", "def start(dialogs_dir):\n xd = display.XKCDDisplayService(dialogs_dir)\n if xd.is...
[ "0.7816807", "0.71714574", "0.639347", "0.63744885", "0.63719267", "0.6370289", "0.6337747", "0.6207863", "0.61884946", "0.6174844", "0.61601406", "0.60837084", "0.6057261", "0.6049021", "0.6041432", "0.60386074", "0.60089785", "0.60076314", "0.59878737", "0.5955808", "0.5955...
0.8131057
0
will render one dialog to panel images in a directory Use this after a new dialog has been added before using the display service to show it. Sometimes adjustments to the dialog have to be made... If now output directory is set, the images are rendered to a temporary directory and are shown even if show is not selected...
def xkcdtest(show, outdir, dialogfile): if not outdir: show = True dialog_path = Path(dialogfile) raw_transcript = dialog.parse_dialog(dialog_path.read_text()) transcript = dialog.adjust_narrators(raw_transcript) context_manager = _get_directory_context_manager(outdir) with context_m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ImgDirDialog(self):\r\n \r\n self.img_dir = tk.filedialog.askdirectory(title = \"Select Destination Directory for image data\")\r\n self.file_names = [fn for fn in sorted(os.listdir(self.img_dir)) if any(fn.endswith(ext) for ext in file_extensions)]\r\n self.paths = [self.img_dir + ...
[ "0.6428622", "0.5838526", "0.5789744", "0.5718895", "0.5699779", "0.5641215", "0.56146413", "0.5602032", "0.55841285", "0.5568528", "0.55275464", "0.55205595", "0.54951227", "0.54480064", "0.5439059", "0.54216087", "0.5409717", "0.54024154", "0.5397537", "0.53339106", "0.5329...
0.51934576
36
returns a context manager for the output directory This unifies the interface for a temporary directory and a normal one
def _get_directory_context_manager(outdir): if outdir: return contextlib.nullcontext(outdir) else: return tempfile.TemporaryDirectory()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __enter__(self):\n self.temporary_directory = tempfile.mkdtemp(**self.options)\n logger.debug(\"Created temporary directory: %s\", self.temporary_directory)\n return self.temporary_directory", "def tempdir():\n\n class ctx(object):\n\n def __enter__(self):\n self.pre...
[ "0.7752122", "0.7585298", "0.7412195", "0.7404056", "0.73954296", "0.73756963", "0.7361229", "0.71462", "0.7106759", "0.71039194", "0.7094585", "0.7080965", "0.70607036", "0.7023971", "0.7012873", "0.70049137", "0.6981151", "0.69428104", "0.69373924", "0.6918992", "0.6860234"...
0.8132279
0
Contact page should respond with a success 200.
def test_contact_page(self, client): response = client.get(url_for('contact.index')) assert response.status_code == 200
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_contact(self):\n\t\tresponse = self.client.get('/contact')\n\t\tself.assertContains(response, 'Contact', 4, 200)", "def test_contact(self):\n response = self.client.get('/contact')\n self.assertContains(response, 'Contact', 3, 200)", "def test_contact_page(self):\n res = self.clie...
[ "0.7664089", "0.7607836", "0.76031023", "0.72401404", "0.72066057", "0.71902645", "0.7109812", "0.7044971", "0.70092994", "0.70016336", "0.69757664", "0.69253606", "0.6818164", "0.6804292", "0.68033624", "0.6797687", "0.67721766", "0.6771458", "0.67613375", "0.67613375", "0.6...
0.7707643
0
Contact form should redirect with a message.
def test_contact_form(self, client): form = { 'email': 'info@rmsfinance.com', 'message': 'Test message from Snake Eyes.' } # !!!! turn-off CSRF?? !!!! from flask import current_app current_app.config['WTF_CSRF_ENABLED'] = False response = client.post...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def contact(request):\n\n if request.method == \"POST\":\n form = ContactForm(request.POST)\n if form.is_valid():\n form.save()\n messages.info(\n request, 'Your message is send. '\n + 'We will reply within 48 hours!')\n else:\n ...
[ "0.75234383", "0.74533474", "0.717565", "0.71242446", "0.7078214", "0.70689213", "0.70594895", "0.69463015", "0.6922647", "0.6904521", "0.6846544", "0.67900354", "0.6786419", "0.6760009", "0.6755947", "0.6742739", "0.67029417", "0.6693726", "0.6609479", "0.6603915", "0.656761...
0.68944603
10
Redirect to welcome if not seen, add Rooms user to request.
def fn_wrapper(request, *args, **kwargs): user = get_user(request.user.username) if not user: return HttpResponseForbidden() if not user.seen_welcome: return HttpResponseRedirect('/about/') request.rooms_user = user return fn(request, *args, **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_user(fn):\n @wraps(fn)\n def fn_wrapper(request, *args, **kwargs):\n \"\"\"Redirect to welcome if not seen, add Rooms user to request.\"\"\"\n user = get_user(request.user.username)\n if not user:\n return HttpResponseForbidden()\n if not user.seen_welcome:\n ...
[ "0.7237326", "0.6771685", "0.6520982", "0.6438865", "0.63811123", "0.6358513", "0.6305313", "0.61365885", "0.61279976", "0.6087376", "0.60715854", "0.6041219", "0.60119677", "0.60118747", "0.60030186", "0.5964917", "0.5961812", "0.59132254", "0.5865454", "0.5840754", "0.58332...
0.68554676
1
Connect to the MQTT client
def connect_mqtt(): client = mqtt.Client() client.connect(MQTT_HOST, MQTT_PORT, MQTT_KEEPALIVE_INTERVAL) return client
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connect_mqtt():\n ### TODO: Connect to the MQTT client ###\n client = mqtt.Client(\"41\")\n client.connect(MQTT_HOST,port=MQTT_PORT, keepalive=MQTT_KEEPALIVE_INTERVAL)\n\n return client", "def mqtt_connect():\n global mqtt_client\n logging.debug('connecting to mqtt broker %s', config['mqtt']['h...
[ "0.8602263", "0.8580073", "0.79658973", "0.79198533", "0.7795112", "0.75766146", "0.7463519", "0.7463519", "0.737208", "0.7370956", "0.73446757", "0.73396283", "0.73305845", "0.7290404", "0.72773945", "0.7222561", "0.72134876", "0.7207249", "0.71264404", "0.7106446", "0.70897...
0.84291947
2
The set of arguments for constructing a AzureVpcPeeringConnection resource.
def __init__(__self__, *, azure_subscription_id: pulumi.Input[str], peer_azure_app_id: pulumi.Input[str], peer_azure_tenant_id: pulumi.Input[str], peer_resource_group: pulumi.Input[str], vnet_name: pulumi.Input[str], v...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(__self__,\n resource_name: str,\n args: AzureVpcPeeringConnectionArgs,\n opts: Optional[pulumi.ResourceOptions] = None):\n ...", "def __init__(__self__,\n resource_name: str,\n args: VirtualNetworkPeeringArgs,\n ...
[ "0.7815642", "0.71084815", "0.6161979", "0.6066089", "0.5916522", "0.5731427", "0.56703377", "0.56020623", "0.54761213", "0.54172224", "0.5412391", "0.5411983", "0.53963774", "0.5322029", "0.52777976", "0.5276574", "0.5208601", "0.51988477", "0.5186508", "0.5174702", "0.51393...
0.59426546
4
Azure resource group name of the peered VPC. This property cannot be changed, doing so forces recreation of the resource.
def peer_resource_group(self) -> pulumi.Input[str]: return pulumi.get(self, "peer_resource_group")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def peer_resource_group(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"peer_resource_group\")", "def peer_resource_group(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"peer_resource_group\")", "def resource_group_name(self) -> str:\n return pulumi.get(self, \"r...
[ "0.7321809", "0.6867212", "0.678169", "0.6648449", "0.660941", "0.6525809", "0.6525809", "0.6525809", "0.6525809", "0.6525809", "0.6525809", "0.6525809", "0.6525809", "0.6525809", "0.6525809", "0.6525809", "0.6525809", "0.6427488", "0.63939893", "0.6344449", "0.6344449", "0...
0.71472734
1
Azure Network name. This property cannot be changed, doing so forces recreation of the resource.
def vnet_name(self) -> pulumi.Input[str]: return pulumi.get(self, "vnet_name")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def network_name(self, **kwargs):\n\n return self.api_request(self._get_method_fullname(\"network_name\"), kwargs)", "def computer_network_name(self) -> str:\n return self._computer_network_name", "def managed_network_name(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"managed_net...
[ "0.7657632", "0.6852617", "0.67742956", "0.6564357", "0.6404147", "0.63744426", "0.6328653", "0.6316064", "0.62649024", "0.6164433", "0.6149063", "0.6113465", "0.6095669", "0.6067018", "0.6052242", "0.5961927", "0.5868755", "0.5787973", "0.5774253", "0.57605964", "0.5743953",...
0.59987205
15
Azure resource group name of the peered VPC. This property cannot be changed, doing so forces recreation of the resource.
def peer_resource_group(self) -> Optional[pulumi.Input[str]]: return pulumi.get(self, "peer_resource_group")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def peer_resource_group(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"peer_resource_group\")", "def peer_resource_group(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"peer_resource_group\")", "def resource_group_name(self) -> str:\n return pulumi.get(self, \"resource_gr...
[ "0.7323304", "0.71490234", "0.67819756", "0.6647383", "0.66097444", "0.6526289", "0.6526289", "0.6526289", "0.6526289", "0.6526289", "0.6526289", "0.6526289", "0.6526289", "0.6526289", "0.6526289", "0.6526289", "0.6526289", "0.64283174", "0.639524", "0.63453496", "0.63453496"...
0.6868886
2
Azure Network name. This property cannot be changed, doing so forces recreation of the resource.
def vnet_name(self) -> Optional[pulumi.Input[str]]: return pulumi.get(self, "vnet_name")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def network_name(self, **kwargs):\n\n return self.api_request(self._get_method_fullname(\"network_name\"), kwargs)", "def computer_network_name(self) -> str:\n return self._computer_network_name", "def managed_network_name(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"managed_net...
[ "0.76564425", "0.68517154", "0.6775293", "0.6565352", "0.64029956", "0.63751686", "0.6331702", "0.63171816", "0.62627614", "0.61647", "0.61473006", "0.61129576", "0.6095525", "0.60653454", "0.60499185", "0.59986174", "0.596154", "0.5789407", "0.57735646", "0.57611805", "0.574...
0.5868162
17
Azure resource group name of the peered VPC. This property cannot be changed, doing so forces recreation of the resource.
def peer_resource_group(self) -> pulumi.Output[str]: return pulumi.get(self, "peer_resource_group")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def peer_resource_group(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"peer_resource_group\")", "def peer_resource_group(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"peer_resource_group\")", "def resource_group_name(self) -> str:\n return pulumi.get(self, \"re...
[ "0.71490234", "0.6868886", "0.67819756", "0.6647383", "0.66097444", "0.6526289", "0.6526289", "0.6526289", "0.6526289", "0.6526289", "0.6526289", "0.6526289", "0.6526289", "0.6526289", "0.6526289", "0.6526289", "0.6526289", "0.64283174", "0.639524", "0.63453496", "0.63453496"...
0.7323304
0
Azure Network name. This property cannot be changed, doing so forces recreation of the resource.
def vnet_name(self) -> pulumi.Output[str]: return pulumi.get(self, "vnet_name")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def network_name(self, **kwargs):\n\n return self.api_request(self._get_method_fullname(\"network_name\"), kwargs)", "def computer_network_name(self) -> str:\n return self._computer_network_name", "def managed_network_name(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"managed_net...
[ "0.76564425", "0.68517154", "0.6775293", "0.6565352", "0.64029956", "0.63751686", "0.6331702", "0.63171816", "0.62627614", "0.61647", "0.61473006", "0.6095525", "0.60653454", "0.60499185", "0.59986174", "0.596154", "0.5868162", "0.5789407", "0.57735646", "0.57611805", "0.5743...
0.61129576
11
Create an Fixed Point object.
def __init__(self, value=0, int_bits=INT_BITS, frac_bits=FRAC_BITS): if MODE_STRICT_WITHOUT_ERROR_CHECKING == 0: assert int_bits >= 1, "int_bits must be greater or equal than 1" assert frac_bits >= 0, "frac_bits must be greater or eqaul than 0" assert isinstance(value, int) | isinsta...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_instantiate_1():\n a = FixedPoint(1, 'Q2.0')\n assert a.value == 1\n assert a.m == 2\n assert a.n == 0", "def point(cls): # No range because it's unknown at this time.\r\n def factory(i, name):\r\n return cls(i, name, (0, 0), lambda a: point.Point(*a).floor(), None)\r\n ...
[ "0.68527544", "0.6835607", "0.6810045", "0.6802522", "0.6802522", "0.6207056", "0.6078274", "0.605024", "0.60153264", "0.5938773", "0.5930962", "0.5929886", "0.5869593", "0.58671975", "0.5816842", "0.5812471", "0.57779264", "0.57236135", "0.5720597", "0.5719535", "0.5702016",...
0.0
-1
Convert a value to the encoded representation and clip it
def encode(self, value): x = round(value * (1<< self.frac_bits)) return self.min_value if x<self.min_value else self.max_value if x > self.max_value else x
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _to_clips_value(cls, x):\n return x", "def value_to_rawvalue(self, value):\n return self.value_min_raw + 1./ self._value_scale * value", "def sanitize(cls, value):\n return value", "def strip(self, value):\n return value*self._scale + self._offset", "def normalize(self, valu...
[ "0.6938578", "0.669795", "0.6528455", "0.6449331", "0.6446176", "0.6413692", "0.6316371", "0.6307703", "0.62329113", "0.6224035", "0.6215969", "0.6052055", "0.602871", "0.60232586", "0.60232586", "0.59961975", "0.59961975", "0.59961975", "0.59904057", "0.5982614", "0.59513384...
0.58054906
29
Calculate the great circle distance between two points on the earth (specified in decimal degrees)
def haversine(lon1, lat1, lon2, lat2): # convert decimal degrees to radians lon1, lat1, lon2, lat2 = map(radians, [lon1, lat1, lon2, lat2]) # haversine formula dlon = lon2 - lon1 dlat = lat2 - lat1 a = sin(dlat/2.)**2. + cos(lat1) * cos(lat2) * sin(dlon/2.)**2. c = 2. * asin(sqrt(a)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def great_circle(lat_1, long_1, lat_2, long_2):\n long_1 = m.radians(long_1)\n lat_1 = m.radians(lat_1)\n long_2 = m.radians(long_2)\n lat_2 = m.radians(lat_2)\n\n d = 2 * 6367.45 * m.asin(\n m.sqrt(haversine(lat_2 - lat_1)\n + m.cos(lat_1)*m.cos(lat_2) *\n haversine(long...
[ "0.8146851", "0.78653836", "0.7633587", "0.760638", "0.7597363", "0.7595882", "0.7594262", "0.7571903", "0.7563977", "0.7557409", "0.7529731", "0.7516804", "0.7494894", "0.74672914", "0.74524754", "0.7434426", "0.7391925", "0.735819", "0.73490065", "0.7331919", "0.73290455", ...
0.0
-1
To move the bullet on the screen every loop
def move(self, vel): self.y += vel
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shootBullet(self,event):\n if (not self.hasBulletLoaded):\n return\n if (self.currentBullets>=self.maxBullets):\n return\n newBullet=Bullet(self.canvasIGetDrawnOn,entityThatCreatedMe=self,xPos=self.xPos,yPos=self.yPos)\n self.hasBulletLoaded=False#the gun chamb...
[ "0.756119", "0.7482356", "0.74686915", "0.73459524", "0.73293495", "0.73224866", "0.73185426", "0.7312508", "0.7305877", "0.72865003", "0.7235276", "0.7235276", "0.72133136", "0.72133136", "0.7156737", "0.71109635", "0.7097615", "0.70760983", "0.7022629", "0.6999813", "0.6999...
0.0
-1
test place has attributes User
def testUser(self): place = Place() self.assertTrue(hasattr(place, "user_id")) self.assertEqual(place.user_id, "")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_user_id(self):\n place = Place()\n self.assertTrue(hasattr(place, \"user_id\"))\n self.assertEqual(type(place.user_id), str)\n self.assertEqual(place.user_id, \"\")", "def test_user(self):\n return True", "def test_location(self):\n self.assertEqual(self.user1...
[ "0.7354759", "0.6985283", "0.6894407", "0.6876992", "0.67938614", "0.6756325", "0.6750763", "0.6749276", "0.67444235", "0.6721583", "0.6692416", "0.6646179", "0.66298807", "0.6587614", "0.6538709", "0.6532357", "0.651582", "0.65015686", "0.6493719", "0.64820313", "0.6449384",...
0.81319594
0
test place has attributes number rooms
def testNumberRooms(self): place = Place() self.assertTrue(hasattr(place, "number_rooms")) self.assertEqual(type(place.number_rooms), int) self.assertEqual(place.number_rooms, 0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_number_rooms(self):\n place = Place()\n self.assertTrue(hasattr(place, \"number_rooms\"))\n self.assertEqual(type(place.number_rooms), int)\n self.assertEqual(place.number_rooms, 0)", "def test_number_bathrooms(self):\n place = Place()\n self.assertTrue(hasattr(...
[ "0.7589906", "0.6944802", "0.68648404", "0.64007443", "0.6326029", "0.6170222", "0.6080759", "0.5924711", "0.58849084", "0.5854982", "0.5810926", "0.57908463", "0.5782188", "0.5727568", "0.57184094", "0.57007533", "0.56783646", "0.56723815", "0.56674874", "0.56615335", "0.566...
0.762148
0
test place has attributes number bathrooms
def testNumberBathrooms(self): place = Place() self.assertTrue(hasattr(place, "number_bathrooms")) self.assertEqual(type(place.number_bathrooms), int) self.assertEqual(place.number_bathrooms, 0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_number_bathrooms(self):\n place = Place()\n self.assertTrue(hasattr(place, \"number_bathrooms\"))\n self.assertEqual(type(place.number_bathrooms), int)\n self.assertEqual(place.number_bathrooms, 0)", "def test_number_rooms(self):\n place = Place()\n self.assertT...
[ "0.7493405", "0.7024076", "0.69143075", "0.66481113", "0.6235911", "0.6097309", "0.60060585", "0.5947601", "0.5921368", "0.5840065", "0.5814581", "0.5791613", "0.57781535", "0.5736302", "0.56763566", "0.5667157", "0.56450933", "0.5626067", "0.5603241", "0.5587661", "0.5586978...
0.75048167
0
Al seleccionar una provincia en el comboBox, llama al evento cmb.activated y devuelve la provincia seleccionada
def selProv(prov): try: global vprov vprov = prov except Exception as error: print('Error %s ' % str(error))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_comboBox_celuebianhao_currentIndexChanged(self, p0):\n # TODO: not implemented yet\n raise NotImplementedError", "def on_comboBox_currentIndexChanged(self, p0):\n # TODO: not implemented yet\n \n self.selectedItem = str(p0.toUtf8()).decode('utf-8')\n #raise NotImp...
[ "0.70185935", "0.6914049", "0.6878037", "0.6811465", "0.65116304", "0.6444286", "0.64416206", "0.62473744", "0.6232103", "0.6185888", "0.61528057", "0.61134714", "0.61096245", "0.60649854", "0.6018415", "0.59621966", "0.59606874", "0.5942534", "0.5911412", "0.59029245", "0.58...
0.55884093
32
Get the scene viewer for this ZincWidget.
def getSceneviewer(self): return self._sceneviewer
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_viewer_container(self):\n self.viewer = self.traj._tempmol.draw3d(style='licorice')\n return self.viewer", "def get_scene(self):\n return self.scenes[self.current_scene]", "def getViewer(self, v_id=-1) -> Viewer:\n viewer_ctrl = self.getViewerController(v_id)\n if vi...
[ "0.71168274", "0.702649", "0.6721892", "0.6579078", "0.6406719", "0.62917256", "0.61424106", "0.601053", "0.5851335", "0.57047683", "0.5638967", "0.5630164", "0.56223744", "0.5573266", "0.55413276", "0.55246353", "0.5522934", "0.5511635", "0.5501095", "0.54792523", "0.5451217...
0.84277904
0
Maximum input length supported by the encoder.
def max_positions(self): return int(1e5)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def max_length(self) -> int | None:\n return self._underlying.max_length", "def max_length(self):\n\t\treturn self._max_length", "def _max_length(self):\n return self.__max_length", "def max_size(self):\n raise NotImplementedError()", "def len_max(self):\n return 16 + 16 + 8 + 8...
[ "0.79897684", "0.796766", "0.7858538", "0.7661177", "0.764795", "0.7555229", "0.7417586", "0.7405116", "0.733513", "0.7185543", "0.7182693", "0.7143216", "0.71080714", "0.7097763", "0.70617527", "0.70289385", "0.70070046", "0.6974585", "0.6966727", "0.69448024", "0.69448024",...
0.0
-1
Get a scoped session for the given tenancy.
def scoped_session(self, tenancy: Union[dto.Tenancy, str]) -> 'ScopedSession': raise errors.UnsupportedOperationError( "Operation not supported for provider '{}'".format(self.provider_name) )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_scoped_session():\n if scopedsessionclass is None:\n s = None\n else:\n s = scopedsessionclass()\n\n return s", "def get_session():\n session = scoped_session(sessionmaker(bind=engine))\n return session", "def get_session():\n return scoped_session(sessionmaker(autocommi...
[ "0.7463624", "0.7218879", "0.67233324", "0.6672524", "0.6630983", "0.6605064", "0.65718794", "0.6551582", "0.65360403", "0.65349364", "0.6532322", "0.65320045", "0.650158", "0.6429706", "0.6349169", "0.6347238", "0.6325116", "0.6323279", "0.63196206", "0.630509", "0.6291362",...
0.7907093
0
Returns the firewall rules for the machine.
def fetch_firewall_rules_for_machine( self, machine: Union[dto.Machine, str] ) -> Iterable[dto.FirewallGroup]: raise errors.UnsupportedOperationError( "Operation not supported for provider '{}'".format(self.provider_name) )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_dedicated_fwl_rules(self, firewall_id):\r\n svc = self.client['Network_Vlan_Firewall']\r\n return svc.getRules(id=firewall_id, mask=RULE_MASK)", "def get_firewall_rules(self, server):\n server_uuid, server_instance = uuid_and_instance(server)\n\n url = f'/server/{server_uuid}/...
[ "0.7195407", "0.7168536", "0.69507354", "0.6922061", "0.66115016", "0.657532", "0.6527567", "0.6404079", "0.627062", "0.6250536", "0.62291163", "0.6209954", "0.60805774", "0.60230684", "0.59564626", "0.59405327", "0.5936703", "0.59035397", "0.58358794", "0.58089083", "0.57980...
0.6786547
4
Removes the specified firewall rule from the machine and returns the new set of rules.
def remove_firewall_rule_from_machine( self, machine: Union[dto.Machine, str], firewall_rule: Union[dto.FirewallRule, str] ) -> Iterable[dto.FirewallGroup]: raise errors.UnsupportedOperationError( "Operation not supported for provider '{}'".format(self.provider_name) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_firewall_rule(self, firewall_rule):\r\n return self.delete(self.firewall_rule_path % (firewall_rule))", "def removeRule(self, *args):\n return _libsbml.Model_removeRule(self, *args)", "def remove_rule(self, rule_number):\n\n\t\tif self._mode == Mode.PassThrough:\n\t\t\traise ValueError...
[ "0.70346546", "0.6309014", "0.62628484", "0.6229227", "0.62191707", "0.61981905", "0.5955112", "0.5944173", "0.5938731", "0.59235305", "0.5776932", "0.5769019", "0.57204884", "0.5607488", "0.55820453", "0.5573506", "0.5550639", "0.55348074", "0.5477784", "0.5465073", "0.54238...
0.77816683
0
Finds a Kubernetes cluster template by id.
def find_kubernetes_cluster_template(self, id: str) -> dto.KubernetesClusterTemplate: raise errors.UnsupportedOperationError( "Operation not supported for provider '{}'".format(self.provider_name) )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_template_by_id(context, id):\n admin = context.getAdministrationService()\n enterprise = admin.getCurrentEnterprise()\n return enterprise.findTemplate(VirtualMachineTemplatePredicates.id(id))", "def _get_template_by_id(self, template_id):\n raise NotImplementedError()", "def get_templa...
[ "0.7872412", "0.6790759", "0.65845335", "0.6535215", "0.64060813", "0.63237554", "0.62393624", "0.6136813", "0.6100347", "0.60435617", "0.60230935", "0.5989392", "0.59092027", "0.58121604", "0.57508606", "0.5655647", "0.5598551", "0.5561136", "0.55345184", "0.55205876", "0.54...
0.82877433
0
Update the specified Kubernetes cluster.
def update_kubernetes_cluster( self, cluster: Union[dto.KubernetesCluster, str], template: Union[dto.KubernetesClusterTemplate, str] ) -> dto.KubernetesCluster: raise errors.UnsupportedOperationError( "Operation not supported for provider '{}'".format(self.provider_name) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_cluster(self, cluster, params, *args, **kwargs):\n raise NotImplementedError", "def update_cluster(\n self,\n cluster: Union[dto.Cluster, str],\n params: Mapping[str, Any]\n ) -> dto.Cluster:\n raise errors.UnsupportedOperationError(\n \"Operation not s...
[ "0.7799675", "0.73916435", "0.71293277", "0.7100284", "0.70896614", "0.70332205", "0.6753576", "0.65889484", "0.6259748", "0.62123793", "0.6042892", "0.600235", "0.58724767", "0.5868797", "0.5837158", "0.5837158", "0.5837158", "0.5837158", "0.5837158", "0.5837158", "0.5815896...
0.7554193
1
Find a cluster by id.
def find_cluster(self, id: str) -> dto.Cluster: raise errors.UnsupportedOperationError( "Operation not supported for provider '{}'".format(self.provider_name) )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_cluster(self, id):\n raise NotImplementedError", "def find_kubernetes_cluster(self, id: str) -> dto.KubernetesCluster:\n raise errors.UnsupportedOperationError(\n \"Operation not supported for provider '{}'\".format(self.provider_name)\n )", "def get_cluster_by_id(self,...
[ "0.89340335", "0.80049926", "0.7087015", "0.6964663", "0.6952615", "0.67677695", "0.6584001", "0.6523775", "0.6490518", "0.64823717", "0.6398891", "0.6380067", "0.6297336", "0.6271734", "0.6266025", "0.623782", "0.6237797", "0.6187373", "0.6111801", "0.60111856", "0.59842736"...
0.8516475
1
Reset the internal statistics of the tracker.
def reset(self): weight = self.module.weight.data self.sensitivity_in = torch.zeros(weight.shape[1]).to(weight.device) self._features = torch.Tensor() self._current_batch = 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stats_reset(self):\n self.stats.reset()", "def stats_reset(self):\n self.stats.reset()", "def reset(self) -> None:\n self.statistics = defaultdict(int)", "def reset(self) -> None:\n self.statistics = defaultdict(float)", "def reset(self):\n self.stats = {}", "def re...
[ "0.85885596", "0.85885596", "0.8498898", "0.8487036", "0.8430663", "0.8076107", "0.80572075", "0.8034867", "0.8033949", "0.7989022", "0.7923762", "0.78862035", "0.78862035", "0.78862035", "0.77523303", "0.76605135", "0.76589984", "0.7553357", "0.7504818", "0.7469674", "0.7431...
0.0
-1
Get a single element out of the circular buffer. If the buffer is empty, throw a runtime_error
def get (self) : if (self.empty()) : # Empty, can't get anything raise Exception("Circular Buffer Empty") else : # nextGet always tells us where we are c = self.buff_[self.nextGet_]; self.nextGet_ = (self.nextGet_+1) % self.capacity() self.emp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def peek(self):\n if len(self) == 0:\n if self.none_for_empty:\n return None\n raise ValueError(\"Buffer is empty\")\n return self.buf[self.front]", "def __getitem__(self, index):\n return self.buffer[index]", "def blocking_read_elem(self):\n _, read...
[ "0.64193106", "0.6361958", "0.620972", "0.6167406", "0.6118264", "0.6018218", "0.6008571", "0.59713346", "0.59308946", "0.5902252", "0.5885353", "0.5827976", "0.5815899", "0.5790655", "0.5782687", "0.5776721", "0.57740057", "0.5757702", "0.5756447", "0.57542306", "0.57536995"...
0.74701625
0
This implements performing "n" gets, but in O(1) time. If asked to consume more elements that the CircularBuffer contains, a runtime_error will be thrown.
def consume (self, n) : if (n<0 or n>len(self)) : m = "Trying to consume more data than in Circ. Buff" raise Exception(m) self.empty_ = (n==len(self)) self.nextGet_ = (self.nextGet_+n) % self.capacity()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get (self) :\r\n if (self.empty()) : # Empty, can't get anything\r\n raise Exception(\"Circular Buffer Empty\")\r\n else : # nextGet always tells us where we are\r\n c = self.buff_[self.nextGet_];\r\n self.nextGet_ = (self.nextGet_+1) % self.capacity()\r\n ...
[ "0.6635225", "0.53858465", "0.5350926", "0.53395367", "0.5309778", "0.52753824", "0.5273038", "0.5232316", "0.520699", "0.5196958", "0.518943", "0.5165232", "0.5088297", "0.50483835", "0.5030135", "0.50276226", "0.5023479", "0.5011553", "0.4999453", "0.49924186", "0.49361953"...
0.66673464
0
Indent the given number of spaces
def indentOut_ (stream, indent) : if indent == 0 : return else : stream.write(" "*indent)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Indent(indents):\n return ' ' * (2 * indents)", "def _indent_spaces(self):\n if prettyprint:\n return self.indentspace * self._indent_level\n else:\n return ''", "def make_spaces_for_html(indent_num: int) -> str:\r\n from apysc.validation import number_validation\r\n...
[ "0.7832996", "0.7463453", "0.74218243", "0.7418618", "0.7306952", "0.7290147", "0.72859424", "0.72232956", "0.7124279", "0.71098685", "0.7048212", "0.70235944", "0.70119065", "0.70048267", "0.69974303", "0.69407064", "0.6929608", "0.68927306", "0.68902695", "0.68902695", "0.6...
0.62001437
49
default_minimum Default for the minimum amount needed for a path.
def __init__(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _minimum(self) -> float:\n return self._config[CONF_MIN]", "def _get_minimum(self):\n return self._minimum", "def minimum(self):\n return self.properties.get('minimum')", "def minimum(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"minimum\")", "def minimum...
[ "0.7048602", "0.68590534", "0.6830656", "0.6534922", "0.6534922", "0.6534922", "0.6534922", "0.6534922", "0.6534922", "0.6534922", "0.6534922", "0.6534922", "0.65331006", "0.651231", "0.64590424", "0.6447218", "0.6411486", "0.6394953", "0.63818043", "0.637015", "0.63255066", ...
0.0
-1
Convert anything to unicode
def touni(x, enc='utf8', err='strict'): return str(x, enc, err) if isinstance(x, bytes) else str(x)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_unicode(value):\r\n if isinstance(value, _TO_UNICODE_TYPES):\r\n return value\r\n if not isinstance(value, bytes_type):\r\n raise TypeError(\r\n \"Expected bytes, unicode, or None; got %r\" % type(value)\r\n )\r\n return value.decode(\"utf-8\")", "def _to_unicode(t...
[ "0.7830607", "0.754466", "0.7537315", "0.75043535", "0.7463989", "0.7440848", "0.74289066", "0.7398759", "0.7381902", "0.7361686", "0.7345176", "0.7331741", "0.7284262", "0.7274428", "0.72743064", "0.7266106", "0.72488856", "0.72433484", "0.72323835", "0.72158426", "0.7173030...
0.65506434
71
Convert anything to unicode
def touni(x, enc='utf8', err='strict'): return x if isinstance(x, unicode) else unicode(str(x), enc, err)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_unicode(value):\r\n if isinstance(value, _TO_UNICODE_TYPES):\r\n return value\r\n if not isinstance(value, bytes_type):\r\n raise TypeError(\r\n \"Expected bytes, unicode, or None; got %r\" % type(value)\r\n )\r\n return value.decode(\"utf-8\")", "def _to_unicode(t...
[ "0.7830607", "0.754466", "0.7537315", "0.75043535", "0.7463989", "0.7440848", "0.74289066", "0.7398759", "0.7381902", "0.7361686", "0.7345176", "0.7331741", "0.7284262", "0.7274428", "0.72743064", "0.7266106", "0.72488856", "0.72433484", "0.72158426", "0.71730304", "0.7147997...
0.72323835
18
Wrap a WSGI environ dictionary.
def __init__(self, environ): #: The wrapped WSGI environ dictionary. This is the only real attribute. #: All other attributes actually are read-only properties. self.environ = environ environ['bottle.request'] = self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wrap_env(env, wrappers):\n for wrapper, args in wrappers:\n env = wrapper(env, **args)\n return env", "def env_wrap(self):\n\n old_env = dict(os.environ)\n try:\n yield\n finally:\n os.environ.clear()\n os.environ.update(old_env)", "def aug...
[ "0.671824", "0.6690523", "0.6403964", "0.63861644", "0.6372965", "0.6352816", "0.63467866", "0.6332451", "0.6332451", "0.6288268", "0.62810814", "0.6262264", "0.6262264", "0.6262264", "0.62449044", "0.62283427", "0.621685", "0.62027925", "0.6150311", "0.6036567", "0.6036567",...
0.61631316
18
The full request URI including hostname and scheme. If your app lives behind a reverse proxy or load balancer and you get confusing results, make sure that the ``XForwardedHost`` header is set correctly.
def url(self): return self.urlparts.geturl()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_request_uri(request):\n # DEV: Use django.http.request.HttpRequest._get_raw_host() when available\n # otherwise back-off to PEP 333 as done in django 1.8.x\n if hasattr(request, \"_get_raw_host\"):\n host = request._get_raw_host()\n else:\n try:\n # Try to build host ho...
[ "0.73544174", "0.7217821", "0.70844305", "0.70398045", "0.70150244", "0.6983493", "0.6931652", "0.69294363", "0.6926602", "0.68164396", "0.67835087", "0.6741773", "0.6604946", "0.657473", "0.65206856", "0.64861465", "0.64765525", "0.6451627", "0.64361566", "0.64314216", "0.64...
0.60115194
60
Get whether or not a user has the given permission. If a LocalSite instance is passed as ``obj``, then the permissions checked will be those that the user has on that LocalSite. Otherwise, they will be their global permissions. It is not legal to pass any other object.
def has_perm(self, user, perm, obj=None): if obj is not None and not isinstance(obj, LocalSite): logging.error('Unexpected object %r passed to has_perm. ' 'Returning False.', obj) if settings.DEBUG: raise ValueError('Unexpected object %r' % obj)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_access_permissions(self, request, obj, local_site=None, *args,\n **kwargs):\n return obj.is_accessible_by(request.user, local_site=local_site)", "def has_perm(context, perm, obj):\n return access.has_perm(context['request'].user, perm, obj)", "def has_perm(contex...
[ "0.7490337", "0.73814666", "0.73814666", "0.73680097", "0.73172367", "0.7240334", "0.70846283", "0.70710444", "0.70634866", "0.6985904", "0.6985904", "0.6938536", "0.69204664", "0.68978906", "0.6893581", "0.6884795", "0.68789595", "0.6876425", "0.6839636", "0.6837762", "0.677...
0.7613315
0
Name of the target. This will be used as the directory to clone into as well as selecting the target from the command line. Returns
def name(self): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def target_name(self):\n return self._target_name", "def name(self) -> str:\n return self.inst['targetname']", "def get_target_name(self):\n if self.preferred_name is None:\n target_name = self.original_name\n elif len(self.preferred_name) > 4:\n target_name = ...
[ "0.7605067", "0.72559136", "0.6671485", "0.64695215", "0.6375588", "0.6325633", "0.63179445", "0.6313169", "0.63048226", "0.62497365", "0.62211955", "0.61647624", "0.6158533", "0.6097426", "0.60679483", "0.60613495", "0.6051746", "0.6018321", "0.6018321", "0.6018321", "0.6018...
0.0
-1