query stringlengths 10 2k | document stringlengths 20 51.2k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
Return the widget's value. | def value(self):
for rb in self.rb:
# if rb.isChecked():
if rb.isDown():
return str(rb.text())
return '' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_value(self):\n if self.notebook:\n return self.widget.value\n else:\n if hasattr(self.widget, \"value\"):\n return self.widget.value()\n elif hasattr(self.widget, \"currentText\"):\n return self.widget.currentText()\n e... | [
"0.8619286",
"0.7838884",
"0.7805611",
"0.7696525",
"0.7696525",
"0.7696525",
"0.76916736",
"0.7636346",
"0.7633243",
"0.7633243",
"0.7592193",
"0.7586152",
"0.7577611",
"0.7571931",
"0.7547001",
"0.7547001",
"0.7547001",
"0.75265634",
"0.7511581",
"0.75024223",
"0.74897397",... | 0.0 | -1 |
Change the widget's value. | def setValue(self,val):
val = str(val)
for rb in self.rb:
rb.setChecked(rb.text() == val)
rb.setDown(rb.text() == val) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setValue(self, value):\n self.setText(str(value))",
"def change_value(self,val):\n self.val = val",
"def set_value(self, value):\n if self.notebook:\n self.widget.value = value\n else:\n if hasattr(self.widget, \"setValue\"):\n self.widge... | [
"0.8164613",
"0.81342715",
"0.80459005",
"0.80246407",
"0.7893645",
"0.78935117",
"0.7575533",
"0.75690585",
"0.75590235",
"0.7548683",
"0.75123805",
"0.7453666",
"0.74110395",
"0.73848647",
"0.7379169",
"0.7360229",
"0.7360229",
"0.7360229",
"0.7316806",
"0.7260266",
"0.7256... | 0.0 | -1 |
Return the widget's value. | def value(self):
return int(self.input.text()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_value(self):\n if self.notebook:\n return self.widget.value\n else:\n if hasattr(self.widget, \"value\"):\n return self.widget.value()\n elif hasattr(self.widget, \"currentText\"):\n return self.widget.currentText()\n e... | [
"0.8619286",
"0.7838884",
"0.7805611",
"0.7696525",
"0.7696525",
"0.7696525",
"0.76916736",
"0.7636346",
"0.7633243",
"0.7633243",
"0.7592193",
"0.7586152",
"0.7577611",
"0.7571931",
"0.7547001",
"0.7547001",
"0.7547001",
"0.75265634",
"0.7511581",
"0.75024223",
"0.74897397",... | 0.0 | -1 |
Change the widget's value. | def setValue(self,val):
val = int(val)
self.input.setText(str(val)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setValue(self, value):\n self.setText(str(value))",
"def change_value(self,val):\n self.val = val",
"def set_value(self, value):\n if self.notebook:\n self.widget.value = value\n else:\n if hasattr(self.widget, \"setValue\"):\n self.widge... | [
"0.8164613",
"0.81342715",
"0.80459005",
"0.80246407",
"0.78935117",
"0.7575533",
"0.75690585",
"0.75590235",
"0.7548683",
"0.75123805",
"0.7453666",
"0.74110395",
"0.73848647",
"0.7379169",
"0.7360229",
"0.7360229",
"0.7360229",
"0.7316806",
"0.7260266",
"0.72569114",
"0.722... | 0.7893645 | 4 |
Return the widget's value. | def value(self):
return float(self.input.text()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_value(self):\n if self.notebook:\n return self.widget.value\n else:\n if hasattr(self.widget, \"value\"):\n return self.widget.value()\n elif hasattr(self.widget, \"currentText\"):\n return self.widget.currentText()\n e... | [
"0.8619286",
"0.7838884",
"0.7805611",
"0.7696525",
"0.7696525",
"0.7696525",
"0.76916736",
"0.7636346",
"0.7633243",
"0.7633243",
"0.7592193",
"0.7586152",
"0.7577611",
"0.7571931",
"0.7547001",
"0.7547001",
"0.7547001",
"0.75265634",
"0.7511581",
"0.75024223",
"0.74897397",... | 0.0 | -1 |
Change the widget's value. | def setValue(self,val):
val = float(val)
self.input.setText(str(val)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setValue(self, value):\n self.setText(str(value))",
"def change_value(self,val):\n self.val = val",
"def set_value(self, value):\n if self.notebook:\n self.widget.value = value\n else:\n if hasattr(self.widget, \"setValue\"):\n self.widge... | [
"0.8164613",
"0.81342715",
"0.80459005",
"0.80246407",
"0.7893645",
"0.78935117",
"0.75690585",
"0.75590235",
"0.7548683",
"0.75123805",
"0.7453666",
"0.74110395",
"0.73848647",
"0.7379169",
"0.7360229",
"0.7360229",
"0.7360229",
"0.7316806",
"0.7260266",
"0.72569114",
"0.722... | 0.7575533 | 6 |
Return the widget's value. | def value(self):
return self.input.getValues() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_value(self):\n if self.notebook:\n return self.widget.value\n else:\n if hasattr(self.widget, \"value\"):\n return self.widget.value()\n elif hasattr(self.widget, \"currentText\"):\n return self.widget.currentText()\n e... | [
"0.8618489",
"0.7837465",
"0.7806361",
"0.76970685",
"0.76970685",
"0.76970685",
"0.7691161",
"0.7636789",
"0.76339215",
"0.76339215",
"0.75928247",
"0.75866276",
"0.757809",
"0.7571875",
"0.7547639",
"0.7547639",
"0.7547639",
"0.75267",
"0.7511499",
"0.75030684",
"0.74901867... | 0.0 | -1 |
Change the widget's value. | def setValue(self,val):
self.input.setValues(val) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setValue(self, value):\n self.setText(str(value))",
"def change_value(self,val):\n self.val = val",
"def set_value(self, value):\n if self.notebook:\n self.widget.value = value\n else:\n if hasattr(self.widget, \"setValue\"):\n self.widge... | [
"0.81650984",
"0.81335413",
"0.8046718",
"0.80233526",
"0.7894542",
"0.789224",
"0.7573783",
"0.7570143",
"0.75580525",
"0.75474405",
"0.7512271",
"0.74522203",
"0.7410017",
"0.73818564",
"0.73771447",
"0.7359452",
"0.7359452",
"0.7359452",
"0.73161274",
"0.72585565",
"0.7256... | 0.6760889 | 50 |
Return the widget's value. | def value(self):
return [ f.value() for f in self.fields ] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_value(self):\n if self.notebook:\n return self.widget.value\n else:\n if hasattr(self.widget, \"value\"):\n return self.widget.value()\n elif hasattr(self.widget, \"currentText\"):\n return self.widget.currentText()\n e... | [
"0.8619286",
"0.7838884",
"0.7805611",
"0.7696525",
"0.7696525",
"0.7696525",
"0.76916736",
"0.7636346",
"0.7633243",
"0.7633243",
"0.7592193",
"0.7586152",
"0.7577611",
"0.7571931",
"0.7547001",
"0.7547001",
"0.7547001",
"0.75265634",
"0.7511581",
"0.75024223",
"0.74897397",... | 0.0 | -1 |
Change the widget's value. | def setValue(self,val):
for f,v in zip(self.fields,val):
f.setValue(v) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setValue(self, value):\n self.setText(str(value))",
"def change_value(self,val):\n self.val = val",
"def set_value(self, value):\n if self.notebook:\n self.widget.value = value\n else:\n if hasattr(self.widget, \"setValue\"):\n self.widge... | [
"0.8164613",
"0.81342715",
"0.80459005",
"0.80246407",
"0.7893645",
"0.78935117",
"0.7575533",
"0.75690585",
"0.75590235",
"0.7548683",
"0.75123805",
"0.7453666",
"0.74110395",
"0.73848647",
"0.7379169",
"0.7360229",
"0.7360229",
"0.7360229",
"0.7316806",
"0.7260266",
"0.7256... | 0.0 | -1 |
Change the widget's value. | def setValue(self,value):
rgb = QtGui.QColor(value).getRgb()
self.input.setStyleSheet("* { background-color: rgb(%s,%s,%s) }" % rgb[:3])
self.input.setText(str(value)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setValue(self, value):\n self.setText(str(value))",
"def change_value(self,val):\n self.val = val",
"def set_value(self, value):\n if self.notebook:\n self.widget.value = value\n else:\n if hasattr(self.widget, \"setValue\"):\n self.widge... | [
"0.8164613",
"0.81342715",
"0.80459005",
"0.80246407",
"0.7893645",
"0.78935117",
"0.7575533",
"0.75690585",
"0.75590235",
"0.7548683",
"0.75123805",
"0.7453666",
"0.74110395",
"0.73848647",
"0.7379169",
"0.7360229",
"0.7360229",
"0.7360229",
"0.7316806",
"0.7260266",
"0.7256... | 0.0 | -1 |
Change the widget's value. | def setValue(self,val):
if val:
self.input.setValue(val) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setValue(self, value):\n self.setText(str(value))",
"def change_value(self,val):\n self.val = val",
"def set_value(self, value):\n if self.notebook:\n self.widget.value = value\n else:\n if hasattr(self.widget, \"setValue\"):\n self.widge... | [
"0.8164613",
"0.81342715",
"0.80459005",
"0.80246407",
"0.7893645",
"0.78935117",
"0.7575533",
"0.75690585",
"0.75590235",
"0.7548683",
"0.75123805",
"0.7453666",
"0.74110395",
"0.73848647",
"0.7360229",
"0.7360229",
"0.7360229",
"0.7316806",
"0.7260266",
"0.72569114",
"0.722... | 0.7379169 | 14 |
Return the widget's value. | def value(self):
if self.isCheckable():
return self.isChecked()
else:
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_value(self):\n if self.notebook:\n return self.widget.value\n else:\n if hasattr(self.widget, \"value\"):\n return self.widget.value()\n elif hasattr(self.widget, \"currentText\"):\n return self.widget.currentText()\n e... | [
"0.8619286",
"0.7838884",
"0.7805611",
"0.7696525",
"0.7696525",
"0.7696525",
"0.76916736",
"0.7636346",
"0.7633243",
"0.7633243",
"0.7592193",
"0.7586152",
"0.7577611",
"0.7571931",
"0.7547001",
"0.7547001",
"0.7547001",
"0.75265634",
"0.7511581",
"0.75024223",
"0.74897397",... | 0.0 | -1 |
Change the widget's value. | def setValue(self,val):
if self.isCheckable():
self.setChecked(val) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setValue(self, value):\n self.setText(str(value))",
"def change_value(self,val):\n self.val = val",
"def set_value(self, value):\n if self.notebook:\n self.widget.value = value\n else:\n if hasattr(self.widget, \"setValue\"):\n self.widge... | [
"0.81634307",
"0.81331855",
"0.80457467",
"0.80234236",
"0.78933406",
"0.7892486",
"0.7573996",
"0.7568683",
"0.75586784",
"0.7547441",
"0.751063",
"0.745214",
"0.7408914",
"0.7382569",
"0.73779815",
"0.7358218",
"0.7358218",
"0.7358218",
"0.731455",
"0.72589403",
"0.7255768"... | 0.6269658 | 98 |
Tests POST on file unauthenticated | def test_post_unauthenticated(self):
url = reverse('file')
data = {}
response = self.client.post(url, data)
self.assertEqual(response.status_code, status.HTTP_401_UNAUTHORIZED) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_post(self):\n\n url = reverse('file')\n\n data = {}\n\n self.client.force_authenticate(user=self.test_user_obj)\n response = self.client.post(url, data)\n\n self.assertEqual(response.status_code, status.HTTP_405_METHOD_NOT_ALLOWED)",
"def test_put_unauthenticated(self)... | [
"0.7752659",
"0.7266007",
"0.7110174",
"0.69661796",
"0.6945237",
"0.68660885",
"0.6836687",
"0.68304443",
"0.6820725",
"0.6719347",
"0.67168397",
"0.6686575",
"0.6651495",
"0.6627669",
"0.6626526",
"0.6626526",
"0.657339",
"0.6570174",
"0.6562219",
"0.6495492",
"0.6481062",
... | 0.8424144 | 0 |
Tests PUT on file with a user who doesn't own the datastore | def test_put_unauthorized(self):
url = reverse('file')
data = {
'shard_id': self.shard1.id,
'link_id': "b8866161-0b1f-4a8e-acde-07047313ec8f",
'parent_datastore_id': str(self.test_datastore_obj.id),
'chunk_count': 1,
'size': 512,
}
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_put_unauthenticated(self):\n\n url = reverse('file')\n\n data = {}\n\n response = self.client.put(url, data)\n\n self.assertEqual(response.status_code, status.HTTP_401_UNAUTHORIZED)",
"def test_put(self):\n\n url = reverse('file')\n\n data = {\n 'shar... | [
"0.7512838",
"0.7058365",
"0.6818942",
"0.6723851",
"0.665037",
"0.6530518",
"0.65142083",
"0.64078647",
"0.6284101",
"0.62529373",
"0.6219782",
"0.621801",
"0.620902",
"0.61986274",
"0.61644834",
"0.6142557",
"0.6134883",
"0.613342",
"0.6126856",
"0.61205983",
"0.6109851",
... | 0.76804084 | 0 |
Tests PUT on file unauthenticated | def test_put_unauthenticated(self):
url = reverse('file')
data = {}
response = self.client.put(url, data)
self.assertEqual(response.status_code, status.HTTP_401_UNAUTHORIZED) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_put_unauthorized(self):\n\n url = reverse('file')\n\n data = {\n 'shard_id': self.shard1.id,\n 'link_id': \"b8866161-0b1f-4a8e-acde-07047313ec8f\",\n 'parent_datastore_id': str(self.test_datastore_obj.id),\n 'chunk_count': 1,\n 'size': 5... | [
"0.7626012",
"0.7401775",
"0.7173107",
"0.67623436",
"0.67374367",
"0.6728364",
"0.6711227",
"0.6680001",
"0.6642437",
"0.6619603",
"0.6533711",
"0.65131867",
"0.65131867",
"0.6497745",
"0.6460368",
"0.64108264",
"0.6388223",
"0.6373701",
"0.63549167",
"0.6294441",
"0.6233359... | 0.8623474 | 0 |
Tests GET on file unauthenticated | def test_read_unauthenticated(self):
url = reverse('file', kwargs={'file_id': str(self.file.id)})
data = {}
response = self.client.get(url, data)
self.assertEqual(response.status_code, status.HTTP_401_UNAUTHORIZED) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_read_unauthorized(self):\n\n url = reverse('file', kwargs={'file_id': str(self.file.id)})\n\n data = {}\n\n self.client.force_authenticate(user=self.test_user2_obj)\n response = self.client.get(url, data)\n\n self.assertEqual(response.status_code, status.HTTP_400_BAD_REQ... | [
"0.7965914",
"0.7429487",
"0.73475087",
"0.7292251",
"0.7290932",
"0.7225834",
"0.72250456",
"0.70361984",
"0.69749945",
"0.69634527",
"0.69383645",
"0.6899656",
"0.6882416",
"0.68493575",
"0.67811966",
"0.6757249",
"0.6747454",
"0.67469394",
"0.66999966",
"0.66865456",
"0.66... | 0.8376965 | 0 |
Inspect and promote the last element to satisfy the heap property | def _swim(self):
child_ix = len(self) - 1
parent_ix = self._get_parent(child_ix)
while (parent_ix is not None and self._test(parent_ix, child_ix)):
self._exch(parent_ix, child_ix)
child_ix = parent_ix
parent_ix = self._get_parent(parent_ix) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _heapify(self):\n start = self._parent(len(self) - 1)\n for i in range(start, -1, -1):\n self._down_heap(i)",
"def delete_max(self):\n retval = self.heap_list[1]\n self.heap_list[1] = self.heap_list[self.size]\n self.size = self.size - 1\n pop_val = self.h... | [
"0.7209032",
"0.7204322",
"0.70725787",
"0.7039402",
"0.7034055",
"0.7021225",
"0.6941711",
"0.6923058",
"0.6888912",
"0.6870779",
"0.68561715",
"0.6854089",
"0.68402016",
"0.6808661",
"0.67988247",
"0.67911476",
"0.6778329",
"0.6751484",
"0.6751373",
"0.6724999",
"0.6680802"... | 0.0 | -1 |
Return the parent for a given child. If child is root returns None. | def _get_parent(self, child_ix):
if child_ix == 0:
return None
t = 1 if child_ix & 1 else 2
return (child_ix - t) / 2 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _parent(child):\n parent = Pos(n=child.n - 1, x=child.x // 2, y=child.y // 2)\n left = child.x % 2\n top = child.y % 2\n return (parent, left, top)",
"def get_parent(child: State, states: [State]) -> State:\n parents = [state for state in states if is_state_a_child(state)]\n if not parents:... | [
"0.69394714",
"0.6901768",
"0.6880801",
"0.6794497",
"0.6774906",
"0.6743549",
"0.6701883",
"0.66412795",
"0.66393906",
"0.6495745",
"0.6478589",
"0.64264286",
"0.6346279",
"0.63417375",
"0.6336633",
"0.6310587",
"0.6270332",
"0.6258721",
"0.6219147",
"0.6165097",
"0.6157627"... | 0.7120068 | 0 |
Number of playlists that is marked for offline synchronization. | def num_playlists(self):
return lib.sp_offline_num_playlists(self._session._sp_session) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def count_offline_tubes(dqxx):\n count = 0\n for lcn in range(0, len(dqxx)):\n if not is_tube_online(dqxx, lcn):\n count = count + 1\n return count",
"def downloads(self):\n return self.proto.details.appDetails.numDownloads",
"def count(self):\n return len(self.wallpape... | [
"0.72183985",
"0.66198426",
"0.64349097",
"0.6376838",
"0.6367251",
"0.63528526",
"0.63002723",
"0.628578",
"0.6274594",
"0.62648314",
"0.62559146",
"0.616712",
"0.6118985",
"0.61064416",
"0.6072728",
"0.60606015",
"0.60589707",
"0.60473436",
"0.6045003",
"0.60436404",
"0.602... | 0.86027527 | 0 |
Stops the currently playing track. | def unload(self):
spotify.Error.maybe_raise(
lib.sp_session_player_unload(self._session._sp_session)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def StopTrack(self):\n handler = self.get_command_object(\"StopTrack\")\n handler()",
"def stop(self):\n if self.is_playing:\n self.is_playing = False\n self.tstamp_play = None\n self.thread.stop()",
"def stop(self):\n self.stopped = True\n # ... | [
"0.79150885",
"0.77564913",
"0.74339575",
"0.72337574",
"0.71699464",
"0.71699464",
"0.7169126",
"0.7109833",
"0.7092249",
"0.7066716",
"0.69835085",
"0.6971127",
"0.6954772",
"0.69443446",
"0.69374263",
"0.6933053",
"0.6929116",
"0.69143456",
"0.6896805",
"0.6852822",
"0.669... | 0.0 | -1 |
Returns True if the class we are converting is a subclass of SearchRequest, and False otherwise. | def isSearchRequest(self):
return re.search('Search.+Request', self.name) is not None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def match(self, cls):\n return isinstance(self, cls)",
"def _is_filter_class(cls):\n return type(cls) is types.TypeType and issubclass(cls, BaseHostFilter)",
"def isinstance(self, class_or_string):\n if class_or_string is None:\n return False\n import inspect\n if insp... | [
"0.6955812",
"0.6614258",
"0.6097166",
"0.6093385",
"0.6074422",
"0.6068396",
"0.60630846",
"0.6048266",
"0.60441655",
"0.60441655",
"0.60441655",
"0.60441655",
"0.60441655",
"0.60441655",
"0.6027702",
"0.60120237",
"0.6008305",
"0.6002916",
"0.6002916",
"0.5977774",
"0.59589... | 0.65545744 | 2 |
Create a black background picture same dimension of original picture | def blanck_picture(img):
blank_image = np.zeros((img.shape[0],img.shape[1],3), np.uint8)
blank_image[0:img.shape[0], 0:img.shape[1]] = 0, 0, 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def blanck_picture(img):\r\n blank_image = np.zeros((img.shape[0],img.shape[1],3), np.uint8)\r\n blank_image[0:, 0:] = 0, 0, 0\r\n return blank_image",
"def create_white_picture(pic_width, pic_height):\n white_picture = Image.new(\"1\", (pic_width, pic_height), (1))\n return white_picture",
"def... | [
"0.6996534",
"0.6984226",
"0.6963813",
"0.6868536",
"0.68203586",
"0.6755348",
"0.6751116",
"0.6686289",
"0.663069",
"0.65891045",
"0.6588334",
"0.65822417",
"0.65449536",
"0.6511273",
"0.6441599",
"0.6432435",
"0.64313275",
"0.64044607",
"0.638811",
"0.6316486",
"0.6298739",... | 0.6975773 | 2 |
Set the looping interval. | def set_looping_interval(self, interval: float) -> None:
self._looping_interval = interval | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setInterval(self, interval):\n self._interval = interval",
"def setInterval(self, interval):\n self._interval = interval",
"def setInterval(self, x):\n self._base_interval = x",
"def repeat_interval(self, repeat_interval):\n\n self._repeat_interval = repeat_interval",
"def i... | [
"0.70067775",
"0.70067775",
"0.6704157",
"0.65188605",
"0.6411603",
"0.6411139",
"0.62783813",
"0.62051964",
"0.6125222",
"0.611593",
"0.60915494",
"0.6089724",
"0.60281783",
"0.5941409",
"0.5916258",
"0.590815",
"0.5877096",
"0.5757094",
"0.574734",
"0.5726518",
"0.57196486"... | 0.8625491 | 0 |
Returns a datetime in the ISO8601 UTC format | def isotime(dt):
return dt.astimezone(utc).strftime("%Y-%m-%dT%H:%M:%SZ") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def datetime_to_iso8601(date_time):\n assert not date_time.utcoffset()\n return date_time.strftime('%Y-%m-%dT%H:%M:%S.%f') + 'Z'",
"def isoformat_now():\n return datetime_isoformat(datetime.datetime.utcnow())",
"def datetime_to_isoformat(obj: datetime.datetime) -> str:\n return obj.replace(tzinfo=d... | [
"0.72437805",
"0.7182269",
"0.7171575",
"0.7161534",
"0.7130591",
"0.70865774",
"0.7071643",
"0.70367897",
"0.6990853",
"0.6949722",
"0.69456",
"0.6891238",
"0.6890162",
"0.68323416",
"0.68026674",
"0.6764128",
"0.673723",
"0.6712216",
"0.66887975",
"0.66819733",
"0.6681017",... | 0.5909755 | 90 |
get a new property descriptor object for a field, this property will be used to enable getting/setting the actual value as the field only describes the type and other validation/conversion options, but do not hold the value itself, the vale will be held in the base instance | def get_field_property(name: str, field: fields.Field) -> property:
# in this property getter/setter method, we use an inner_name
# this inner name will be used with base instances
inner_name = f"__{name}"
def getter(self):
"""
getter method this property
Returns:
a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _create_property_field(property_, alias_dictionary):\n name_for_methods = property_['name_for_methods']\n\n assert property_['default_value'] is not None, \\\n ('MakeComputedStyleBase requires an default value for all fields, none specified '\n 'for property ' + property_['name'])\n\n i... | [
"0.62636584",
"0.60121363",
"0.60121363",
"0.60059655",
"0.59186065",
"0.5917823",
"0.57549435",
"0.57250744",
"0.571623",
"0.57017404",
"0.5690531",
"0.5679348",
"0.56779623",
"0.56774503",
"0.5663694",
"0.56347156",
"0.560949",
"0.5608972",
"0.55872804",
"0.5584982",
"0.557... | 0.67542446 | 0 |
get a new class with all field attributes replaced by property data descriptors. | def __new__(cls, name: str, based: tuple, attrs: dict) -> type:
# will collect class fields
# and also all fields of super classes, as we already have them in based
cls_fields = {}
super_fields = {}
for super_cls in based:
if hasattr(super_cls, "_fields"):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __new__(mcs, name, bases, attrs):\n\n # Retrieve the Meta class, if present\n dynaproperties = attrs.get('dynaproperties', {})\n\n for key, value in dynaproperties.iteritems():\n attrs[key] = value\n\n # Leave the rest to type\n return super(DynaFieldMetaclass, mcs).__new__(mcs, name, bases... | [
"0.6741659",
"0.6596639",
"0.65899366",
"0.6436674",
"0.63820106",
"0.63327616",
"0.62057453",
"0.61706173",
"0.6122545",
"0.61194694",
"0.5997487",
"0.59106374",
"0.5861464",
"0.58340454",
"0.5720563",
"0.57020956",
"0.56830716",
"0.5669115",
"0.56587535",
"0.56511825",
"0.5... | 0.6757574 | 0 |
base class implementation for any class with fields which supports getting/setting raw data for any instance fields. any instance can have an optional name and a parent. ```python | def __init__(self, parent_=None, instance_name_=None, **values):
self.__parent = parent_
self.__instance_name = instance_name_
self._factories = {}
for name, field in self._get_fields().items():
if isinstance(field, fields.Factory):
# for factory fields, we ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, name, age, billing):\n super().__init__(name, age)\n \"\"\"Define own properties in children class\"\"\"\n self.billing = billing",
"def __init__(self, parent: TgnObject, **data: str) -> None:\n\n super().__init__()\n self._data = {}\n self.objects = O... | [
"0.6448269",
"0.62080926",
"0.62060744",
"0.6179797",
"0.6081988",
"0.6061282",
"0.60211796",
"0.6017866",
"0.6016089",
"0.5994971",
"0.5975353",
"0.59096503",
"0.59085906",
"0.58942974",
"0.58819133",
"0.5874986",
"0.5864089",
"0.5853534",
"0.58503026",
"0.58267725",
"0.5814... | 0.67221147 | 0 |
set current instance name | def _set_instance_name(self, name):
self.__instance_name = name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def instance_name(self, instance_name):\n\n self._instance_name = instance_name",
"def set_name(self,name):\r\n self._name = __name",
"def set_name(self, name):\n self.class_name = name",
"def getname(self):\n if self.instance is not None:\n return '%s_%s' % (self.name,self... | [
"0.8216543",
"0.7283299",
"0.71977305",
"0.716456",
"0.71362364",
"0.7125649",
"0.7078434",
"0.70502263",
"0.69848585",
"0.69477206",
"0.69333655",
"0.68378365",
"0.68378365",
"0.68378365",
"0.68378365",
"0.68340784",
"0.6825455",
"0.6825455",
"0.6825455",
"0.6825455",
"0.682... | 0.8581111 | 0 |
get an instance from a dict ```python | def from_dict(cls, data):
instance = cls()
instance._set_data(data)
return instance | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _from_dict(cls, _dict):\n return cls.from_dict(_dict)",
"def _from_dict(cls, _dict):\n return cls.from_dict(_dict)",
"def _from_dict(cls, _dict):\n return cls.from_dict(_dict)",
"def _from_dict(cls, _dict):\n return cls.from_dict(_dict)",
"def _from_dict(cls, _dict):\n ... | [
"0.7040449",
"0.7040449",
"0.7040449",
"0.7040449",
"0.7040449",
"0.7040449",
"0.7040449",
"0.7040449",
"0.7040449",
"0.7040449",
"0.7040449",
"0.7040449",
"0.7040449",
"0.7040449",
"0.7040449",
"0.7040449",
"0.7040449",
"0.7040449",
"0.7040449",
"0.7040449",
"0.7040449",
"... | 0.0 | -1 |
A domain name represented as a sequence of labels, where each label consists of a length octet followed by that number of octets. The domain name terminates with the zero length octet for the null label of the root. | def buildQuestion():
#example.com
QNAME = b"\x07\x65\x78\x61\x6d\x70\x6c\x65\x03\x63\x6f\x6d\x00"
"""
A two octet code which specifies the type of the query.
The values for this field include all codes valid for a
TYPE field, together with some more general codes which
can match more than o... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def domainroot(d):\n dn = str2dn(d)\n dn.pop(0)\n return dn2str(dn)",
"def encode_name(self,name):\n #print(\"Hackable label decoder in place\")\n if not isinstance(name,dnslib.dns.DNSLabel):\n name = dnslib.dns.DNSLabel(name)\n if len(name) > 253:\n raise dnslib.dns... | [
"0.62829083",
"0.6096502",
"0.5893731",
"0.58364475",
"0.5501817",
"0.54517794",
"0.54386926",
"0.5414825",
"0.54074854",
"0.5312327",
"0.5299121",
"0.5286002",
"0.5267979",
"0.5242896",
"0.52235526",
"0.52235526",
"0.5200697",
"0.5197403",
"0.5197403",
"0.50467134",
"0.50391... | 0.0 | -1 |
Get principal components for each group as vectors. Vectors can then be used to annotate graphs. | def get_pca_vectors_by(dataframe, by=None):
vector_pairs = list()
if by is None:
pca_df = get_pca_data(dataframe)
v = get_pca_vectors(pca_df)
vector_pairs.append(v)
else:
grouped = dataframe.groupby(by)
for group, data in grouped:
pca_df = get_pca_data(dat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def principle_component_analysis(data_frame, dim=2):\n pca = PCA(n_components=dim)\n sc = StandardScaler()\n y = data_frame.loc[:, [\"Label\"]].values\n x = pd.DataFrame(data_frame[\"Vector\"].tolist())\n x = sc.fit_transform(x)\n principlecomponents = pca.fit_transform(x)\n principalDf = pd.D... | [
"0.6633548",
"0.6501782",
"0.64948344",
"0.63673437",
"0.6301872",
"0.6166161",
"0.60992414",
"0.6068504",
"0.60426587",
"0.60334784",
"0.6026655",
"0.5925093",
"0.5898814",
"0.5898383",
"0.57988095",
"0.5725366",
"0.5688086",
"0.56405854",
"0.56040853",
"0.559885",
"0.555161... | 0.5636186 | 18 |
Returns 2D unit vector in direction of uncontrolled manifold. | def get_ucm_vec(p0=None, p1=None):
if p0 is None:
p0 = np.array([25, 100])
if p1 is None:
p1 = np.array([100, 25])
parallel = p1 - p0
parallel = parallel / np.linalg.norm(parallel) # Normalize.
return parallel | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unit():\n return Vec2d(0, 1)",
"def unit(self):\r\n return Vector(self.x/self.length(), self.y/self.length())",
"def unit(direction):\r\n return Vector(0, -1).rotate(direction)",
"def to_unit(self):\n if self.is_zero():\n return Vector(0,0,0)\n else:\n ... | [
"0.73797184",
"0.7079676",
"0.7035807",
"0.69459254",
"0.6938189",
"0.6764016",
"0.66703093",
"0.66608363",
"0.66475135",
"0.6596861",
"0.6596861",
"0.6596861",
"0.65925646",
"0.65640414",
"0.65605986",
"0.6541429",
"0.6511837",
"0.6501078",
"0.6501078",
"0.6501078",
"0.65010... | 0.5924094 | 70 |
Get a vector that is orthogonal to vec and has same length. | def get_orthogonal_vec2d(vec):
ortho = np.array([-vec[1], vec[0]])
return ortho | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def orthogonal(v):\n return np.array([-v[1], v[0]])",
"def orthogonal_to(vector: ModelParameters) -> ModelParameters:\n new_vector = rand_u_like(vector)\n new_vector = new_vector - new_vector.dot(vector) * vector / math.pow(vector.model_norm(2), 2)\n return new_vector",
"def _orthogonal_vector(vect... | [
"0.79699546",
"0.78229326",
"0.782159",
"0.7100014",
"0.6910409",
"0.6701473",
"0.65584576",
"0.65008396",
"0.64585507",
"0.63431656",
"0.63099426",
"0.63004905",
"0.62967134",
"0.62808675",
"0.6217863",
"0.61572903",
"0.6153107",
"0.61404115",
"0.61301965",
"0.61055833",
"0.... | 0.8337211 | 0 |
Returns coefficients a and b in x = avec_ucm + bvec_ortho with x being the difference of a data point and the mean. Projection is computed using a transformation matrix with ucm parallel and orthogonal vectors as basis. | def get_projections(points, vec_ucm):
# Get the vector orthogonal to the UCM.
vec_ortho = get_orthogonal_vec2d(vec_ucm)
# Build a transformation matrix with vec_ucm and vec_ortho as new basis vectors.
A = np.vstack((vec_ucm, vec_ortho)).T # A is not an orthogonal projection matrix (A=A.T), but this wor... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def project(face_image, u):\n \n # finding the magnitude of each component\n a = np.matmul(face_image, u)\n \n # use a's to get the projection back\n res = np.matmul(u, a.T)\n\n return res",
"def plane_equation(point_a, point_b, point_c):\n v1 = np.subtract(point_a, point_c)\n v2 = np.... | [
"0.53170663",
"0.527942",
"0.51499736",
"0.5103482",
"0.5076025",
"0.506706",
"0.506189",
"0.5049584",
"0.50066495",
"0.49553856",
"0.4954054",
"0.48910704",
"0.48879737",
"0.4825265",
"0.48229244",
"0.4817381",
"0.48025677",
"0.47988865",
"0.47755438",
"0.4752021",
"0.475167... | 0.59730095 | 0 |
Tests whether there is considerable deviation from a normal distribution. If no deviation could be detected, we don't know much about the distribution. Independent normality tests use the ShapiroWilk method. Multivariate tests use the HenzeZirkler multivariate normality test. | def normality_test(df, columns, multivariate=False):
if multivariate:
# Multivariate testing.
is_normal, p = df.groupby(['user', 'block'])[columns].apply(pg.multivariate_normality)
res = df.groupby(['user', 'block'])[['df1', 'df2']].apply(pg.multivariate_normality).apply(pd.Series)\
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_stddev(self):\n self.assertEqual(stddev(list1, sample=False), np.std(list1))\n self.assertEqual(stddev(list1), np.std(list1, ddof=1))",
"def test_2_normal(self):\n print(\"test 2: normal distributions\")\n\n mean = self.means[0]\n dispersion = self.dispersions[0]\n\n ... | [
"0.6919491",
"0.664252",
"0.65996706",
"0.6537072",
"0.6537072",
"0.6488099",
"0.6476006",
"0.6475181",
"0.6451581",
"0.643908",
"0.6390576",
"0.6390576",
"0.63825583",
"0.6340337",
"0.6335496",
"0.63261",
"0.6264083",
"0.6231583",
"0.6198118",
"0.61954486",
"0.619501",
"0.... | 0.5951867 | 47 |
For comparing two objects of the same model | def __eq__(self, other):
if self.__class__ != other.__class__:
return False
if self.primary != other.primary:
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_model_equality(self):\n class EqualityModel0(Model):\n pk = columns.Integer(primary_key=True)\n\n class EqualityModel1(Model):\n kk = columns.Integer(primary_key=True)\n\n m0 = EqualityModel0(pk=0)\n m1 = EqualityModel1(kk=1)\n\n self.assertEqual(m0... | [
"0.7782331",
"0.7771082",
"0.77151304",
"0.7576283",
"0.7541877",
"0.7446219",
"0.7392344",
"0.7275335",
"0.7142937",
"0.70192295",
"0.69918585",
"0.6979135",
"0.69612825",
"0.69044703",
"0.69005966",
"0.6891177",
"0.6873375",
"0.6845887",
"0.6835001",
"0.683161",
"0.6826421"... | 0.0 | -1 |
Get datetime and return formatted string | def get_now():
right_now = datetime.datetime.now()
return ("%04d%02d%02d-%02d:%02d:%02d"
% (right_now.year, right_now.month, right_now.day,
right_now.hour, right_now.minute, right_now.second)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_datetime_str():\n return time.strftime(\"%Y-%m-%d %H:%M:%S\", time.localtime())",
"def getFormattedDate(self, dt):\n if DATE_FORMAT_STRING == '':\n return time.strftime('%Y-%m-%d %H:%M:%S', dt.timetuple())\n else:\n return time.strftime(DATE_FORMAT_STRING, dt.timetu... | [
"0.7883391",
"0.78338957",
"0.7743146",
"0.736925",
"0.7311836",
"0.7207552",
"0.720648",
"0.71460825",
"0.71427226",
"0.7134697",
"0.71107453",
"0.71107453",
"0.70890594",
"0.7079677",
"0.7054055",
"0.70503676",
"0.7035276",
"0.70123863",
"0.6984007",
"0.6954821",
"0.6944794... | 0.0 | -1 |
Create a file name based on settings.py variables Note image numbering will not be saved but will be inferred from the last image name using get_last_counter() function. If the last image file name is not a number sequence file then numbering will start from imageNumStart variable and may overwrite previous number sequ... | def get_file_name(image_dir, image_name_prefix, current_count):
if imageNumOn:
# you could also use os.path.join to construct image path file_path
file_path = image_dir+ "/"+image_name_prefix+str(current_count)+".jpg"
else:
right_now = datetime.datetime.now()
file_path = ("%s/%s%... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def file_suffix(self):\n return f'{self.image_count:05}' if self.sequential_naming else \\\n datetime.datetime.now().strftime(\"%Y-%m-%d-%H-%M-%S\")",
"def generate_image_filename():\n now = datetime.now().strftime('%a-%w-%b-%H:%M:%S')\n return 'CCTV_{0}.jpg'.format(now)",
"def create_f... | [
"0.7332335",
"0.7269702",
"0.71892095",
"0.7092047",
"0.7070344",
"0.6906071",
"0.67635506",
"0.6743491",
"0.6650507",
"0.6636983",
"0.66362214",
"0.6628076",
"0.66172546",
"0.65974015",
"0.655586",
"0.6503115",
"0.64914685",
"0.6473188",
"0.64111376",
"0.635552",
"0.6350939"... | 0.68097144 | 6 |
Returns a list of all field names on the instance. | def get_all_fields(self):
fields = []
for f in self._meta.fields:
fname = f.name
# resolve picklists/choices, with get_xyz_display() function
get_choice = 'get_'+fname+'_display'
if hasattr( self, get_choice):
value = getattr( self... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _fields_names(cls) -> List:\n return list(field.name for field in dataclasses.fields(cls))",
"def get_field_names(cls):\n return cls._meta.get_field_names()",
"def field_names(self):\r\n return self._names",
"def fieldNames(self):\n return self.__fieldNames",
"def get_field_... | [
"0.85165054",
"0.8455776",
"0.83252025",
"0.831076",
"0.8289615",
"0.8282349",
"0.80371535",
"0.7991998",
"0.7978423",
"0.796092",
"0.79292834",
"0.78528595",
"0.7833529",
"0.7798423",
"0.77685726",
"0.7739057",
"0.76987565",
"0.76074624",
"0.7534721",
"0.753396",
"0.7507191"... | 0.6511627 | 77 |
Set some specific loggers to `INFO` level. | def shush_loggers():
for logger in loggers_to_info:
logging.getLogger(logger).setLevel(logging.INFO) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_log_level_info(loggers=[\"vaex\"]):\n set_log_level(loggers, logging.INFO)",
"def info(*args, **kwargs) -> None:\n\n # Assert that there are some active loggers\n assert Log.active_loggers\n\n for logger in Log.active_loggers:\n logger.info(*args, **kwargs)",
"def set... | [
"0.82853645",
"0.7106168",
"0.6905257",
"0.6565394",
"0.6547133",
"0.6499193",
"0.6496912",
"0.6479103",
"0.6328484",
"0.6280059",
"0.62240595",
"0.5995724",
"0.5975346",
"0.59023815",
"0.58690083",
"0.5848318",
"0.58460593",
"0.5824303",
"0.58190125",
"0.58115554",
"0.580827... | 0.77254915 | 1 |
Returns current year's month number. Each year has 48 weeks and each month has 4 weeks. | def getCurrentMonth(self):
return math.ceil((self.wcount % 48) / 4) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_current_month() -> int:\n return datetime.now().month",
"def month(self) -> int:\n return self.arxiv_id.month",
"def month(self) -> int:\n if self.is_old_style:\n return int(self.split('/', 1)[1][2:4])\n return int(self[2:4])",
"def _to_nb_months(ym_dec):\n n... | [
"0.7134712",
"0.6734856",
"0.6723071",
"0.65809315",
"0.6526972",
"0.6500095",
"0.6446426",
"0.6425172",
"0.6425172",
"0.6414315",
"0.6345253",
"0.6305628",
"0.6304355",
"0.6235092",
"0.62197715",
"0.6203484",
"0.6190745",
"0.6189388",
"0.6154831",
"0.6149387",
"0.6123022",
... | 0.74324125 | 0 |
Test if the transaction is affordable on the ledger. | def test_transaction_is_not_affordable(self):
tx_message = TransactionMessage(
performative=TransactionMessage.Performative.PROPOSE_FOR_SETTLEMENT,
skill_callback_ids=[PublicId("author", "a_skill", "0.1.0")],
tx_id="transaction0",
tx_sender_addr="agent_1",
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _is_affordable(self, tx_message: TransactionMessage) -> bool:\n is_affordable = True\n if self.context.ownership_state.is_initialized:\n is_affordable = self.context.ownership_state.is_affordable_transaction(\n tx_message\n )\n if self.context.ledger_st... | [
"0.7880082",
"0.7677402",
"0.70854414",
"0.70677227",
"0.68708575",
"0.672653",
"0.66985077",
"0.66725504",
"0.6646409",
"0.65738314",
"0.65279305",
"0.64913565",
"0.6411708",
"0.640841",
"0.63817716",
"0.62301314",
"0.6226215",
"0.60837436",
"0.5937613",
"0.5878771",
"0.5836... | 0.6775096 | 5 |
Test if the transaction is affordable on the ledger. | def test_transaction_is_affordable(self):
tx_message = TransactionMessage(
performative=TransactionMessage.Performative.PROPOSE_FOR_SETTLEMENT,
skill_callback_ids=[PublicId("author", "a_skill", "0.1.0")],
tx_id="transaction0",
tx_sender_addr="agent_1",
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _is_affordable(self, tx_message: TransactionMessage) -> bool:\n is_affordable = True\n if self.context.ownership_state.is_initialized:\n is_affordable = self.context.ownership_state.is_affordable_transaction(\n tx_message\n )\n if self.context.ledger_st... | [
"0.78809047",
"0.7677851",
"0.70842946",
"0.6870106",
"0.67748666",
"0.6725127",
"0.6699159",
"0.6673563",
"0.66455567",
"0.6573246",
"0.6527361",
"0.6490685",
"0.6412649",
"0.64092696",
"0.63823044",
"0.6229748",
"0.6225676",
"0.60840076",
"0.593836",
"0.5879338",
"0.5837346... | 0.70671576 | 3 |
Sends a 401 response that enables basic auth | def authenticate():
return Response(
'Could not verify your access level for that URL.\n'
'You have to login with proper credentials', 401,
{'WWW-Authenticate': 'Basic realm="Login Required"'}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def authenticate():\n return Response('Not Authorized', 401, {'WWW-Authenticate': 'Basic realm=\"api\"'})",
"def authenticate():\n return Response(\n '', 401, {'WWW-Authenticate': 'Basic realm=\"Login Required\"'}\n )",
"def authenticate():\n return Response(\n 'You have to login with pro... | [
"0.8093736",
"0.80926424",
"0.7958403",
"0.7852648",
"0.7843114",
"0.7824419",
"0.776624",
"0.7754693",
"0.774767",
"0.774767",
"0.774767",
"0.774767",
"0.774767",
"0.774767",
"0.774767",
"0.774767",
"0.771945",
"0.7667712",
"0.7664151",
"0.76493174",
"0.76140213",
"0.76131... | 0.7810746 | 18 |
Convert feet to meters. | def meters_from(feet):
try:
meters = float(feet) / 3.28
meters = round(meters, 2) # Round to three decimal places
return str(meters)
except ValueError:
return "invalid input" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def feet_to_meters(feet: float) -> float:\n feet = float(feet)\n meter = float(float(feet) * 0.3048)\n return round(meter, 2)",
"def meters_to_feet(meters: float) -> float:\n meters = float(meters)\n feet = float(float(meters) * 3.28084)\n return round(feet, 2)",
"def feet2m(feet):\n retur... | [
"0.87025774",
"0.82659894",
"0.7739321",
"0.7666288",
"0.7324921",
"0.700244",
"0.6886812",
"0.67837816",
"0.66554064",
"0.6441032",
"0.64013606",
"0.63439703",
"0.6339806",
"0.63303095",
"0.63266355",
"0.6132486",
"0.6091889",
"0.5971584",
"0.59507674",
"0.5929875",
"0.59266... | 0.7645984 | 4 |
Assert that 1 + 1 equals 2. | def test_dummy():
one = 1
assert one + 1 == 2 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_sanity(self):\n self.assertEquals(2 + 2, 4)",
"def test_two_plus_two():\n assert add.add(2, 2) == 4",
"def test_basic_addition(self):\r\n self.assertEqual(1 + 1, 2)",
"def test_basic_addition(self):\r\n self.assertEqual(1 + 1, 2)",
"def test_basic_addition(self):\r\n ... | [
"0.80213726",
"0.7624266",
"0.75925636",
"0.75925636",
"0.75925636",
"0.75925636",
"0.75925636",
"0.75925636",
"0.75925636",
"0.75925636",
"0.75925636",
"0.75925636",
"0.75925636",
"0.758117",
"0.758117",
"0.758117",
"0.758117",
"0.758117",
"0.758117",
"0.758117",
"0.758117",... | 0.71834093 | 41 |
Get the average age of something. | def average_age(self, start=1, end=None):
picks = self.pick_set.filter(number__gte=start)
if end is not None:
picks = picks.filter(number__lte=end)
dt = datetime.date(self.year, 1, 1)
ages = [e.player.age(dt) for e in picks]
ages = [e for e in ages if e]
aver... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_average_age(self):\n sql = \"\"\"\n SELECT AVG(age) as avg_age\n FROM(\n SELECT DATE_PART('year', AGE(now(), birth_date)) as age\n FROM {schema}.participant_match\n WHERE birth_date is not null\n ) x\n \"\"\".forma... | [
"0.8195994",
"0.80716383",
"0.76091504",
"0.737472",
"0.7196157",
"0.7196157",
"0.71620697",
"0.7157197",
"0.7131047",
"0.7124838",
"0.71149206",
"0.710629",
"0.7089089",
"0.7051463",
"0.70180637",
"0.69923854",
"0.69923854",
"0.69923854",
"0.6968645",
"0.6956367",
"0.6952959... | 0.7209326 | 4 |
Create a Python instance from the given DOM node. The node tag must correspond to an element declaration in this module. | def CreateFromDOM (node, default_namespace=None):
if default_namespace is None:
default_namespace = Namespace.fallbackNamespace()
return pyxb.binding.basis.element.AnyCreateFromDOM(node, default_namespace) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def CreateFromDOM (node, default_namespace=None):\n if default_namespace is None:\n default_namespace = Namespace.fallbackNamespace()\n return pyxb.binding.basis.element.AnyCreateFromDOM(node, _fallback_namespace=default_namespace)",
"def CreateFromDOM (node, default_namespace=None):\n if default... | [
"0.6949202",
"0.6949202",
"0.6949202",
"0.6946226",
"0.6698814",
"0.6698814",
"0.6698814",
"0.66975737",
"0.66655135",
"0.6650566",
"0.6622097",
"0.6594007",
"0.6585428",
"0.6564717",
"0.65103894",
"0.6489292",
"0.64718515",
"0.64257324",
"0.6323297",
"0.6312424",
"0.6311245"... | 0.70111525 | 7 |
Unit take damage. (decrease hit_points) | def take_damage(self, dmg):
self._ensure_is_alive()
self._hit_points -= dmg
if self.hit_points <= 0:
self._hit_points = 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def take_damage(self, damage):\n if damage <= 0: return\n self.hit_points[0] -= damage\n if self.hit_points[0] <= 0: self.die()",
"def Hit(self, damage):\n self.health -= damage",
"def attack(self, enemy):\n damage_dealt = self.damage - enemy.armor\n if damage_dealt < ... | [
"0.8146412",
"0.7915786",
"0.7550729",
"0.7537189",
"0.74744195",
"0.7381872",
"0.71792126",
"0.7124606",
"0.70154124",
"0.7008814",
"0.6996197",
"0.6987823",
"0.6947183",
"0.69254905",
"0.6920809",
"0.6877696",
"0.68563145",
"0.68476164",
"0.6827126",
"0.6789038",
"0.6779014... | 0.7958667 | 1 |
Layer normalize the tensor x, averaging over the last dimension. | def layer_norm(x, filters=None, epsilon=1e-6, name=None, reuse=None):
if filters is None:
filters = x.get_shape()[-1]
with tf.variable_scope(name, default_name="layer_norm", values=[x], reuse=reuse):
scale = tf.get_variable(
"layer_norm_scale", [filters], initializer=tf.ones_initializer())
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalize(self, x, train=True):\n if train is not None:\n mean, variance = tf.nn.moments(x, [0,1,2])\n assign_mean = self.mean.assign(mean)\n assign_variance = self.variance.assign(variance)\n with tf.control_dependencies([assign_mean, assign_variance]):\n return tf.nn.batch_norm_... | [
"0.7025246",
"0.7000931",
"0.69984037",
"0.6946193",
"0.6926463",
"0.6913268",
"0.6907985",
"0.68715054",
"0.6863467",
"0.6787572",
"0.6776529",
"0.67483455",
"0.6723166",
"0.6712802",
"0.6702004",
"0.66976094",
"0.6691674",
"0.66691875",
"0.6619964",
"0.6619837",
"0.65780723... | 0.59974504 | 88 |
Return the fallback chain for the instance. Most of the time, it is just the configured fallback chain, but if the perrecordfallback feature is used, the value of the field is added (if not None). | def get_instance_fallback_chain(self, instance, language):
default = get_fallback_chain(language)
i18n_field = instance._meta.get_field("i18n")
if i18n_field.fallback_language_field:
record_fallback_language = get_instance_field_value(
instance, i18n_field.fallback_l... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fallback(self) -> Fallback:\n return Fallback(self)",
"def fallback(self):\n pass",
"def fallback(self):\n pass",
"def _get_fallback_model(self) -> BertModel:\n if not self._model_fallback:\n self._model_fallback = BertModel.from_pretrained(\n self._m... | [
"0.6371701",
"0.5556227",
"0.5556227",
"0.53391176",
"0.53262955",
"0.5088272",
"0.4984686",
"0.4984686",
"0.4937749",
"0.48029009",
"0.47889504",
"0.47214517",
"0.4719033",
"0.47126076",
"0.46867204",
"0.46085182",
"0.4607969",
"0.4587122",
"0.45835298",
"0.45781404",
"0.457... | 0.7417146 | 0 |
Returns the field name for the current virtual field. The field name is ``_`` in case of a specific translation or ``_i18n`` for the currently active language. | def get_field_name(self):
if self.language is None:
lang = "i18n"
else:
lang = self.get_language()
return build_localized_fieldname(self.original_name, lang) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_field_name(self, instance):\n fields = getattr(instance, \"_fields\")\n return fields[self.id]",
"def _field_name(self) -> str:\n name = self._resolve_field_name()\n if name is None:\n # pylint: disable=consider-using-f-string\n raise FieldNameError(\n ... | [
"0.750741",
"0.7346204",
"0.73409873",
"0.72984535",
"0.7271999",
"0.7146221",
"0.70940757",
"0.7034059",
"0.6862624",
"0.6862624",
"0.6805619",
"0.67804295",
"0.65705174",
"0.6508788",
"0.6504531",
"0.64664215",
"0.64299816",
"0.6419768",
"0.6408808",
"0.6368428",
"0.6365481... | 0.82945055 | 0 |
Returns the language for this field. In case of an explicit language (title_en), it returns "en", in case of `title_i18n`, it returns the currently active Django language. | def get_language(self):
return self.language if self.language is not None else get_language() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_language(self):\n return self.lang",
"def get_language(self) -> str:\n return self.language",
"def get_language(self) -> str:\n return settings.LANGUAGE_CODE",
"def getLanguage(self):\n return self.getOrDefault(self.language)",
"def get_language(self):\r\n return ... | [
"0.7848438",
"0.7752576",
"0.7752498",
"0.7711676",
"0.76986414",
"0.7615696",
"0.7467676",
"0.7450652",
"0.7384894",
"0.73752946",
"0.7354082",
"0.73281753",
"0.73281753",
"0.7318031",
"0.7318031",
"0.7318031",
"0.7318031",
"0.7301742",
"0.72110444",
"0.71490264",
"0.7149026... | 0.7781222 | 1 |
Split Full Keywords This tokenizer function is used for search strings loaded into the fullKwPropertiesJson field of the SearchObject. This exists, because not all data is suitable for partial keywork search for example IDs like J00001223COMP | def splitFullKeywords(keywordStr: str) -> Set[str]:
tokens = _splitFullTokens(keywordStr)
tokens = ['^%s$' % t for t in tokens if 2 <= len(t)]
return set(tokens) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_keywords(self):\n keywords = [] \n for keyword in self.watsonLanguageModel['keywords'][:self.entitySizeLimit]: \n keywords.append(keyword['text'])\n return keywords",
"def split_keywords(keywords):\n try:\n keywords = keywords.replace(u'\\u201c', '\"').repl... | [
"0.58322096",
"0.5583472",
"0.5572735",
"0.5560477",
"0.5474023",
"0.53832906",
"0.5359477",
"0.5321437",
"0.53193283",
"0.53133535",
"0.529936",
"0.5264558",
"0.52047807",
"0.51859987",
"0.5168437",
"0.51543987",
"0.51494706",
"0.50787365",
"0.5077012",
"0.50721586",
"0.5070... | 0.55533636 | 4 |
Split Partial Keywords This tokenizer function is used for search strings loaded into the partialKwPropertiesJson field of the SearchObject. This will tokenize all the smaller keywords as a full keyword, all numbers as full keywords all remaining items will be tokenized in a rolling three char method. | def splitPartialKeywords(keywordStr: str) -> Set[str]:
# Strip and Split words, filter out words less than three letters
tokens = _splitFullTokens(keywordStr)
# Split the words up into tokens, this creates partial keyword search support
tempTokens, tokens = tokens, []
for token in tempTokens:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def split_keywords(keywords):\n try:\n keywords = keywords.replace(u'\\u201c', '\"').replace(u'\\u201d', '\"')\\\n .replace(\"-\", \" \")\n\n except AttributeError:\n # In the event that keywords = nan\n return []\n\n if '\"' in keywords:\n # for handling key phrases... | [
"0.54471326",
"0.5392321",
"0.53489757",
"0.53376627",
"0.52470607",
"0.5224805",
"0.5203103",
"0.51778513",
"0.5126674",
"0.5082571",
"0.5048342",
"0.50135595",
"0.49993193",
"0.49584663",
"0.49558958",
"0.4936515",
"0.4916695",
"0.4913067",
"0.49010512",
"0.4895756",
"0.488... | 0.6212856 | 0 |
The home page of the web app. | def page_home(state):
st.title(":house: Welcome to Stock Swing Predictor (SSP)")
image = Image.open("ssp.png") # load logo
st.image(image, use_column_width=True)
st.markdown("*Note:* This is a conceptual tool and should not be used to make real/serious trading decisions.")
st.markdown("## Tool Ov... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def home():\n\n\treturn render_template('index.html', title='Home Page',\n\t\t\t\t\t\t year=datetime.now().year)",
"def home():\r\n return render_template(\r\n 'index.html',\r\n title='Home Page',\r\n year=datetime.now().year,\r\n )",
"def home():\n return render_template(\n ... | [
"0.8634473",
"0.8444874",
"0.8351165",
"0.8351165",
"0.8351165",
"0.8351165",
"0.8351165",
"0.8351165",
"0.8351165",
"0.8351165",
"0.8351165",
"0.8351165",
"0.830264",
"0.8299314",
"0.8287148",
"0.824534",
"0.82333416",
"0.81935173",
"0.8181438",
"0.81654906",
"0.81393796",
... | 0.0 | -1 |
Return a saved state value, None if item is undefined. | def __getitem__(self, item):
return self._state["data"].get(item, None) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __getitem__(self, item):\r\n return self._state[\"data\"].get(item, None)",
"def __getitem__(self, item):\r\n return self._state[\"data\"].get(item, None)",
"def __getattr__(self, item):\r\n return self._state[\"data\"].get(item, None)",
"def __getattr__(self, item):\r\n retur... | [
"0.6428999",
"0.6428999",
"0.6149919",
"0.6149919",
"0.61460555",
"0.6132298",
"0.6100829",
"0.6100829",
"0.6100829",
"0.59394336",
"0.58175045",
"0.57939315",
"0.5749789",
"0.5733325",
"0.57251567",
"0.57221013",
"0.57221013",
"0.5686118",
"0.5686118",
"0.5686118",
"0.568611... | 0.63583726 | 2 |
Return a saved state value, None if item is undefined. | def __getattr__(self, item):
return self._state["data"].get(item, None) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __getitem__(self, item):\r\n return self._state[\"data\"].get(item, None)",
"def __getitem__(self, item):\r\n return self._state[\"data\"].get(item, None)",
"def __getitem__(self, item):\n return self._state[\"data\"].get(item, None)",
"def __getitem__(self, item):\n return se... | [
"0.64281183",
"0.64281183",
"0.6357475",
"0.6357475",
"0.6357475",
"0.6148605",
"0.6148605",
"0.61450446",
"0.6130774",
"0.59375536",
"0.58148605",
"0.5792937",
"0.57490504",
"0.5732397",
"0.5725432",
"0.572095",
"0.572095",
"0.56847996",
"0.56847996",
"0.56847996",
"0.568479... | 0.6099511 | 10 |
Converts Relay operator batch_norm to ONNX operator. Relay operator has property axis to handle data in NHWC format. | def convert(cls, node_entry, model_container, node_dict):
attrs = cls.convert_attributes(node_entry["relay_node"].attrs)
transpose_out_name = node_entry["input_names"][0]
inter_output_names = [node_entry["output_names"][0]]
# axis==3 means channel is specified along the 3rd axis
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_batchnorm(node, **kwargs):\n name, input_nodes, attrs = get_inputs(node, kwargs)\n\n momentum = float(attrs.get(\"momentum\", 0.9))\n eps = float(attrs.get(\"eps\", 0.001))\n\n bn_node = onnx.helper.make_node(\n \"BatchNormalization\",\n input_nodes,\n [name],\n ... | [
"0.6541993",
"0.64909947",
"0.6259625",
"0.6180726",
"0.58876705",
"0.5871205",
"0.5851244",
"0.579899",
"0.57913005",
"0.5720004",
"0.5608946",
"0.56069124",
"0.5598963",
"0.5561915",
"0.5556486",
"0.55066925",
"0.54907095",
"0.5459949",
"0.54525256",
"0.5448313",
"0.5442287... | 0.5450486 | 19 |
Converts Relay operator Pad to ONNX operator. Relay operator accepts pads as attribute but ONNX operator accepts it as a input. | def convert(cls, node_entry, model_container, node_dict):
attrs = cls.convert_attributes(node_entry["relay_node"].attrs)
name = node_entry["name"]
pad_data = numpy.asarray(attrs["pads"], dtype=attrs["pads"][0].dtype).astype(numpy.int64)
input_names = [
node_entry["input_nam... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_pad(node, **kwargs):\n name, input_nodes, attrs = get_inputs(node, kwargs)\n\n mxnet_pad_width = convert_string_to_list(attrs.get(\"pad_width\"))\n onnx_pad_width = transform_padding(mxnet_pad_width)\n\n pad_mode = attrs.get(\"mode\")\n\n if pad_mode == \"constant\":\n pad_value =... | [
"0.6538645",
"0.5719668",
"0.5366189",
"0.5357081",
"0.5325323",
"0.5124648",
"0.5062208",
"0.5062166",
"0.5020885",
"0.4986378",
"0.4964931",
"0.49568442",
"0.48615396",
"0.48526943",
"0.4851009",
"0.4847235",
"0.4843729",
"0.47943538",
"0.47775134",
"0.47187746",
"0.4709594... | 0.4878402 | 12 |
Creates a dictionary of all words greater than length 4 | def dict_make():
f = open('words.txt','r')
dict1 = f.read().splitlines()
return filter(lambda z:len(z) >= 4, dict1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def createDict(self):\n data = d.Dictionary.dictionary\n while True:\n filtered = [line.strip() for line in data if len(line) == self.wordLen]\n if len(filtered) == 0:\n self.setNewLen()\n else:\n break\n return filtered",
"def l... | [
"0.70881146",
"0.6841121",
"0.6781512",
"0.66973716",
"0.6584902",
"0.6535768",
"0.64710885",
"0.64660025",
"0.6351441",
"0.6287912",
"0.6242764",
"0.6216731",
"0.6214173",
"0.6188059",
"0.6187457",
"0.6181007",
"0.6165614",
"0.6131073",
"0.61249644",
"0.61112076",
"0.6109968... | 0.8377515 | 0 |
Gets the config_bucket_names of this OrgApacheSlingCaconfigImplConfigurationResolverImplProperties. | def config_bucket_names(self) -> ConfigNodePropertyArray:
return self._config_bucket_names | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def config_bucket_names(self, config_bucket_names: ConfigNodePropertyArray):\n\n self._config_bucket_names = config_bucket_names",
"def keys_bucket_name(self):\n return self.config.keys_bucket",
"def config_names(self):\n return self._config_names.copy()",
"def list_buckets(self):\n ... | [
"0.6446771",
"0.635213",
"0.6213152",
"0.59815043",
"0.57801086",
"0.57022256",
"0.56896275",
"0.56456745",
"0.5594053",
"0.55713063",
"0.54901016",
"0.5486375",
"0.5450226",
"0.5442416",
"0.54410875",
"0.54410875",
"0.54349226",
"0.5384884",
"0.5383223",
"0.5383223",
"0.5382... | 0.8308459 | 0 |
Sets the config_bucket_names of this OrgApacheSlingCaconfigImplConfigurationResolverImplProperties. | def config_bucket_names(self, config_bucket_names: ConfigNodePropertyArray):
self._config_bucket_names = config_bucket_names | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def config_bucket_names(self) -> ConfigNodePropertyArray:\n return self._config_bucket_names",
"def __init__(self, config_bucket_names: ConfigNodePropertyArray=None): # noqa: E501\n self.openapi_types = {\n 'config_bucket_names': ConfigNodePropertyArray\n }\n\n self.attrib... | [
"0.65626925",
"0.64696985",
"0.49947178",
"0.49317083",
"0.47936618",
"0.47743237",
"0.46930325",
"0.468822",
"0.46469864",
"0.45277184",
"0.44977584",
"0.44669712",
"0.44647247",
"0.4457448",
"0.4454922",
"0.43873423",
"0.4362385",
"0.43282983",
"0.4326901",
"0.4322709",
"0.... | 0.8082579 | 0 |
Check for messages this client hasn't read yet. | def get_next_message(self):
newest_available_offset = self.broker.get_last_offset(self.topic_name)
if self.offset <= newest_available_offset:
msg = self.broker.read_message(self.topic_name, self.offset)
self.offset += 1
return msg | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_messages(self) -> bool:\n return self._has_messages",
"def new_messages(self):\n ready, _, _ = select([self.socket], [], [], 0.0)\n return self.socket in ready",
"def has_message_available(self):\n return not self.feedback_log.empty()",
"def _chk_empty(self, queue, receive... | [
"0.67009234",
"0.6630358",
"0.6489416",
"0.6445604",
"0.63360494",
"0.62131083",
"0.61870766",
"0.61870766",
"0.6180996",
"0.60523677",
"0.6035146",
"0.59893167",
"0.59873474",
"0.5978187",
"0.59721524",
"0.5968284",
"0.5943144",
"0.5941435",
"0.59409124",
"0.59337324",
"0.59... | 0.0 | -1 |
Parse a list of strings into a generate of pkg_resources.Requirements | def parse_requirements(reqs):
for req in reqs:
req = req.strip()
if "\n" in req:
for inner_req in parse_requirements(req.split("\n")):
yield inner_req
else:
result = parse_requirement(req)
if result is not None:
yield result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_requirements(*filenames):\n requirements = []\n for f in filenames:\n for line in open(f, 'r').read().split('\\n'):\n # Comment lines. Skip.\n if re.match(r'(\\s*#)|(\\s*$)', line):\n continue\n # Editable matches. Put the egg name into our req... | [
"0.7389504",
"0.68496203",
"0.67472965",
"0.6537811",
"0.6537811",
"0.6526558",
"0.63636464",
"0.6341593",
"0.63336",
"0.6303288",
"0.6264439",
"0.6261472",
"0.62147063",
"0.61846936",
"0.615088",
"0.6139954",
"0.61361915",
"0.6130059",
"0.6079676",
"0.60738415",
"0.6008824",... | 0.6540374 | 3 |
Returns whether an InstallRequirement is a "pinned" requirement. | def is_pinned_requirement(req):
return any(
(spec.operator == "==" or spec.operator == "===")
and not spec.version.endswith(".*")
for spec in req.specifier
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_pinned_requirement(ireq):\n if ireq.editable:\n return False\n\n if ireq.req is None or len(ireq.specifier._specs) != 1:\n return False\n\n op, version = next(iter(ireq.specifier._specs))._spec\n return (op == \"==\" or op == \"===\") and not version.endswith(\".*\")",
"def has_p... | [
"0.7513447",
"0.62215865",
"0.61540097",
"0.59717345",
"0.57373136",
"0.5589763",
"0.5527289",
"0.5499865",
"0.5481368",
"0.5413137",
"0.5396164",
"0.5387966",
"0.5385613",
"0.5380379",
"0.53092164",
"0.5266532",
"0.5258908",
"0.5237129",
"0.5233404",
"0.52219605",
"0.5221199... | 0.7603063 | 0 |
Returns whether an InstallRequirement has a prerelease specifier | def has_prerelease(req):
return any(parse_version(spec.version).is_prerelease for spec in req.specifier) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_pinned_requirement(req):\n\n return any(\n (spec.operator == \"==\" or spec.operator == \"===\")\n and not spec.version.endswith(\".*\")\n for spec in req.specifier\n )",
"def distributionRequiresNoTtyPatch():\n\tdistributor = Distribution().distributor.lower()\n\n\treturn bool(... | [
"0.63374144",
"0.6329881",
"0.6324707",
"0.6314748",
"0.63002926",
"0.629812",
"0.6284919",
"0.6269838",
"0.61530244",
"0.60710454",
"0.6028728",
"0.6027197",
"0.59786683",
"0.59185714",
"0.59039694",
"0.58831704",
"0.58299696",
"0.5749476",
"0.5688985",
"0.5664355",
"0.56533... | 0.8068535 | 0 |
Accessor for the flag indicating an active connection with the sender. | def connection_ready(self) -> bool:
return self._connection_ready | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def connection_status(self):\n return self._connection_status",
"def get_connection_state(self):\n return self.connection_state",
"def active(self) -> bool:\n return self.relay(\"active\")",
"def is_active(self):\n return self.stream.is_active()",
"def getConnectionStatus(self):... | [
"0.7091084",
"0.66623783",
"0.6646278",
"0.65829873",
"0.6570094",
"0.6550943",
"0.6533798",
"0.6510629",
"0.64728993",
"0.6464216",
"0.64600235",
"0.64568365",
"0.6432882",
"0.6412655",
"0.64096314",
"0.6403282",
"0.6385838",
"0.6385838",
"0.6385838",
"0.6385838",
"0.6385838... | 0.0 | -1 |
Setter for the flag indicating an active connection with the sender. | def connection_ready(self, active: bool):
self._connection_ready = active | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def SetConnectionStatus(self, state, info):\n self.connection_state = state\n self.connection_info = info",
"def set_connected(self):\n self.connected = True",
"def active(self) -> bool:\n return self.relay(\"active\")",
"def active(self, active):\n\n self._active = active"... | [
"0.644422",
"0.63624835",
"0.6278445",
"0.6212713",
"0.6212713",
"0.6212713",
"0.6212713",
"0.6165462",
"0.6091793",
"0.6068813",
"0.6047195",
"0.6047195",
"0.6047195",
"0.6047195",
"0.6037968",
"0.603676",
"0.60192496",
"0.6006551",
"0.5993154",
"0.5983737",
"0.59043485",
... | 0.6089047 | 9 |
Provide a human readable representation of this object. | def __repr__(self) -> str:
skip = ()
items = (
"{}={}".format(k, repr(v))
for k, v in self.__dict__.items()
if k not in skip
)
return "<{}({})>".format(self.__class__.__name__, ", ".join(items)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return \"<%s: %s>\" % (self.__class__, self.describe())",
"def describe(self):\n return str(self)",
"def __str__(self):\n if self.__description:\n return self.__description\n return repr(self)",
"def __repr__(self):\n return str(self.__dict__... | [
"0.85030085",
"0.8300885",
"0.8244565",
"0.8220404",
"0.8220404",
"0.8220404",
"0.8220404",
"0.8220404",
"0.8150463",
"0.8102265",
"0.81000656",
"0.81000656",
"0.80629987",
"0.80590695",
"0.80590695",
"0.80590695",
"0.80590695",
"0.80590695",
"0.80590695",
"0.80590695",
"0.80... | 0.0 | -1 |
Retrieves a value from the config parser. | def _GetConfigValue(self, config_parser, section_name, value_name):
try:
return config_parser.get(section_name, value_name).decode('utf-8')
except configparser.NoOptionError:
return | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _GetConfigValue(self, config_parser, section_name, value_name):\n try:\n return config_parser.get(section_name, value_name).decode('utf-8')\n except (configparser.NoOptionError, configparser.NoSectionError):\n return",
"def get_config_value(self, name):\r\n if name in self.config_value... | [
"0.7771524",
"0.72632587",
"0.72562516",
"0.7231387",
"0.7180348",
"0.7152527",
"0.7135673",
"0.70670396",
"0.6819385",
"0.68079066",
"0.6805623",
"0.6791728",
"0.6755313",
"0.6745314",
"0.6717178",
"0.67007136",
"0.6682381",
"0.66780645",
"0.66668546",
"0.6644024",
"0.663696... | 0.7828994 | 0 |
Initializes a github contributions helper. | def __init__(self, user_mappings):
super(GithubContributionsHelper, self).__init__()
self._alternate_output_format = False
self._user_mappings = user_mappings | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, owner, repo, github_response):\n self.owner = owner\n self.repo = repo\n self.number = github_response['number']\n self.username = github_response['user']['login']\n self.user_url = github_response['user']['url']\n self.title = github_response['title']\n... | [
"0.63185495",
"0.62853664",
"0.6181784",
"0.6104193",
"0.59050566",
"0.58005875",
"0.5664177",
"0.55889434",
"0.55611813",
"0.55303746",
"0.55025697",
"0.55003685",
"0.5486738",
"0.54730445",
"0.54620427",
"0.5450299",
"0.54495436",
"0.54432213",
"0.54048556",
"0.5361404",
"0... | 0.6745938 | 0 |
Closes the output writer object. | def Close(self):
return | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close(self):\n self.output.close()",
"def close(self):\n self.out_file.close()",
"def close(self):\r\n if self.__writer is not None:\r\n self.__writer.close()",
"def close(self):\n self.file_out.close()",
"def close(self):\n self._closed = True\n sel... | [
"0.7876922",
"0.76582605",
"0.76430863",
"0.76274985",
"0.74859744",
"0.73995525",
"0.73909664",
"0.7373782",
"0.72184306",
"0.7055909",
"0.7055909",
"0.70288664",
"0.6933643",
"0.67121214",
"0.6678854",
"0.6668728",
"0.6644544",
"0.6644544",
"0.6644544",
"0.66031075",
"0.655... | 0.0 | -1 |
CREATE_DATASET Create a new dataset. | def create_dataset(self, k:str, N:int, shape:tuple, dtype=np.float32) -> None:
if k in self.fp.keys():
if self.verbose:
print('dataset %s already exists in internal data' % str(k))
return
if type(shape) is not tuple:
raise ValueError('shape must be a ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_dataset(dataset_name, project=None):\n bigquery_client = bigquery.Client(project=project)\n\n dataset = bigquery_client.dataset(dataset_name)\n\n dataset.create()\n\n print('Created dataset {}.'.format(dataset_name))",
"def create_dataset():\n\n dataset_id = \"{}.airflow\".format(client... | [
"0.7941709",
"0.7912807",
"0.76475465",
"0.7357188",
"0.7332741",
"0.7269704",
"0.72053736",
"0.71413475",
"0.7073372",
"0.70585173",
"0.7013224",
"0.69907296",
"0.6953539",
"0.6950812",
"0.6901694",
"0.6886943",
"0.67950124",
"0.679185",
"0.67825633",
"0.66999835",
"0.669892... | 0.63175887 | 43 |
Test that all the events are properly stored. | def test_accurate(self):
M = simulation.EventMonitor(self.G)
sim = simulation.Simulation(self.G, M, dt=self.dt)
sim.run(self.t_max)
times = self.G.pattern.nonzero()[1]*self.dt
self.assertTrue(np.allclose(sorted(times), M.t))
for (i, t) in zip(M.i, M.t):
self.assertTrue(self.G.pattern[i, i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_gameHandleEvents(self):\n # this kinda gonna be reiterating the other tests??\n # the tests of all the individual methods below make this test work\n pass",
"def test_get_events(self):\n events = gracedb.events()\n for event in events:\n self.assertTrue('gra... | [
"0.7527969",
"0.7155776",
"0.7145005",
"0.69259846",
"0.6917851",
"0.69145364",
"0.6912371",
"0.6888338",
"0.68824285",
"0.6879379",
"0.68482476",
"0.6844045",
"0.67904955",
"0.67640173",
"0.6713294",
"0.6708508",
"0.66980785",
"0.6689647",
"0.66610473",
"0.6620852",
"0.66120... | 0.0 | -1 |
Test that storage is accurate with custom interval. | def test_accurate_interval(self):
interval = 0.5
M = simulation.StateMonitor(self.G, 'v', interval=interval)
sim = simulation.Simulation(self.G, M, dt=self.dt)
sim.run(self.t_max)
v_expected = np.array([i*(M.t + self.dt) for i in xrange(self.N)])
self.assertTrue(np.allclose(M.v, v_expected)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_interval(self):\n\n\t\tself.assertEqual(self.interval, self.tracker.server_class.interval)",
"def test_interval(self):\n # Interval is not supported on MySQL\n if self.database.name == 'mysqldb':\n return\n conn = self.database.connection()\n cursor = conn.cursor()... | [
"0.6657347",
"0.6455442",
"0.6277867",
"0.60733277",
"0.596885",
"0.59567255",
"0.59564763",
"0.58951753",
"0.5859431",
"0.5808392",
"0.5795658",
"0.57874465",
"0.5756947",
"0.57451195",
"0.57442296",
"0.5723408",
"0.5676464",
"0.56661284",
"0.5661708",
"0.562706",
"0.5615096... | 0.66437536 | 1 |
Test controller with vanishing weights. | def test_zero(self):
controller = LinearController(self.G, 2, mode='zero')
sim = simulation.Simulation(self.G, controller, dt=self.dt)
sim.run(self.dt)
self.assertAlmostEqual(np.linalg.norm(controller.W.ravel()), 0.0)
self.assertAlmostEqual(np.linalg.norm(controller.out), 0.0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_weight_decrease(self):\n new_weight = (1 - 0.05) * self.herb.weight\n self.herb.weightloss()\n nt.assert_equal(round(self.herb.weight, 7), round(new_weight, 7))",
"def test_weight_decrease_carn(self):\n new_weight = (1 - 0.125) * self.carn.weight\n self.carn.weightloss... | [
"0.6282826",
"0.61770695",
"0.61273265",
"0.5837296",
"0.58048284",
"0.57963616",
"0.5779904",
"0.5770524",
"0.57501686",
"0.5679012",
"0.5676502",
"0.564979",
"0.563728",
"0.562752",
"0.55774784",
"0.5564742",
"0.555519",
"0.5550397",
"0.5499559",
"0.5495501",
"0.5485591",
... | 0.5747283 | 9 |
Test that we can force the weights to stay positive. | def test_constrain_positive(self):
# first run without constraints and make sure some weights become negative
# NB: need to divide by 2 because the SimpleLayer's `evolve` gets called
# before the plasticity rule's `evolve`, and so the tutor output becomes
# *twice* `out_step`
self.tutor.out_step = s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_weight_is_positive(self):\n nt.assert_greater(self.herb.weight, 0)",
"def test_weight_is_positive_carn(self):\n nt.assert_greater(self.carn.weight, 0)",
"def test_check_null_weight_with_nonzeros() -> None:\n sample_weight = np.ones_like(y_toy)\n sw_out, X_out, y_out = check_null_we... | [
"0.7899517",
"0.7574693",
"0.6764845",
"0.67458266",
"0.67034054",
"0.67010665",
"0.6630825",
"0.66251284",
"0.6612169",
"0.6600548",
"0.6573299",
"0.6563832",
"0.653979",
"0.65337634",
"0.65124184",
"0.6446398",
"0.638029",
"0.63738894",
"0.6370881",
"0.6305685",
"0.6305685"... | 0.69739485 | 3 |
Test that we can force the weights to stay positive. | def test_constrain_positive(self):
# first run without constraints and make sure some weights become negative
# NB: need to divide by 2 because the SimpleLayer's `evolve` gets called
# before the plasticity rule's `evolve`, and so the tutor output becomes
# *twice* `out_step`
self.tutor.out_step = s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_weight_is_positive(self):\n nt.assert_greater(self.herb.weight, 0)",
"def test_weight_is_positive_carn(self):\n nt.assert_greater(self.carn.weight, 0)",
"def test_check_null_weight_with_nonzeros() -> None:\n sample_weight = np.ones_like(y_toy)\n sw_out, X_out, y_out = check_null_we... | [
"0.7899843",
"0.7574691",
"0.67651737",
"0.6745855",
"0.67029047",
"0.6701758",
"0.66307133",
"0.6624664",
"0.66120076",
"0.6600157",
"0.6573501",
"0.6565063",
"0.6539056",
"0.6533849",
"0.65115273",
"0.6445534",
"0.6381412",
"0.63754797",
"0.63716966",
"0.6306137",
"0.630613... | 0.6974296 | 2 |
Test deconvolution with two timescales. | def test_deconvolve_second(self):
tau = 50.0
tau_deconv1 = 20.0
tau_deconv2 = 35.0
mrate = 50.0
Mrate = 100.0
tmax = 100.0
dt = 0.1
self.rule.tau = tau
self.rule.min_rate = mrate
self.rule.max_rate = Mrate
self.rule.compress_rates = False
self.rule.tau_deconv1 = tau_dec... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_deconvolve_symmetric(self):\n tau = 50.0\n tau_deconv1 = 5.0\n tau_deconv2 = 20.0\n mrate = 50.0\n Mrate = 100.0\n\n tmax = 60.0\n dt = 0.1\n\n self.rule.tau = tau\n self.rule.min_rate = mrate\n self.rule.max_rate = Mrate\n self.rule.compress_rates = False\n self.rule.t... | [
"0.64282507",
"0.6305039",
"0.6245069",
"0.62182724",
"0.6133431",
"0.6107571",
"0.5956537",
"0.59557354",
"0.59470016",
"0.59012747",
"0.5888332",
"0.5805929",
"0.58006305",
"0.57936764",
"0.5691477",
"0.5662282",
"0.56433153",
"0.55472803",
"0.551716",
"0.54842436",
"0.5482... | 0.6413375 | 1 |
Check whether user has authorisation to make edits in this academy | def has_academy_access(self, acad_id):
master_access = (PermissionGroups.query
.filter_by(group_name="Master")
.first())
if self.has_auth_access(master_access):
return True
academy = Academy.query.filte... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def can_edit(self, user):\n return self.author_id == user.id or user.is_staff",
"def user_can_edit(self, user):\n return user == self.owner",
"def test_func(self):\n answer = self.get_object()\n return True if self.request.user == answer.author or self.request.user.is_superuser else Fal... | [
"0.7246516",
"0.7076891",
"0.7042649",
"0.702144",
"0.70143193",
"0.69346905",
"0.693315",
"0.690113",
"0.690113",
"0.6870045",
"0.68344486",
"0.6809024",
"0.6760061",
"0.6739009",
"0.67316705",
"0.6728541",
"0.6651187",
"0.66472137",
"0.6635301",
"0.66264796",
"0.6613071",
... | 0.6422915 | 42 |
Draw a collection of lines. | def draw_collection(collection, color=None, layer=None, clear=False, group_collection=False, group_name=None):
colors = list_like(collection, color)
lines = []
for line, rgb in zip(collection, colors):
lines.append({
'start': list(line.start),
'end': l... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def DrawLines(*args, **kwargs):\n return _gdi_.PseudoDC_DrawLines(*args, **kwargs)",
"def DrawLines(*args, **kwargs):\n return _gdi_.DC_DrawLines(*args, **kwargs)",
"def DrawLineList(self, lines, pens=None):\n if pens is None:\n pens = []\n elif isinstance(pens, wx.Pen):\n... | [
"0.7331374",
"0.7317525",
"0.7315203",
"0.7237377",
"0.72169656",
"0.72160655",
"0.70974207",
"0.70948637",
"0.6939401",
"0.6913349",
"0.6776746",
"0.6742799",
"0.6713807",
"0.66904086",
"0.6688678",
"0.66644764",
"0.66453815",
"0.6636744",
"0.6629767",
"0.6579093",
"0.657050... | 0.0 | -1 |
Build url section for requesting fields. Returns string. _build_field_request() returns string | def _build_field_request(self):
include = []
for field in self.fields:
if self.fields[field] is True:
include.append(field)
include = '&printFields=' + ','.join(include)
return include | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _build_request_url(self, params, kwargs, post=False):\n if post:\n return '%s%s' % (self.endpoint, self.methodname)\n else:\n return '%s%s?%s' % (self.endpoint, self.methodname, kwargs)",
"def build_url(self, request, action, **query):\n base = urlparse.urljoin(requ... | [
"0.64085364",
"0.62794167",
"0.62771565",
"0.62771565",
"0.6251801",
"0.61218977",
"0.6087071",
"0.6061477",
"0.6029068",
"0.5922624",
"0.58853877",
"0.58853835",
"0.58302647",
"0.58161813",
"0.57343006",
"0.5703065",
"0.5692685",
"0.5660309",
"0.565952",
"0.56572324",
"0.565... | 0.66768503 | 0 |
Return the path to the base folder and the path to the file if it is present in the project. | def check_recursive(base_folders, name) -> 'Optional[Tuple[str, str]]':
for base_folder in base_folders:
for root, dirs, files in os.walk(base_folder):
for f in files:
if f == name:
return osp.dirname(base_folder), root
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_path(self, project_file=None):\n root = os.path.abspath(\n os.path.join(os.path.dirname(__file__), '..', '..')\n )\n if project_file:\n return os.path.join(root, project_file)\n else:\n return root",
"def base_path(self):\n return se... | [
"0.798062",
"0.75320756",
"0.75041085",
"0.74587375",
"0.73903346",
"0.73903346",
"0.73903346",
"0.73903346",
"0.7379813",
"0.7346453",
"0.7309549",
"0.7293107",
"0.72783643",
"0.7262517",
"0.7226026",
"0.7226026",
"0.7149905",
"0.71322846",
"0.71163934",
"0.70629233",
"0.705... | 0.0 | -1 |
Access the packet indicator field first byte. | def type(self):
return struct.unpack('<B', self.raw_data[0])[0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getDataField(self):\n if not self.checkPacketLength():\n raise AttributeError(\"inconsistent packetLength\")\n dataFieldLength = self.packetLength + 1\n return self.getBytes(PRIMARY_HEADER_BYTE_SIZE, dataFieldLength)",
"def next_byte(self):\r\n return self.next_bytes(1)",
"def readByte... | [
"0.64534265",
"0.6442491",
"0.63698435",
"0.63209796",
"0.62407744",
"0.618661",
"0.6166607",
"0.6162412",
"0.60829794",
"0.60751694",
"0.6065768",
"0.6051177",
"0.60055166",
"0.59812737",
"0.59624577",
"0.59462583",
"0.59462583",
"0.5918713",
"0.5918691",
"0.5918505",
"0.590... | 0.5762812 | 38 |
String representation of the decoded packet. | def __str__(self):
return '\tNo readable data representation.' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return '\\n%(source)s > %(type)s (0x%(type_d).2x)\\n%(data)s' % \\\n {'type': DGTL.pkt_type_str[self.type], 'type_d': self.type,\n 'data': str(self.decoded) if self.decoded else 'Unknown raw data.',\n 'source': self.source}",
"def _packet_st... | [
"0.76695573",
"0.72700393",
"0.6919632",
"0.68297493",
"0.67805356",
"0.6630007",
"0.6587308",
"0.6476543",
"0.6449791",
"0.64259374",
"0.64172685",
"0.638863",
"0.638863",
"0.638863",
"0.638863",
"0.638863",
"0.638863",
"0.638863",
"0.638863",
"0.638863",
"0.638863",
"0.63... | 0.0 | -1 |
Returns the opcode field | def opcode(self):
return struct.unpack('<H', self.pkt.payload[0:2])[0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def opcode(self):\n if self.op is None:\n return None\n return self.op.value",
"def get_opcode(self, code):\r\n opcode = int(str(code)[-2:])\r\n return opcode",
"def read_opcode(self) -> int:\n\n offset = self.current_address - self.STARTING_ADDRESS\n\n if s... | [
"0.8187123",
"0.7671392",
"0.75208026",
"0.7456473",
"0.66593695",
"0.65984523",
"0.65605485",
"0.6538594",
"0.64191306",
"0.63911355",
"0.63685006",
"0.62461615",
"0.62461615",
"0.61672693",
"0.61587954",
"0.6154032",
"0.5975539",
"0.5952517",
"0.59519726",
"0.5950461",
"0.5... | 0.8290724 | 0 |
String representation of the decoded packet. | def __str__(self):
return '\tOpcode: %(opcode)d (0x%(opcode).2x)\n' \
'\tLength: %(length)d (0x%(length).2x)\n' \
'\tParameters:\n' \
'\t\t%(data)s' % {'opcode': self.opcode, 'length': self.length,
'data': self.format_raw_data(self.pa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return '\\n%(source)s > %(type)s (0x%(type_d).2x)\\n%(data)s' % \\\n {'type': DGTL.pkt_type_str[self.type], 'type_d': self.type,\n 'data': str(self.decoded) if self.decoded else 'Unknown raw data.',\n 'source': self.source}",
"def _packet_st... | [
"0.76695573",
"0.72700393",
"0.6919632",
"0.68297493",
"0.67805356",
"0.6630007",
"0.6587308",
"0.6476543",
"0.6449791",
"0.64259374",
"0.638863",
"0.638863",
"0.638863",
"0.638863",
"0.638863",
"0.638863",
"0.638863",
"0.638863",
"0.638863",
"0.638863",
"0.638863",
"0.6388... | 0.64172685 | 10 |
String representation of the decoded packet. | def __str__(self):
return '\tHandle: %(handle)d (0x%(handle).2x)\n' \
'\tLength: %(length)d (0x%(length).2x)\n' \
'\tParameters:\n' \
'\t\t%(data)s' % {'handle': self.handle, 'length': self.length,
'data': self.format_raw_data(self.pa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return '\\n%(source)s > %(type)s (0x%(type_d).2x)\\n%(data)s' % \\\n {'type': DGTL.pkt_type_str[self.type], 'type_d': self.type,\n 'data': str(self.decoded) if self.decoded else 'Unknown raw data.',\n 'source': self.source}",
"def _packet_st... | [
"0.76695573",
"0.72700393",
"0.6919632",
"0.68297493",
"0.67805356",
"0.6630007",
"0.6587308",
"0.6476543",
"0.6449791",
"0.64259374",
"0.64172685",
"0.638863",
"0.638863",
"0.638863",
"0.638863",
"0.638863",
"0.638863",
"0.638863",
"0.638863",
"0.638863",
"0.638863",
"0.63... | 0.0 | -1 |
String representation of the decoded packet. | def __str__(self):
return '\tHandle: %(handle)d (0x%(handle).2x)\n' \
'\tLength: %(length)d (0x%(length).2x)\n' \
'\tParameters:\n' \
'\t\t%(data)s' % {'handle': self.handle, 'length': self.length,
'data': self.format_raw_data(self.pa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return '\\n%(source)s > %(type)s (0x%(type_d).2x)\\n%(data)s' % \\\n {'type': DGTL.pkt_type_str[self.type], 'type_d': self.type,\n 'data': str(self.decoded) if self.decoded else 'Unknown raw data.',\n 'source': self.source}",
"def _packet_st... | [
"0.76695573",
"0.72700393",
"0.6919632",
"0.68297493",
"0.67805356",
"0.6630007",
"0.6587308",
"0.6476543",
"0.6449791",
"0.64259374",
"0.64172685",
"0.638863",
"0.638863",
"0.638863",
"0.638863",
"0.638863",
"0.638863",
"0.638863",
"0.638863",
"0.638863",
"0.638863",
"0.63... | 0.0 | -1 |
String representation of the decoded packet. | def __str__(self):
return '\tCode: %(code)d (0x%(code).2x)\n' \
'\tLength: %(length)d (0x%(length).2x)\n' \
'\tParameters:\n' \
'\t\t%(data)s' % {'code': self.code, 'length': self.length,
'data': self.format_raw_data(self.parameters)} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return '\\n%(source)s > %(type)s (0x%(type_d).2x)\\n%(data)s' % \\\n {'type': DGTL.pkt_type_str[self.type], 'type_d': self.type,\n 'data': str(self.decoded) if self.decoded else 'Unknown raw data.',\n 'source': self.source}",
"def _packet_st... | [
"0.76695573",
"0.72700393",
"0.6919632",
"0.68297493",
"0.67805356",
"0.6630007",
"0.6587308",
"0.6476543",
"0.6449791",
"0.64259374",
"0.64172685",
"0.638863",
"0.638863",
"0.638863",
"0.638863",
"0.638863",
"0.638863",
"0.638863",
"0.638863",
"0.638863",
"0.638863",
"0.63... | 0.0 | -1 |
String representation of the decoded packet. | def __str__(self):
return '\tMsg ID: %(msg_id)d (0x%(msg_id).4x)\n' \
'\tSrc. task ID: %(src_task_id)d (0x%(src_task_id).4x)\n' \
'\tDst. task ID: %(dst_task_id)d (0x%(dst_task_id).4x)\n' \
'\tLength: %(length)d (0x%(length).4x)\n' \
'\tParameters:\n' ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return '\\n%(source)s > %(type)s (0x%(type_d).2x)\\n%(data)s' % \\\n {'type': DGTL.pkt_type_str[self.type], 'type_d': self.type,\n 'data': str(self.decoded) if self.decoded else 'Unknown raw data.',\n 'source': self.source}",
"def _packet_st... | [
"0.766953",
"0.72699344",
"0.6919049",
"0.6830453",
"0.6779812",
"0.66305566",
"0.65875816",
"0.6477554",
"0.6449713",
"0.64255065",
"0.6417497",
"0.63893193",
"0.63893193",
"0.63893193",
"0.63893193",
"0.63893193",
"0.63893193",
"0.63893193",
"0.63893193",
"0.63893193",
"0.6... | 0.0 | -1 |
Provide a nice instance representation string. The length/degree of detail can be switched via the class variable `long_repr`. | def __repr__(self) -> str:
if self.long_repr:
attr_repr = 'arr_shape={}, arr_dtype={}, metadata={}'.format(self.data.shape,
self.data.dtype,
self.metadata... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __repr__(self):\n s = ''\n for attr in self.__dict__:\n val = pformat(self.__dict__[attr])[:1500]\n if len(val)>70:\n s+=f'\\n{attr}:\\n{val}\\n\\n'\n else:\n s += f'{attr}: {val}\\n'\n return s",
"def __str__(self):\n ... | [
"0.7424985",
"0.7065908",
"0.70141524",
"0.7013193",
"0.7008164",
"0.6996676",
"0.69442207",
"0.68783367",
"0.6875018",
"0.6872168",
"0.6871172",
"0.68670297",
"0.68596965",
"0.6858567",
"0.6848698",
"0.68422407",
"0.684151",
"0.67972994",
"0.6796759",
"0.67521167",
"0.675199... | 0.73410684 | 1 |
Change the name attribute of a segment. The segment is accessed via its `label_value`. | def rename(self, label_value: int, new_name: str) -> None:
seginfo = self.infos[label_value]
seginfo.name = new_name
# propagate state changes
self._update_state_from_infos() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rename(self, label):\n self._seg_header = self._seg_header.replace(self._label, label)\n self._label = label\n for seg in self._segments:\n seg.rename(label)",
"def set_name(self, name):\n self.name = name\n self.labels.change_name(name)",
"def name(self, value... | [
"0.74237776",
"0.7024633",
"0.6811663",
"0.6811663",
"0.6681774",
"0.65745354",
"0.65458244",
"0.6481394",
"0.6474462",
"0.6459464",
"0.6450721",
"0.643437",
"0.6401439",
"0.6401439",
"0.6395992",
"0.6390431",
"0.63880545",
"0.6361964",
"0.6354115",
"0.6295582",
"0.6295582",
... | 0.78593975 | 0 |
Add an item to the left of the deque | def left_enqueue(self, item):
item_to_add = Node(item)
item_to_add.set_next(self.head)
# if the deque is empty, the new item is the tail
if not self.tail:
self.tail = item_to_add
else:
# connect the old head to the new head
self.head.set_prev(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def appendleft(self, item):\n tmpNode = Node(item, self.head.next)\n self.head.next = tmpNode\n self._size += 1",
"def right_enqueue(self, item):\n item_to_add = Node(item)\n item_to_add.set_prev(self.tail)\n\n # if the deque is empty, the new item is the head\n i... | [
"0.754678",
"0.7425301",
"0.7240149",
"0.71819776",
"0.71179277",
"0.70548034",
"0.6968305",
"0.6947284",
"0.691008",
"0.69081",
"0.6874867",
"0.68729055",
"0.68586403",
"0.68586403",
"0.68532795",
"0.6844967",
"0.68438506",
"0.6718541",
"0.6718313",
"0.6681286",
"0.66544807"... | 0.808663 | 0 |
Set up module once, before any TestCases are run. | def setUpModule():
logging.basicConfig()
# logPoint('module %s' % __name__) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUp(self):\n self.modules = {}",
"def setUp(self):\n test_env_setup()",
"def setUp(self):\n log.debug('TestModule.setUp')\n if self.module is None:\n self.module = _import(self.moduleName, [self.path], self.conf)\n log.debug('Imported %s from %s on %s', s... | [
"0.8089004",
"0.8038264",
"0.79731303",
"0.7948143",
"0.7948143",
"0.788953",
"0.788953",
"0.78740597",
"0.78455335",
"0.7743296",
"0.77400124",
"0.77315354",
"0.77315354",
"0.7727674",
"0.77244264",
"0.76997197",
"0.7658526",
"0.7654174",
"0.76530343",
"0.7642491",
"0.763155... | 0.0 | -1 |
Set up class before _each_ test method is executed. Creates a tensorflow session and instantiates a dbinterface. | def setUp(self):
self.setup_model()
self.sess = tf.Session(
config=tf.ConfigProto(
allow_soft_placement=True,
gpu_options=tf.GPUOptions(allow_growth=True),
log_device_placement=self.params['log_device_placement'],
))
# ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUp(self):\n self._logger = mock_lib.MockBenchmarkLogger()\n\n self.graph = tf.Graph()\n with self.graph.as_default():\n tf.train.create_global_step()\n self.train_op = tf.assign_add(tf.train.get_global_step(), 1)\n self.global_step = tf.train.get_global_... | [
"0.73305035",
"0.70200276",
"0.69346213",
"0.6932429",
"0.68916905",
"0.68707",
"0.68157595",
"0.6775853",
"0.6754787",
"0.6727972",
"0.67227936",
"0.67102116",
"0.670938",
"0.6707399",
"0.6694288",
"0.6654798",
"0.66523933",
"0.6641229",
"0.6623708",
"0.6621165",
"0.66112334... | 0.8358574 | 0 |
Remove a MonogoDB database. | def remove_database(cls, database_name):
cls.log.info('Removing database: {}'.format(database_name))
cls.conn.drop_database(database_name)
cls.log.info('Database successfully removed.') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def drop_db(self):\n db_name = self.db.db_url.split('///')[1]\n if os.path.exists(db_name):\n os.remove(db_name)",
"def drop_db():\n database.db.reflect()\n database.db.drop_all()\n print('Dropped the database')",
"def drop_database():\n drop_db(app)",
"def delete_db():\n... | [
"0.80009437",
"0.78017175",
"0.77897173",
"0.76258606",
"0.75912684",
"0.7514121",
"0.751287",
"0.75036794",
"0.74991983",
"0.74372333",
"0.74372333",
"0.74372333",
"0.74372333",
"0.74372333",
"0.74372333",
"0.74372333",
"0.74372333",
"0.74372333",
"0.743501",
"0.74137664",
"... | 0.7637478 | 3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.