query stringlengths 9 9.05k | document stringlengths 10 222k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 4 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
Convert valid HTML content to a docx document and return it as a io.BytesIO() object. | def html2docx(content: str, title: str) -> BytesIO:
parser = HTML2Docx(title)
parser.feed(content.strip())
buf = BytesIO()
parser.doc.save(buf)
return buf | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_document(html_content, base_href=None):\n assert html_content is not None\n\n if isinstance(html_content, unicode):\n html_content = html_content.encode(\"utf8\", \"ignore\")\n\n try:\n document = document_fromstring(html_content, parser=UTF8_PARSER)\n except XMLSyntaxError:\n ... | [
"0.6267531",
"0.6155429",
"0.59656364",
"0.59277767",
"0.5913685",
"0.57495946",
"0.5702084",
"0.5644858",
"0.55864066",
"0.55211043",
"0.54855055",
"0.54576254",
"0.5440441",
"0.5410662",
"0.53540075",
"0.53327227",
"0.5327012",
"0.52911425",
"0.5288239",
"0.5259865",
"0.521... | 0.8468066 | 0 |
Adds a classification cross entropy loss term to the LOSSES collection. Initializes the loss attribute from the LOSSES collection (sum of all entries). | def _init_loss(self) -> None:
labels_one_hot = tf.one_hot(self.labels, depth=Data.num_classes)
cross_entropy_loss = tf.losses.softmax_cross_entropy(labels_one_hot, self.logits)
# cross_entropy_loss is a scalar
tf.add_to_collection(tf.GraphKeys.LOSSES, cross_entropy_loss)
self.los... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_loss_op(self, pred):\n ### YOUR CODE HERE\n loss = cross_entropy_loss(self.labels_placeholder,pred)\n ### END YOUR CODE\n return loss",
"def setup_loss(self):\n with vs.variable_scope(\"loss\"):\n self.loss = tf.reduce_mean(tf.nn.sparse_softmax_cross_entropy_... | [
"0.6853098",
"0.6785605",
"0.664682",
"0.66212046",
"0.6615802",
"0.6549143",
"0.65392613",
"0.6462261",
"0.6417518",
"0.6413369",
"0.64058745",
"0.639511",
"0.6377996",
"0.636467",
"0.6336875",
"0.6331348",
"0.63192064",
"0.63083047",
"0.6307947",
"0.62998617",
"0.62917644",... | 0.7008454 | 0 |
Global average pooling along dimensions 1 and 2 followed by a conv layer. | def global_avg_pooling(self, x: tf.Tensor) -> tf.Tensor:
x = tf.reduce_mean(x, [1, 2], name='pool5', keepdims=True)
x = slim.conv2d(x, self.num_classes, [1, 1], activation_fn=None, normalizer_fn=None, scope='logits')
return tf.squeeze(x, [1, 2], name='spatial_squeeze') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def global_average_pooling_2d(x, use_cudnn=True):\n\n return F.average_pooling_2d(x, ksize=(x.shape[2], x.shape[3]), use_cudnn=use_cudnn)",
"def avg_pool(x,\n k_h,\n k_w,\n s_h,\n s_w,\n name,\n padding=\"VALID\"):... | [
"0.742766",
"0.73737955",
"0.7155445",
"0.7088838",
"0.70634246",
"0.69688636",
"0.688236",
"0.6860589",
"0.68567985",
"0.6843583",
"0.6826399",
"0.66978544",
"0.6668701",
"0.6629671",
"0.65874946",
"0.65217507",
"0.646423",
"0.6462713",
"0.64536524",
"0.64530504",
"0.6452748... | 0.76906246 | 0 |
Wraps the slim.batch_norm method. | def batch_norm(x: tf.Tensor) -> tf.Tensor:
return slim.batch_norm(x, activation_fn=tf.nn.relu, scope='postnorm') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def batch_norm(self, inputs):\n x = inputs\n x = self.bn(x)\n return x",
"def _create_batchnorm(cls, onnx_node, inputs, opset_version):\n x = inputs[0]\n factor = onnx_node.getattr('momentum', 0.9)\n if x.device.id() == -1:\n handle = singa.BatchNormHandle(fac... | [
"0.77198064",
"0.7221723",
"0.7205403",
"0.7122821",
"0.70920277",
"0.7062579",
"0.70412093",
"0.6991486",
"0.6889606",
"0.6839133",
"0.67720395",
"0.67292756",
"0.66320497",
"0.66199714",
"0.6513374",
"0.64413357",
"0.64288867",
"0.6414264",
"0.63921666",
"0.6374264",
"0.635... | 0.7585613 | 1 |
2D convolutional layer with sizing 'SAME', i.e. input and output have the same spatial dimensionality. | def _conv2d_same(x: tf.Tensor, num_outputs: int, kernel_size: int, stride: int, rate: int = 1, scope: str = None) \
-> tf.Tensor:
if stride == 1:
return slim.conv2d(x, num_outputs, kernel_size, stride=1, rate=rate, padding='SAME', scope=scope)
kernel_size_effective = kernel_size... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def apply_conv2d_1x1(input_layer, num_classes, kernel_size=1):\n # tf.layers.conv2d(inputs, filters, kernel_size, strides=(1, 1), padding='valid', ...,\n # kernel_initializer=None, ... , kernel_regularizer=None)\n return tf.layers.conv2d(input_layer, num_classes, kernel_size, padding='same',\n ... | [
"0.7545657",
"0.74986684",
"0.7375278",
"0.7367939",
"0.735206",
"0.735206",
"0.7328537",
"0.7319557",
"0.7237753",
"0.7234719",
"0.7219779",
"0.7217196",
"0.72141415",
"0.72014695",
"0.71911883",
"0.71911883",
"0.71911883",
"0.71911883",
"0.71795094",
"0.7173091",
"0.7172888... | 0.7597218 | 0 |
First conv layer of the ResNet followed by max pooling. | def _first_conv(x: tf.Tensor) -> tf.Tensor:
with slim.arg_scope([slim.conv2d], activation_fn=None, normalizer_fn=None):
x = ResNet._conv2d_same(x, 64, 7, stride=2, scope='conv1')
return slim.max_pool2d(x, [3, 3], stride=2, scope='pool1') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def conv_and_max_pool(x, conv):\n return F.relu(conv(x).permute(0, 2, 1).max(1)[0])",
"def __init__(self, filter1x1):\n super(poolproj, self).__init__()\n self.max = layers.MaxPooling2D(pool_size=3, strides=1, padding=\"same\")\n self.conv = layers.Conv2D(\n filter1x1, kern... | [
"0.7434547",
"0.70575374",
"0.6948558",
"0.68813705",
"0.6807957",
"0.68037117",
"0.6794671",
"0.6794671",
"0.6794671",
"0.6794671",
"0.6794671",
"0.67860895",
"0.67267597",
"0.6721148",
"0.6721148",
"0.6653793",
"0.6619886",
"0.6613855",
"0.6594107",
"0.65686387",
"0.6565767... | 0.806326 | 0 |
Adds a ResNet v2 building block to the graph. Constructs a list of parameters. Creates a 'bottleneck' element for each of them. | def _v2_block(x: tf.Tensor, scope: str, base_depth: int, num_units: int, stride: int) -> tf.Tensor:
args = [{'depth': base_depth * 4, 'depth_bottleneck': base_depth, 'stride': 1}] * (num_units - 1)
args.append({'depth': base_depth * 4, 'depth_bottleneck': base_depth, 'stride': stride})
with tf.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bottleneck_x2_block(outer_filters, bottleneck_filters):\n return compose(bottleneck_block(outer_filters, bottleneck_filters),\n DarknetConv2D_BN_Leaky(bottleneck_filters, (1, 1)),\n DarknetConv2D_BN_Leaky(outer_filters, (3, 3)))",
"def add_optimizers_to_graph(self):\n ... | [
"0.53158957",
"0.5312741",
"0.5310144",
"0.5309369",
"0.5304723",
"0.5268971",
"0.52600366",
"0.5204125",
"0.51622105",
"0.51342493",
"0.5128673",
"0.5128139",
"0.5059649",
"0.5054538",
"0.5051078",
"0.50300837",
"0.5022597",
"0.4951433",
"0.4913836",
"0.4910328",
"0.49091956... | 0.55113864 | 0 |
Adds logs of the input tensor x's mean and standard deviation which are aggregated and then normalized each epoch. First, the 1st and 2nd moments are calculated over the given axes, then they are normalized over the other dimensions, such that the result is a scalar. May be used to find out the ideal initializer params... | def _log_moments_every_epoch(self, x: tf.Tensor, axes: List[int], name: str) -> None:
effective_batch_size = FLAGS.physical_batch_size * FLAGS.virtual_batch_size_factor
steps_per_epoch = TinyImageNetPipeline.num_train_samples // effective_batch_size
mean, stddev = tf.nn.moments(x, axes)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _compute_batch_moments(x):\n return torch.mean(x, dim=(0, 2, 3), keepdim=True), torch.var(x, dim=(0, 2, 3), keepdim=True)",
"def _compute_layer_moments(x):\n return torch.mean(x, dim=(1, 2, 3), keepdim=True), torch.var(x, dim=(1, 2, 3), keepdim=True)",
"def moments(\n x,\n ... | [
"0.65681106",
"0.6530468",
"0.6447435",
"0.6430983",
"0.61867017",
"0.61191726",
"0.60429174",
"0.6040019",
"0.60268813",
"0.5977648",
"0.59714365",
"0.59621465",
"0.58673483",
"0.58594334",
"0.5858714",
"0.5841264",
"0.58396095",
"0.58396095",
"0.5834709",
"0.5826251",
"0.58... | 0.78108764 | 0 |
Assigns data to this object and builds the MorseSmale Complex Uses an internal graph given in the constructor to build a MorseSmale complex on the passed in data. Weights are currently ignored. | def build(self, X, Y, w=None):
super(MorseSmaleComplex, self).build(X, Y, w)
if self.debug:
sys.stdout.write("Decomposition: ")
start = time.perf_counter()
stableManifolds = MorseComplex(debug=self.debug)
unstableManifolds = MorseComplex(debug=self.debug)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setData(self, data):\n self.data = data\n dagPath, components = self.__getGeometryComponents()\n self.setInfluenceWeights(dagPath, components)\n self.setBlendWeights(dagPath, components)\n\n for attr in ['skinningMethod', 'normalizeWeights']:\n cmds.setAttr('%s.%s'... | [
"0.5258735",
"0.5159887",
"0.510025",
"0.50699246",
"0.5057417",
"0.50502205",
"0.501364",
"0.50125754",
"0.49936688",
"0.4977205",
"0.49562985",
"0.49325258",
"0.4907552",
"0.49042875",
"0.48714843",
"0.4868553",
"0.48574817",
"0.48549083",
"0.48281965",
"0.48261562",
"0.481... | 0.57312304 | 0 |
Saves a constructed MorseSmale Complex in json file | def save(self, filename=None):
if filename is None:
filename = "morse_smale_complex.json"
with open(filename, "w") as fp:
fp.write(self.to_json()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def WriteStructuralMaterialsjson(save_path,dic_in_json_format):\n complete_name=os.path.join(save_path,\"StructuralMaterials.json\") \n with open(complete_name, \"w\") as save_file:\n save_file.write(dic_in_json_format)\n if(DEBUG):\n print(\"StructuralMaterials.json written\")",
"def sav... | [
"0.713691",
"0.6085894",
"0.6045571",
"0.6032214",
"0.5975927",
"0.5942125",
"0.59125984",
"0.5860308",
"0.58313",
"0.5818231",
"0.58177376",
"0.5802665",
"0.5798953",
"0.5792283",
"0.57880884",
"0.57706547",
"0.57593167",
"0.5752471",
"0.5745989",
"0.57375103",
"0.57362986",... | 0.8055844 | 0 |
Returns a data structure holding the ordered merge sequence of extrema simplification Returns | def get_merge_sequence(self):
return self.merge_sequence | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def solution(l):\n for i in range(len(l)):\n l[i]=l[i].split('.')\n\n #groups all majors\n major_list = {}\n for x in range(len(l)):\n major_number = int(l[x][0])\n if major_number not in major_list:\n major_list[major_number] = [l[x]]\n else:\n major_l... | [
"0.5759952",
"0.5591279",
"0.5576977",
"0.5576657",
"0.5540277",
"0.53981274",
"0.53379506",
"0.52923185",
"0.5247945",
"0.51867205",
"0.5185694",
"0.5127969",
"0.5117715",
"0.51132673",
"0.5093031",
"0.5077379",
"0.50714976",
"0.5069541",
"0.5037335",
"0.50335574",
"0.502551... | 0.5703208 | 1 |
Returns the partitioned data based on a specified persistence level | def get_partitions(self, persistence=None):
if persistence is None:
persistence = self.persistence
partitions = {}
# TODO: Possibly cache at the critical persistence values,
# previously caching was done at every query level, but that
# does not make sense as the part... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_partition_list(self):\n raise NotImplementedError('Must be implemented in subclasses.')",
"def partitionData(data, labels, partition):\n\treturn [s[partition] for s in data], labels[partition]",
"def get_partitions(self, conditions):\n\n raise NotImplementedError('get_partitions')",
"d... | [
"0.5507392",
"0.5324904",
"0.5245607",
"0.52156466",
"0.51397556",
"0.5137993",
"0.51039684",
"0.5059647",
"0.5048426",
"0.5037446",
"0.49348447",
"0.4931412",
"0.49067545",
"0.4899739",
"0.48872158",
"0.48678738",
"0.48626947",
"0.48504812",
"0.48402703",
"0.48204845",
"0.48... | 0.6140042 | 0 |
Return the current disassembly control, either linear viewer or flow graph. | def current_graph(self):
if self._linear_viewer.isVisible():
return self._linear_viewer
else:
return self._flow_graph | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_control(self):\n return self.layout.current_control",
"def cntrl(self):\n return self._cntrl",
"def get_control(self):\n return self.control",
"def control(self):\n return self._control",
"def get_current(self):\n return self.current",
"def current(cls):\n ... | [
"0.64891243",
"0.5761902",
"0.5698585",
"0.5610963",
"0.5607078",
"0.55543864",
"0.5493591",
"0.5437331",
"0.5437331",
"0.54094696",
"0.53840595",
"0.5378792",
"0.5293482",
"0.52914596",
"0.5288046",
"0.5286565",
"0.5265664",
"0.52216554",
"0.5211889",
"0.5211889",
"0.5211889... | 0.65285903 | 0 |
Toggle between the smart highlighting mode and the textbased highlighting mode. | def toggle_smart_highlighting(self, enabled):
self.infodock.smart_highlighting = enabled
self._flow_graph.refresh()
self._linear_viewer.refresh() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _higlightWord(self, bOn=True): #$NON-NLS-1$\r\n if self.currRange:\r\n if bOn:\r\n self.currRange.scrollIntoView()\r\n self.currRange.select()\r\n else:\r\n self.mshtmlEditControl.selectNone()",
"def no_highlight(): #py:no_highlight\n... | [
"0.65434474",
"0.58109915",
"0.57655704",
"0.5666739",
"0.5652088",
"0.56447",
"0.5636003",
"0.5625745",
"0.56229496",
"0.5620752",
"0.5618403",
"0.5597519",
"0.55920243",
"0.5560124",
"0.55429465",
"0.55405146",
"0.54315084",
"0.54154634",
"0.54000455",
"0.5378025",
"0.53698... | 0.720054 | 0 |
Toggle whether addresses are shown on disassembly graph. | def toggle_show_address(self, show_address):
self._show_address = show_address
self.current_graph.refresh() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def disassemble(self, address: ghidra.program.model.address.Address) -> bool:\n ...",
"def enableAddressLayer(self):\n\n self._deladdressaction.setEnabled(True)\n self._createnewaddressaction.setEnabled(True)\n self._moveaddressaction.setEnabled(True)\n self._updateaddressactio... | [
"0.6330883",
"0.5730575",
"0.5648158",
"0.54599404",
"0.54348326",
"0.5413083",
"0.53968865",
"0.53968865",
"0.53968865",
"0.53968865",
"0.53470546",
"0.534517",
"0.53383726",
"0.52447945",
"0.52027893",
"0.5181539",
"0.50885284",
"0.50356966",
"0.503521",
"0.50348634",
"0.49... | 0.7351673 | 0 |
Toggle whether variables are shown on disassembly graph. | def toggle_show_variable(self, show_variable):
self._show_variable = show_variable
self.current_graph.refresh() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def toggle_show_variable_identifier(self, show_ident):\n\n self._show_variable_ident = show_ident\n\n self.current_graph.refresh()",
"def toggle(self):\r\n self._variable.set(not self._variable.get()) \r\n self._activate()",
"def toggle(self):\n self._variable.set(not self._v... | [
"0.648693",
"0.6231648",
"0.61872977",
"0.60490847",
"0.5965433",
"0.5871969",
"0.55691797",
"0.555761",
"0.55553865",
"0.5549849",
"0.5425574",
"0.5358671",
"0.53202283",
"0.52980953",
"0.5286367",
"0.52616876",
"0.52469337",
"0.5243264",
"0.5179553",
"0.51738614",
"0.517386... | 0.66634744 | 0 |
Toggle whether variable identifiers are shown on disassembly graph. | def toggle_show_variable_identifier(self, show_ident):
self._show_variable_ident = show_ident
self.current_graph.refresh() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def toggle_show_variable(self, show_variable):\n\n self._show_variable = show_variable\n\n self.current_graph.refresh()",
"def toggle_variable(self, obj):\n if self.is_variable_present(obj):\n self.remove_variable(obj)\n else:\n self.add_variable(obj)",
"def to... | [
"0.6118503",
"0.5576274",
"0.54515886",
"0.5427665",
"0.532803",
"0.5143953",
"0.5138373",
"0.5041431",
"0.49786666",
"0.49662778",
"0.4960723",
"0.49375546",
"0.48943216",
"0.48468545",
"0.48139197",
"0.48022524",
"0.47709212",
"0.4736414",
"0.47327405",
"0.47207642",
"0.470... | 0.72014356 | 0 |
Modify the messages created by internal validation for each tool parameter. This method is called after internal validation. | def updateMessages(self, parameters):
l = 0;
if parameters[1].value == True:
#parameters[4].setErrorMessage("Random percentage value required!")
l = l + 1;
if parameters[2].value == '' or parameters[2].value is None:
parameters[2].setErrorMes... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def updateMessages(self):\r\n\t\tif self.approach.altered:\r\n\t\t\tif self.approach.value == \"Locations in the DEM generated from field observations\":\r\n\t\t\t\tif not self.point_vectors.altered:\r\n\t\t\t\t\tself.point_vectors.setIDMessage(\"ERROR\", 735, self.point_vectors.displayName)\r\n\t\t\t\tif not self... | [
"0.6271568",
"0.6220484",
"0.5906583",
"0.5857997",
"0.5826674",
"0.58234125",
"0.5643723",
"0.55588835",
"0.5523212",
"0.54982775",
"0.54687554",
"0.5461878",
"0.54512423",
"0.5427085",
"0.5403418",
"0.54019755",
"0.53487635",
"0.5335484",
"0.5331722",
"0.5313806",
"0.528849... | 0.6226257 | 1 |
Remove a character at a random position | def remove_random_character(self, node, verbose=False):
s = node.children[0].symbol
if s:
pos = random.randint(0, len(s) - 1)
if verbose:
print("Removing character {} at pos {} of {}.".format(repr(s[pos]), pos, node.symbol))
else:
self.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _delChar(self, pos):\n nonGlyph = countInSet(self.text[:pos], self.NO_GLYPH_CHARS)\n\n self.allVertices = self.allVertices[:(pos - nonGlyph) * 4]\n self.allIndices = self.allIndices[:pos - nonGlyph]\n self.colors.pop(pos)\n self._string_metric = self._string_metric[:pos]\n ... | [
"0.67755336",
"0.66044414",
"0.6603213",
"0.6524631",
"0.6354763",
"0.6318837",
"0.6233282",
"0.61724204",
"0.61465085",
"0.61430657",
"0.610653",
"0.60415685",
"0.5997627",
"0.5991896",
"0.5818757",
"0.57605433",
"0.5756256",
"0.5754224",
"0.5746882",
"0.5734124",
"0.5723415... | 0.8029536 | 0 |
Insert a random character at a random position | def insert_random_character(self, node, verbose=False):
s = node.children[0].symbol
if s:
pos = random.randint(0, len(s) - 1)
#random_character = chr(random.randrange(0, 127))
random_character = random.choice(self.char_pool)
if verbose:
pri... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def replace_random_character(self, node, verbose=False):\n s = node.children[0].symbol\n if s:\n pos = random.randint(0, len(s) - 1)\n #random_character = chr(random.randrange(0, 127))\n random_character = random.choice(self.char_pool)\n if verbose:\n ... | [
"0.72734463",
"0.6765991",
"0.6615657",
"0.66150004",
"0.65729195",
"0.6542741",
"0.64680856",
"0.6388844",
"0.63665134",
"0.6343753",
"0.63390565",
"0.62850773",
"0.62693447",
"0.6221558",
"0.61541325",
"0.6147074",
"0.61075926",
"0.60737973",
"0.6054582",
"0.60543376",
"0.6... | 0.79282 | 0 |
Replace a character at a random position with a random character | def replace_random_character(self, node, verbose=False):
s = node.children[0].symbol
if s:
pos = random.randint(0, len(s) - 1)
#random_character = chr(random.randrange(0, 127))
random_character = random.choice(self.char_pool)
if verbose:
pr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def replace_char_candidate_typo(self, char):\n i = np.random.randint(0, 2)\n\n return self.typo[char][i]",
"def mutate(text, mutation_rate):\n if mutation_rate is None or not randint(0, mutation_rate) == 0:\n return text\n\n chars = list(text)\n new_char = choice([\" \", \"X\"])\n ... | [
"0.76067",
"0.7222626",
"0.6926276",
"0.6861797",
"0.68179584",
"0.6747207",
"0.6704646",
"0.6649654",
"0.6648097",
"0.66113585",
"0.6556977",
"0.6494964",
"0.64882547",
"0.6469378",
"0.64481014",
"0.6344109",
"0.63404214",
"0.6318366",
"0.6306871",
"0.62959796",
"0.618165",
... | 0.80698806 | 0 |
Remove a subtree at a random position under a given node | def remove_random_subtree(self, node, verbose=False):
if node.children:
pos = random.randint(0, len(node.children) - 1)
if verbose:
print("Removing subtree {} under {}.".format(repr(node.children[pos].symbol), repr(node.symbol)))
else:
self.mut... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def replace_random_subtree(self, node, verbose=False):\n if node.children:\n pos = random.randint(0, len(node.children) - 1)\n random_symbol = random.choice(self.symbol_pool)\n random_subtree = self.input.build_tree(Node(random_symbol))\n if verbose:\n ... | [
"0.70216113",
"0.6851963",
"0.68404883",
"0.6701593",
"0.66995466",
"0.6693727",
"0.64837015",
"0.64495987",
"0.6433999",
"0.63744557",
"0.63653535",
"0.6358678",
"0.63335925",
"0.62550515",
"0.6244501",
"0.6223531",
"0.6192929",
"0.6143264",
"0.6133787",
"0.61286485",
"0.604... | 0.78036106 | 0 |
Update a subtree at a random position under a given node with a subtree expanded from a symbol chosen randomly from the list of symbols | def replace_random_subtree(self, node, verbose=False):
if node.children:
pos = random.randint(0, len(node.children) - 1)
random_symbol = random.choice(self.symbol_pool)
random_subtree = self.input.build_tree(Node(random_symbol))
if verbose:
print("... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def insert_random_subtree(self, node, verbose=False):\n if node.children:\n pos = random.randint(0, len(node.children) - 1)\n random_symbol = random.choice(self.symbol_pool)\n random_subtree = self.input.build_tree(Node(random_symbol))\n if verbose:\n ... | [
"0.6856606",
"0.6261597",
"0.6132622",
"0.5915443",
"0.5868683",
"0.58531255",
"0.5765468",
"0.5749285",
"0.5733321",
"0.5695601",
"0.56653696",
"0.5616609",
"0.5597261",
"0.55874693",
"0.55705416",
"0.5551399",
"0.55089056",
"0.5506339",
"0.5498486",
"0.54605955",
"0.5429455... | 0.7230515 | 0 |
Insert a subtree at a random position under a given node; inserted subtree is expanded from a symbol chosen randomly from the list of symbols | def insert_random_subtree(self, node, verbose=False):
if node.children:
pos = random.randint(0, len(node.children) - 1)
random_symbol = random.choice(self.symbol_pool)
random_subtree = self.input.build_tree(Node(random_symbol))
if verbose:
print("I... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def replace_random_subtree(self, node, verbose=False):\n if node.children:\n pos = random.randint(0, len(node.children) - 1)\n random_symbol = random.choice(self.symbol_pool)\n random_subtree = self.input.build_tree(Node(random_symbol))\n if verbose:\n ... | [
"0.6853367",
"0.6788633",
"0.6571975",
"0.64785516",
"0.6283161",
"0.6135038",
"0.6056984",
"0.60454845",
"0.60041726",
"0.597236",
"0.59546906",
"0.5947398",
"0.5922098",
"0.5918083",
"0.59036756",
"0.58993024",
"0.5894578",
"0.58852",
"0.5860656",
"0.5851595",
"0.5846938",
... | 0.7963577 | 0 |
Assume `readFile` is a lineiterable (list of strings, or a File object, etc.) and construct a sudoku Board. Squares are delimited by whitespace; blank lines are ignored. | def boardFromFile(readFile):
matrix = []
for boardLine in readFile:
matrix.append([])
for value in boardLine.rstrip().lstrip().split():
matrix[-1].append( int(value) if value in string.digits else None )
if len(matrix[-1]) == 0:
matrix.pop() # Non-board l... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parsePuzzle(fileName):\n data = []\n f = open(fileName, 'r')\n for line in f:\n splitLine = line.split(sep=\" \")\n row = []\n if len(splitLine) >= 9:\n for i in range(9):\n row.append(int(splitLine[i]))\n data.append(row)\n f.close()\n retur... | [
"0.699868",
"0.6732886",
"0.65791404",
"0.6434917",
"0.6214608",
"0.6197037",
"0.6125963",
"0.612072",
"0.6002244",
"0.59961015",
"0.5995857",
"0.59928566",
"0.59928566",
"0.589898",
"0.5846396",
"0.5844585",
"0.57868797",
"0.57727474",
"0.57339036",
"0.5707703",
"0.56929004"... | 0.77136385 | 0 |
This method filters the data for each measurement using a low pass filter and then normalizes the data with mean and standard deviation. | def low_pass_mean_std_measurement(measurements: List[Measurement],
sample_rate: float=0.5,
cutoff_freq: float=0.02,
order: int=2) -> list:
for meas in measurements:
data = meas.get_data()
ys = np.ze... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalize_data(self):\n self.x_mean, self.x_std = du.get_mean_std(self.x_train)\n self.x_train = du.normalize(self.x_train, self.x_mean, self.x_std)\n if self.x_test is not None and self.y_test is not None:\n self.x_test = du.normalize(self.x_test, self.x_mean, self.x_std)\n ... | [
"0.6626087",
"0.6607096",
"0.6552704",
"0.6429685",
"0.6325302",
"0.63103735",
"0.62867707",
"0.62702703",
"0.6255789",
"0.61919826",
"0.6150663",
"0.6134884",
"0.60972375",
"0.608683",
"0.60767394",
"0.607562",
"0.60708255",
"0.60708255",
"0.60382974",
"0.6035645",
"0.602155... | 0.6770705 | 0 |
This method returns the standarized measurements found in the data in the specified directory. | def get_measurements_from_dir(directory_name: str= '../data_train') -> np.ndarray:
functionalisations, correct_channels, data = file_reader.read_all_files_in_folder(directory_name)
print(np.count_nonzero(correct_channels))
measurements_per_file = {}
for file in data:
measurements_per_file[file] ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_rmsd_list(self):\n fout_no = open('no_rmsd','w')#no poses file\n fout_empty = open('rmsd_empty','w')#poses file was empty\n fout_minus = open('minus_1','w')\n for subdir in os.listdir(self.path):\n if subdir.startswith('.'):\n continue\n try... | [
"0.6248413",
"0.61085045",
"0.59458065",
"0.5899078",
"0.576028",
"0.57227725",
"0.57054085",
"0.5680517",
"0.56376094",
"0.5615381",
"0.5596967",
"0.5559288",
"0.55444014",
"0.5503717",
"0.5476108",
"0.5475856",
"0.5449518",
"0.5447881",
"0.54418343",
"0.5437756",
"0.5437708... | 0.6795982 | 0 |
This method splits an array of measurements into train and test data sets with the specified split. | def train_test_split(measurements: np.ndarray, split: float = 0.8) -> (np.ndarray, np.ndarray):
labels_measurements = [m.label for m in measurements]
labels = np.unique(labels_measurements)
for i, l in enumerate(labels):
indices_label = np.argwhere(np.array(labels_measurements) == l).flatten()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def split_dataset(self, split):\n trunk_pos_size = math.ceil((1 - split) * len(self.Pos))\n trunk_neg_size = math.ceil((1 - split) * len(self.Neg))\n trunk_num = int(1 / (1 - split))\n pos_temp = list()\n neg_temp = list()\n for index in range(trunk_num):\n pos_... | [
"0.8101568",
"0.77468383",
"0.75648856",
"0.74929947",
"0.745164",
"0.7404906",
"0.7385529",
"0.7308533",
"0.7253971",
"0.72037363",
"0.71789664",
"0.7159913",
"0.71504116",
"0.7145964",
"0.71187127",
"0.707697",
"0.7064171",
"0.70577216",
"0.7057104",
"0.70542663",
"0.705032... | 0.8009372 | 1 |
Function to shuffle one or respectively two datasets. | def shuffle(dataset_one: np.ndarray, dataset_two: np.ndarray = None) -> np.ndarray:
np.random.shuffle(dataset_one)
if dataset_two is not None:
np.random.shuffle(dataset_two)
return dataset_one, dataset_two
else:
return dataset_one | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shuffle(input_dataset, target_dataset):\n\t\t#######################################################################\n\t\t# ** START OF YOUR CODE **\n\t\t#######################################################################\n\t\tassert(input_dataset.shape[0] == target_dataset.shape[0])\... | [
"0.7532333",
"0.7395217",
"0.7208842",
"0.7166049",
"0.7123875",
"0.7077964",
"0.70646924",
"0.70646924",
"0.70646924",
"0.702299",
"0.6964035",
"0.69373035",
"0.68993974",
"0.6843264",
"0.6827827",
"0.67698973",
"0.67485476",
"0.66867405",
"0.6683289",
"0.665731",
"0.6638449... | 0.858289 | 0 |
Create async job scheduler (aiosched.scheduler) ALoop must always be specified or default ALoop defined | def create_async_job_scheduler(self,
name,
aloop=None,
start=True,
default=False):
if name == '__supervisor__':
raise RuntimeError('Name "__supervisor__" is res... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_async_task(self, loop: AbstractEventLoop) -> TaskAwaitable:\n self._agent.runtime.set_loop(loop)\n if not isinstance(self._agent.runtime, AsyncRuntime): # pragma: nocover\n raise ValueError(\n \"Agent runtime is not async compatible. Please use runtime_mode=async... | [
"0.594277",
"0.59365505",
"0.58708346",
"0.58176726",
"0.58176726",
"0.58075076",
"0.57906157",
"0.5644279",
"0.56286633",
"0.5555956",
"0.55498445",
"0.55180025",
"0.55148154",
"0.55112565",
"0.55022705",
"0.5480445",
"0.5457724",
"0.543988",
"0.53532386",
"0.5339552",
"0.53... | 0.6401269 | 0 |
Returns a list of uninstalled translation and/or writing aid packages. pkgcode = language code as used in the languagepack packagenames. If the list 'packages' is supplied, only check for extra translation and/or writing aid packages for that given list of packages. Otherwise check the full list. This function is to be... | def findPackages(self, pkgcode, packages=None):
if not packages:
if (self.system_pkgcode and pkgcode == self.system_pkgcode):
scanlist = ['language-pack', 'language-support-fonts', 'language-support-input', 'language-support-writing']
else:
scanlist = ['la... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getMissingPackages(self, language=None, all=False, packages=None, showInstalled=False):\n if self._cache.broken_count > 0:\n raise SoftwareIndexBroken\n \n self.langpack_locales = {}\n self.pkg_translations = {}\n self.pkg_writing = {}\n filter_list ... | [
"0.6694555",
"0.630489",
"0.60526824",
"0.59820795",
"0.59367204",
"0.58597094",
"0.5746762",
"0.5709202",
"0.56863105",
"0.5629539",
"0.5562808",
"0.55523163",
"0.55228466",
"0.54971147",
"0.5418953",
"0.53863466",
"0.5362188",
"0.53404444",
"0.53176177",
"0.5308036",
"0.530... | 0.7913609 | 0 |
Build a list of translation packages available in the archive, then call findPackages() to find out which packages are not installed yet, depending on the languages and packages installed on the system. If 'language' is supplied, only check for that language. If the list 'packages' is supplied, only check for that list... | def getMissingPackages(self, language=None, all=False, packages=None, showInstalled=False):
if self._cache.broken_count > 0:
raise SoftwareIndexBroken
self.langpack_locales = {}
self.pkg_translations = {}
self.pkg_writing = {}
filter_list = {}
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def findPackages(self, pkgcode, packages=None):\n if not packages:\n if (self.system_pkgcode and pkgcode == self.system_pkgcode):\n scanlist = ['language-pack', 'language-support-fonts', 'language-support-input', 'language-support-writing']\n else:\n scanl... | [
"0.73599285",
"0.662594",
"0.60000914",
"0.5965488",
"0.5675069",
"0.5623985",
"0.5592453",
"0.5591188",
"0.5559924",
"0.55497634",
"0.5516158",
"0.5475252",
"0.54111075",
"0.53518283",
"0.5333861",
"0.5328471",
"0.52935153",
"0.52628386",
"0.52476615",
"0.52433175",
"0.52171... | 0.7269999 | 1 |
Test case for reboot_machine Reboot machine | def test_reboot_machine(self, pretty_print, owner_api_token):
machine = setup_data.get('reboot_machine', {}).get(
'machine') or setup_data.get('machine') or 'my-machine'
uri = MIST_URL + \
'/api/v2/machines/{machine}/actions/reboot'.format(machine=machine)
request = MistR... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reboot(self, node):",
"def reboot(self):\n self.resetStream()\n logger.info(\"Going to reboot %s\" % self)\n self.setMode(CLI_MODES.shell)\n self._session.sendline(\"reboot\")\n reboot_failed_tries = 3\n reboot_wait_tries = 3\n while True:\n i = sel... | [
"0.70903337",
"0.7048861",
"0.70248234",
"0.7024573",
"0.69434863",
"0.6939822",
"0.69081414",
"0.68886054",
"0.68289524",
"0.6813449",
"0.6811622",
"0.675784",
"0.6741054",
"0.6718294",
"0.6674288",
"0.6671791",
"0.6632096",
"0.6615547",
"0.65919745",
"0.6588558",
"0.6578621... | 0.8017381 | 0 |
Test case for resize_machine Resize machine | def test_resize_machine(self, pretty_print, owner_api_token):
query_string = setup_data.get('resize_machine', {}).get(
'query_string') or [('size', '9417745961a84bffbf6419e5of68faa5')]
machine = setup_data.get('resize_machine', {}).get('machine') \
or setup_data.get('machine') or... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_run_resize(self):\n self.expect_datatore_lookup('SomeBlobKey', True)\n self.expect_open_image('SomeBlobKey', (1600, 1200))\n self.expect_resize(32)\n self.expect_encode_image('SomeImageSize32')\n self.mox.ReplayAll()\n self._environ['PATH_INFO'] += '=s32'\n self.run_request('image/jpe... | [
"0.7088068",
"0.6835079",
"0.68001926",
"0.6787852",
"0.66834754",
"0.6582125",
"0.6496937",
"0.6435406",
"0.6435306",
"0.6418407",
"0.62910765",
"0.62636906",
"0.61564857",
"0.6136038",
"0.6106428",
"0.6055025",
"0.60534954",
"0.59988904",
"0.59908295",
"0.5974895",
"0.59667... | 0.7975628 | 0 |
Test case for start_machine Start machine | def test_start_machine(self, pretty_print, owner_api_token):
machine = setup_data.get('start_machine', {}).get('machine') \
or setup_data.get('machine') or 'my-machine'
uri = MIST_URL + \
'/api/v2/machines/{machine}/actions/start'.format(machine=machine)
request = MistReq... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test06_machine_create(self, image_name=\"Ubuntu 16.04 x64\"):\n self.lg('%s STARTED' % self._testID)\n self.lg(' create %s machine ' % self.machine_name)\n self.assertTrue(self.EUMachines.end_user_create_virtual_machine(image_name,self.machine_name))\n self.lg('delete %s machine ' %... | [
"0.712213",
"0.69544697",
"0.67624426",
"0.66833043",
"0.6654861",
"0.64897984",
"0.6405975",
"0.6345799",
"0.633896",
"0.63150626",
"0.6279257",
"0.6275615",
"0.62745196",
"0.62729925",
"0.62729925",
"0.62729925",
"0.62729925",
"0.6254736",
"0.6241875",
"0.6230146",
"0.62301... | 0.81441724 | 0 |
Test case for stop_machine Stop machine | def test_stop_machine(self, pretty_print, owner_api_token):
machine = setup_data.get('stop_machine', {}).get(
'machine') or setup_data.get('machine') or 'my-machine'
uri = MIST_URL + \
'/api/v2/machines/{machine}/actions/stop'.format(machine=machine)
request = MistRequest... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_issue_stop_stop_watch(self):\n pass",
"def test_stop(self):\n\n message = {\"method\": \"stop\",\n \"params\": {\"elem\": self.container_running}}\n response = yield self._get_response(message)\n\n self.assertIsInstance(response, dict)\n self.assertEq... | [
"0.7449237",
"0.7145444",
"0.70612454",
"0.70612454",
"0.70612454",
"0.70612454",
"0.6965416",
"0.69536024",
"0.6939678",
"0.6937532",
"0.6924902",
"0.68780553",
"0.6846745",
"0.6837282",
"0.6821555",
"0.6816824",
"0.6803591",
"0.68005586",
"0.67573744",
"0.67483574",
"0.6729... | 0.8273033 | 0 |
A function that Displays the Application title | def app_title():
print("*" * 27)
print(" Stock App")
print("*" * 27) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ftitle(self, text):\n return \"{} - {}\".format(self._app_name, text)",
"def get_window_title(self): # real signature unknown; restored from __doc__\n return \"\"",
"def title(self):\n return self.run_command('title')[0]",
"def get_title():",
"def set_title(self):\n if self.curr... | [
"0.7987455",
"0.76876086",
"0.74768496",
"0.7352188",
"0.73134965",
"0.7188488",
"0.71628493",
"0.7073167",
"0.70338106",
"0.70335376",
"0.7019124",
"0.7009708",
"0.7009067",
"0.7008662",
"0.6995737",
"0.69579667",
"0.69293475",
"0.6918747",
"0.69179785",
"0.69156885",
"0.688... | 0.84884506 | 0 |
A function that calculates the total using a total_price dictonary | def calculate_total_price(total_prices):
total = 0.0
for symbol,individual_cost in total_prices.items():
total += individual_cost
return total | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _total_price(self, cr, uid, ids, field_name, arg, context={}):\n res = {}\n for record in self.browse(cr, uid, ids, context=context):\n val = 0.0\n for line in record.item_ids:\n val += line.price\n res[record.id] = val \n return res",
"def... | [
"0.7553555",
"0.7160713",
"0.70185536",
"0.6953715",
"0.6841713",
"0.6808858",
"0.67253566",
"0.66981643",
"0.6597098",
"0.65884054",
"0.6526942",
"0.64824396",
"0.6474311",
"0.646815",
"0.64627033",
"0.64469385",
"0.6425829",
"0.6329689",
"0.62726945",
"0.62711716",
"0.62531... | 0.8007162 | 0 |
Displays the letters currently in the hand. | def displayHand(hand):
for letter in hand.keys():
for j in range(hand[letter]):
print(letter,end=" ") # print all on the same line
print() # print an empty line
| {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def displayHand(hand: d_si) -> None:\n for letter in hand.keys():\n for _ in range(hand[letter]):\n print(letter,end=\" \")\n print()",
"def display_hand(hand):\n letters = \"\"\n\n for i in hand.keys():\n\n for j in range(hand[i]):\n letters += i\n\n return let... | [
"0.7693712",
"0.76311296",
"0.7603163",
"0.75780857",
"0.70311123",
"0.6969054",
"0.6889765",
"0.688254",
"0.6803918",
"0.6751547",
"0.67467827",
"0.67184234",
"0.657022",
"0.654471",
"0.6518856",
"0.64886594",
"0.6484981",
"0.635198",
"0.635198",
"0.635198",
"0.62984085",
... | 0.7692085 | 1 |
reading install.rdf and packaging a xpi file. | def packaging(src):
work_copy = osp.dirname(src)
addon_info = "".join(open(work_copy + osp.sep + "install.rdf"))
addon_name = re.search("(?<=em\:name\=\").*(?=\")",addon_info).group(0)
addon_version = re.search("(?<=em\:version\=\").*(?=\")",addon_info).group(0)
temp_copy_base = tempfile.mkdtemp()
temp_copy =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_read_file():\n z = XPIManager(get_path('xpi/install_rdf_only.xpi'))\n assert z.read('install.rdf') is not None",
"def do_package(package):\n\tn_ucr = extFile(package, 'univention-config-registry')\n\tif not os.path.exists(n_ucr):\n\t\treturn\n\n\tf_ucr = open(n_ucr, 'r')\n\n\tfor item in univentio... | [
"0.67769736",
"0.58431524",
"0.5731654",
"0.53610206",
"0.5328531",
"0.52752286",
"0.52238744",
"0.5133663",
"0.5114246",
"0.5086411",
"0.50564915",
"0.4995326",
"0.49743095",
"0.49723762",
"0.4960447",
"0.49585983",
"0.49314535",
"0.49213263",
"0.48943603",
"0.48861384",
"0.... | 0.7172041 | 0 |
compressing src to dstfile | def compress(src,dstfile):
afile = zipfile.ZipFile(dstfile,"w",zipfile.ZIP_DEFLATED)
for root,dirs,files in os.walk(src):
for filename in files:
abspath = osp.join(root,filename)
relpath = osp.relpath(abspath,src)
afile.write(abspath, relpath)
afile.close(); | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compress_stream(src, dst):\n with gzip.GzipFile(fileobj=dst, mode='wb') as gz:\n for block in iterfile(src):\n gz.write(block)",
"def convert_to_jpg_then_compress(self):\n\t\tself._compressed_file_name = 'c_' + self.file_name\n\t\tself._compressed_save_path = self.full_path.replace(self.... | [
"0.7516959",
"0.71220577",
"0.71102154",
"0.6987134",
"0.6921339",
"0.69202715",
"0.6675342",
"0.66714424",
"0.6651059",
"0.658698",
"0.65178204",
"0.6368867",
"0.6335321",
"0.6322695",
"0.6292022",
"0.6259602",
"0.6240624",
"0.6174037",
"0.61739165",
"0.61098135",
"0.6076184... | 0.7422028 | 1 |
Initiate the OpenID authentication. | def initiateAuthentication(identity_url, return_to=None): | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_open_id_setup(self):\r\n self.attempt_login(200)",
"def start(self):\n if not self.available:\n self.get_auth_token()\n\n if self.key_required and not self.no_prompt:\n email = self.login_handler.data[\"username\"]\n key = input(\"Enter code sent to ... | [
"0.69026184",
"0.63827485",
"0.62664413",
"0.61199707",
"0.6094853",
"0.6077462",
"0.5932199",
"0.5931994",
"0.58713615",
"0.58662707",
"0.5848481",
"0.5825932",
"0.58192325",
"0.5807114",
"0.5803267",
"0.579822",
"0.57908255",
"0.57895243",
"0.5770746",
"0.57687616",
"0.5758... | 0.70473796 | 0 |
Require name from the provider. | def require(name): | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _check_name(self):\n\t\tpass",
"def provider_name(self):\n raise NotImplementedError",
"def test_name_required(self):\n self.required_field_fail('name', self.test_data['pants'])",
"def _check_required_if_provider(self):\n return",
"def get_name(cls, unused_provider_details):\r\n ... | [
"0.6641928",
"0.65102655",
"0.6313946",
"0.6204481",
"0.6201834",
"0.60720944",
"0.60657215",
"0.5928671",
"0.58682555",
"0.58007234",
"0.57963943",
"0.57170355",
"0.5714742",
"0.56783366",
"0.5658971",
"0.5656948",
"0.56058604",
"0.5602015",
"0.5599806",
"0.5573291",
"0.5526... | 0.6959248 | 0 |
Returns True if a __dunder__ name, False otherwise. | def _is_dunder(name):
return (name[:2] == name[-2:] == '__' and
name[2:3] != '_' and
name[-3:-2] != '_' and
len(name) > 4) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _is_sunder(name):\n return (name[0] == name[-1] == '_' and\n name[1:2] != '_' and\n name[-2:-1] != '_' and\n len(name) > 2)",
"def has_name(self):\n return self.unpack_word(0x2) != 0",
"def hasname(self):\n\t\treturn self.name is not None",
"def has_name(self):\... | [
"0.7273525",
"0.6633811",
"0.6501823",
"0.64277774",
"0.63677377",
"0.6311043",
"0.62160003",
"0.6174542",
"0.61492544",
"0.6086734",
"0.6082686",
"0.598643",
"0.5984556",
"0.59556955",
"0.5952864",
"0.59306496",
"0.5928376",
"0.591307",
"0.5912606",
"0.58773774",
"0.5876665"... | 0.8264985 | 0 |
Returns True if a _sunder_ name, False otherwise. | def _is_sunder(name):
return (name[0] == name[-1] == '_' and
name[1:2] != '_' and
name[-2:-1] != '_' and
len(name) > 2) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _is_dunder(name):\n return (name[:2] == name[-2:] == '__' and\n name[2:3] != '_' and\n name[-3:-2] != '_' and\n len(name) > 4)",
"def hasname(self):\n\t\treturn self.name is not None",
"def is_named(self):\n return self._name != \"\"",
"def _contains_in_self_or_... | [
"0.70001805",
"0.6296333",
"0.62138236",
"0.62128055",
"0.6188118",
"0.61865014",
"0.6180469",
"0.61716455",
"0.60152316",
"0.60152316",
"0.60103506",
"0.5957709",
"0.595426",
"0.5918318",
"0.58843344",
"0.5863175",
"0.58612895",
"0.5830889",
"0.5805472",
"0.5801909",
"0.5766... | 0.8430488 | 0 |
Create a github repository with the required files. | def _create_github_repo(self):
repo_dir = join(self.temp_dir, 'repo')
subprocess.check_output(['git', 'init', repo_dir])
subprocess.check_output(
['git', 'config', 'user.email', os.environ['GIT_EMAIL']],
cwd=repo_dir
)
subprocess.check_output(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cmd_create(self):\n self.repo.create()\n\n # Add .gitignore.\n self.repo.add_files({'.gitignore': '.swp\\n'}, FIRST_COMMIT_MSG)\n\n # Create the etc and timestamps branches.\n self.repo.checkout('etc', create=True)\n self.repo.checkout('timestamps', create=True)\n\n ... | [
"0.7318281",
"0.6899682",
"0.68942326",
"0.6752328",
"0.670566",
"0.6548337",
"0.6541082",
"0.65020144",
"0.64994895",
"0.6498471",
"0.64834964",
"0.6463574",
"0.6410983",
"0.6408448",
"0.6402237",
"0.63451135",
"0.6299232",
"0.6277113",
"0.62666315",
"0.6260556",
"0.6226182"... | 0.7632598 | 0 |
Get the install steps defined in the .travis.yml. | def _get_install_steps(self):
content = self._get_yaml_content()
return self._fix_install_steps(content['install']) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deploy_steps(self):\n return [ShellCommand(command=[\"node\", \"medic/build_\" + self.platform + \".js\"], workdir='build', timeout=CONFIG.build_timeout, description='Run tests', name='Run tests')]",
"def init_workspace_steps(self):\n return [\n InstallShellJS(),\n RMComma... | [
"0.6074886",
"0.56737584",
"0.55808955",
"0.55732894",
"0.547664",
"0.5451829",
"0.5418202",
"0.53568316",
"0.53509235",
"0.53031504",
"0.5299737",
"0.5262377",
"0.52623457",
"0.5230698",
"0.5226938",
"0.52096236",
"0.5194174",
"0.5171432",
"0.5170086",
"0.5143787",
"0.512609... | 0.76059 | 0 |
Return the contents of the .travis.yml file. | def _get_yaml_content(self):
with open('.travis.yml') as f:
content = yaml.load(f)
return content | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load(path=\".travis.yml\"):\n if not path:\n path = \".travis.yml\"\n with open(path, 'r') as stream:\n return yaml.load(stream)",
"def get_yml_files():\n repo_fs()\n return YML_FILES",
"def readme():\n with open(os.path.join(build_root, 'README.rst')) as f:\n return f.r... | [
"0.71477246",
"0.60372835",
"0.58110964",
"0.5783853",
"0.5661705",
"0.562468",
"0.55627483",
"0.55493027",
"0.549967",
"0.549379",
"0.5482828",
"0.5460947",
"0.540087",
"0.53984547",
"0.5373335",
"0.5372923",
"0.5368626",
"0.5362527",
"0.53587914",
"0.53507423",
"0.529618",
... | 0.8137851 | 0 |
Print Precision Recall Statistics and Graph | def precision_recall(y_true, y_prob, ARGS):
average_precision = average_precision_score(y_true, y_prob)
if ARGS.graphs:
precision, recall, _ = precision_recall_curve(y_true, y_prob)
plt.style.use('ggplot')
plt.clf()
plt.plot(recall, precision,
label='Precision-Re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_results(precision, recall, f1):\n print \"Precision:\", precision\n print \"Recall:\", recall\n print \"F1 score:\", f1",
"def print_precision_recall(classifier, test_set):\n known_set = collections.defaultdict(set)\n computed_set = collections.defaultdict(set)\n \n for i, (feature... | [
"0.74584013",
"0.68987024",
"0.6865462",
"0.6698197",
"0.66308886",
"0.6575319",
"0.6499797",
"0.648275",
"0.6473039",
"0.6470332",
"0.6406804",
"0.63657784",
"0.6316522",
"0.6266483",
"0.6263798",
"0.6262908",
"0.62624615",
"0.62489355",
"0.6233685",
"0.62256986",
"0.6209668... | 0.6991588 | 1 |
Displays the source code of a command. | async def source(self, ctx: commands.Context, *, command):
cmd = self.bot.get_command(command)
if not cmd:
return await ctx.send(f"I don't have a command with name `{command}`.")
lines = []
for line in inspect.getsourcelines(cmd.callback)[0]:
line = line.rstrip()... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def source(ctx, command: Option(str, \"The command to view the source code for\", required=False)):\n source_url = 'https://github.com/Pycord-Development/robocord'\n branch = 'main'\n view = discord.ui.View()\n if command is None:\n url = source_url\n label = \"Source code for entir... | [
"0.70631963",
"0.6911194",
"0.6907721",
"0.6829085",
"0.6648254",
"0.6569909",
"0.6569909",
"0.6511003",
"0.6441746",
"0.6438145",
"0.6437378",
"0.6368477",
"0.63677675",
"0.63636225",
"0.63121545",
"0.6279086",
"0.62749237",
"0.62749237",
"0.62749237",
"0.62749237",
"0.62749... | 0.7033797 | 1 |
Add a user to the database. On the production system, LOGIN_EMAIL and LOGIN_PASSWORD environment variables must be set in order for legitimate credentials to be applied. If these environment variables are not set, the hardcoded credentials will be applied. | def add_default_user():
# add the test user. If the environment variables are not set, the
# credentials are assumed to be dummy credentials.
if (
models.User.query.filter_by(
email=os.environ.get("LOGIN_EMAIL", "test@gmail.com")
).first()
is None
):
hashed_p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_user(self, user, pw):\n self.db.execute(\"INSERT INTO user_credentials VALUES (?, ?)\", [user, pw])\n self.db.commit()",
"def add_user(self):\n user = models.User(email=self.test_user,\n password=generate_password_hash(self.test_user_password))\n use... | [
"0.7594291",
"0.71106",
"0.702027",
"0.6980305",
"0.69453",
"0.6876356",
"0.6863111",
"0.68164414",
"0.68097824",
"0.68097824",
"0.6801479",
"0.6757333",
"0.6750992",
"0.67370045",
"0.6700386",
"0.66853833",
"0.6650041",
"0.6646186",
"0.66421914",
"0.6614237",
"0.6590234",
... | 0.7664909 | 0 |
Generate a simple filtering matrix using cov_mat_simple. | def filter_mat_simple(tol=1e-9, use_sparseness=False, **cov_kwargs):
cmat_simple = covariances.cov_mat_simple(**cov_kwargs)
cmat_simple = cmat_simple / tol + np.identity(cmat_simple.shape[0])
if "bl_cutoff_buffer" in cov_kwargs and np.isfinite(cov_kwargs["bl_cutoff_buffer"]) and use_sparseness:
cmat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filter_covariance(cov_matrix, uvd=None, return_diag_as_uvdata=True, **array_kwargs):\n raise NotImplementedError(\"This function has not yet been written.\")",
"def cov_matrix(X, mu):\n m, n = X.shape\n X_minus_mu = X - mu\n sigma = (1 / m) * (X_minus_mu.T).dot(X_minus_mu)\n\n return sigma",
... | [
"0.61381596",
"0.6036834",
"0.56737685",
"0.56492865",
"0.5647445",
"0.56401086",
"0.56280065",
"0.55828583",
"0.55420446",
"0.5534423",
"0.5474711",
"0.5444186",
"0.535749",
"0.53563684",
"0.53526884",
"0.5340584",
"0.5278175",
"0.5205729",
"0.5201209",
"0.5168274",
"0.51570... | 0.6467109 | 0 |
Apply filter to data covariance matrix. | def filter_covariance(cov_matrix, uvd=None, return_diag_as_uvdata=True, **array_kwargs):
raise NotImplementedError("This function has not yet been written.") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def covariance(data_matrix):\n return np.asmatrix(np.cov(data_matrix, rowvar=0))",
"def covariance_matrix(self):\n\n cov_filename = self.covariance_filename\n cov_press, cov_data = self._co_star_read(cov_filename)\n\n # \"Fix\" covariances that are not positive definite\n if not np... | [
"0.6775914",
"0.6289425",
"0.61702186",
"0.60526186",
"0.6009848",
"0.59324443",
"0.58920604",
"0.58613175",
"0.5838152",
"0.58364546",
"0.5780669",
"0.5780518",
"0.5777342",
"0.5769662",
"0.57512814",
"0.57483286",
"0.5709528",
"0.5679253",
"0.5666637",
"0.5659598",
"0.56075... | 0.7238172 | 0 |
Returns nodenames of all nodes managed by the compute service. This method is for multi computenodes support. If a driver supports multi computenodes, this method returns a list of nodenames managed by the service. Otherwise, this method should return [hypervisor_hostname]. | def get_available_nodes(self, refresh=False):
# TODO(preethipy): Refresh parameter should be handled to fetch
# updated nodenames
LOG.debug("get_available_nodes return node %(cpcsubset_name)s" %
{'cpcsubset_name': self._host.properties[
"hypervisor_hostnam... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_nodes(self):\n nodes = self.nodes\n result = []\n for i_node in self.iapi.node.list():\n if i_node.name:\n name = i_node.name\n else:\n # Sometimes Ironic does not show the names, pull them from Nova if possible.\n sel... | [
"0.7244441",
"0.67744815",
"0.6688071",
"0.6612138",
"0.6536389",
"0.65173835",
"0.640309",
"0.6397725",
"0.63750756",
"0.6367326",
"0.63235855",
"0.6308414",
"0.6299488",
"0.6272551",
"0.6251894",
"0.62495553",
"0.6209872",
"0.6151072",
"0.614149",
"0.6140894",
"0.6139483",
... | 0.6927579 | 1 |
Get connector information for the instance for attaching to volumes. Connector information is a dictionary representing the initiator WWPNs and a unique identifier of the partition. { | def get_volume_connector(self, instance):
props = {}
# 'get_volume_connector' will be invoked during creation
# of the partition and during deletion of the partition.
# But 'wwpns' we can access only when partition is available.
# During spawn flow 'get_volume_connector' function... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_volume_connector(self, instance):\n iqn = volume_util.get_host_iqn(self._session, self._cluster)\n return {\n 'ip': CONF.vmwareapi_host_ip,\n 'initiator': iqn,\n 'host': CONF.vmwareapi_host_ip\n }",
"def initialize_connection(self, volume, connector):... | [
"0.7217811",
"0.5731354",
"0.5719643",
"0.5626514",
"0.56229466",
"0.5587685",
"0.554909",
"0.5512526",
"0.5443555",
"0.5432417",
"0.5393865",
"0.53157926",
"0.52930737",
"0.52738225",
"0.5260998",
"0.52491385",
"0.5242627",
"0.5212603",
"0.51588446",
"0.51039207",
"0.5099608... | 0.7021322 | 1 |
Generate the NIC string that must be available from inside the OS Passing the string into the operating system is achieved via appending it to the partitions bootosspecificparameters property. The value of this property will then be appended to the kernels cmdline and be accessible from within the instance under /proc/... | def _get_nic_string_for_guest_os(self, nic, vif):
# Format: <dev-no>,<port-no>,<mac>;
# <devno>: The DPM device number
# <port-no>: The network adapters port that should be usd
# <mac>: MAC address without deliminator. This saves 5 additional
# characters in the limited bo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gvnic(self) -> Optional[pulumi.Input['VirtualNICArgs']]:\n return pulumi.get(self, \"gvnic\")",
"def get_disk_name(self):\n self.clear_screen()\n default = 'nvme0n1'\n logging.info('ensure disknames are absolutely available. Otherwise OpenShift install fails')\n master_inst... | [
"0.55713814",
"0.5472155",
"0.5330196",
"0.5288305",
"0.52612746",
"0.523743",
"0.5192633",
"0.51294136",
"0.5128945",
"0.5098528",
"0.5096468",
"0.5086131",
"0.5074997",
"0.5051161",
"0.5009125",
"0.4969358",
"0.4968168",
"0.49670076",
"0.49664944",
"0.49631187",
"0.4954584"... | 0.7306482 | 0 |
Sets the client id assigned by the server to this client after a succesfull connection | def set_client_id(self):
data = self.receive() # deserialized data
client_id = data['clientid'] # extracts client id from data
self.client_id = client_id # sets the client id to this client
print("Successfully connected to server: " + self.userInfo['host'] + " / " + str(self.userInfo[... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def client_id(self, client_id):\n\n self._client_id = client_id",
"def client_id(self, client_id):\n\n self._client_id = client_id",
"def client_id(self, client_id):\n\n self._client_id = client_id",
"def client_id(self, client_id):\n\n self._client_id = client_id",
"def request... | [
"0.7308508",
"0.7308508",
"0.7308508",
"0.7308508",
"0.6723002",
"0.6500564",
"0.6478586",
"0.6478586",
"0.64429605",
"0.6375152",
"0.6272744",
"0.6203709",
"0.6139192",
"0.6091799",
"0.60748994",
"0.6051267",
"0.60084945",
"0.6008076",
"0.6008076",
"0.6005546",
"0.5973466",
... | 0.8302304 | 0 |
Default success crop handler | def crop_success(request, form, original, cropped):
if request.is_ajax():
return HttpResponse(
simplejson.dumps({
'image': {
'url': cropped.image.url,
'width': cropped.w,
'height': cropped.h,
}
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _generate_crop(self):\n if self.box_drawn == True:\n if (self.cd_pic_num != -1) & (self.cd_crop_num == 1):\n self.communicator.generate_crop(picture_num=self.cd_pic_num, \\\n xa=self.xa, ya=self.ya, xb=self.xb, yb=self.yb)\n else:\n ... | [
"0.6105374",
"0.6016954",
"0.59118897",
"0.58140594",
"0.57611096",
"0.57062334",
"0.5693865",
"0.568417",
"0.567735",
"0.567735",
"0.5643648",
"0.5571682",
"0.5537213",
"0.5512094",
"0.5442058",
"0.542961",
"0.5413916",
"0.5398916",
"0.5360239",
"0.5346647",
"0.5305511",
"... | 0.727314 | 0 |
Use gitannex's splitShortExtensions rule for splitting extensions. | def split_ext(filename):
parts = filename.split(".")
if len(parts) == 1:
return filename, ""
tail = list(dropwhile(lambda x: len(x) < 5,
reversed(parts[1:])))
file_parts = parts[:1] + tail[::-1]
ext_parts = parts[1+len(tail):]
return ".".join(file_parts), "." ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def break_down_ext(ext, expr, mode):\n m = expr.match(ext)\n return {\n 'full_name': ext,\n 'api_prefix': m.group(1),\n 'vendor': m.group(2),\n 'name_with_underscores': m.group(3),\n 'name_camel_case': get_camel_case(m.group(3)),\n 'mode': mode,\n 'link': _LIN... | [
"0.55672586",
"0.55343074",
"0.55152595",
"0.5474432",
"0.54447776",
"0.5410322",
"0.53296214",
"0.5228014",
"0.51011866",
"0.5058345",
"0.5036512",
"0.5000507",
"0.49889123",
"0.49404445",
"0.49292362",
"0.49239823",
"0.4920626",
"0.4895473",
"0.4885054",
"0.48794067",
"0.48... | 0.55939746 | 0 |
Returns a list of all supported platforms. | def Platforms():
return platforms | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def platforms(self):\n logger.debug(\"Get platforms\")\n return self._raw_api.platforms.get()",
"def get_platforms(self):\n if self.platform == 'All':\n return PLATFORMS\n else:\n return self.platform.split(':')",
"def list_platforms(self):\n return self... | [
"0.8469478",
"0.84350204",
"0.8323497",
"0.81891674",
"0.79978454",
"0.77241737",
"0.7588078",
"0.7408845",
"0.73557884",
"0.7238537",
"0.698357",
"0.6899838",
"0.6823315",
"0.6802424",
"0.67996347",
"0.67626536",
"0.6738391",
"0.66473496",
"0.6570459",
"0.6557098",
"0.649542... | 0.8486307 | 0 |
Return the name of the next link name to be used when archiving a previously active release directory for the given promotion label. This picks the highest numerical portion of the promotion label type found in all supported platform directories and then adds 1 to it to compose the new archival promotion label. Ex. Hig... | def NewLinkName(promotion_label):
latestlinks = {}
highval = 0
for platform in platforms:
latestlinks[platform] = ''
for link in prolinks[platform]:
if promotion_label in link and '_' in link and \
link > latestlinks[platform]:
latestlinks[platf... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def map_release_label():\n release = \"\".join(map(lambda x: x.lower(), sh.lsb_release(\"-irs\").split()))\n return OS_MAPPING[next(k for k in OS_MAPPING if re.search(k, release))]",
"def get_label_name(label):\n\tindex = np.argmax(label)\n\tlabels = ['airplane', 'automobile', 'bird', 'cat', 'deer', 'dog', 'frog... | [
"0.57763886",
"0.5655021",
"0.55032444",
"0.5381864",
"0.5346807",
"0.53060865",
"0.5243026",
"0.5188378",
"0.51658285",
"0.5145332",
"0.51091605",
"0.5082027",
"0.5068403",
"0.5033763",
"0.5011738",
"0.4979112",
"0.4934989",
"0.491461",
"0.49044046",
"0.48930407",
"0.4880539... | 0.7795426 | 0 |
Returns dictionary of all releases, active and past, for each supported platform. | def Releases():
return releases | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_releases(platform, year, month):\n platform_num = PLATFORMS.get(platform.lower(), 0)\n\n if platform_num == 0:\n url = _3DJUEGOS_RELEASES_URL + \"todos/por-mes/0/{}/{}/\".format(year, month)\n else:\n url = _3DJUEGOS_RELEASES_URL + platform + \\\n \"/por-mes/{}/{}/{}/\".format(platform_num,... | [
"0.68578357",
"0.6132219",
"0.6130017",
"0.60804945",
"0.60657156",
"0.5966034",
"0.5948615",
"0.59411365",
"0.5939307",
"0.58749706",
"0.5814653",
"0.5793198",
"0.5762535",
"0.57454413",
"0.5679881",
"0.5609426",
"0.5606308",
"0.559027",
"0.5571989",
"0.557128",
"0.5548787",... | 0.6198369 | 1 |
Return dictionary of true release names for the given promotion label (typically 'current' or 'devel', defined above) for each supported platform. | def ActiveRelNames(promotion_label):
names = {}
for platform in platforms:
names[platform] = active_releases[platform][promotion_label]
return names | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def map_release_label():\n release = \"\".join(map(lambda x: x.lower(), sh.lsb_release(\"-irs\").split()))\n return OS_MAPPING[next(k for k in OS_MAPPING if re.search(k, release))]",
"def RelNameConsistency(promotion_label):\n names = []\n for platform in platforms:\n names.append(active_releases[pl... | [
"0.6325008",
"0.5821582",
"0.5532198",
"0.5421374",
"0.5382423",
"0.5175362",
"0.5077426",
"0.50566345",
"0.503576",
"0.5025082",
"0.5014561",
"0.5008361",
"0.50056815",
"0.4991536",
"0.49782038",
"0.49297404",
"0.49256536",
"0.49223256",
"0.4918518",
"0.4861656",
"0.48451436... | 0.80126363 | 0 |
Returns True if the true release name for the given promotion label is identical across all supported platforms, returns False otherwise. | def RelNameConsistency(promotion_label):
names = []
for platform in platforms:
names.append(active_releases[platform][promotion_label])
if len(set(names)) == 1:
return True
else:
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_same_platform(self, platform_in):\n if self.parse_platform(platform_in) == self.platform(return_str=False):\n return True\n return False",
"def osarch_match(op):\n arch = g_osarch\n while True:\n if op == arch:\n return True\n arch = platform_map_iterate(arch)\n if... | [
"0.58827287",
"0.57045436",
"0.5490518",
"0.5417627",
"0.52694106",
"0.5210125",
"0.51612073",
"0.5156541",
"0.51191235",
"0.50484794",
"0.50302917",
"0.5018195",
"0.50089735",
"0.5005585",
"0.5005585",
"0.5002941",
"0.49944687",
"0.49898046",
"0.49777013",
"0.49702853",
"0.4... | 0.8072693 | 0 |
Returns True if the specified build name is present in all supported platform archive directories, False otherwise. | def BuildExists(buildname):
for platform in platforms:
if not os.path.exists(builds_basedir+'/'+platform+'/'+buildname):
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_build(self, bld_num):\n # QQQ In future this should be replaced with a query to the\n # build database\n bld_dir = os.path.join(self.ver_dir, str(bld_num))\n for plat in self.plats.keys():\n if self.plats[plat]:\n # QQQ Assumes format of filename uniq... | [
"0.6572912",
"0.6286476",
"0.6014141",
"0.5983851",
"0.5820054",
"0.578158",
"0.57279706",
"0.5724255",
"0.5704239",
"0.56942886",
"0.56918424",
"0.56864065",
"0.56485593",
"0.56369096",
"0.5626966",
"0.56218207",
"0.56190425",
"0.5616681",
"0.56087834",
"0.5607145",
"0.56061... | 0.79211926 | 0 |
Add link to D3 graph Link is added only if it does not exist yet | def add_link(self, start, end, link_type):
key = str(start.id()) + "_" + link_type + "_" + str(end.id())
# Add link only if it does not exist yet
if (key in self.__links):
return
js = "links.push({source: " + self.__nodes[start.id()] + ", target: " + self.__nodes[end.id()]... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_link(self, link):\n raise NotImplementedError",
"def add_link():\n return True",
"def link(self, link):\n\n self.container['link'] = link",
"def add_link(self, **kwgs):\n self.links.append(kwgs)",
"def create_link(self):\n if self.link_info:\n link_type = s... | [
"0.7131202",
"0.67361426",
"0.6684408",
"0.6671478",
"0.656178",
"0.6472186",
"0.6421587",
"0.6365547",
"0.62807876",
"0.62630177",
"0.6236912",
"0.62360376",
"0.616382",
"0.6140761",
"0.6118386",
"0.61124617",
"0.608122",
"0.60742754",
"0.60675305",
"0.6067251",
"0.6063527",... | 0.7167818 | 0 |
Add a node to D3 graph Node is added only if it does not exist yet | def add_node(self, node):
# Add node only if it does not exist yet
if node.id() in self.__nodes:
return
labels = node.labels()
for label in labels:
break
if label not in self.__labels:
self.__labels[label] = len(self.__labels)
j... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_node(self, node):\n if node not in self.nodes:\n self.nodes.append(node)",
"def add_node(self, node):",
"def add_node (self, node):\n self.network.add_node(node.id)\n self.network.node[node.id] = node",
"def add_node(self, n):\r\n keys = self.d.keys()\r\n #check ... | [
"0.78017753",
"0.7727478",
"0.7617233",
"0.7596939",
"0.75890046",
"0.753409",
"0.7443518",
"0.74378455",
"0.7414301",
"0.73876536",
"0.726267",
"0.7238294",
"0.72301346",
"0.72251856",
"0.7195722",
"0.71833897",
"0.71688193",
"0.71688193",
"0.71421427",
"0.71053565",
"0.7100... | 0.83232576 | 0 |
Return object proxy currently points to | def current_object(proxy):
return proxy.__current_object__() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_proxy(self):\n return self.proxy()",
"def proxy(self):\n return self._proxy",
"def Proxy(self):\n return self._proxy",
"def _get_current_object(self):\n loc = object.__getattribute__(self, '_Proxy__local')\n if not hasattr(loc, '__release_local__'):\n ret... | [
"0.7595558",
"0.74364364",
"0.74205405",
"0.7201796",
"0.70927536",
"0.70927536",
"0.70556164",
"0.70515597",
"0.69184744",
"0.6874021",
"0.68467873",
"0.6697907",
"0.66792965",
"0.66792965",
"0.66415787",
"0.66415787",
"0.6638435",
"0.66239613",
"0.64842606",
"0.64394045",
"... | 0.7953302 | 0 |
Return ``True`` if ``proxy`` is bound to some value | def is_bound(proxy):
try:
current_object(proxy)
except UnboundProxyError:
return False
else:
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def proxy_check(self, proxy):",
"def is_proxy(elt):\n\n if ismethod(elt):\n elt = get_method_function(elt)\n\n result = hasattr(elt, __PROXIFIED__)\n\n return result",
"def proxies_get(self) -> bool:\n return True",
"def is_result_proxy(obj):\n # Use type() instead of isinstance() t... | [
"0.73534244",
"0.701953",
"0.687595",
"0.6725776",
"0.64723337",
"0.63858086",
"0.6336905",
"0.630922",
"0.61029094",
"0.59946597",
"0.5974598",
"0.5966062",
"0.5957966",
"0.583836",
"0.5837844",
"0.58277816",
"0.5827374",
"0.5796517",
"0.5709862",
"0.5705993",
"0.5697246",
... | 0.8039707 | 0 |
Releases the contents of the local for the current context. This makes it possible to use locals without a manager. | def release(local):
local.__release__() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def teardown():\n if hasattr(_thread_local_data, 'current_space'):\n _thread_local_data.current_space.teardown()\n del _thread_local_data.current_space",
"def __resetLocal__(self):\n pass",
"def clear_locals(self):\n self._locals = dict()",
"def pop(self):\n assert self.loca... | [
"0.6167353",
"0.6135214",
"0.6016827",
"0.5890918",
"0.5849941",
"0.5601843",
"0.5471506",
"0.5468664",
"0.5401603",
"0.53448004",
"0.5329697",
"0.5322617",
"0.5312668",
"0.5302505",
"0.5292452",
"0.5284921",
"0.5280798",
"0.5280798",
"0.52590144",
"0.52415234",
"0.52384776",... | 0.7114636 | 0 |
Takes a pattern as a string in the format of ... where a is an integer, and a can be substituded with an to produce a random octet. pattern = 127.0.0. would return a random string between 127.0.0.1 and 127.0.0.254 | def random_ip(pattern=None):
if pattern is None:
pattern = '*.*.*.*'
num_asterisks = 0
for c in pattern:
if c == '*':
num_asterisks += 1
rand_list = [random.randint(1, 255) for i in range(0, num_asterisks)]
for item in rand_list:
pattern = pattern.replace('*', str... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_cidr(ip_pattern=None, mask=None, min_mask=0, max_mask=30):\n if mask is None:\n mask = random.randint(min_mask, max_mask)\n ip = random_ip(ip_pattern)\n return ''.join([ip, '/', str(mask)])",
"def randip():\n from random import randrange\n a = randrange(1, 256) # 1..255\n b =... | [
"0.67973614",
"0.65871245",
"0.6324621",
"0.62712437",
"0.6241498",
"0.6232529",
"0.6139835",
"0.6023708",
"0.5923157",
"0.5809103",
"0.5794317",
"0.5787698",
"0.5769226",
"0.5629785",
"0.5514082",
"0.5499556",
"0.5499556",
"0.54649913",
"0.54278797",
"0.54145545",
"0.5394106... | 0.79278386 | 0 |
Gets a random cidr using the random_ip function in this module. If mask is None then a random mask between 0 and 30 inclusive will be assigned. | def random_cidr(ip_pattern=None, mask=None, min_mask=0, max_mask=30):
if mask is None:
mask = random.randint(min_mask, max_mask)
ip = random_ip(ip_pattern)
return ''.join([ip, '/', str(mask)]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_ip():\n return new_ip(\"%i.%i.%i.%i\" % (randint(1, 254), # nosec\n randint(1, 254), # nosec\n randint(1, 254), # nosec\n randint(1, 254))) # nosec",
"def get_static_ip(cidr_block, mask, ip_blo... | [
"0.6930924",
"0.67024636",
"0.66299516",
"0.65706676",
"0.63367563",
"0.6235149",
"0.62161034",
"0.6205034",
"0.6169165",
"0.61217475",
"0.59297633",
"0.59187055",
"0.59187055",
"0.59047616",
"0.5884301",
"0.5874056",
"0.58580476",
"0.5849997",
"0.5849997",
"0.58244616",
"0.5... | 0.85735756 | 0 |
Spew awesome fireballs in the direction of the mouse. This function utilises the game's camera, which is passed to it, to compute the position of the cursor relative to the player. | def shoot_fire(self, camera):
cursor_pos = pygame.mouse.get_pos()
tempMouseRect = pygame.Rect(cursor_pos, (0, 0))
tempMouseRect = camera.use_cam_rect(tempMouseRect)
relPos = tempMouseRect.topleft
self.intMousePos = relPos
ang = self.get_shoot_angle(relPos)
#ang... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fire_mouse():\n\n global fireball_cooldown\n\n mouse_pos = pygame.mouse.get_pos()\n dx = mouse_pos[0] - player.rect.centerx\n dy = mouse_pos[1] - player.rect.centery\n angle = math.degrees(math.atan2(dy, dx))\n\n if pygame.mouse.get_pressed()[0]:\n fireball_cooldown += 1\n\n new... | [
"0.661249",
"0.65047914",
"0.64566827",
"0.6238234",
"0.62228835",
"0.6066043",
"0.6061872",
"0.5995509",
"0.5993031",
"0.59462136",
"0.59324545",
"0.5874765",
"0.58259207",
"0.5777629",
"0.576069",
"0.57571095",
"0.5752885",
"0.5742983",
"0.5740019",
"0.5740019",
"0.5739754"... | 0.69248307 | 0 |
if the player is not in contact with an obstacle, fall | def check_falling(self, obstacles):
self.rect.move_ip((0, 1))
if not pygame.sprite.spritecollideany(self, obstacles):
if not self.climb:
self.fall = True
self.rect.move_ip((0, -1)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update():\n move()\n check_collision()",
"def on_hit(self, event, data):\n world, player = data\n # Ensure the top of the bounce block is being hit\n if get_collision_direction(player, self) == \"A\":\n self._active = True\n player.set_velocity((0, -3*player.g... | [
"0.6350203",
"0.6320141",
"0.6295526",
"0.6262406",
"0.62003756",
"0.6155984",
"0.6142885",
"0.61255413",
"0.6090876",
"0.607908",
"0.59880394",
"0.59824514",
"0.59797436",
"0.59546566",
"0.5949843",
"0.5937984",
"0.59079707",
"0.5890373",
"0.5882923",
"0.5862835",
"0.5845777... | 0.7307812 | 0 |
checks if a collision would occur after moving offset pixels | def check_collisions(self, offset, index, obstacles):
unaltered = True
self.rect.move_ip(offset)
while pygame.sprite.spritecollideany(self, obstacles):
# First of all, check if it is a motile transparent block.
# if so, do nothin
col_spr = pygame.sprite.spri... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def will_collide(self, direction=None):\n new_origin, new_positions = self.active_piece.try_move(direction=direction)\n for row, col in new_positions:\n y, x = new_origin[0] + row, new_origin[1] + col\n if y > 19 or y < 0 or x > 9 or x < 0 or self.board[y][x] == '#':\n ... | [
"0.7137286",
"0.70542896",
"0.69913536",
"0.69702214",
"0.6903446",
"0.6827035",
"0.68161577",
"0.6785352",
"0.66876936",
"0.66633946",
"0.66370517",
"0.6629326",
"0.66260034",
"0.6609509",
"0.66094655",
"0.6606352",
"0.6577517",
"0.6563548",
"0.65456706",
"0.6536451",
"0.652... | 0.77491987 | 0 |
checks if self is in contact with an actionObj like a switch, button, lever, vechicle, or any such thing | def check_action_contact(self, actionObjGroup):
self.action_contact = False # Reset the value to prevent mishaps
obj = pygame.sprite.spritecollideany(self, actionObjGroup)
if obj:
self.action_obj = obj
if obj.type == "SWITCH":
self.action_contact... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_action(self, action_cnfg, data):\n if data.get(\"result\") == \"ok\" and len(data.get(\"objects\",[])) > 0: \n if action_cnfg is None:\n return True\n else:\n tobe_detected = action_cnfg.objects\n tobe_excluded = action_cnfg... | [
"0.6563271",
"0.60149145",
"0.5952098",
"0.594276",
"0.59262407",
"0.59094846",
"0.5877136",
"0.58626676",
"0.5821471",
"0.5753487",
"0.5731873",
"0.5726309",
"0.5718478",
"0.56733894",
"0.56528467",
"0.5633522",
"0.56308097",
"0.56237614",
"0.5616864",
"0.5607649",
"0.560332... | 0.801582 | 0 |
(Hopefully) handles slope collisions. slopeG = slope sprites Group | def handle_slopes(self, slopeG):
colSprite = pygame.sprite.spritecollideany(self, slopeG)
if colSprite: #and self.rect.y < colSprite.rect.y:
self.fall = False
tl = colSprite.rect.topleft # used for slope calculation only
br = colSprite.rect.bottomright
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate_slope(self, i, j):\n \n if i==0:\n if j==0:#this is the cell at the top left corner of the map\n self.slope1=(self.heights[i][j]-self.heights[i][j+1])/1\n self.slope2=(self.heights[i][j]-self.heights[i+1][j+1])/(2**0.5)\n self.slop... | [
"0.6303389",
"0.60579646",
"0.5912998",
"0.5808207",
"0.5745357",
"0.5731838",
"0.5599098",
"0.5469725",
"0.54648405",
"0.54482526",
"0.54025656",
"0.53591955",
"0.5353843",
"0.53184927",
"0.53094876",
"0.5303646",
"0.53017473",
"0.52982223",
"0.52978694",
"0.5284808",
"0.525... | 0.8014487 | 0 |
Convert a fiwalk fileobject into a dict. Ignores unallocated fileobjects. | def fileobject_to_dict(fo):
if fo.allocated():
# proc = subprocess.Popen(['./extract_strings', fo.inode()], stdout=subprocess.PIPE)
# contents = proc.stdout.read()
return {
'atime_dt': epoch_to_dt(fo.atime()),
'compressed_b': fo.compressed(),
'contents_t':... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def map_file_data(file_obj, file_events):\n file_as_dict = {\n \"premis:originalName\": file_obj.currentlocation,\n \"original_name\": escape(file_obj.originallocation),\n # needs investigation\n \"sanitized_file_name\": get_sanitized_file_name(\n get_file_name_cleanup(fil... | [
"0.66417193",
"0.6149795",
"0.6076419",
"0.58282316",
"0.57924473",
"0.57005566",
"0.5651788",
"0.5607776",
"0.5605399",
"0.55764467",
"0.5540483",
"0.5479918",
"0.545862",
"0.54482424",
"0.5440984",
"0.5426981",
"0.54248583",
"0.5410066",
"0.5406672",
"0.54061353",
"0.539715... | 0.7522488 | 0 |
Callback function to post a fileobjectdict to Solr. | def index_fobj(fobj):
doc = fileobject_to_dict(fobj)
if doc is not None:
#print doc
SOLR.add(doc)
else:
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def upload_doc():\n file = request.files[\"file\"]\n meta_data = {\"name\": request.form[\"name\"].lower()}\n file_id = save_file(meta_data, file)\n print('file-id: ' + file_id)\n index_after_uploading(file_id)\n return jsonify({\"file_id\": file_id})",
"def upload_fileobj(Fileobj=None, Bucket... | [
"0.5929655",
"0.58118945",
"0.57638466",
"0.5587986",
"0.5492942",
"0.5472073",
"0.54142874",
"0.5361964",
"0.5308735",
"0.53042793",
"0.5300762",
"0.52995235",
"0.5273893",
"0.5261559",
"0.520994",
"0.5206699",
"0.5174983",
"0.5160648",
"0.513785",
"0.51374733",
"0.5122303",... | 0.6977669 | 0 |
Return all members in the group as CSHMember objects | def get_members(self):
res = self.__con__.search_s(
self.__ldap_base_dn__,
ldap.SCOPE_SUBTREE,
"(memberof=%s)" % self.__dn__,
['uid'])
ret = []
for val in res:
val = val[1]['uid'][0]
try:
ret.append(val.deco... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetGroupMembers(self, group):\n return []",
"def members(self):\r\n return GroupMembers(self)",
"def getMembers():",
"def getMembers():",
"def getMembers():",
"def getMembers():",
"def getListOfMembers(self, *args):\n return _libsbml.Group_getListOfMembers(self, *args)",
"def get... | [
"0.76905155",
"0.7352615",
"0.72614336",
"0.72614336",
"0.72614336",
"0.72614336",
"0.7167668",
"0.7046053",
"0.7042981",
"0.70067006",
"0.6848639",
"0.67581475",
"0.6729239",
"0.6720802",
"0.665485",
"0.6489105",
"0.6488144",
"0.64647114",
"0.6458484",
"0.64539886",
"0.64337... | 0.748515 | 1 |
Test logout with fresh access token. | def test_logout_user_with_valid_access_token(auth_client):
response = auth_client.delete("/auth/logout/")
payload = response.get_json()
assert response.status_code == HTTPStatus.OK
assert payload["msg"] == "Successfully logged out" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_logout_user(self):\n # register a user\n self.register_user()\n # login the user\n result = self.log_in()\n access_token = json.loads(result.data.decode())['access_token']\n # logout the same user\n response = self.client().post(AuthTestCase.logout, headers... | [
"0.8082298",
"0.77411133",
"0.7733489",
"0.76754975",
"0.7645583",
"0.76317406",
"0.75950015",
"0.7594508",
"0.75817096",
"0.75562507",
"0.75438744",
"0.7476154",
"0.7423761",
"0.7407601",
"0.7376585",
"0.7373836",
"0.7352988",
"0.73291695",
"0.73090243",
"0.7283257",
"0.7282... | 0.80093527 | 1 |
Test access protected route after logging out. | def test_get_protected_route_after_logout(protected_route, auth_client):
response = auth_client.delete("/auth/logout/")
assert response.status_code == HTTPStatus.OK
response = auth_client.get("/")
payload = response.get_json()
assert response.status_code == HTTPStatus.UNAUTHORIZED
assert payload... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_events_route_logged_out(self):\n resp = self.request_with_role('/admin/events', role='none')\n self.assertEqual(resp.status_code, 302)",
"def test_logout(self):\n\n self.client.post(reverse('login'), self.user)\n response = self.client.post(reverse('logout'))\n self.as... | [
"0.73159087",
"0.71710515",
"0.7146994",
"0.71434283",
"0.71218604",
"0.71142375",
"0.7081883",
"0.701559",
"0.6941714",
"0.69348663",
"0.6933737",
"0.69100976",
"0.690201",
"0.68928885",
"0.68871397",
"0.6841851",
"0.68143636",
"0.6772217",
"0.6764113",
"0.67492455",
"0.6734... | 0.79926014 | 0 |
Test revoke refresh token. | def test_revoke_refresh_token(client, tokens):
response = client.delete(
"/auth/refresh-token/",
headers={"Authorization": "Bearer {}".format(tokens["refresh"])},
)
payload = response.get_json()
assert response.status_code == HTTPStatus.OK
assert payload["msg"] == "Refresh token suc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def revoke_token():\n json_request = request.json\n refresh_token = json_request.get('refresh_token')\n if not refresh_token:\n return msg.errors.bad_request(\n 'You should provide refresh token for this call')\n RefreshToken.revoke(refresh_token)\n db.session.commit()\n return ... | [
"0.80636173",
"0.72727895",
"0.72587085",
"0.7246768",
"0.72375983",
"0.7156301",
"0.71221495",
"0.694973",
"0.6943253",
"0.69193393",
"0.689053",
"0.6890302",
"0.68596876",
"0.6852859",
"0.6847941",
"0.6833426",
"0.68089926",
"0.6803983",
"0.67889047",
"0.6766794",
"0.674824... | 0.88370794 | 0 |
Roll and return 5 randomly generated dices | def roll_dices():
dices = []
for i in range(DICE_COUNT):
dice = random.randrange(MIN_DICE, MAX_DICE + 1)
dices.append(dice)
return dices | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rollDices():\n for i in range(5):\n dices[i] = randint(1, 6)",
"def roll_dice():\n roll = random.randint(1, 6)\n return roll",
"def diceRoll():\n return randint(1,6)",
"def rollDie():\n return random.choice([1, 2, 3, 4, 5, 6])",
"def roll_dice(self):\r\n return randint(1,se... | [
"0.8811349",
"0.7985477",
"0.7898765",
"0.78609425",
"0.78588647",
"0.7838321",
"0.7778819",
"0.7754263",
"0.77284366",
"0.7696784",
"0.7677492",
"0.76733106",
"0.76341176",
"0.7629973",
"0.76082134",
"0.75341004",
"0.75341004",
"0.7501904",
"0.7483777",
"0.7469801",
"0.74542... | 0.8016309 | 1 |
Display settings from a given profile; defaults to active. | def inspect(
name: Optional[str] = typer.Argument(
None, help="Name of profile to inspect; defaults to active profile."
)
):
profiles = prefect.settings.load_profiles()
if name is None:
current_profile = prefect.context.get_settings_context().profile
if not current_profile:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def settings():\n # TODO: How should this be handled? Should a speaker's bio be stored\n # as a snapshot from event to event? It could be stored as part of a\n # talks.models.Presentation.\n from pygotham.forms import ProfileForm\n\n form = ProfileForm(request.form, obj=current_user)\n if form.va... | [
"0.6756128",
"0.66700906",
"0.6456585",
"0.63694584",
"0.63072556",
"0.628905",
"0.6175014",
"0.61721754",
"0.61697793",
"0.6055271",
"0.60417676",
"0.60363483",
"0.60136175",
"0.5946818",
"0.58866954",
"0.5848323",
"0.57758117",
"0.5775226",
"0.5751613",
"0.5744777",
"0.5720... | 0.69104576 | 0 |
Load chained operator from serialized operators and configs | def load_chained_operator(chained_operator_bytes: bytes):
serialized_operators, configs = gateway_client.deserialize(chained_operator_bytes)
operators = [load_operator(desc_bytes) for desc_bytes in serialized_operators]
return ChainedOperator.new_chained_operator(operators, configs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_operator(descriptor_operator_bytes: bytes):\n assert len(descriptor_operator_bytes) > 0\n function_desc_bytes, module_name, class_name = gateway_client.deserialize(\n descriptor_operator_bytes\n )\n if function_desc_bytes:\n return create_operator_with_func(function.load_function... | [
"0.6096495",
"0.60404676",
"0.576951",
"0.5726986",
"0.55989707",
"0.5295531",
"0.52044106",
"0.5168352",
"0.5163849",
"0.51374054",
"0.51358587",
"0.5130481",
"0.5124499",
"0.5089488",
"0.50191414",
"0.49893028",
"0.49821264",
"0.49735475",
"0.4850254",
"0.4774401",
"0.47652... | 0.7146247 | 0 |
Deserialize `descriptor_operator_bytes` to get operator info, then create streaming operator. Note that this function must be kept in sync with `io.ray.streaming.runtime.python.GraphPbBuilder.serializeOperator` | def load_operator(descriptor_operator_bytes: bytes):
assert len(descriptor_operator_bytes) > 0
function_desc_bytes, module_name, class_name = gateway_client.deserialize(
descriptor_operator_bytes
)
if function_desc_bytes:
return create_operator_with_func(function.load_function(function_d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_chained_operator(chained_operator_bytes: bytes):\n serialized_operators, configs = gateway_client.deserialize(chained_operator_bytes)\n operators = [load_operator(desc_bytes) for desc_bytes in serialized_operators]\n return ChainedOperator.new_chained_operator(operators, configs)",
"def export_... | [
"0.5689354",
"0.5260812",
"0.51502585",
"0.48538688",
"0.47016197",
"0.46771327",
"0.46754816",
"0.45588443",
"0.44390532",
"0.440012",
"0.439291",
"0.4384977",
"0.43613827",
"0.43447337",
"0.43236858",
"0.4272149",
"0.42555672",
"0.42209926",
"0.42105085",
"0.41918352",
"0.4... | 0.6957904 | 0 |
A string is an ID if any of the first 3 characters are digits e.g. 111 > True M152a > True CM102 > True Computer Science 111 > False | def string_is_course_id(string):
for i in range(min(len(string), 3)):
if string[i].isdigit():
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_id(string):\n regex = re.compile('[0-9a-f]{32}\\Z', re.I)\n if bool(regex.match(string)):\n return True\n\n return False",
"def is_id(s):\n return s and ' ' not in s.strip()",
"def shorten_id(id):\n if id.startswith('CN'):\n id = id[2:]\n if not id[-1].isdigit():\n ... | [
"0.68249166",
"0.6632558",
"0.6375884",
"0.633318",
"0.6330792",
"0.6165102",
"0.612999",
"0.61042184",
"0.60848475",
"0.6061708",
"0.6007807",
"0.59907436",
"0.59420085",
"0.59355605",
"0.5892069",
"0.58820844",
"0.58638835",
"0.58638835",
"0.5794941",
"0.5763327",
"0.571013... | 0.70646024 | 0 |
Returns a list of list of courses that are requisites of the course at the given url. Requisite logic is in conjunctive normal form. e.g. | def get_requisites(url):
course_requisites, course_dept = get_raw_requisites_data(url)
if course_requisites == 'None':
return []
# Order matters!
bad_strings = ['(', ')', 'C- or better', 'corequisite', 'courses', 'course']
for bad_string in bad_strings:
course_requisites = course_requisites.replace(b... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_courses():\n if settings.XPRO_COURSES_API_URL:\n return requests.get(settings.XPRO_COURSES_API_URL, timeout=20).json()\n return []",
"def get_courses_info(url, headers):\n dash = get_page_contents(url, headers)\n soup = BeautifulSoup(dash)\n courses_soup = soup.find_all('article... | [
"0.6653958",
"0.6547612",
"0.6404819",
"0.61601496",
"0.6127471",
"0.6085023",
"0.6018573",
"0.5983271",
"0.5942867",
"0.59113234",
"0.59042835",
"0.5877169",
"0.5860586",
"0.584251",
"0.5840896",
"0.57963705",
"0.57810396",
"0.57464916",
"0.57354975",
"0.5727371",
"0.5705949... | 0.72542685 | 0 |
Parses a gff file and populates the MicroRNA table. If the Mirbase ID section is misformed, it prints the line and continues through the file. | def import_gff(file, genome_version, verbose = False):
from tridentdb import models
import re
from django.db.utils import DatabaseError
if genome_version == None:
print("Genome Version is needed for loading a gff file.")
return
genomes = models.Genome.objects.filter(genome... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GFFParse(gff_file):\n genes, utr5, exons=dict(), dict(), dict()\n transcripts, utr3, cds=dict(), dict(), dict()\n # TODO Include growing key words of different non-coding/coding transcripts \n features=['mrna', 'transcript', 'ncrna', 'mirna', 'pseudogenic_transcript', 'rrna', 'snorna', 'snrna', 'tr... | [
"0.68714756",
"0.6269894",
"0.61470723",
"0.5972656",
"0.59630376",
"0.59543747",
"0.57391804",
"0.57000613",
"0.5656472",
"0.56498057",
"0.56356585",
"0.56222224",
"0.56056106",
"0.5583481",
"0.55816907",
"0.5549911",
"0.5545924",
"0.5459913",
"0.5452266",
"0.54218423",
"0.5... | 0.67980194 | 1 |
Parses a result file from ge vs mir meta analysis and populates the mirge table. | def import_mirge(file, verbose = False):
from drresults import models
import re
from django.db.utils import DatabaseError
lineno = 1
for line in file:
if verbose:
print("Line Number: %d" % lineno)
lineno += 1
info = line.split('\t')
probe_set_id = info[0] ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read(results_file):\n results = {}\n sequences = []\n current_method = 0\n with open(results_file) as results_handle: \n for line in results_handle:\n # Find all floating point numbers in this line\n line_floats_res = re.findall(\"-*\\d+\\.\\d+\", line)\n ... | [
"0.6403201",
"0.61042666",
"0.6081272",
"0.5856147",
"0.58489424",
"0.5843187",
"0.5785779",
"0.576793",
"0.5743352",
"0.5692992",
"0.56579775",
"0.5627994",
"0.5622681",
"0.55764925",
"0.5568365",
"0.5561891",
"0.5509765",
"0.55012876",
"0.54932266",
"0.5487232",
"0.5462981"... | 0.6482122 | 0 |
Test for waiting until the db is available | def test_wait_for_db_ready(self):
with patch(
'django.db.utils.ConnectionHandler.__getitem__',
return_value=True
) as gi:
call_command('wait_for_db')
self.assertEqual(gi.call_count, 1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_wait_for_db_ready(self):\n\n with patch('django.db.utils.ConnectionHandler.__getitem__') as gi:\n gi.return_value = True\n call_command('Wait_DB')\n self.assertEqual(gi.call_count, 1)",
"def test_wait_for_db_ready(self):\n # mock behaviour of getItem() using pa... | [
"0.8308631",
"0.7974183",
"0.7863306",
"0.77208954",
"0.7361866",
"0.7348919",
"0.73227704",
"0.72788495",
"0.6950278",
"0.6940697",
"0.6844289",
"0.6824598",
"0.6609087",
"0.65914476",
"0.65551347",
"0.65335333",
"0.65189093",
"0.6503669",
"0.6271244",
"0.62603986",
"0.62585... | 0.8235279 | 1 |
Trains the Qmatrix based on reward, and the previous state done etc | def learn(state, action, reward, next_state, qmatrix, numb_actions, numb_rounds):
qmatrix = check_state_exist(state, qmatrix, numb_actions)
qmatrix = check_state_exist(next_state, qmatrix, numb_actions)
q_predict = qmatrix.loc[state, int(action)]
q_target = float(reward) + gamma * qmatrix.loc[next_state... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def updateQTable( self, reward, current_state ):",
"def replay(self):\n \n #grab random batch\n if len(self.memory) < self.batchsize:\n minibatch = self.memory\n else:\n minibatch = random.sample(self.memory,self.batchsize)\n \n #instantiate\n... | [
"0.71691614",
"0.69272965",
"0.6822977",
"0.6783508",
"0.67278415",
"0.6692399",
"0.66648996",
"0.66588914",
"0.66537625",
"0.6612005",
"0.6551927",
"0.6506888",
"0.647058",
"0.64683205",
"0.64674103",
"0.6463543",
"0.6446579",
"0.6442902",
"0.64308715",
"0.6421758",
"0.64156... | 0.7072287 | 1 |
Checks if the current state is in the Qmatrix otherwise adds that empty row | def check_state_exist(state, qmatrix, numb_actions):
if state not in qmatrix.index:
# append new state to q table
qmatrix = qmatrix.append(
pd.Series(
[0]*numb_actions,
index=qmatrix.columns,
name=state,
)
)
return ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isEmpty(self):\n return self.qSize == 0",
"def empty(self) -> bool:\n return self.q1==[]",
"def empty(self): \n return self.qsize() == 0",
"def empty(self):\n return self.frontierpq == []",
"def empty(self):\n return self.q_size.current_value == 0",
"def empty(self) ->... | [
"0.63855267",
"0.62967646",
"0.6202757",
"0.61654204",
"0.61212945",
"0.6116752",
"0.6105146",
"0.58641446",
"0.5824393",
"0.5824393",
"0.58180845",
"0.5801234",
"0.5766266",
"0.57286334",
"0.56055146",
"0.5521125",
"0.5490785",
"0.54602826",
"0.5446421",
"0.54389143",
"0.543... | 0.7086502 | 0 |
Creates a empty Qmatrix with columns of size of number of possible actions | def generate_empty_qmatrix(numb_actions):
return (pd.DataFrame(columns=list(range(numb_actions)), dtype=np.float64)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init(t_nrow, t_ncol, t_nAction=4):\n nState = t_nrow * t_ncol\n # initialize Q table\n Qtable = np.zeros((nState, t_nAction), dtype=np.float32)\n \n # an array for \"state_idx --> pixel position\"\n States = np.empty((nState,2), np.int16)\n for i in range(t_nrow):\n for j in range(t... | [
"0.642701",
"0.60853463",
"0.59730035",
"0.5903178",
"0.58970857",
"0.5889878",
"0.5884095",
"0.5879082",
"0.58569485",
"0.5818688",
"0.58000517",
"0.57726854",
"0.5759172",
"0.5738363",
"0.57213527",
"0.5719859",
"0.57144415",
"0.5703958",
"0.5655203",
"0.5642284",
"0.562461... | 0.8236657 | 0 |
Returns iPythonHTML summarizing a folder of fastqc outputs | def fastqc_display_dir(path, ignore=[]):
html_files = set(glob.glob(os.path.join(path, '*.html')))
html_files -= set(ignore)
html_files = list(sorted(html_files))
zsumm, zdata = zip(*[zip_parse(x) for x in html_files])
zsumm = {a: b for (a, b) in zip(html_files, zsumm)}
zdata = {a: b for (a, b... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def report_processing_qc(analysis_dir,html_file):\n # Initialise the HTML report\n processing_qc = Document(\"Processing report for %s\" %\n os.path.basename(analysis_dir.analysis_dir))\n processing_qc.add_css_rule(css_rules.QC_REPORT_CSS_RULES)\n processing_qc.add_css_rule(... | [
"0.63466215",
"0.59765893",
"0.5946057",
"0.5943992",
"0.59312093",
"0.5910661",
"0.59071505",
"0.5899792",
"0.58321846",
"0.58162546",
"0.5798966",
"0.57915145",
"0.5785713",
"0.5770808",
"0.57258904",
"0.56848323",
"0.5664915",
"0.56643665",
"0.56633735",
"0.56567186",
"0.5... | 0.6872476 | 0 |
Returns an image containing the digit from MNIST as a numpy array | def drawDigit(self, digit):
random_index = np.random.randint(len(self.mnist_images[digit]))
return np.array(
self.mnist_images[digit][random_index]
).reshape((28, 28)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mnist_to_img(x: Any) -> Any:\n x = (x > 0).float()\n d = x.reshape([28, 28, 1]) * 255\n return np.concatenate([d, d, d], 2)",
"def mnist_to_img(x):\r\n x = (x > 0).astype(np.float32)\r\n d = x.reshape([28, 28, 1]) * 255\r\n return np.concatenate([d, d, d], 2)",
"def MNIST_data():\n\n #... | [
"0.725973",
"0.7087758",
"0.685377",
"0.667444",
"0.6483375",
"0.64523995",
"0.64044553",
"0.6329031",
"0.62813526",
"0.62227714",
"0.62148196",
"0.6179465",
"0.61726207",
"0.6158583",
"0.61520797",
"0.6078437",
"0.6060459",
"0.6042899",
"0.60126966",
"0.6000601",
"0.5999382"... | 0.7141378 | 1 |
Translate the given `.vm` file to a Hack file. The result will be saved in `.asm` If input_path is a directory, then all the .vm files in the directory will be translated to a single .asm file named '.asm' | def translate(input_path):
input_path = Path(input_path)
if not input_path.is_dir() and input_path.suffix != '.vm':
raise Exception('Expected .vm file or a directory of .vm files')
input_files = list(input_path.rglob('*.vm')) if input_path.is_dir() else [input_path]
with open(input_path.with_s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main(path):\n vm_files = []\n if not os.path.exists(path):\n print(\"Error: File or directory does not exist: %s\"\n % path)\n return\n\n elif os.path.isdir(path): # Directory of files\n vm_files = filter_paths(path)\n dir_path = path\n file_name = os.p... | [
"0.7032453",
"0.6207294",
"0.6081634",
"0.591717",
"0.59113586",
"0.57247174",
"0.547165",
"0.5268171",
"0.51832944",
"0.5176026",
"0.51518446",
"0.5149318",
"0.51303303",
"0.5123404",
"0.51224524",
"0.50986433",
"0.5074192",
"0.50365764",
"0.50296026",
"0.502069",
"0.4947626... | 0.81136394 | 0 |
Convenience method that returns a boolean indicating whether or not this mentor has uploaded a receipt id document. | def has_receipt_id(self):
return self.receipt_id_uploaded_at is not None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_receipt_knowledge(self):\n return self.receipt_knowledge_uploaded_at is not None",
"def has_receipt_penal(self):\n return self.receipt_penal_uploaded_at is not None",
"def has_receipt_diploma(self):\n return self.receipt_diploma_uploaded_at is not None",
"def _document_exists(sel... | [
"0.67200947",
"0.6585871",
"0.62343657",
"0.5961473",
"0.5950481",
"0.59395933",
"0.5921426",
"0.5830527",
"0.5716745",
"0.5656079",
"0.56382585",
"0.5579861",
"0.55564404",
"0.555603",
"0.5549212",
"0.55135226",
"0.5505022",
"0.5486386",
"0.5454336",
"0.5448195",
"0.5416172"... | 0.7911256 | 0 |
Convenience method that returns a string indicating the status of receipt id document. | def get_receipt_id_status(self):
return self.get_document_status_choice(self.receipt_id_status) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def document_status(document_id: uuid.UUID, db: Session = Depends(get_db)):\n document_status = get_document_status(db, document_id)\n return document_status",
"def get_receipt_penal_status(self):\n return self.get_document_status_choice(self.receipt_penal_status)",
"def id_str(self):\n ret... | [
"0.6664973",
"0.66071737",
"0.6605014",
"0.6422415",
"0.63374007",
"0.62502736",
"0.62368214",
"0.60858274",
"0.583776",
"0.58267385",
"0.58231235",
"0.57659763",
"0.5764909",
"0.5764909",
"0.5764909",
"0.5764909",
"0.5764909",
"0.5764909",
"0.5764909",
"0.5764909",
"0.576490... | 0.8058843 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.