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 |
|---|---|---|---|---|---|---|
Returns a state object for the current thread state. | def state(self):
if self._thread.breakpoint and self._thread.pc in self._process.threads._breakpoint_original_bytes:
LOGGER.warning("Overwriting current breakpoint in memory so it doesn't trip up angr.")
LOGGER.warning("This has the side-effect of disabling this breakpoint. You can re-e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_state(self):\n return self.__state",
"def _get_state(self):\n return self.__state",
"def _get_state(self):\n return self.__state",
"def _get_state(self):\n return self.__state",
"def _get_state(self):\n return self.__state",
"def _get_state(self):\n return self.__state",
"def... | [
"0.74767864",
"0.74767864",
"0.74767864",
"0.74767864",
"0.74767864",
"0.74767864",
"0.74767864",
"0.74767864",
"0.74767864",
"0.74767864",
"0.74767864",
"0.74767864",
"0.74767864",
"0.74767864",
"0.74767864",
"0.74767864",
"0.74767864",
"0.74767864",
"0.74767864",
"0.74767864"... | 0.0 | -1 |
Get the value of the indexth node in the linked list. If the index is invalid, return 1. | def get(self, index):
if index < 0:
return -1
# print('index:',index)
p = self.head
while index and p:
p = p.next
index -= 1
# print('after,index:',index)
if index:
return -1
if p and p.next:
return p.nex... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(self, index: int) -> int:\n node = self.get_node(index)\n if node:\n return node.val\n else:\n return -1",
"def get(self, index: int) -> int:\n cnt = 0\n cur = self.head \n while cur != None:\n if(cnt == index):\n r... | [
"0.8309071",
"0.8223403",
"0.81012017",
"0.79819065",
"0.7971722",
"0.79658747",
"0.7951939",
"0.79492354",
"0.79279983",
"0.7905674",
"0.7799605",
"0.7734565",
"0.77311933",
"0.76516724",
"0.758455",
"0.7507213",
"0.7455023",
"0.7386918",
"0.7386918",
"0.7384269",
"0.7336994... | 0.74742204 | 16 |
Add a node of value val before the first element of the linked list. After the insertion, the new node will be the first node of the linked list. | def addAtHead(self, val):
cur = linkNode(val)
cur.next = self.head.next
cur.prev = self.head
self.head.next = cur
if cur.next:
cur.next.prev = cur
if cur.next == None: # first node
self.tail = cur
# self.printList() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def insert(self, val):\n new_node = Node(val)\n new_node.next = self.head\n self.head = new_node",
"def addAtHead(self, val):\n node = ListNode(val)\n if self.head == None:\n self.head = node\n else:\n node.next = self.head\n self.head = ... | [
"0.7890199",
"0.7812391",
"0.77156895",
"0.7667366",
"0.7633173",
"0.7596094",
"0.75715685",
"0.75026643",
"0.74938554",
"0.7480735",
"0.74631685",
"0.7429043",
"0.74087286",
"0.73821265",
"0.7349201",
"0.7349201",
"0.72856104",
"0.72476804",
"0.72358054",
"0.7174488",
"0.714... | 0.75860196 | 6 |
Append a node of value val to the last element of the linked list. | def addAtTail(self, val):
cur = linkNode(val)
if self.tail == None: # first node
self.head.next = cur
cur.prev = self.head
self.tail = cur
else:
self.tail.next = cur
cur.prev = self.tail
self.tail = cur # update tail
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def append(self, val):\n inserted_node = DblNode(val, previous_node=self.tail)\n self.tail.next_node = inserted_node\n self.tail = inserted_node",
"def addAtTail(self, val):\n if self.head is None:\n self.addAtHead(val)\n else:\n new_node = Node(val)\n ... | [
"0.80130863",
"0.79794717",
"0.78928936",
"0.7879162",
"0.7879162",
"0.7856019",
"0.7782996",
"0.7744707",
"0.7721728",
"0.76904315",
"0.7632201",
"0.76267153",
"0.7550089",
"0.7530205",
"0.7521708",
"0.74483246",
"0.7416057",
"0.73196465",
"0.72394246",
"0.7223336",
"0.72167... | 0.77368987 | 8 |
Add a node of value val before the indexth node in the linked list. If index equals to the length of linked list, the node will be appended to the end of linked list. If index is greater than the length, the node will not be inserted. | def addAtIndex(self, index, val):
if index < 0:
return -1
p = self.head
while index and p: # 0-index before index-th
p = p.next
index -= 1
if p == None:
return
cur = linkNode(val)
cur.next = p.next
cur.prev = p
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def addAtIndex(self, index, val):\n if index < 0:\n new_node = ListNode(val)\n new_node.next = self.head\n self.head = new_node\n\n if index <= self.length:\n prev = None\n curr = self.head\n for i in range(1, index + 1):\n ... | [
"0.8006325",
"0.7905185",
"0.78425467",
"0.7757298",
"0.77432555",
"0.7742992",
"0.77307177",
"0.7709473",
"0.7618637",
"0.7613535",
"0.7613535",
"0.75972575",
"0.7502922",
"0.728164",
"0.7210373",
"0.7155025",
"0.70898044",
"0.702463",
"0.70231825",
"0.7017992",
"0.69305086"... | 0.7801852 | 3 |
apply a set of transformation to the entry spark.dataframe. Filter the data to keep for each category of portofolio the top three elements with the greater number of clients | def transform_dataframe (input_data) :
# PARTITIONING data based on portofolio value and
# ORDERING the number of client in descending order
# Then FILTERING based on their numbering
w = Window.partitionBy("NMPTF").orderBy(col("TOTAL_CLIENTS").desc())
transformed_df1 = ( input_data.select("*",r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def top_five_customers(data_frame):\n data_set = data_frame.groupby(['customer_id']).agg({'quantity_rented': 'sum'})\n data_set = data_set.nlargest(5, 'quantity_rented')\n return data_set",
"def filteringForNetworkBusiness():\n spark = SparkSession.builder.getOrCreate();\n\n # --------------------... | [
"0.58741754",
"0.58380884",
"0.55707556",
"0.5548277",
"0.5508892",
"0.5486306",
"0.54796374",
"0.545032",
"0.54274887",
"0.5374257",
"0.53721774",
"0.536778",
"0.5352473",
"0.5347465",
"0.52793276",
"0.5260128",
"0.5235301",
"0.52092594",
"0.51645166",
"0.5156671",
"0.515492... | 0.73606634 | 0 |
Returns given namedtuple as str in specified format. | def student_format(student):
s = student
return '{0}, {1}, {2}, {3}'.format(s[0], s[1], s[2], s[3]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _tupstr(tuple_):\n return ', '.join(list(map(str, tuple_)))",
"def tupleStrFormat(tupl):\n string = \"this is a tuple (\"\n for element in tupl:\n string += str(element) + \", \"\n string += \")\"\n return string",
"def deg_tuple_to_str(tup):\n if len(tup) == 0:\n return \"(... | [
"0.6826757",
"0.6704613",
"0.6636602",
"0.66048133",
"0.6586561",
"0.65383196",
"0.628286",
"0.62826",
"0.6211917",
"0.61802745",
"0.61746967",
"0.61746967",
"0.61746967",
"0.61746967",
"0.61746967",
"0.61746967",
"0.61746967",
"0.61746967",
"0.61746967",
"0.61746967",
"0.617... | 0.0 | -1 |
Parsing function for tf.train.SequenceExample proto. | def _parse_function(proto_string):
_, parsed_features = tf.parse_single_sequence_example(
proto_string, sequence_features=_parsing_spec(input_size))
lengths = tf.shape(parsed_features['inputs'])[0]
# Type int32 is not supported by parsing spec, but int64 is not supported by
# XLA. Here cast to i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _parse_function(example_proto):\n # Parse the tf.example according to the features_spec definition\n parsed_features = tf.parse_single_example(example_proto, features_spec)\n sequence = parsed_features[\"sequence\"]\n # Convert the sparse sequence tensor to dense.\n sequence_d = tf.sparse_to_den... | [
"0.74572957",
"0.738854",
"0.69824004",
"0.6940501",
"0.68003434",
"0.6753431",
"0.67320424",
"0.6690594",
"0.667501",
"0.66727",
"0.6533608",
"0.6524563",
"0.6512412",
"0.64945394",
"0.6489629",
"0.64781165",
"0.64726233",
"0.6458001",
"0.64427835",
"0.63338643",
"0.6320823"... | 0.65335304 | 11 |
Reads batches of SequenceExamples from TFRecords and pads them. Can deal with variable length SequenceExamples by padding each batch to the length of the longest sequence with zeros. | def get_padded_batch(file_list, batch_size, input_size, padding_length):
dataset = tf.contrib.data.TFRecordDataset(file_list)
return _generate_data_from_dataset(dataset, batch_size, input_size,
padding_length) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _pad_feature_sequences(sequences, pad=PAD, feature_dims=768):\n lengths = [tf.shape(x)[0] for x in sequences]\n padded_size = tf.reduce_max(lengths)\n padded_sequences = tf.stack([\n tf.pad(x,\n paddings=[[0, padded_size - lengths[i]], [0, 0]],\n mode='CONSTANT',\n c... | [
"0.7078886",
"0.665422",
"0.6546085",
"0.65287644",
"0.6525181",
"0.64944434",
"0.64910656",
"0.6382942",
"0.6380104",
"0.6305826",
"0.6293694",
"0.6285716",
"0.62830055",
"0.61936915",
"0.615768",
"0.613324",
"0.6127893",
"0.61159444",
"0.6103063",
"0.6102993",
"0.6099373",
... | 0.6214865 | 13 |
Returns the current user of the vehicle, None if there is no a user. | def get_car_user(self) -> str:
return self.currentuser | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_user(self) -> t.Optional[api.json_api.account.CurrentUser]:\n try:\n return self.AUTH.get_current_user()\n except Exception: # noqa: BLE001\n return None",
"def current_user(self):\n user_dict = self.auth.get_user_by_session()\n if user_dict is None:... | [
"0.777394",
"0.7680449",
"0.756367",
"0.75623953",
"0.75597775",
"0.74885786",
"0.7470461",
"0.7417092",
"0.73823",
"0.73823",
"0.7381088",
"0.73222816",
"0.73114973",
"0.72721213",
"0.7205473",
"0.72035533",
"0.7155266",
"0.71310526",
"0.71186304",
"0.7117634",
"0.7117634",
... | 0.7983246 | 0 |
Quaternion, representing the tool orientation, shaped (4, ). | def tool_quat(self):
return self.sim.data.get_body_xquat(self.end_effector) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def base_orientation_quaternion(self):\n raise NotImplementedError('Not yet implemented!')",
"def _rotate_quaternion(self, q):\n self._normalise()\n return self * q * self.conjugate",
"def euler_to_quat(roll, pitch, yaw):\n pose = Pose()\n quaternion = tf.transformations.quaternion_from_... | [
"0.7244247",
"0.6950813",
"0.6762128",
"0.67617494",
"0.6663095",
"0.6642175",
"0.66380304",
"0.66352683",
"0.66347474",
"0.6603356",
"0.6597779",
"0.6593862",
"0.6572314",
"0.65449",
"0.6539435",
"0.65345",
"0.6531859",
"0.65169245",
"0.6510475",
"0.6508387",
"0.64811444",
... | 0.631602 | 27 |
Angular positions of the joints, [A1, A2, E1, A3, A4, A5, A6]. | def robot_arm_pos(self):
return self.sim.data.qpos[self.arm_index] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_joint_positions(self, joint_angles ): \n\n\n # current angles\n res_joint_angles = joint_angles.copy() \n\n # detect limits\n maskminus= res_joint_angles > self.joint_lims[:,0]\n maskplus = res_joint_angles < self.joint_lims[:,1]\n \n res_joint_angles = res_joi... | [
"0.6855489",
"0.63787943",
"0.6109877",
"0.6061975",
"0.59795773",
"0.5923432",
"0.58638656",
"0.578657",
"0.5779264",
"0.57708746",
"0.5734521",
"0.5664255",
"0.56584126",
"0.5643948",
"0.56410617",
"0.5632338",
"0.56251764",
"0.5597765",
"0.5585096",
"0.55560833",
"0.554612... | 0.0 | -1 |
output_layer is the custom output layer object output_layer.nodes return a list with all node objects (and thus the semantics of each node can be accessed by node.semantics ) output_layer.tensors returns a list with all TensorFlow.Tensors, if you want to implement a predict call for the deepSLM to asses the generalizat... | def mutate_ncp(parent, child_cp, parameters):
if not parameters['one_child_keep_child']:
child_nn = NeuralNetworkBuilder.clone_neural_network(parent.ncp.nn)
else:
child_nn = parent.ncp.nn
if parameters['ncp_fully_connect_mutation'] or parameters['ncp_only_mutation_nodes']:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def layer_output(self, layer_id, example_id=0, batch_id=0, use_val=False):\n raise Exception(\n \"currently_unsupported: layer_output method is not yet supported for \"\n + \"graph neural networks in ktrain\"\n )",
"def layer_output(self, layer_id, example_id=0, batch_id=0, us... | [
"0.6626294",
"0.6626294",
"0.6569732",
"0.65449935",
"0.6537881",
"0.65220183",
"0.65176386",
"0.6515459",
"0.65145874",
"0.6496883",
"0.6419638",
"0.6375512",
"0.63620085",
"0.63402104",
"0.63312835",
"0.6279025",
"0.6266821",
"0.6263862",
"0.62531936",
"0.6228919",
"0.61847... | 0.0 | -1 |
Preprocess the text into a list of tokens. Nodes represent the words in the original graph without any pre processing. Only punctuation marks are removed. | def process_text(self, text, lemma=False):
processed_text = TextGraph.nlp(text.lower())
words = [t.text.strip() if not lemma else t.lemma_ for t in processed_text if not t.is_punct]
return words | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def preprocess(text):\n\tX = []\n\tsent_detector = nltk.data.load('tokenizers/punkt/english.pickle')\n\tfor t in text:\n\t\tsents = sent_detector.tokenize(t)\n\t\tresult = ''\n\t\tfor s in sents:\n\t\t\ttokens = word_tokenize(s)\n\t\t\tresult += ' ' + ' '.join(tokens)\n\t\tX.append(result)\n\treturn X",
"def pre... | [
"0.7865816",
"0.7834171",
"0.7730953",
"0.76476705",
"0.7482704",
"0.7404678",
"0.73329353",
"0.72822094",
"0.7216706",
"0.71945953",
"0.71874404",
"0.7167434",
"0.715561",
"0.7138126",
"0.71286356",
"0.71089816",
"0.708399",
"0.70649815",
"0.70614004",
"0.70502543",
"0.70441... | 0.69710755 | 35 |
returns a list of DentalClient instances | def GetListDoctors(self):
return self.ClientsMap.values() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_client_list(self):\r\n cursor = self.conn.cursor()\r\n cursor.execute(\"\"\"SELECT * FROM CLIENT\"\"\")\r\n return cursor.fetchall()",
"def get(self):\n return get_clientes()",
"def list(self) -> List[ListClientDto]:\n raise NotImplementedError",
"def list_clients(s... | [
"0.71598",
"0.71062267",
"0.69957685",
"0.6947192",
"0.6902781",
"0.67157465",
"0.6605059",
"0.65984327",
"0.65944815",
"0.65489656",
"0.65489656",
"0.6497943",
"0.6443791",
"0.63974047",
"0.6388476",
"0.63833565",
"0.6364596",
"0.6342643",
"0.6257699",
"0.6190698",
"0.616067... | 0.6287675 | 18 |
returns a dictionary of acts and their default unit prices for a given doctor | def GetDoctorPricesByDoctorID(self, iDoctorID):
doctor = self.GetDoctorFromID(iDoctorID)
if doctor is None: return 0
return doctor.GetDoctorPrices() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def construct_current_holdings(self):\n d = dict((k,v) for k,v in [(s,0.0) for s in self.symbol_list])\n d['cash'] = self.initial_capital\n d['commission'] = 0.0\n d['total'] = self.initial_capital\n \n return d",
"def construct_current_holdings(self):\n d = dict(... | [
"0.5458577",
"0.5458577",
"0.5432462",
"0.54285246",
"0.5154268",
"0.51251113",
"0.51013696",
"0.5090879",
"0.5090879",
"0.5060403",
"0.5013387",
"0.49561012",
"0.49362904",
"0.4935259",
"0.49247858",
"0.4859183",
"0.48460388",
"0.48300397",
"0.48004258",
"0.48004258",
"0.478... | 0.0 | -1 |
one residual block in a ResNet | def _block(self, filters, inp):
layer_1 = BatchNormalization()(inp)
act_1 = Activation('relu')(layer_1)
conv_1 = Conv2D(filters, (3, 3),
padding='same',
kernel_initializer=self.initializer)(act_1)
layer_2 = BatchNormalization()(conv_1... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def residual_block(blockInput, nf, strides=1, batch_activate=False):\n x = BatchActivate(blockInput)\n x = res_conv_block(x, nf)\n x = res_conv_block(x, nf, activation=False)\n x = Add()([x, blockInput])\n if batch_activate:\n x = BatchActivate(x)\n return x",
"def residual_block(x,index... | [
"0.73757786",
"0.72383446",
"0.718902",
"0.7178416",
"0.703563",
"0.7013798",
"0.6986031",
"0.6937016",
"0.6882355",
"0.6808773",
"0.6791494",
"0.6788144",
"0.6771143",
"0.6744148",
"0.67075026",
"0.6694921",
"0.66881585",
"0.663388",
"0.6598716",
"0.65526",
"0.6550113",
"0... | 0.0 | -1 |
Get the thing at the given index. | def get_thing(self, _):
return self.thing | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_thing(self, idx):\n try:\n idx = int(idx)\n except ValueError:\n return None\n\n if idx < 0 or idx >= len(self.things):\n return None\n\n return self.things[idx]",
"def get_item(self, index: int) -> _T:\n return self.index_to_item[index]",
"def __getitem__(self, index:... | [
"0.8391444",
"0.79880023",
"0.790446",
"0.7888263",
"0.7845708",
"0.77786726",
"0.77561533",
"0.75189954",
"0.750497",
"0.74664783",
"0.74571145",
"0.7394297",
"0.7394297",
"0.73590815",
"0.7345813",
"0.7328971",
"0.7324696",
"0.7322868",
"0.7303253",
"0.72960925",
"0.7292394... | 0.0 | -1 |
Get the mDNS server name. | def get_name(self):
return self.thing.name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def server_name(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"server_name\")",
"def server_name(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"server_name\")",
"def server_name(self) -> str:\n return pulumi.get(self, \"server_name\")",
"def get_server_name(self):\n ... | [
"0.7578818",
"0.7578818",
"0.74995416",
"0.7405455",
"0.7363975",
"0.7291746",
"0.7266458",
"0.71998364",
"0.71948135",
"0.7155862",
"0.7137073",
"0.71219605",
"0.71135145",
"0.70957357",
"0.707762",
"0.707762",
"0.70303017",
"0.70303017",
"0.7000716",
"0.6945586",
"0.6924513... | 0.0 | -1 |
Get the mDNS server name. | def get_name(self):
return self.name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def server_name(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"server_name\")",
"def server_name(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"server_name\")",
"def server_name(self) -> str:\n return pulumi.get(self, \"server_name\")",
"def get_server_name(self):\n ... | [
"0.7578818",
"0.7578818",
"0.74995416",
"0.7405455",
"0.7363975",
"0.7291746",
"0.7266458",
"0.71998364",
"0.71948135",
"0.7155862",
"0.7137073",
"0.71219605",
"0.71135145",
"0.70957357",
"0.707762",
"0.707762",
"0.70303017",
"0.70303017",
"0.7000716",
"0.6945586",
"0.6924513... | 0.0 | -1 |
Returns True if annotation is a typing.List | def is_list(annotation):
annotation_origin = getattr(annotation, "__origin__", None)
return annotation_origin == list | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_list(self) -> bool:\n if self.is_list_of_list: # pylint: disable=R1705\n return False\n else:\n return bool(AnnotationWrapper.list_field_re.match(self.data))",
"def is_list_of_list(self) -> bool:\n return bool(AnnotationWrapper.list_of_list_re.match(self.data))"... | [
"0.81827617",
"0.7847181",
"0.7669008",
"0.7458712",
"0.74519604",
"0.7418812",
"0.74130565",
"0.73896694",
"0.73880374",
"0.7356629",
"0.7340702",
"0.7315212",
"0.72951037",
"0.7294195",
"0.71716565",
"0.7147178",
"0.7052984",
"0.7026019",
"0.69802266",
"0.6722729",
"0.66400... | 0.89825094 | 0 |
Returns True if annotation is a typing.Union | def is_union(annotation):
annotation_origin = getattr(annotation, "__origin__", None)
return annotation_origin == typing.Union | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_Union(tp):\n if tp is Union:\n return True\n try:\n # Python 3.6\n return tp.__origin__ is Union\n except AttributeError:\n try:\n return isinstance(tp, typing.UnionMeta)\n except AttributeError:\n return False",
"def _is_union(typeval: Typ... | [
"0.7930164",
"0.78377384",
"0.74319726",
"0.7213345",
"0.7189466",
"0.6971448",
"0.68199366",
"0.6816511",
"0.66394156",
"0.6596198",
"0.6583962",
"0.657489",
"0.64812815",
"0.6431451",
"0.63352233",
"0.63147604",
"0.6227341",
"0.6048918",
"0.5936904",
"0.5822235",
"0.5749798... | 0.8940492 | 0 |
Returns True if the annotation is typing.Optional[SomeType] | def is_optional(annotation):
# Optionals are represented as unions
if not is_union(annotation):
return False
types = annotation.__args__
# A Union to be optional needs to have at least one None type
return any([x == None.__class__ for x in types]) # noqa:E711 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def NeedsOptional(self, type_):\n return self._NameComponents(type_) in self._optional_types",
"def is_optional(self) -> bool:\n return bool(AnnotationWrapper.opt_field_re.match(self.data))",
"def is_typing_annotation(node: ast.AST, ctx: 'model.Documentable') -> bool:\n return is_using_annotations... | [
"0.7119634",
"0.6777314",
"0.67294765",
"0.66906065",
"0.660762",
"0.65246433",
"0.6460162",
"0.6405668",
"0.6214892",
"0.6193245",
"0.6140008",
"0.5959917",
"0.59436053",
"0.59061086",
"0.5879152",
"0.5790608",
"0.5768761",
"0.5749402",
"0.57180893",
"0.568248",
"0.56704485"... | 0.8433701 | 0 |
Test if the filename is a zip file by looking at the file extension. | def _iszip(self, filename):
fname, ext = os.path.splitext(filename)
return ext in _file_openers.keys() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_zip(filepath):\n\treturn os.path.splitext(filepath)[1] == '.gz'",
"def is_zipfile(filename):\n\n import zipfile\n\n return zipfile.is_zipfile(filename)",
"def is_archive_ext(filepath):\n file_extension = os.path.splitext(filepath)[1].lower()\n if file_extension in get_archive_extensions():\n ... | [
"0.83977294",
"0.79119194",
"0.7489723",
"0.7257286",
"0.6911587",
"0.670677",
"0.6701618",
"0.6683297",
"0.6615599",
"0.6543064",
"0.64603907",
"0.6445178",
"0.64401263",
"0.64146334",
"0.6391526",
"0.635634",
"0.6332119",
"0.6325717",
"0.6325717",
"0.6322895",
"0.6280105",
... | 0.8175293 | 1 |
Test if path is a net location. Tests the scheme and netloc. | def _isurl(self, path):
# We do this here to reduce the 'import numpy' initial import time.
from urllib.parse import urlparse
# BUG : URLs require a scheme string ('http://') to be used.
# www.google.com will fail.
# Should we prepend the scheme for those that don't... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_url(path):\n parsed = urlparse(path)\n return bool(parsed.scheme) and bool(parsed.netloc)",
"def url_has_netloc(self, url):\n\n parsed_url = urllib.parse.urlparse(url)\n\n if parsed_url.scheme == \"http\":\n port = 80\n elif parsed_url.scheme == \"https\... | [
"0.6963719",
"0.66976756",
"0.66315925",
"0.66214675",
"0.66111904",
"0.6594737",
"0.6510752",
"0.644198",
"0.64038455",
"0.631968",
"0.6234764",
"0.6123423",
"0.5997464",
"0.59941345",
"0.599214",
"0.59885806",
"0.59866095",
"0.5980592",
"0.5960594",
"0.5952764",
"0.59398335... | 0.7411492 | 0 |
Return absolute path of file in the DataSource directory. If `path` is an URL, then `abspath` will return either the location the file exists locally or the location it would exist when opened using the `open` method. | def abspath(self, path):
# We do this here to reduce the 'import numpy' initial import time.
from urllib.parse import urlparse
# TODO: This should be more robust. Handles case where path includes
# the destpath, but not other sub-paths. Failing case:
# path = /ho... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def abspath(self, path):\n return DataSource.abspath(self, self._fullpath(path))",
"def get_abs_path(path):\r\n abs_path = lib_path.abspath(path)\r\n return abs_path",
"def get_abspath(path: str) -> str:\n if os.path.isabs(path):\n return path\n\n return os.path.join(os.path.dirname(_... | [
"0.8125326",
"0.756073",
"0.7387321",
"0.7276463",
"0.71550006",
"0.7072829",
"0.7021888",
"0.6978824",
"0.68552876",
"0.6842238",
"0.6837306",
"0.6632285",
"0.66160834",
"0.6609835",
"0.65914",
"0.65908337",
"0.65532213",
"0.65062183",
"0.64587915",
"0.64567614",
"0.64554787... | 0.70033056 | 7 |
Return a sanitised relative path for which os.path.abspath(os.path.join(base, path)).startswith(base) | def _sanitize_relative_path(self, path):
last = None
path = os.path.normpath(path)
while path != last:
last = path
# Note: os.path.join treats '/' as os.sep on Windows
path = path.lstrip(os.sep).lstrip('/')
path = path.lstrip(os.pardir).lstrip('..'... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _is_bad_path(path, base):\r\n return not resolved(joinpath(base, path)).startswith(base)",
"def force_absolute(base, path):\n if os.path.abspath(path) and os.path.exists(path):\n return path\n else:\n return path_format(base + path)",
"def relative_base(base):\n return as_base(bas... | [
"0.7371985",
"0.70666826",
"0.7010255",
"0.69092906",
"0.6819726",
"0.677577",
"0.6773675",
"0.677088",
"0.66405314",
"0.6604213",
"0.65837216",
"0.65801865",
"0.6568496",
"0.65299433",
"0.650704",
"0.64681405",
"0.6454777",
"0.6435511",
"0.64232725",
"0.6421542",
"0.63972384... | 0.75666535 | 0 |
Return complete path for path. Prepends baseurl if necessary. | def _fullpath(self, path):
splitpath = path.split(self._baseurl, 2)
if len(splitpath) == 1:
result = os.path.join(self._baseurl, path)
else:
result = path # path contains baseurl already
return result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def base_url_path(self):\n path = urlsplit(self.base_url())[2]\n if path.endswith(\"/\"):\n path = path[:-1]\n return path",
"def buildpath(self):\n basepath = urlutil.href_settings.root + (self.relpath if self.relpath else cherrypy.request.path_info)\n if basepath.find('~') < 0:\n ... | [
"0.76091164",
"0.76040256",
"0.72865564",
"0.72775275",
"0.72654957",
"0.7263893",
"0.7140314",
"0.7106468",
"0.7069619",
"0.70541084",
"0.7050083",
"0.69943416",
"0.6919419",
"0.68832046",
"0.6869661",
"0.6854031",
"0.6839454",
"0.67599654",
"0.6757101",
"0.6745232",
"0.6723... | 0.7879512 | 0 |
Return absolute path of file in the Repository directory. If `path` is an URL, then `abspath` will return either the location the file exists locally or the location it would exist when opened using the `open` method. | def abspath(self, path):
return DataSource.abspath(self, self._fullpath(path)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_abs_path(path):\r\n abs_path = lib_path.abspath(path)\r\n return abs_path",
"def absolute_path(path):\n return os.path.abspath(\n os.path.join(\n os.path.dirname(__file__),\n \"..\",\n path\n )\n )",
"def get_abspath(path: str) -> str:\n if ... | [
"0.7629076",
"0.75626737",
"0.7454101",
"0.7232429",
"0.7206303",
"0.71296304",
"0.7119729",
"0.7119076",
"0.6931215",
"0.67803645",
"0.6668909",
"0.6648437",
"0.6647841",
"0.6630996",
"0.6603007",
"0.6567621",
"0.6516734",
"0.6375691",
"0.6368071",
"0.633774",
"0.6336079",
... | 0.62763745 | 26 |
Determines primality of n. Returns boolean. | def is_prime(n):
if n <= 1:
return False
elif n <= 2:
return True
elif n % 2 == 0:
return False
else:
for i in range(3, int(n**.5) + 1, 2):
if n % i == 0:
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_prime(n):\n return mr_prime(n)",
"def isprime(n):\r\n\treturn is_prime(n)",
"def isprime(n):\n\treturn is_prime(n)",
"def if_prime(cls, n):\n\n if (n <= 1):\n return False\n if (n <= 3):\n return True\n\n if (n % 2 == 0 or n % 3 == 0):\n return ... | [
"0.8217768",
"0.8163338",
"0.8115984",
"0.7991603",
"0.7908177",
"0.7883512",
"0.7864498",
"0.78575337",
"0.7830496",
"0.77996314",
"0.777556",
"0.7757916",
"0.77469367",
"0.77201784",
"0.7705273",
"0.7700479",
"0.7694237",
"0.7680724",
"0.76467794",
"0.76393825",
"0.76358145... | 0.7767428 | 11 |
Calculates the prime number which the lowest difference from n. Returns an integer. | def get_nearest(n, y=1):
if n < 1:
# Integer must be positive - using 1 instead
n = 1
p = generate()
r = []
s = y
g = 0
c = y
z = []
# Just grabbing up the y additional primes that are greater than n is
# probably not the smartest approach
while s > 0:
q =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def low_prime(n):\n if n < 2 or n - round(n) != 0:\n print('Numbers smaller than 2 and non-integers do not have prime',\n 'factors')\n return None\n for i in range(2, int(sqrt(n) + 2)):\n if n % i == 0 and is_prime(i):\n return i\n return n",
"def smallest_nu... | [
"0.7890132",
"0.7688885",
"0.76185596",
"0.7596571",
"0.73925024",
"0.7258991",
"0.72501606",
"0.7241679",
"0.7238218",
"0.71969134",
"0.7148384",
"0.71075964",
"0.69322246",
"0.69122225",
"0.6806718",
"0.6744762",
"0.6713115",
"0.67053115",
"0.6671802",
"0.6667411",
"0.66435... | 0.0 | -1 |
Picks the last element from array A[right] and places it to correct position(with respect to ascending order) and returns index of that position. | def partition(A, left, right):
pivot = A[right]
i = left # Elements smaller than pivot
for j in range(left, right + 1):
if A[j] < pivot:
A[i], A[j] = A[j], A[i]
i += 1
A[i], A[right] = A[right], A[i] # Move pivot to correct position
return i | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def right(self, A, i):\n if 2*i + 1 +1 < len(A):\n return 2*i + 1 +1\n return None",
"def right(self, A, i):\n if 2*i + 1 +1 < len(A):\n return 2*i + 1 +1\n return None",
"def _right(self, index):\r\n return 2*index + 2",
"def selectIdx(A, leftBound, r... | [
"0.7379295",
"0.7379295",
"0.6852494",
"0.682096",
"0.6813935",
"0.6616484",
"0.6495831",
"0.6362469",
"0.6283471",
"0.6272057",
"0.62390155",
"0.6101527",
"0.6101527",
"0.60750306",
"0.6072639",
"0.60587525",
"0.60385543",
"0.60385543",
"0.6036334",
"0.5986997",
"0.59490174"... | 0.56897354 | 31 |
Returns k smallest numbers in given array. | def select(A, left, right, k):
if left == right:
return A[:left + 1]
pivot_idx = partition(A, left, right)
if pivot_idx == k:
return A[:k + 1]
elif pivot_idx > k:
return select(A, left, pivot_idx - 1, k)
return select(A, pivot_idx + 1, right, k) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def k_smallest_sorted(a, k):\r\n k_smallest_idxs = np.argpartition(a, k)[:k]\r\n return k_smallest_idxs[np.argsort(a[k_smallest_idxs])]",
"def kth_smallest_alt(arr1, arr2, k):\n pass",
"def kthSmallest(A, k):\n if k >= len(A):\n return None\n return select(A, 0, len(A) - 1, k)",
"def fi... | [
"0.81894356",
"0.75828063",
"0.7414324",
"0.724465",
"0.7188396",
"0.7109902",
"0.7019681",
"0.69027394",
"0.6825911",
"0.67840886",
"0.6707103",
"0.6695252",
"0.66165316",
"0.6530981",
"0.65058476",
"0.6501868",
"0.64497817",
"0.6405848",
"0.63902783",
"0.6387001",
"0.633520... | 0.0 | -1 |
Returns k smallest numbers in given array. | def kthSmallest(A, k):
if k >= len(A):
return None
return select(A, 0, len(A) - 1, k) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def k_smallest_sorted(a, k):\r\n k_smallest_idxs = np.argpartition(a, k)[:k]\r\n return k_smallest_idxs[np.argsort(a[k_smallest_idxs])]",
"def kth_smallest_alt(arr1, arr2, k):\n pass",
"def find_k_closest(self, a, k):\r\n if not a:\r\n return []\r\n\r\n # Sort input array by E... | [
"0.81894356",
"0.75828063",
"0.724465",
"0.7188396",
"0.7109902",
"0.7019681",
"0.69027394",
"0.6825911",
"0.67840886",
"0.6707103",
"0.6695252",
"0.66165316",
"0.6530981",
"0.65058476",
"0.6501868",
"0.64497817",
"0.6405848",
"0.63902783",
"0.6387001",
"0.6335201",
"0.626172... | 0.7414324 | 2 |
Returns the batch job. | def GetBatchJob(self, request, context):
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def job(self):\n return self.batch[self.job_id]",
"def get_batch(self):\n return self.batch",
"def get_job(self) -> Job:\n return self.jobs_list[self.sel_idx]",
"def get_job(self) -> CustomJob:\n return self._client.get_custom_job(name=self._job_name)",
"def GetBatchJob(client, batc... | [
"0.8623201",
"0.7867651",
"0.75914085",
"0.73782194",
"0.7126725",
"0.70916843",
"0.70719725",
"0.6977918",
"0.6960657",
"0.6898964",
"0.6853924",
"0.6844199",
"0.6842058",
"0.6806553",
"0.6806553",
"0.68008065",
"0.66844535",
"0.66703385",
"0.66703385",
"0.66623664",
"0.6563... | 0.6973975 | 8 |
L{getTagValues} returns all L{TagValue}s in the database, by default. | def testGetTagValues(self):
objectID1 = uuid4()
objectID2 = uuid4()
user = createUser(u'username', u'password', u'User',
u'user@example.com')
user.namespaceID = createNamespace(user, user.username, None).id
tag = createTag(user, user.namespace, u'name')
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def values(self):\n store = getMainStore()\n tagIDs = self._getTagIDs()\n where = self._getWhereClause(tagIDs)\n return store.find((Tag, TagValue), *where)",
"def values(self):\n return self._tagged.values()",
"def get_tag_values(self, event):\n raise NotImplementedErr... | [
"0.7602426",
"0.6732532",
"0.6465641",
"0.63738614",
"0.62099445",
"0.61761415",
"0.6090599",
"0.60646725",
"0.6032984",
"0.59970844",
"0.5989308",
"0.5984317",
"0.59732395",
"0.59555686",
"0.59468436",
"0.5931612",
"0.587783",
"0.58758116",
"0.58618337",
"0.58557856",
"0.585... | 0.6253085 | 4 |
An C{IntegrityError} is raised if a L{TagValue} with duplicate L{Tag.id} and object ID values is added to the database. | def testUniqueTagAndObjectID(self):
user = createUser(u'name', u'password', u'User', u'user@example.com')
user.namespaceID = createNamespace(user, user.username, None).id
tag = createTag(user, user.namespace, u'tag')
objectID = uuid4()
self.store.add(TagValue(user.id, tag.id, obj... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testUniqueAboutTagValue(self):\n objectID1 = uuid4()\n objectID2 = uuid4()\n self.store.add(AboutTagValue(objectID1, u'foo'))\n self.store.flush()\n self.store.add(AboutTagValue(objectID2, u'foo'))\n self.assertRaises(IntegrityError, self.store.flush)\n self.sto... | [
"0.6996132",
"0.6618967",
"0.6355843",
"0.63079774",
"0.6137372",
"0.60387564",
"0.59948325",
"0.5980942",
"0.59475344",
"0.5931762",
"0.589663",
"0.5889884",
"0.58897746",
"0.5842825",
"0.5827065",
"0.5786595",
"0.5685995",
"0.5676611",
"0.5669568",
"0.56388897",
"0.5580017"... | 0.66849446 | 1 |
Get model resource object. | def getModelObj(self):
model_psp = self.getModelPsp()
if not model_psp:
log_func.warning(u'Not define model in <%s : %s>' % (self.getName(), self.getType()))
return None
model_obj = self.getKernel().createByPsp(psp=model_psp)
return model_obj | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def model(self):\n return ResourceModel(\n self.type, self._resource_defs[self.type], self._resource_defs\n )",
"def get_resource(self):\n\n return self",
"def get_model():\n global model\n if model is None:\n model = AppModel()\n model.load_resources()\n ... | [
"0.78477323",
"0.7475346",
"0.7264473",
"0.72430974",
"0.7060936",
"0.6971485",
"0.6971485",
"0.6971485",
"0.6971485",
"0.6971485",
"0.6971485",
"0.6971485",
"0.6971485",
"0.6971485",
"0.6971485",
"0.6965318",
"0.6965318",
"0.69616693",
"0.69381076",
"0.6903528",
"0.6889998",... | 0.6727377 | 26 |
Produce the singlequbit rotation operator. In terms of the Bloch sphere picture of the qubit state, the | def Rotation(v, theta):
v = np.array(v)
if v.shape != (3,) or abs(v.dot(v) - 1.0) > 1e-8 or not np.all(np.isreal(v)):
raise ValueError('Rotation vector v should be a 3D real unit vector.')
return np.cos(theta/2) * Identity() - 1j * np.sin(theta/2) * (
v[0] * PauliX() + v[1] * PauliY() + v[... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _rotate_quaternion(self, q):\n self._normalise()\n return self * q * self.conjugate",
"def toRot(q):\n R = SX.zeros(3, 3)\n qi = q[0]; qj = q[1]; qk = q[2]; qr = q[3]\n R[0, 0] = 1. - 2. * (qj * qj + qk * qk);\n R[0, 1] = 2. * (qi * qj - qk * qr);\n R[0, 2] = ... | [
"0.71419793",
"0.68843895",
"0.6572093",
"0.6537804",
"0.64653456",
"0.6457292",
"0.6382543",
"0.63550967",
"0.62887585",
"0.62887585",
"0.62784964",
"0.62776893",
"0.6259031",
"0.62376493",
"0.6225259",
"0.6222622",
"0.62108684",
"0.62060213",
"0.61558574",
"0.61417925",
"0.... | 0.0 | -1 |
Produce the singlequbit Xrotation operator. In terms of the Bloch sphere picture of the qubit state, the operator rotates a state through angle theta around the xaxis. | def RotationX(theta):
return Rotation([1., 0., 0.], theta) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def quat_rotate(X, q):\n # repeat q along 2nd dim\n ones_x = X[[0], :, :][:, :, [0]] * 0 + 1\n q = torch.unsqueeze(q, 1) * ones_x\n\n q_conj = torch.cat([q[:, :, [0]], -1 * q[:, :, 1:4]], dim=-1)\n X = torch.cat([X[:, :, [0]] * 0, X], dim=-1)\n\n X_rot = hamilton_product(q, hamilton_product(X, q_... | [
"0.63538575",
"0.63538575",
"0.61463094",
"0.6108724",
"0.59622985",
"0.59598017",
"0.5948983",
"0.59022963",
"0.5836463",
"0.5823615",
"0.5819526",
"0.5800318",
"0.5737173",
"0.5737141",
"0.57323533",
"0.57028115",
"0.5689563",
"0.5670751",
"0.5662868",
"0.56523216",
"0.5642... | 0.61335605 | 3 |
Produce the singlequbit Zrotation operator. In terms of the Bloch sphere picture of the qubit state, the operator rotates a state through angle theta around the zaxis. | def RotationZ(theta):
return Rotation([0., 0., 1.], theta) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _rotate_quaternion(self, q):\n self._normalise()\n return self * q * self.conjugate",
"def rotateZ(self, *args, **kwargs):\n ...",
"def xform_Z_rot( self , thetaZrad ):\r\n self.xform_homog( homogeneous_Z( thetaZrad , [ 0 , 0 , 0 ] ) )",
"def toRot(q):\n R = SX.zeros(3,... | [
"0.6423433",
"0.6393009",
"0.62467724",
"0.6216662",
"0.61132073",
"0.61082804",
"0.6073067",
"0.6067056",
"0.6047031",
"0.6036282",
"0.6032215",
"0.60279804",
"0.60279804",
"0.60279804",
"0.60279804",
"0.6003709",
"0.59748393",
"0.59061724",
"0.589118",
"0.58707964",
"0.5861... | 0.637686 | 2 |
Produce a ControlledU operator, an operator for a `d` + 1 qubit system where the supplied U is an operator for a `d` qubit system. If the first bit is set, apply U to the state for the remaining bits. | def ControlledU(U):
d = U.rank // 2 + 1
shape = [2] * 2 * d
t = np.zeros(shape, dtype=np.complex128)
# If the first bit is zero, fill in as the identity operator.
t[:, 0, ...] = Identity(d)[:, 0, ...]
# Else, fill in as Identity tensored with U (Identity for the first bit,
# which remains ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def U_f(f, d):\n if d < 2:\n raise ValueError('U_f operator requires rank >= 2.')\n\n operator_shape = [2] * 2 * d\n t = np.zeros(operator_shape, dtype=np.complex128)\n\n for bits in product([0, 1], repeat=d):\n input_bits = bits[:-1]\n result = f(*input_bits)\n\n if result ... | [
"0.6397385",
"0.5830867",
"0.5511867",
"0.5243373",
"0.51545084",
"0.51057506",
"0.5095474",
"0.5090405",
"0.49849778",
"0.49308988",
"0.4847714",
"0.48279467",
"0.47819698",
"0.4767429",
"0.47428566",
"0.47422913",
"0.47275674",
"0.4710749",
"0.46764436",
"0.46726048",
"0.46... | 0.7348258 | 0 |
AddMemberToGroup. [Preview API] Add a member to a Group. | def add_member_to_group(self, group_id, member_id):
route_values = {}
if group_id is not None:
route_values['groupId'] = self._serialize.url('group_id', group_id, 'str')
if member_id is not None:
route_values['memberId'] = self._serialize.url('member_id', member_id, 'str'... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def AddMemberToGroup(group_id,user_id):\r\n Group.AddMemberToGroup(group_id,user_id)",
"def addMember(self, *args):\n return _libsbml.Group_addMember(self, *args)",
"def add_group_group_member(self, targetgroup, groupname):\n try:\n targetgroup = self.quote(targetgroup)\n ... | [
"0.7839239",
"0.7760257",
"0.75464904",
"0.7353598",
"0.71915346",
"0.7065892",
"0.70058525",
"0.69709706",
"0.6900687",
"0.6899213",
"0.6811232",
"0.67834246",
"0.67187214",
"0.6677965",
"0.6592777",
"0.65845025",
"0.6490095",
"0.6464633",
"0.64457136",
"0.6426373",
"0.64206... | 0.8220404 | 0 |
RemoveMemberFromGroup. [Preview API] Remove a member from a Group. | def remove_member_from_group(self, group_id, member_id):
route_values = {}
if group_id is not None:
route_values['groupId'] = self._serialize.url('group_id', group_id, 'str')
if member_id is not None:
route_values['memberId'] = self._serialize.url('member_id', member_id, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def removeMember(self, *args):\n return _libsbml.Group_removeMember(self, *args)",
"def delete_group_group_member(self, targetgroup, groupname):\n try:\n targetgroup = self.quote(targetgroup)\n groupname = self.quote(groupname)\n self.g.delete('groups/%s/groups/%s' ... | [
"0.7621764",
"0.7452198",
"0.74007785",
"0.7218349",
"0.71105415",
"0.7091542",
"0.70266795",
"0.7020149",
"0.6935036",
"0.6889006",
"0.6830964",
"0.6830964",
"0.67362976",
"0.664636",
"0.6636082",
"0.65703773",
"0.6506194",
"0.6494153",
"0.64828914",
"0.6476642",
"0.6432244"... | 0.81593364 | 0 |
Opens a new database connection if there is none yet for the current application context. | def get_db():
if not hasattr(g, 'sqlite_db'):
g.sqlite_db = connect_db()
return g.sqlite_db | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def db_open():\n if not hasattr(g, 'sqlite_db'):\n g.sqlite_db = db_connect()\n return g.sqlite_db",
"def open_database(self):\n if self._conn is None:\n self._conn = sqlite3.connect(self._db_path)",
"def open_db(db_name: str = DB_NAME) -> DBConnection:\n return sqlite3.connec... | [
"0.77379817",
"0.75827783",
"0.731633",
"0.716833",
"0.702289",
"0.6965276",
"0.6953964",
"0.6948672",
"0.68981296",
"0.68425506",
"0.6828195",
"0.6819551",
"0.68043447",
"0.67949706",
"0.67684644",
"0.6760031",
"0.675094",
"0.6747081",
"0.67314476",
"0.66986555",
"0.668763",... | 0.64022416 | 78 |
Takes two coordinates as input, returns the euclidean distance between them. | def euclidean_distance(x, y):
x1, y1 = x
x2, y2 = y
return sqrt((x1 - x2)**2 + (y1 - y2)**2) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _Dist(coordinates1, coordinates2):\n if len(coordinates2) == 1:\n return math.abs(coordinates2[0] - coordinates1[0])\n elif len(coordinates2) == 2:\n return math.sqrt(\n math.pow(\n coordinates2[0] - coordinates1[0], 2) \n + math.pow(coordinates2[1] - coordinates1[1], 2)\n )... | [
"0.8410921",
"0.8283483",
"0.8187794",
"0.8108096",
"0.8094443",
"0.8077792",
"0.8052177",
"0.80387455",
"0.8037439",
"0.80354005",
"0.80234015",
"0.8004943",
"0.7986166",
"0.7965749",
"0.7964502",
"0.79482317",
"0.79333234",
"0.7919648",
"0.78885245",
"0.7849046",
"0.7834458... | 0.791364 | 18 |
Check to see if the file extension is correct. | def allowed_file(filename):
return '.' in filename and filename.rsplit('.', 1)[1].lower() in ALLOWED_EXTENSIONS | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _check_extension(self):\n if self.extension in Config.override_ext:\n expected_mimetype = Config.override_ext[self.extension]\n else:\n expected_mimetype, encoding = mimetypes.guess_type(self.src_path,\n strict=Fa... | [
"0.8223102",
"0.8098047",
"0.80212986",
"0.7982124",
"0.7931028",
"0.78752446",
"0.78410715",
"0.7808993",
"0.78076386",
"0.7790524",
"0.7752457",
"0.7720431",
"0.76973546",
"0.76944226",
"0.7660322",
"0.76600534",
"0.75873685",
"0.7547095",
"0.7539818",
"0.7520363",
"0.75203... | 0.74025416 | 28 |
Index page that the flask app initially loads to. | def index():
if request.method == 'POST':
# check if the post request has the file part
if 'file' not in request.files:
alert('File not found.', 'danger')
return redirect(request.url)
file = request.files['file']
# if user does not select file
if fil... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index():\n return render_template('index.html'), 200",
"def index():\n\n return render_template(\"index.html\"), 200",
"def index():\n with app.app_context():\n return render_template(\"public/index.html\")",
"def index_page():\n \n return render_template(\"index.html\")",
"def in... | [
"0.8247882",
"0.8223611",
"0.8182606",
"0.81401646",
"0.8136579",
"0.8127533",
"0.8127533",
"0.8110224",
"0.8110224",
"0.8109293",
"0.8109293",
"0.8109293",
"0.81034905",
"0.80871516",
"0.8084594",
"0.80750334",
"0.8069612",
"0.8069612",
"0.8069612",
"0.8069612",
"0.8069612",... | 0.0 | -1 |
convert a byteASCII encoded string into equivalent Unicode string in the UTF8 notation. | def convert_to_unicode( tscii_input ):
output = list()
prev = None
prev2x = None
# need a look ahead of 2 tokens atleast
for char in tscii_input:
## print "%2x"%ord(char) # debugging
if ord(char) < 128 :
# base-ASCII copy to output
output.append( char )
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unicode2utf8(s):\n return s.encode(encoding='utf-8', errors='ignore')",
"def utf8tounicode(arg):\n\n try:\n if isinstance(arg, unicode):\n return arg.decode('utf-8')\n except NameError:\n pass # Python 3\n return arg",
"def _as_unicode(s):\n if isinstance(s, str):\n... | [
"0.7498928",
"0.727322",
"0.72464",
"0.7157063",
"0.71352875",
"0.71275663",
"0.71263367",
"0.7053737",
"0.7051872",
"0.7001006",
"0.6979546",
"0.69742584",
"0.69687325",
"0.6956651",
"0.69403577",
"0.69048417",
"0.68990797",
"0.6893302",
"0.6880633",
"0.6871457",
"0.68544734... | 0.0 | -1 |
Calculates the probability to move from one cell to another | def probability_move_to_cell(self, animal, total_propensity):
return self.propensity_to_move(animal) / total_propensity | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move(probability, motion, p_move):\n y, x = motion\n return p_move * (np.roll(np.roll(probability, x, axis=1), y, axis=0)) + (1. - p_move) * probability",
"def determine_move_position(self):\n green_probs = []\n net_size = len(self.net)\n adjacents = self.net[self.current_pos].adjacents\n #... | [
"0.6690777",
"0.65113527",
"0.62798494",
"0.62798494",
"0.6104662",
"0.60481334",
"0.5970731",
"0.59247243",
"0.59032303",
"0.5868516",
"0.58299446",
"0.5807982",
"0.5806464",
"0.5755514",
"0.5751845",
"0.5750305",
"0.5732099",
"0.57181597",
"0.5716741",
"0.569959",
"0.568061... | 0.75229514 | 0 |
Herbivores eat according to their fitness. Animal with highest fitness eats first If there is no fodder available in cell animal doesnt eat if the available fodder is greater than the food required animal eats the required amount. We calculate the remaining fodder in cell if fodder available is less than food required ... | def herbivore_eats(self):
self.order_by_fitness()
for herb in self.fauna_list['Herbivore']:
herb_remaining_fodder = self.remaining_food['Herbivore']
if herb_remaining_fodder == 0:
break
elif herb_remaining_fodder >= herb.parameters['F']:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def eating_landscape(self):\n\n fodder = self.default_f_max['f_max']\n random.shuffle(self.herb_pop)\n\n for herb in self.herb_pop:\n if fodder == 0:\n break\n if herb.weight > 0:\n if fodder >= herb.default_params[\"F\"]:\n ... | [
"0.69020694",
"0.6670388",
"0.66041064",
"0.65662813",
"0.65371966",
"0.64244616",
"0.62765944",
"0.6272279",
"0.6226726",
"0.61986",
"0.6183424",
"0.6153006",
"0.6111536",
"0.6107747",
"0.6042602",
"0.6010183",
"0.60087925",
"0.59852326",
"0.5981021",
"0.59576046",
"0.594989... | 0.7012955 | 0 |
Compare the probability_of_birth with random value generated If its greater animal gives birth. Create offspring of same species and decrease weight of animal | def animals_gives_birth(self):
for species, animals in self.new_fauna_list.items():
for i in range(math.floor(len(self.new_fauna_list[species])/2)):
animal = animals[i]
if animal.probability_of_birth(len(animals)):
offspring_species = animal.__clas... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def birth_check(self):\r\n if random.random() < 0.00017: # 0.0121, or 1.21%, is the yearly birth rate.\r\n birth_flag_list.append(1)\r\n # This makes the birth rate for every 5 days (73 'checks' a year) 0.00017%,\r\n # because 1 - 0.0121 = 0.9879; 98.79% is the chance of no... | [
"0.6535434",
"0.6147806",
"0.60852355",
"0.6021033",
"0.60173345",
"0.5979847",
"0.59765476",
"0.5919734",
"0.5852468",
"0.5814601",
"0.5809598",
"0.58016634",
"0.57861865",
"0.57854414",
"0.57651263",
"0.5763651",
"0.5759383",
"0.57299536",
"0.5696674",
"0.5683446",
"0.56788... | 0.7387718 | 0 |
Removes tensors from the tensor dictionary Takes the dictionary of tensors and removes the holdout_tensors. | def _remove_and_save_holdout_tensors(self, tensor_dict):
shared_tensors, self.holdout_tensors = split_tensor_dict_for_holdouts(self.logger, tensor_dict, **self.tensor_dict_split_fn_kwargs)
if self.holdout_tensors != {}:
self.logger.debug("{} removed {} from tensor_dict".format(self, list(sel... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_keys_from_dict(dictionary, keys):\n\n # Copy dictionary\n dictionary_updated = dictionary.copy()\n try:\n [dictionary_updated.pop(key) for key in keys]\n except:\n print(\"Error: No ratio and sampling strategy parameters\")\n return dictionary_updated",
"def remove_np(dict... | [
"0.5669481",
"0.5632027",
"0.562678",
"0.56244636",
"0.5579722",
"0.5573514",
"0.55401367",
"0.5511749",
"0.54539216",
"0.53951776",
"0.53766304",
"0.53714544",
"0.536991",
"0.53520995",
"0.5348204",
"0.5346742",
"0.53111166",
"0.52928454",
"0.52928454",
"0.52928454",
"0.5284... | 0.793685 | 0 |
Update the base model weights with the delta weights from the aggregator | def update_base_for_deltas(self, tensor_dict, delta_from_version, version, is_delta=True):
if not self.send_model_deltas:
raise ValueError("Should not be handing a base for deltas when not sending deltas.")
if self.base_for_deltas["tensor_dict"] is None:
if is_delta:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_weights(self):\n\t\tpass",
"def update_weights(self):\n self._weights = self._weights + self.update_weights_value",
"def update_weights(self, weight_delta):\n\n self._weights = math_util.vector_sum(self._weights, weight_delta)",
"def update_weights(self):\n activation, activat... | [
"0.7747767",
"0.7496904",
"0.7475495",
"0.74219024",
"0.73181736",
"0.73176295",
"0.72988594",
"0.7077386",
"0.6960366",
"0.6897132",
"0.68703353",
"0.68466127",
"0.6843764",
"0.6757247",
"0.67033124",
"0.6689873",
"0.66840315",
"0.6660204",
"0.6658731",
"0.6606588",
"0.66065... | 0.0 | -1 |
Download model operation Asks the aggregator for the latest model to download and downloads it. | def do_download_model_job(self):
# time the download
download_start = time.time()
# sanity check on version is implicit in send
reply = self.channel.DownloadModel(ModelDownloadRequest(header=self.create_message_header(), model_header=self.model_header))
received_model_proto = r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def download_model():\n logging.info(\"[genreml] Downloading model...\")\n with urllib.request.urlopen(config.FMAModelConfig.FMA_MODEL_URL) as f:\n data = f.read()\n open(config.FMAModelConfig.FMA_MODEL_PATH, 'wb').write(data)\n logging.info(\"[genreml] Model download complete\")",
"def do... | [
"0.7371159",
"0.72905463",
"0.701357",
"0.6771838",
"0.66719526",
"0.662528",
"0.65694314",
"0.6466253",
"0.6457582",
"0.64550656",
"0.64525837",
"0.6445036",
"0.6417326",
"0.6383256",
"0.63635904",
"0.63403845",
"0.62961596",
"0.62142116",
"0.6140292",
"0.6129733",
"0.607829... | 0.69979095 | 3 |
example of quickly accessing the DB to get something 'now'. | def get_temp():
epts = ["cage_coldPlate_temp", "cage_pressure"]
# t_earlier_aug = '2019-10-02T00:00'
# t_later_aug = datetime.utcnow().isoformat()
t_earlier_aug = '2019-09-27T13:00'
t_later_aug = '2019-09-28T19:49'
dfs = pandas_db_query(epts, t_earlier_aug, t_later_aug)
print(dfs[epts[0]].ta... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dbCurrentTime():\n return datetime.datetime.utcnow()",
"def _database_time_now(self) -> datetime:\n return self._engine.execute(select([func.now()])).scalar()",
"def get_now():\n return datetime.now()",
"def get_now():\n return datetime.now()",
"def db_date():\n return datetime.datet... | [
"0.74867404",
"0.7315794",
"0.7267445",
"0.7267445",
"0.726699",
"0.7137557",
"0.6891693",
"0.6733109",
"0.67171943",
"0.67102265",
"0.663534",
"0.6632679",
"0.66321456",
"0.6593538",
"0.65569776",
"0.65020406",
"0.6421096",
"0.63957703",
"0.63557816",
"0.6347333",
"0.6340492... | 0.0 | -1 |
Returns a bool representing whether the user currently has a JWT from the API. | def has_token(self):
user_id = getattr(self, '_id', None)
user_token = getattr(self, 'token', None)
if user_id is not None and user_token is not None:
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_authenticated(self):\n return bool(get_auth_token())",
"def has_user(self):\n\t\treturn len( self.a_token ) > 0 and len( self.a_secret ) > 0",
"def is_authenticated(self):\n if not self.token:\n return False\n\n try:\n self.lookup_token()\n return Tr... | [
"0.732634",
"0.71411",
"0.7085654",
"0.7004815",
"0.69719034",
"0.69609934",
"0.69316536",
"0.6830247",
"0.6822765",
"0.67873245",
"0.6786056",
"0.67637455",
"0.67287576",
"0.6599139",
"0.6589998",
"0.6586506",
"0.6586506",
"0.6586506",
"0.6586506",
"0.6586506",
"0.6586506",
... | 0.7006382 | 3 |
Get the label int associated with the given joint name. | def jointNameToLabel(name):
label = JOINT_LABELS.get(name)
return label if label else JOINT_LABELS[None] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fromLabel(name):\n return Data.labels.index(name)",
"def get_label_id(self) -> int:\n pass",
"def get_label(self, name):\n label_list = self.wls_board.get_labels()\n for label in label_list:\n if name in label.name: \n return label",
"def get_label(se... | [
"0.72864354",
"0.6823212",
"0.67168826",
"0.67084706",
"0.66864634",
"0.6442083",
"0.6432232",
"0.6432232",
"0.6428356",
"0.6381289",
"0.6376801",
"0.63684094",
"0.63273376",
"0.62954444",
"0.6289112",
"0.62834805",
"0.6233521",
"0.6200284",
"0.61646473",
"0.61553395",
"0.605... | 0.71001244 | 1 |
Converts given RGB value to a color name. | def rgbToColor(rgb):
color_table = reverse(COLORS_RGB)
color = color_table.get(rgb)
return color if color else None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def color(value):\r\n return 'RGB({}, {}, {})'.format(value.red(), value.blue(), value.green())",
"def name(r, g, b, a=1):\n r = 0 if r < 0 else 1 if r > 1 else r\n g = 0 if g < 0 else 1 if g > 1 else g\n b = 0 if b < 0 else 1 if b > 1 else b\n a = 0 if a < 0 else 1 if a > 1 else a\n if a >... | [
"0.75409275",
"0.6961265",
"0.6841742",
"0.67339015",
"0.66836846",
"0.6662928",
"0.6660782",
"0.6644752",
"0.6643624",
"0.6640179",
"0.6581014",
"0.6511388",
"0.6511154",
"0.64947855",
"0.64790165",
"0.64444906",
"0.64340377",
"0.6399628",
"0.6362991",
"0.63305104",
"0.63305... | 0.6121733 | 31 |
Splits the input text in tokens based on a boundary pattern. | def clean_and_split(text: str, compiled_pattern=TOKENIZER):
text = text.lower().strip()
if not hasattr(compiled_pattern, 'findall'):
return text.split()
return compiled_pattern.findall(text) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _tokenize(self, text):\n bpe_tokens = []\n for token in re.findall(self.pat, text):\n bpe_tokens.extend([t for t in self.bpe(token).split(\" \")])\n return bpe_tokens",
"def _tokenize(self, text):\n split_tokens = []\n for token in self.basic_tokenizer.tokenize(t... | [
"0.6597656",
"0.6385324",
"0.6354024",
"0.6242324",
"0.6099083",
"0.60963154",
"0.6014714",
"0.60118985",
"0.59987247",
"0.5975637",
"0.5970941",
"0.5957264",
"0.5953192",
"0.5950901",
"0.5945501",
"0.59415275",
"0.59329784",
"0.5921556",
"0.58798665",
"0.5834613",
"0.5832450... | 0.6381031 | 2 |
Acts as a safe version of isinstance without having to explicitly import packages which may not exist in the users environment. Checks if obj is an instance of type specified by class_path_str. | def safe_isinstance(obj, class_path_str):
# this function is copy-paste from the code of the SHAP Python library
# Copyright (c) 2018 Scott Lundberg
if isinstance(class_path_str, str):
class_path_strs = [class_path_str]
elif isinstance(class_path_str, list) or isinstance(class_path_str, tuple):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isinstancemethod(cls, obj):\n return _isinstancemethod(cls, obj)",
"def isclass(object):\r\n return isinstance(object, (type, types.ClassType))",
"def _isinstancetype(an_obj):\n if an_obj is None: return False\n if not PY3K:\n return isinstance(an_obj, types.InstanceType)\n typstr = s... | [
"0.7045127",
"0.69226027",
"0.69180334",
"0.68585414",
"0.68585414",
"0.68585414",
"0.68585414",
"0.68585414",
"0.68585414",
"0.6853871",
"0.6804288",
"0.6800417",
"0.67662555",
"0.67662555",
"0.6758966",
"0.6758856",
"0.67519283",
"0.67416555",
"0.67397916",
"0.66753584",
"0... | 0.8855454 | 0 |
This function overloads the inbuilt equals function. | def __eq__(self, secondPoint):
return self.xCoordinate == secondPoint.xCoordinate and self.yCoordinate == secondPoint.yCoordinate | {
"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.7984513",
"0.7984513",
"0.7984513",
"0.7984513",
"0.7984513",
"0.7984513",
"0.7984513",
"0.7984513",
"0.7984513",
"0.7984513",
"0.7984513",
"0.7984513",
"0.7984513",
"0.7984513",
"0.7984513",
"0.7984513",
"0.7984513",
"0.7984513",
"0.7984513",
"0.7984513",
"0.7934846",
"... | 0.0 | -1 |
This function returns the list of all neighbours of the point. | def findNeighbours(self):
neighbours = []
for i in range(self.xCoordinate - 1, self.xCoordinate + 2):
for j in range(self.yCoordinate - 1, self.yCoordinate + 2):
if (not (i == self.xCoordinate and j == self.yCoordinate)) and (0 <= i <= 394 and 0 <= j <= 499):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_neighbours(self):\n return []",
"def neighbours(x, y):\n n = []\n for c in ((y-1, x-1), (y-1, x), (y-1, x+1), (y, x-1), (y, x+1), (y+1, x-1), (y+1, x), (y+1, x+1)):\n n.append(c)\n return n",
"def get_neighbours(self):\n return self.points_to.keys()",
"def _get_neigh... | [
"0.8180882",
"0.81145775",
"0.80388033",
"0.788986",
"0.78794646",
"0.7765944",
"0.7760734",
"0.7721289",
"0.7721197",
"0.7711811",
"0.76023585",
"0.76017636",
"0.7575302",
"0.74904513",
"0.74600446",
"0.7457931",
"0.74217457",
"0.7419964",
"0.7413813",
"0.7407643",
"0.735959... | 0.8121635 | 1 |
Returns True if all of the arguments are different. | def pairwise(a,b):
return a != b | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _all_equal(arg):\n return arg.count(arg[0]) == len(arg)",
"def __is_args_new(self, *args, **kwargs):\n # if input size is different\n if len(args) != len(self.__cached_args) or len(kwargs) != len(self.__cached_kwargs):\n return True\n # check args and kwargs\n for a,... | [
"0.7428239",
"0.67609185",
"0.6724227",
"0.66924536",
"0.6547225",
"0.6522354",
"0.64895624",
"0.6437745",
"0.627661",
"0.6260951",
"0.6260951",
"0.6260951",
"0.6260951",
"0.6236019",
"0.62349296",
"0.6160123",
"0.61373013",
"0.6087885",
"0.6080716",
"0.6064579",
"0.6054207",... | 0.5826457 | 44 |
The additional checking for the condition that the ball passes the corner of the platform | def _platform_additional_check(self, platform: Platform):
if self.rect.bottom > platform.rect.top:
routine_a = (Vector2(self._last_pos.bottomleft), Vector2(self.rect.bottomleft))
routine_b = (Vector2(self._last_pos.bottomright), Vector2(self.rect.bottomright))
return (physic... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_wall_collision(self):\r\n if self.head.xcor() > 280 or self.head.xcor() < -280 or \\\r\n self.head.ycor() > 280 or self.head.ycor() < -280:\r\n return False\r\n else:\r\n return True",
"def detect_collision():\n # with the top and bottom of screen\n... | [
"0.7020381",
"0.6991046",
"0.6960288",
"0.69310695",
"0.69291",
"0.69133246",
"0.6902754",
"0.6771094",
"0.67497414",
"0.6727516",
"0.6669436",
"0.66675127",
"0.6661212",
"0.659745",
"0.65965515",
"0.6592364",
"0.652055",
"0.65175146",
"0.65070635",
"0.64702076",
"0.64690757"... | 0.6994262 | 1 |
Check if the platform slices the ball, and modify the ball speed. The new x speed of the ball after slicing | def _slice_ball(self, ball_speed_x, platform_speed_x):
# If the platform doesn't move, bounce normally.
if platform_speed_x == 0:
return 7 if ball_speed_x > 0 else -7
# If the platform moves at the same direction as the ball moving,
# speed up the ball.
elif ball_spee... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tick():\n move_balls(targets_speed)\n move_super_balls(targets_speed * 2)",
"def step(self):\n\n self.ball_x = self.ball_x + self.vel_x\n self.ball_y = self.ball_y + self.vel_y\n if self.ball_y >= 480:\n self.vel_y *= -1\n elif self.ball_y <= 0:\n self.... | [
"0.64066947",
"0.61620367",
"0.60370106",
"0.6017596",
"0.60112005",
"0.600528",
"0.5964903",
"0.59623045",
"0.5944055",
"0.5932685",
"0.59208786",
"0.5920131",
"0.5846469",
"0.5840507",
"0.5793683",
"0.5764298",
"0.574475",
"0.5740634",
"0.57035035",
"0.5687237",
"0.56776065... | 0.7822065 | 0 |
Initialize a new Node object. | def __init__(self, board, action, cost, parent):
self.board = board
self.action = action
self.cost = cost
self.parent = parent
self.estimate = cost + board.h() # A* "f" function | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n self.root = self.Node(None)",
"def __init__(self):\n self.root = Node(None)",
"def __init__(self):\n self.root = Node('')",
"def __init__(self):\n self.__root = Node()",
"def __init__(self):\n self.root = Node(\"\")",
"def __init__(self):\n ... | [
"0.7934499",
"0.79317695",
"0.7850318",
"0.77857846",
"0.7774532",
"0.7774532",
"0.7747123",
"0.76721925",
"0.76721925",
"0.76721925",
"0.7573146",
"0.7563046",
"0.7507151",
"0.7437758",
"0.7425841",
"0.73877245",
"0.73667717",
"0.73650455",
"0.7360725",
"0.73314893",
"0.7306... | 0.0 | -1 |
Return a list possible nodes to move to from this node. | def expand(self):
nodes = []
for action in self.board.actions():
# copy the current board
board = copy.deepcopy(self.board)
board.apply_action(action)
nodes.append(Node(board, action, self.cost + 1, self))
return nodes | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def solution(self):\n return [node.move for node in self.path()[1:]]",
"def moves(self) -> List[List[PushState]]:\n # seen_moves = set()\n possible_moves = [[], []]\n\n if state := self.prune_states(self.state): # Could return None\n size = len(self.prune_states(state))\n ... | [
"0.72129065",
"0.6824141",
"0.6769268",
"0.6761867",
"0.6656835",
"0.66465706",
"0.6590588",
"0.6538939",
"0.6526565",
"0.64979565",
"0.64799905",
"0.64790946",
"0.64521295",
"0.6448713",
"0.64455914",
"0.6425663",
"0.64233065",
"0.64206487",
"0.6416289",
"0.64083403",
"0.640... | 0.6469425 | 12 |
\ Set a new heap. If COMPARE is given, use it instead of builtin comparison. COMPARE, given two items, should return negative, zero or positive depending on the fact the first item compares smaller, equal or greater than the second item. | def __init__(self, compare=cmp):
self.compare = compare
self.array = []
self.pos = {} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_heap_sort(self):\n integers = heap_sort(self.actual)\n self.assertEqual(self.expected, integers)",
"def heap_sort(self, A):\n pass",
"def heap_sort(self, A):\n pass",
"def manage_heap(heap, coordinates, distance):\n\tif distance > SUN_DISTANCE:\n\t\tif len(heap) < k:\n\t\... | [
"0.5681324",
"0.5558629",
"0.5558629",
"0.5549648",
"0.5498197",
"0.5488744",
"0.5437574",
"0.5428701",
"0.5417761",
"0.5407857",
"0.5393433",
"0.5325093",
"0.5321586",
"0.53184164",
"0.526839",
"0.52496094",
"0.5245629",
"0.52261066",
"0.5160288",
"0.5158207",
"0.5089999",
... | 0.0 | -1 |
Snakecase of the basename of a given path | def snakecase(self, given_path):
filename = os.path.basename(given_path)
filename = first_cap_re.sub(r'\1_\2', filename)
filename = all_cap_re.sub(r'\1_\2', filename).lower()
return given_path.replace(os.path.basename(given_path), filename) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cap_case_filename(f):\n return cap_case_str(os.path.basename(f))",
"def niceName(self, path):\n logger.debug(\"Func: niceName\")\n\n basename = os.path.split(path)[1]\n return os.path.splitext(basename)[0]",
"def basename(path: str) -> str:\n pass",
"def base_name(path):\n ret... | [
"0.7490113",
"0.72724944",
"0.7177208",
"0.7001592",
"0.6986876",
"0.6982326",
"0.6971713",
"0.6933596",
"0.6892308",
"0.6790028",
"0.6712766",
"0.6668713",
"0.6665952",
"0.66558576",
"0.6654879",
"0.6649229",
"0.66313565",
"0.66221565",
"0.6618814",
"0.6618213",
"0.6609062",... | 0.8028466 | 0 |
linearly space over an interval | def linspace(start, stop, n, istart=True, istop=True):
n = n-1
arr = [start + ((stop-start)/n) * i for i in range(n+1)]
return arr | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def linspace(start, stop, num=50, include_endpoint=True, dtype=None, constant=False):\n return Tensor(np.linspace(start, stop, num, include_endpoint, dtype=dtype), constant=constant)",
"def rangeLin(min, max, n):\n\n return np.arange( min, max, (max-min)/n )",
"def linear_space(min_value=0, max_value=1.... | [
"0.6631998",
"0.652269",
"0.64658177",
"0.62139356",
"0.6185518",
"0.61606616",
"0.61552",
"0.6136111",
"0.61311287",
"0.61235183",
"0.61106104",
"0.6025417",
"0.60220975",
"0.60115683",
"0.5997035",
"0.5944245",
"0.59212077",
"0.5909719",
"0.5891475",
"0.58831275",
"0.586407... | 0.626045 | 3 |
Get the path to the Anaconda binary | def get_conda_bin():
conda_bin = 'conda'
# Try executing the `conda` command
if os.popen(conda_bin).read().strip() == '':
# If it fails, look for $CONDA_EXE
conda_exe = os.popen('echo $CONDA_EXE').read().strip()
# Check if it returns a valid path
if conda_exe != '' and conda_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_conda_root():\n root_path = \"\"\n try:\n conda_json = subprocess.check_output(\"conda info --json\",\n shell=True, stderr=subprocess.PIPE)\n if sys.version_info.major > 2:\n conda_json = conda_json.decode(\"utf-8\")\n\n dec ... | [
"0.7179487",
"0.68359506",
"0.67374617",
"0.6689178",
"0.6677026",
"0.6672872",
"0.66467005",
"0.66254324",
"0.65498674",
"0.65455717",
"0.65278417",
"0.6419324",
"0.63461524",
"0.6336759",
"0.6264637",
"0.62546116",
"0.622479",
"0.6171432",
"0.61600333",
"0.6136413",
"0.6112... | 0.83061624 | 0 |
Get the name of the active conda environment | def get_conda_env_name():
env_name = os.popen('echo $CONDA_DEFAULT_ENV').read().strip()
if env_name == '' or env_name == '$CONDA_DEFAULT_ENV':
env_name = 'base'
logging.info('Anaconda environment: ' + env_name)
return env_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_current_environment():\n # Search for the environment variable set by the hutch python setup\n env = os.getenv('CONDA_ENVNAME')\n # Otherwise look for built-in Conda environment variables\n if not env:\n env = os.getenv('CONDA_DEFAULT_ENV')\n # Check the top level PYTHONPATH to see if... | [
"0.7313929",
"0.7299991",
"0.7229068",
"0.70954597",
"0.7044305",
"0.6911321",
"0.6853053",
"0.68420464",
"0.68200225",
"0.67829394",
"0.67438376",
"0.6726094",
"0.6719836",
"0.6691608",
"0.6668938",
"0.6598599",
"0.65596694",
"0.6517723",
"0.64665717",
"0.6430876",
"0.642961... | 0.8451536 | 0 |
Read the anaconda environment into a string | def read_conda_env(name=None):
if name is None:
name = get_conda_env_name()
command = get_conda_bin() + ' env export -n ' + \
get_conda_env_name() + " --no-builds"
env_str = os.popen(command).read()
if env_str == '':
error = 'Failed to read Anaconda environment using command: "' ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_conda_env_name():\n env_name = os.popen('echo $CONDA_DEFAULT_ENV').read().strip()\n if env_name == '' or env_name == '$CONDA_DEFAULT_ENV':\n env_name = 'base'\n logging.info('Anaconda environment: ' + env_name)\n return env_name",
"def test_get_environment_string(self):\n pass",... | [
"0.67624956",
"0.6385618",
"0.625789",
"0.6091583",
"0.6058904",
"0.59728247",
"0.59076744",
"0.5894015",
"0.58631897",
"0.5788038",
"0.5721904",
"0.57025355",
"0.56864357",
"0.5607147",
"0.5580074",
"0.55384964",
"0.550029",
"0.5498599",
"0.5493764",
"0.54805815",
"0.5472799... | 0.75861156 | 0 |
Return a plot of the prediction with a color for good prediction and misclassified | def _plot_good_pred_whitout_reject(self, test: Set, title=None, fig_size=None):
if fig_size is not None:
fig = plt.figure(figsize=fig_size)
else:
fig = plt.figure()
ax = fig.add_subplot(111)
goodclassified_index = []
for idx_preds in range(self.pred... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Plot_predict(X,Y,model,X_path): \n labels = {0: 'CNV', 1: 'DME', 2: 'DRUSEN', 3: 'NORMAL'}\n Y_pred_classes = np.argmax(model.predict(X),axis = 1) \n Y_true = np.argmax(Y,axis = 1)\n \n fig = plt.figure(figsize=(40, 40)) \n for i in range(X.shape[0]):\n ax = fig.add_subplot... | [
"0.7521937",
"0.7253972",
"0.7253972",
"0.7221114",
"0.7173466",
"0.71430594",
"0.7121149",
"0.69623876",
"0.68415904",
"0.6763645",
"0.67549914",
"0.6741895",
"0.66811347",
"0.66541106",
"0.6642305",
"0.65931064",
"0.65304095",
"0.65163934",
"0.64967996",
"0.6496369",
"0.646... | 0.6707263 | 12 |
Return a plot of the prediction with a color for good prediction, misclassified and reject | def _plot_good_pred_whit_reject(self, test: Set, title=None, fig_size=None):
if fig_size is not None:
fig = plt.figure(figsize=fig_size)
else:
fig = plt.figure()
ax = fig.add_subplot(111)
goodclassified_index = []
for idx_preds in range(self.preds.s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Plot_predict(X,Y,model,X_path): \n labels = {0: 'CNV', 1: 'DME', 2: 'DRUSEN', 3: 'NORMAL'}\n Y_pred_classes = np.argmax(model.predict(X),axis = 1) \n Y_true = np.argmax(Y,axis = 1)\n \n fig = plt.figure(figsize=(40, 40)) \n for i in range(X.shape[0]):\n ax = fig.add_subplot... | [
"0.7338296",
"0.7182809",
"0.7180572",
"0.7180572",
"0.710078",
"0.7044229",
"0.70320034",
"0.699476",
"0.6866914",
"0.6835376",
"0.67704433",
"0.6710937",
"0.6646451",
"0.66423184",
"0.6641761",
"0.6588589",
"0.65529996",
"0.6548019",
"0.6547666",
"0.64691633",
"0.64613247",... | 0.6848595 | 9 |
Return a plot of the prediction with a color for good prediction, misclassified and reject | def plot_good_pred(self, test: Set, title=None, fig_size=None, reject=False):
if reject:
self._plot_good_pred_whit_reject(test, title, fig_size)
else:
self._plot_good_pred_whitout_reject(test, title, fig_size) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Plot_predict(X,Y,model,X_path): \n labels = {0: 'CNV', 1: 'DME', 2: 'DRUSEN', 3: 'NORMAL'}\n Y_pred_classes = np.argmax(model.predict(X),axis = 1) \n Y_true = np.argmax(Y,axis = 1)\n \n fig = plt.figure(figsize=(40, 40)) \n for i in range(X.shape[0]):\n ax = fig.add_subplot... | [
"0.73385644",
"0.718358",
"0.7180018",
"0.7180018",
"0.70999175",
"0.7045855",
"0.7033122",
"0.6994898",
"0.6864402",
"0.6849473",
"0.68355024",
"0.6769361",
"0.67115283",
"0.6646742",
"0.6642127",
"0.66399837",
"0.65894467",
"0.65528107",
"0.6547762",
"0.65460753",
"0.646887... | 0.63321877 | 36 |
Split a Set in a train set and test set or in train variable arrays, train target array, test variable array and test array. | def train_test_split(self, test_size=0.1, random_state=0, random_rate_label=True):
data = self._shuffle_set(random_state)
if test_size < 1:
threshold = int(data.shape[0] * test_size)
else:
threshold = test_size
dataset = Set(data[:, :-1], data[:, -1])
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def split_data_set_splitted(X, Y):\n\n # Uso la funcion de scikitlearn para separar el data_set\n # Esta funcion por defecto mezcla los datos para asegurar la representacion\n # de los datos en los dos subconjuntos\n #\n # Blanca Cano Camarero me comenta que ponga el stratify = Y porque asi se lo\n ... | [
"0.7188259",
"0.7062666",
"0.70357287",
"0.699757",
"0.6954566",
"0.69124",
"0.68770814",
"0.68704623",
"0.67631143",
"0.6747603",
"0.6689601",
"0.66728866",
"0.6664635",
"0.6657553",
"0.6646984",
"0.664561",
"0.6642134",
"0.6630095",
"0.6626281",
"0.66091126",
"0.6590082",
... | 0.0 | -1 |
Return a list of all nodes in the graph. | def nodes(self):
return list(self._g.keys()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_nodes(self):\n\n return list(self.graph.nodes)",
"def get_node_list(self):\n return [[node] for node in self.graph.nodes]",
"def nodes(self):\n nodes = list()\n for node in self._nodes:\n if isinstance(node, Graph):\n nodes += node.nodes\n ... | [
"0.8470535",
"0.833607",
"0.83090234",
"0.8299594",
"0.820619",
"0.8199423",
"0.8134652",
"0.8117623",
"0.80705255",
"0.80466336",
"0.80246496",
"0.79974836",
"0.7943407",
"0.7838246",
"0.7838246",
"0.7759444",
"0.77276284",
"0.77044064",
"0.7667386",
"0.76653075",
"0.7605519... | 0.78137255 | 15 |
True if node present in graph, else False. | def has_node(self, val):
return val in self._g | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_node(self, node: str) -> bool:\n return self.graph.has_node(node)",
"def has_node(self, n):\n return n in self.node_dict",
"def has_node(self, n):\n return n in self.dict",
"def node_exists(self):\n return self.oid is not None",
"def node_exists(self):\n if not se... | [
"0.80553746",
"0.78457993",
"0.7562757",
"0.74853575",
"0.74153465",
"0.7393044",
"0.73244184",
"0.7209296",
"0.7196078",
"0.7144272",
"0.7144272",
"0.6904445",
"0.6893709",
"0.6814303",
"0.68069935",
"0.677",
"0.6731511",
"0.67026556",
"0.66412073",
"0.66143787",
"0.6579611"... | 0.7584906 | 2 |
Return the list of all node's neighbor nodes. | def neighbors(self, val):
if val in self._g:
return self._g[val]
else:
raise ValueError('Node not in graph') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def neighbours(self):\n return [x.node for x in self.edges]",
"def neighbors(self, node):\r\n return list(self.graph.neighbors(node))",
"def neighbors(self) -> List['Node']:\r\n self._load_neighbors()\r\n return [edge.source if edge.source != self else edge.target\r\n ... | [
"0.8459549",
"0.82267034",
"0.8214946",
"0.7973814",
"0.79065585",
"0.7828362",
"0.7793418",
"0.77260756",
"0.77102315",
"0.7601213",
"0.7600193",
"0.756242",
"0.7499651",
"0.7499651",
"0.7499651",
"0.7499651",
"0.7488334",
"0.74659663",
"0.74386567",
"0.7412902",
"0.74113244... | 0.0 | -1 |
ndarray of size nx X coordinates of the grid. | def xaxis(self):
return self._xaxis | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def makeStartingGrid(self):\n return util.make2DArray(self.xN, self.yN, False)",
"def grids(self):\n x = self.xvalues\n if self.ndim == 1:\n return x\n if self.ndim == 2:\n return x[None, :], x[:, None]\n if self.ndim == 3:\n return x[None, :, N... | [
"0.72128505",
"0.71144724",
"0.7058834",
"0.70564836",
"0.69687074",
"0.6912243",
"0.6879008",
"0.6851687",
"0.68410087",
"0.67996436",
"0.6788176",
"0.6711958",
"0.662833",
"0.6551971",
"0.6516555",
"0.6507521",
"0.6421343",
"0.64059675",
"0.6397222",
"0.6377197",
"0.6345990... | 0.0 | -1 |
ndarray of size ny Y coordinates of the grid. | def yaxis(self):
return self._yaxis | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def as_numpy_array_2D(self):\n wx = []\n wy = []\n for wp in self.waypoints:\n wx.append(wp.location.x)\n wy.append(wp.location.y)\n return np.array([wx, wy])",
"def np(self):\n return np.array([self.x, self.y])",
"def ycoords(self) -> xr.IndexVariable:\... | [
"0.6887094",
"0.68350124",
"0.67748004",
"0.67632985",
"0.66345215",
"0.66161007",
"0.65564966",
"0.6545019",
"0.64110863",
"0.63653713",
"0.63591915",
"0.63485014",
"0.62423956",
"0.62310743",
"0.62072414",
"0.6172723",
"0.612556",
"0.60973793",
"0.6089004",
"0.60829145",
"0... | 0.0 | -1 |
Returns a discrete colormap from the continuous colormap cmap (jet). | def cmap_discretize(N):
cmap = matplotlib.cm.jet;
colors_i = np.concatenate((np.linspace(0, 1., N), (0.,0.,0.,0.)))
colors_rgba = cmap(colors_i)
indices = np.linspace(0, 1., N+1)
cdict = {}
for ki, key in enumerate(('red','green','blue')):
cdict[key] = [(indices[i], colors_rgba[i-1,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def discrete_cmap(N, base_cmap=None):\n base = plt.get_cmap(base_cmap)\n color_list = base(np.linspace(0, 1, N))\n cmap_name = base.name + str(N)\n return base.from_list(cmap_name, color_list, N)",
"def discrete_cmap(N, base_cmap=None):\n\t# Note that if base_cmap is a string or None, you can simply ... | [
"0.6991073",
"0.6950219",
"0.69192636",
"0.69192505",
"0.68909764",
"0.68909764",
"0.68909764",
"0.68573874",
"0.68573874",
"0.68573874",
"0.68573874",
"0.6816557",
"0.6783238",
"0.67764384",
"0.66482025",
"0.6489837",
"0.6214308",
"0.6214094",
"0.6205336",
"0.6205336",
"0.61... | 0.5817075 | 35 |
Initialize weights for network | def __initialize_weights__(num_neurons: int) -> np.ndarray:
weights = np.zeros((num_neurons, num_neurons))
return weights | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _initialize_weights(self):\n pass",
"def init_weights_(self):\n raise NotImplementedError",
"def initialize_weights(self):\n weights_initializer.WeightsInitializer.initialize_layer_or_model(\n self._batch)",
"def init_weights(self):\n # Initialize weights\n self.appl... | [
"0.8888482",
"0.85633284",
"0.85500115",
"0.84907705",
"0.84902096",
"0.83647186",
"0.8325972",
"0.8278652",
"0.82473826",
"0.821882",
"0.8204286",
"0.81793237",
"0.8173799",
"0.8156018",
"0.81374943",
"0.81154287",
"0.81153387",
"0.8019705",
"0.8006014",
"0.7971686",
"0.7953... | 0.7916889 | 21 |
Gets the owner of a given node. Definitions | def m_get_owner(node_name):
# Initialize the contract classes. These classes only work when the smart contracts are already deployed
# ens = ENS_class()
# resolver = PublicResolver_class()
# Get the owner of the node name
owner = ens.owner(node_name)
print(f"Owner address: {owner}")
# Check... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def owner(self):\n answer = self._call('owner')\n return answer.owner",
"def get_owner(self):\n return self.__owner",
"def getOwner(self):\r\n return self.owner",
"def owner(self) -> discord.User:\n if self.config.owner_id:\n return self.get_user(self.config.owne... | [
"0.70637304",
"0.7035408",
"0.69906026",
"0.68623054",
"0.6843497",
"0.6824575",
"0.6824575",
"0.6799534",
"0.6792362",
"0.6788147",
"0.66619384",
"0.6630145",
"0.6630145",
"0.6630145",
"0.65498614",
"0.65498614",
"0.6534138",
"0.6534138",
"0.6534138",
"0.6534138",
"0.6534138... | 0.7378444 | 0 |
Assigns the name to the given record. Definitions | def m_setName(node_name="root", name_to_resolve="root", current_owner_alias="ROOT"):
# Get the account info from the alias
account_address, account_key = wallet.account_from_name(
current_owner_alias, "ThePassword")
# Set the name
resolver.setName(node_name, name_to_resolve, account_key) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setRecord(self,record):\n idLower = record.getId().lower()\n type = record.name\n typeIds = self.indexed[type]\n if idLower in typeIds:\n oldRecord = typeIds[idLower]\n index = self.records.index(oldRecord)\n self.records[index] = record\n els... | [
"0.65023154",
"0.6172945",
"0.6094373",
"0.6051849",
"0.6051849",
"0.60102725",
"0.5975725",
"0.5970085",
"0.5955205",
"0.5949238",
"0.5946793",
"0.5919466",
"0.58846736",
"0.58846736",
"0.58846736",
"0.58846736",
"0.58846736",
"0.58846736",
"0.58846736",
"0.58846736",
"0.588... | 0.0 | -1 |
Contructor. Tesselates the shape, sets normals and elements. Sets up material properties. Buffers all the data to the GPU. | def __init__(self, shader_program):
self.tessellate(20)
self.k_ambient = np.array([0.3, 0.3, 0.21], dtype=np.float32)
self.k_diffuse = np.array([0.4, 0.5, 0.35], dtype=np.float32)
self.k_specular = np.array([0.3, 0.3, 0.3], dtype=np.float32)
self.shininess = 7.0
self.se... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, shape, pts, texcoords, faces, normals=None, smooth=True):\r\n super(Buffer, self).__init__()\r\n\r\n # Uniform variables all in one array!\r\n self.unib = (c_float * 12)(0.0, 0.0, 0.0,\r\n 0.5, 0.5, 0.5,\r\n 1.0, 1.0, 0.0,\r\n ... | [
"0.6879374",
"0.67958015",
"0.66907406",
"0.6299142",
"0.62902856",
"0.6277993",
"0.6207992",
"0.6157443",
"0.6149",
"0.6146905",
"0.6142163",
"0.61315376",
"0.6103731",
"0.6099103",
"0.6093654",
"0.6093492",
"0.60747266",
"0.60434955",
"0.6032783",
"0.6016335",
"0.6012039",
... | 0.64701194 | 3 |
Returns the object that has owner information | def get_owner_object(self):
return self | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_owner_object(self):\n return None",
"def get_owner_object(self):\n return None",
"def get_owner_object(self):\n return None",
"def owner(self):\n answer = self._call('owner')\n return answer.owner",
"def getOwner(self):\r\n return self.owner",
"def get_ow... | [
"0.8491062",
"0.8491062",
"0.8491062",
"0.8280981",
"0.82470596",
"0.81694925",
"0.8113453",
"0.8048076",
"0.8048076",
"0.8048076",
"0.8048076",
"0.8048076",
"0.8043171",
"0.8043171",
"0.8038191",
"0.7893845",
"0.7878419",
"0.77831835",
"0.7378757",
"0.73262",
"0.7325946",
... | 0.8164086 | 6 |
License has no owner information | def get_owner_object(self):
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isLicensed(self):\r\n return True",
"def isLicensed(self):\r\n return True",
"def isLicensed(self):\r\n return True",
"def isLicensed(self):\r\n return True",
"def isLicensed(self):\r\n return True",
"def isLicensed(self):\r\n return True",
"def isLicensed(... | [
"0.69761866",
"0.69761866",
"0.69761866",
"0.69761866",
"0.69761866",
"0.69761866",
"0.69761866",
"0.69761866",
"0.69761866",
"0.69761866",
"0.69761866",
"0.69761866",
"0.69761866",
"0.69761866",
"0.69761866",
"0.6951549",
"0.69202656",
"0.69202656",
"0.69202656",
"0.69202656",... | 0.0 | -1 |
Constructs a ResNet50 model. | def DARetinaNet(num_classes, n_head, attention_type, shot_mode, num_way=2, num_shot=5, pos_encoding=True, pretrained=False):
model = da_retinanet(num_classes, Bottleneck, [3, 4, 6, 3], n_head=n_head, attention_type=attention_type,
shot_mode=shot_mode, num_way=num_way, num_shot=num_shot, pos... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resnet50(pretrained=False, **kwargs):\n model = ResNet(Bottleneck, [3, 4, 6, 3], **kwargs)\n if pretrained:\n model.load_state_dict(model_zoo.load_url(model_urls['resnet50']))\n fc = transfer_fc(model.fc)\n model.fc = fc\n return model",
"def resnet50(**kwargs):\n model = ResNet(... | [
"0.7557751",
"0.75548905",
"0.74759895",
"0.74759895",
"0.74759895",
"0.74759895",
"0.74557495",
"0.7386862",
"0.7386862",
"0.73601955",
"0.7355623",
"0.724254",
"0.724254",
"0.7191571",
"0.7158499",
"0.7101107",
"0.70165247",
"0.69687796",
"0.68687624",
"0.6822836",
"0.68010... | 0.0 | -1 |
256 bit number from equally strong urandom, user entropy, and timer parts | def random_key(entropy):
if entropy.bit_length() < 250:
raise Exception('Insufficent entropy parameter to generate key')
from random import SystemRandom
osrndi = SystemRandom()
entstr = encode(entropy, 16) + encode(osrndi.getrandbits(512), 256) + str(clockrnd())
osrnd = SystemRandom(entstr)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gensalt():\n return hexlify(os.urandom(24)).decode()",
"def iv_gen():\r\n rndiv = os.urandom(16)\r\n return rndiv",
"def tubeid():\n return binascii.hexlify(os.urandom(12))",
"def _guid64():\n return _base91(random.randint(0, 2**64 - 1))",
"def seed_from_system_entropy(bits):\n numbyt... | [
"0.7451088",
"0.71979487",
"0.6784288",
"0.6662948",
"0.6617674",
"0.65703124",
"0.6567308",
"0.65610856",
"0.6554845",
"0.6554845",
"0.652679",
"0.6464131",
"0.6454853",
"0.639059",
"0.63726044",
"0.6368736",
"0.63292813",
"0.63051337",
"0.63027334",
"0.62860274",
"0.6266703... | 0.60082597 | 43 |
Set the name of the data source you want to use in this context. | def setSourceName(self, instance, value):
mapping = IAnnotations(instance).setdefault(
'collective.table',
PersistentMapping()
)
mapping['source_name'] = value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def data_source_name(self, data_source_name):\n\n self._data_source_name = data_source_name",
"def data_source_display_name(self, data_source_display_name):\n\n self._data_source_display_name = data_source_display_name",
"def set_data_source(self, source_id):\n self.data_source = source_id",
... | [
"0.8258608",
"0.72679675",
"0.70725435",
"0.70273864",
"0.6799303",
"0.6784634",
"0.6494911",
"0.6453371",
"0.6245362",
"0.60921675",
"0.6088904",
"0.6069587",
"0.60630035",
"0.5896932",
"0.5891805",
"0.5851537",
"0.5821425",
"0.5804325",
"0.57767296",
"0.5765504",
"0.5747905... | 0.67545146 | 6 |
Get the name of the data source that is used in this context. | def getSourceName(self, instance):
mapping = IAnnotations(instance).setdefault(
'collective.table',
PersistentMapping()
)
return mapping.get('source_name', self.defaultSourceName) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def source(self):\n for source in self.coordinator.data.sources:\n if source.SourceID == self.zone.SourceID:\n return source.Name\n return None",
"def dataset_name(self):\n return self._dataset_name",
"def dataset_name(self):\n return self.dataset.name",
... | [
"0.7485465",
"0.7231715",
"0.7205645",
"0.7191275",
"0.7172556",
"0.7045704",
"0.7039144",
"0.6895098",
"0.6895098",
"0.68483824",
"0.6833959",
"0.6792477",
"0.6543926",
"0.6543926",
"0.6543926",
"0.6543926",
"0.6522359",
"0.6515437",
"0.648321",
"0.6477733",
"0.64710313",
... | 0.7095328 | 5 |
Constructs a new CommentTypeFilterAddressIterator it an address iterator whose items are tested for the comment type. commentType the type of comment to search for. | def __init__(self, program: ghidra.program.model.listing.Program, it: ghidra.program.model.address.AddressIterator, commentType: int):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_comments_by_genus_type(self, comment_genus_type):\n # Implemented from template for\n # osid.resource.ResourceLookupSession.get_resources_by_genus_type\n # NOTE: This implementation currently ignores plenary view\n collection = JSONClientValidated('commenting',\n ... | [
"0.61757857",
"0.59026027",
"0.5580567",
"0.54232424",
"0.53219676",
"0.52644",
"0.4939232",
"0.48069802",
"0.48021403",
"0.47840932",
"0.47625637",
"0.47251922",
"0.46881828",
"0.46519646",
"0.4645314",
"0.4615899",
"0.4579984",
"0.4480709",
"0.43770796",
"0.43579522",
"0.43... | 0.5214822 | 6 |
Return the user full name. | def get_full_name(self):
# The user is identified by their email address
return self.first_name+' '+self.last_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_full_name(self):\n full_name = '%s %s' % (self.user.first_name.strip(), self.user.last_name.strip())\n if len(full_name.strip()) == 0:\n full_name = self.user.username\n return full_name.strip()",
"def full_name(self):\n return \"{} {}\".format(self.user.first_name,... | [
"0.9070203",
"0.8994707",
"0.89643186",
"0.8942489",
"0.88720185",
"0.8855742",
"0.8855742",
"0.8625439",
"0.8606376",
"0.8560753",
"0.85481167",
"0.8490194",
"0.8444255",
"0.8385685",
"0.8379506",
"0.8379506",
"0.83652294",
"0.8333685",
"0.832683",
"0.832683",
"0.832683",
... | 0.87892246 | 7 |
Return the user first name. | def get_short_name(self):
# The user is identified by their email address
return self.first_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_first_name(self) -> str:\n return self.first_name",
"def first_name(self, instance):\r\n return instance.user.first_name",
"def get_first_name(self):\n return self._first_name",
"def first_name(self) -> str:\n return self._first_name",
"def get_user_firstname():\n if ... | [
"0.8749377",
"0.87108755",
"0.861096",
"0.8580902",
"0.85253865",
"0.85245514",
"0.8483944",
"0.844943",
"0.8441186",
"0.8426599",
"0.8426599",
"0.8426599",
"0.8379432",
"0.83402526",
"0.8308882",
"0.8265119",
"0.8222934",
"0.8187334",
"0.8187334",
"0.8157073",
"0.8113996",
... | 0.8526405 | 4 |
Unicode representation of the class. | def __unicode__(self):
return self.email | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __unicode__(self):\n return str(self).decode('ascii')",
"def __str__(self):\n return unicode(self).encode('utf-8')",
"def toString(self) -> unicode:\n ...",
"def toString(self) -> unicode:\n ...",
"def __str__(self):\n return self.__unicode__().encode('utf-8').decode()"... | [
"0.7517766",
"0.73844993",
"0.7381392",
"0.7381392",
"0.73075545",
"0.7306205",
"0.72645223",
"0.7214655",
"0.7208363",
"0.7039957",
"0.70144665",
"0.6975851",
"0.69005096",
"0.68787956",
"0.6878669",
"0.68680876",
"0.6849666",
"0.67154026",
"0.66909933",
"0.66805226",
"0.662... | 0.0 | -1 |
String representation of the class. | def __str__(self): # __unicode__ on Python 2
return self.email | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n class_dictionary = vars(self)\n out = self.__class__.__name__\n for k,v in class_dictionary.items():\n if v > 0:\n out += ' : ' + str(k) + ' = ' + str(v)\n return out",
"def __repr__(self):\n outl = 'class :'+self.__class__.__name_... | [
"0.8378837",
"0.81564015",
"0.81127465",
"0.8063219",
"0.7938267",
"0.7903967",
"0.78738636",
"0.7826438",
"0.7779711",
"0.7779711",
"0.77785045",
"0.7760019",
"0.77581143",
"0.77191687",
"0.7689269",
"0.7687556",
"0.7687556",
"0.7687556",
"0.7687556",
"0.7687556",
"0.7673675... | 0.0 | -1 |
Checking if the user is a member of staff. | def is_staff(self):
# Simplest possible answer: All admins are staff
return self.is_admin | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def is_staff(ctx):\n member = ctx.message.author\n vipRole = discord.utils.get(member.guild.roles, name=ROLE_VIP)\n staffRole = discord.utils.get(member.guild.roles, name=ROLE_STAFF)\n return vipRole in member.roles or staffRole in member.roles",
"def is_staff(self):\n\t\treturn self.is_admin",... | [
"0.7809763",
"0.77470195",
"0.76879174",
"0.7499728",
"0.7499728",
"0.7488985",
"0.74400103",
"0.7431752",
"0.72711295",
"0.72711295",
"0.7221086",
"0.7188802",
"0.7140709",
"0.70102906",
"0.7000652",
"0.6955749",
"0.69439065",
"0.6816755",
"0.67356724",
"0.6686404",
"0.66287... | 0.8005451 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.