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 |
|---|---|---|---|---|---|---|
Gets the start of this GIFOutput. What second of the storyboard timeline to start the GIF. | def start(self):
return self._start | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getStartTime(self):\n return _osgAnimation.Animation_getStartTime(self)",
"def getStartTime(self):\n return _osgAnimation.Channel_getStartTime(self)",
"def get_start(self):\n return self._start",
"def getStart(self):\n return self._start",
"def _get_start(self):\n ret... | [
"0.7076997",
"0.6851174",
"0.66245645",
"0.6571833",
"0.65565145",
"0.6531953",
"0.65159637",
"0.65159637",
"0.63531405",
"0.63480484",
"0.6346194",
"0.63422894",
"0.6338405",
"0.6206076",
"0.6201802",
"0.61647004",
"0.6138878",
"0.6114829",
"0.6110501",
"0.607757",
"0.606464... | 0.61608136 | 20 |
Sets the start of this GIFOutput. What second of the storyboard timeline to start the GIF. | def start(self, start):
if start is None:
raise ValueError("Invalid value for `start`, must not be `None`")
self._start = start | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start(self, start):\n\n self._start = start",
"def start(self, start):\n\n self._start = start",
"def start(self, start):\n\n self._start = start",
"def start(self, start):\n\n self._start = start",
"def start(self):\n\t\tif self._start is not None:\n\t\t\traise RuntimeError... | [
"0.6723576",
"0.6723576",
"0.6723576",
"0.6723576",
"0.6678015",
"0.665719",
"0.6505287",
"0.6384998",
"0.6332083",
"0.62387615",
"0.62376267",
"0.62024736",
"0.6184223",
"0.6178705",
"0.60933346",
"0.60816824",
"0.60661453",
"0.5995193",
"0.5995193",
"0.59945655",
"0.5989577... | 0.60994416 | 14 |
Gets the duration of this GIFOutput. Seconds for the duration of the GIF. Can't be longer than the video. | def duration(self):
return self._duration | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def duration():\r\n elapsed_time, duration = video_time()\r\n return duration",
"def video_duration(self):\n # type: () -> int\n return self._video_duration",
"def get_duration(self):\n frame_dur = self.get_frame_duration()\n num_frames = self.get_num_frames()\n motion_dur = frame_... | [
"0.7762158",
"0.7709614",
"0.75428295",
"0.7538186",
"0.74586827",
"0.74504477",
"0.74190795",
"0.7403893",
"0.7340937",
"0.733311",
"0.7328377",
"0.7324417",
"0.72875273",
"0.7262277",
"0.7247565",
"0.72455525",
"0.72377896",
"0.7232972",
"0.721482",
"0.7209425",
"0.7201544"... | 0.7359599 | 12 |
Gets the suffix of this GIFOutput. Unique ending of the file name so several outputs can be created then identified. Required if there is more then 1 video output. | def suffix(self):
return self._suffix | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def suffix(self):\n return self[\"suffix\"]",
"def suffix(self):\n return self[\"suffix\"]",
"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 suffix ( self ) :\n ... | [
"0.7610536",
"0.7610536",
"0.75316405",
"0.7521287",
"0.7521287",
"0.7347243",
"0.7304037",
"0.70785016",
"0.70785016",
"0.70710915",
"0.7039384",
"0.69881004",
"0.6693291",
"0.6596418",
"0.65870094",
"0.651454",
"0.64653707",
"0.6425669",
"0.63848877",
"0.63419944",
"0.63229... | 0.7638083 | 2 |
Sets the suffix of this GIFOutput. Unique ending of the file name so several outputs can be created then identified. Required if there is more then 1 video output. | def suffix(self, suffix):
self._suffix = suffix | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setSuffix(self, value):\n return self._set(suffix=value)",
"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 suffix(self):\n return self._suffix",
"def suffix(self):\... | [
"0.7028223",
"0.69330084",
"0.67990613",
"0.67990613",
"0.67990613",
"0.67454875",
"0.67454875",
"0.67304456",
"0.66012996",
"0.66012996",
"0.6601247",
"0.6541266",
"0.63328516",
"0.6209011",
"0.6205128",
"0.61271995",
"0.6105634",
"0.6063221",
"0.60500926",
"0.60498923",
"0.... | 0.73530364 | 3 |
Gets the overlay_alignment of this GIFOutput. Alignment for overlay image in case the image doesn't fit the video perfectly. The first item in the array is X. The second is Y. | def overlay_alignment(self):
return self._overlay_alignment | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def overlay_alignment(self, overlay_alignment):\n allowed_values = [\"left\", \"center\", \"right\", \"top\", \"middle\", \"bottom\"]\n if not set(overlay_alignment).issubset(set(allowed_values)):\n raise ValueError(\n \"Invalid values for `overlay_alignment` [{0}], must be ... | [
"0.6082157",
"0.5811847",
"0.57966024",
"0.5563203",
"0.5563203",
"0.5563203",
"0.5542505",
"0.54789925",
"0.5473381",
"0.5473381",
"0.5473381",
"0.54557025",
"0.5414728",
"0.5391308",
"0.53716415",
"0.53711426",
"0.53711426",
"0.5358381",
"0.5308002",
"0.5301803",
"0.5293957... | 0.78458405 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, GIFOutput):
return False
return self.__dict__ == other.__dict__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8088132",
"0.8088132",
"0.8054589",
"0.7982687",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.845611",
"0.8391477",
"0.8144138",
"0.81410587",
"0.8132492",
"0.8093973",
"0.80920255",
"0.80920255",
"0.80920255",
"0.8085325",
"0.8085325",
"0.8076365",
"0.8076365",
"0.8065748"
] | 0.0 | -1 |
Takes masked softmax over given dimension of logits. | def masked_softmax(logits, mask, dim):
exp_mask = (1 - tf.cast(mask, 'float')) * (-1e30) # -large where there's padding, 0 elsewhere
masked_logits = tf.add(logits, exp_mask) # where there's padding, set logits to -large
prob_dist = tf.nn.softmax(masked_logits, dim)
return masked_logits, prob_dist | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def masked_softmax(logits, mask, dim=-1, log_softmax=False):\n mask = mask.type(torch.float32)\n masked_logits = mask * logits + (1 - mask) * -1e30\n softmax_fn = F.log_softmax if log_softmax else F.softmax\n probs = softmax_fn(masked_logits, dim)\n\n return probs",
"def masked_softmax(tensor, mas... | [
"0.80401665",
"0.7654991",
"0.761089",
"0.75716364",
"0.7517807",
"0.74387515",
"0.7438501",
"0.7347286",
"0.7323559",
"0.73165834",
"0.7309688",
"0.73022497",
"0.7278672",
"0.72193605",
"0.7214303",
"0.71653897",
"0.7160705",
"0.7139164",
"0.70996326",
"0.70656717",
"0.70488... | 0.8118963 | 1 |
Get distance between two points going only through the defense land | def getMazeDistanceDefense(self, p1, p2):
try:
return self.distancerDefense.getDistance(p1, p2)
except Exception:
return self.getMazeDistance(p1, p2) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def distance(self, other_pt, is_lla=True):\n return 0.0",
"def get_distance(first: Point, second: Point) -> Float:\n\n return sqrt(\n (second.x - first.x) ** 2\n +\n (second.y - first.y) ** 2\n )",
"def __get_distance(point1: np.ndarray, point2: np.ndarray) -> float:\n ... | [
"0.744277",
"0.71968544",
"0.7164096",
"0.7129097",
"0.707927",
"0.7068014",
"0.7024101",
"0.7008225",
"0.698951",
"0.6964147",
"0.693927",
"0.6936985",
"0.69191873",
"0.6912923",
"0.687099",
"0.68569434",
"0.68446594",
"0.6841914",
"0.68375",
"0.68300796",
"0.6805769",
"0.... | 0.72054726 | 1 |
Return true if this term and other are strictly syntactically equivalent. This would tipically be in the magic method `__eq__`, but we use `__eq__` for a different purpose, namely, to be able to use Python expressions such as "loc(b1)==table" in order to construct a FOL atom. | def is_syntactically_equal(self, other):
raise NotImplementedError() # To be subclassed | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n if other is self:\n return True\n if isinstance(other, CoordFunctionSymb):\n if other.parent() != self.parent():\n return False\n else:\n return bool(other._express == self._express)\n else:\n ... | [
"0.73922414",
"0.72952706",
"0.7224389",
"0.7203774",
"0.6997577",
"0.6990958",
"0.6936724",
"0.6910764",
"0.6866715",
"0.68585664",
"0.6852991",
"0.6825722",
"0.68223184",
"0.67959416",
"0.6793662",
"0.67728335",
"0.67344457",
"0.673216",
"0.667139",
"0.66642874",
"0.6662836... | 0.7148483 | 4 |
insert a new element e into L after position p in L | def insertAfter(self,p,e):
if p == self.tail: #if p is the tail node
e.prev = p #link e to p
p.next = e #link p to e
self.tail = e #set e to be the 'new' tail node
else:
e.next = p.next #link e to next node of p
e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def insert(self, p, elem):\n node = self._validate(p)\n new_node = self._Node(elem, idx=self._curr_idx, parent=node._parent)\n self._curr_idx += 1\n node._parent = new_node\n new_node._children.append(node)\n self._size += 1\n\n # Invalidate depths and heights after... | [
"0.6875697",
"0.683577",
"0.68196416",
"0.6734926",
"0.6691563",
"0.6660932",
"0.65894085",
"0.6546601",
"0.65235424",
"0.6392077",
"0.6371146",
"0.6342604",
"0.63203907",
"0.63068795",
"0.6300094",
"0.6290958",
"0.6276742",
"0.6204748",
"0.6189171",
"0.6147242",
"0.6122845",... | 0.682632 | 2 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, SearchArticlesOldGet200ApplicationJsonResponse):
return False
return self.to_dict() == other.to_dict() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8088132",
"0.8088132",
"0.8054589",
"0.7982687",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
if not isinstance(other, SearchArticlesOldGet200ApplicationJsonResponse):
return True
return self.to_dict() != other.to_dict() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.845611",
"0.8391477",
"0.8144138",
"0.81410587",
"0.8132492",
"0.8093973",
"0.80920255",
"0.80920255",
"0.80920255",
"0.8085325",
"0.8085325",
"0.8076365",
"0.8076365",
"0.8065748",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
... | 0.0 | -1 |
Create a new decider instance for this tank. | def __init__(self, target_height, margin):
self.target_height = target_height
self.margin = margin | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_test_discount(self):\n return Discount()",
"def create_child(parent, idx):\n boardCopy = deepcopy(parent.currentBoardState)\n action = boardCopy.get_available_actions()[idx]\n parent.children[idx] = DecisionTree(boardCopy, action, parent.level+1, parent, strategy=parent.strategy)",
"de... | [
"0.5191765",
"0.5076142",
"0.5060887",
"0.5056275",
"0.49928105",
"0.49708506",
"0.49122322",
"0.4881246",
"0.48092645",
"0.48057178",
"0.48007756",
"0.4775759",
"0.4762769",
"0.47324157",
"0.47183925",
"0.4665197",
"0.4644241",
"0.46142703",
"0.459592",
"0.45821506",
"0.4580... | 0.0 | -1 |
Creates a onedimensional copy of the original list. Each atomic value is copied directly into the returned list. Each list or tuple encountered in the original list has its elements fully expanded into the returned list. | def flatten(list_to_flatten):
flattened_list = []
for item in list_to_flatten:
if isinstance(item, list) or isinstance(item, tuple):
flattened_list += flatten(item)
else:
flattened_list.append(item)
return flattened_list | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def copy_list(original_list):\n list_copy = []\n for i in range(len(original_list)):\n list_copy.append([])\n for j in range(len(original_list)):\n list_copy[i].append(original_list[i][j])\n return list_copy",
"def list_copy(l: List[Any]) -> List[Any]:\n return [item for item... | [
"0.6927564",
"0.64464235",
"0.63768125",
"0.6303269",
"0.6203216",
"0.61485165",
"0.6136498",
"0.61050004",
"0.6041816",
"0.6032829",
"0.59858614",
"0.59675235",
"0.5932443",
"0.58459234",
"0.5824462",
"0.57863224",
"0.5776607",
"0.57702994",
"0.5757627",
"0.5735408",
"0.5725... | 0.51816493 | 97 |
Objects are equal when the have the same DN. | def testDeleteOpEqualitySameDN(self):
first_entry = entry.BaseLDAPEntry(dn="ou=Team, dc=example,dc=com")
second_entry = entry.BaseLDAPEntry(dn="ou=Team, dc=example,dc=com")
first = delta.DeleteOp(first_entry)
second = delta.DeleteOp(second_entry)
self.assertEqual(first, second) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testDeleteOpEqualityEqualDN(self):\n first_dn = distinguishedname.DistinguishedName(\n stringValue=\"ou=Team,dc=example,dc=com\"\n )\n first = delta.DeleteOp(first_dn)\n\n second_entry = entry.BaseLDAPEntry(dn=\"ou=Team, dc=example, dc=com\")\n second = delta.Delet... | [
"0.665897",
"0.6595536",
"0.6559323",
"0.65231705",
"0.64151347",
"0.63600206",
"0.6305464",
"0.6276601",
"0.62563235",
"0.61931187",
"0.61730045",
"0.6166215",
"0.61655784",
"0.61634344",
"0.61440104",
"0.6120709",
"0.6116827",
"0.6102328",
"0.6101921",
"0.60912746",
"0.6087... | 0.6638436 | 1 |
DeleteOp objects are equal if their DNs are equal. | def testDeleteOpEqualityEqualDN(self):
first_dn = distinguishedname.DistinguishedName(
stringValue="ou=Team,dc=example,dc=com"
)
first = delta.DeleteOp(first_dn)
second_entry = entry.BaseLDAPEntry(dn="ou=Team, dc=example, dc=com")
second = delta.DeleteOp(second_entry... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testDeleteOpEqualitySameDN(self):\n first_entry = entry.BaseLDAPEntry(dn=\"ou=Team, dc=example,dc=com\")\n second_entry = entry.BaseLDAPEntry(dn=\"ou=Team, dc=example,dc=com\")\n\n first = delta.DeleteOp(first_entry)\n second = delta.DeleteOp(second_entry)\n\n self.assertEqua... | [
"0.73695445",
"0.7121779",
"0.6974125",
"0.6964153",
"0.68876994",
"0.66953886",
"0.6677444",
"0.62607294",
"0.62252873",
"0.62102026",
"0.6203794",
"0.61505586",
"0.5923089",
"0.58912915",
"0.5797456",
"0.57742137",
"0.5747886",
"0.56847215",
"0.56771487",
"0.56651294",
"0.5... | 0.7539459 | 0 |
DeleteOp objects are not equal when the have different LDAP entries. | def testDeleteOpInequalityDifferentEntry(self):
first_entry = entry.BaseLDAPEntry(dn="ou=Team, dc=example,dc=com")
second_entry = entry.BaseLDAPEntry(dn="ou=Cowboys, dc=example,dc=com")
first = delta.DeleteOp(first_entry)
second = delta.DeleteOp(second_entry)
self.assertNotEqua... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testDeleteOpEqualityEqualDN(self):\n first_dn = distinguishedname.DistinguishedName(\n stringValue=\"ou=Team,dc=example,dc=com\"\n )\n first = delta.DeleteOp(first_dn)\n\n second_entry = entry.BaseLDAPEntry(dn=\"ou=Team, dc=example, dc=com\")\n second = delta.Delet... | [
"0.8243594",
"0.8238518",
"0.79273254",
"0.7917759",
"0.7837672",
"0.7599454",
"0.7520965",
"0.7130038",
"0.6935918",
"0.6859313",
"0.68569475",
"0.6782144",
"0.6508775",
"0.6477197",
"0.62264705",
"0.6213489",
"0.6212964",
"0.60358036",
"0.6033882",
"0.60309523",
"0.59265226... | 0.81283015 | 2 |
Invalid type of DN raises AssertionError | def testDeleteOpInvalidDN(self):
self.assertRaises(AssertionError, delta.DeleteOp, 0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_udp_unknown_rec_type():\n with pytest.raises(SystemExit):\n assert dnsck_query(\"8.8.8.8\", \"google.com\", \"XYZ\", 1)",
"def test_invalid_email_domain_input(self):\n email_dom = '*.domain.loc'\n domain = SpokeEmailDomain(self.org_name)\n self.assertRaises(error.InputErro... | [
"0.6102946",
"0.60879546",
"0.60435635",
"0.59925544",
"0.59021413",
"0.5806988",
"0.5777806",
"0.5716664",
"0.57142717",
"0.56849355",
"0.5669419",
"0.5668466",
"0.5655222",
"0.5636531",
"0.56307924",
"0.56252545",
"0.56155413",
"0.5597194",
"0.5589934",
"0.5567641",
"0.5567... | 0.6022595 | 3 |
Modify operations are not equal with other object types. | def testInequalityNotModifyOP(self):
sut = delta.ModifyOp("cn=john,dc=example,dc=com", [delta.Delete("description")])
self.assertNotEqual("cn=john,dc=example,dc=com", sut) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other):\n if not isinstance(other, VmdkDiskModify):\n return True\n\n return self.to_dict() != other.to_dict()",
"def test_not_equal_on_not_equal_data_type(self):\n a = objects.OpaqueObject(self.bytes_a, enums.OpaqueDataType.NONE)\n b = objects.OpaqueObject... | [
"0.66701645",
"0.6650229",
"0.66290677",
"0.6574526",
"0.65306",
"0.6503209",
"0.6490417",
"0.64533794",
"0.6431893",
"0.641037",
"0.63912207",
"0.63811505",
"0.6380642",
"0.63728714",
"0.6324027",
"0.6298897",
"0.6289167",
"0.62679493",
"0.626407",
"0.62496984",
"0.6221644",... | 0.64344126 | 8 |
Calculate the precisionrecall (PR) curve. It's not a public method. Use it only when you understand what you are doing exactly. The PR curve result is similar to that in sklearn and ROCR in R with minor difference. The first precisionrecall pair always takes the value (1,0). | def _cal_pr_curve(self, labelAndVectorisedScores):
rawPredictionCol = self.rawPredictionColValue
labelCol = self.labelColValue
curve = precision_recall_curve(labelAndVectorisedScores, rawPredictionCol, labelCol).select("precision","recall")
return curve | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def precision_recall(y_true, y_prob, ARGS):\n average_precision = average_precision_score(y_true, y_prob)\n if ARGS.graphs:\n precision, recall, _ = precision_recall_curve(y_true, y_prob)\n plt.style.use('ggplot')\n plt.clf()\n plt.plot(recall, precision,\n label='... | [
"0.7959289",
"0.77566373",
"0.7682807",
"0.74131346",
"0.73854953",
"0.73743725",
"0.73437935",
"0.7288011",
"0.72208554",
"0.72071886",
"0.718288",
"0.7181433",
"0.7181433",
"0.7180739",
"0.7163176",
"0.7161011",
"0.7159116",
"0.70982945",
"0.7091552",
"0.70432097",
"0.70173... | 0.8154175 | 0 |
Take file path as string; return text as string. Takes a string that is a file path, opens the file, and turns the file's contents as one string of text. | def open_and_read_file(file_path):
# your code goes here
text_file = open(file_path)
text_string= text_file.read()
text_file.close()
return text_string | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def open_and_read_file(file_path):\n\n text_file = open(file_path)\n full_text = text_file.read()\n\n return full_text",
"def openFile(filepath):\n assert checkExistenceFile(filepath), \"filepath does not exist\"\n with open(filepath, \"r\", encoding=\"utf-8\") as f:\n text = \" \".join(map... | [
"0.80470866",
"0.8014033",
"0.7990872",
"0.7920758",
"0.786444",
"0.7798141",
"0.7678207",
"0.76581025",
"0.76132697",
"0.76079136",
"0.7569296",
"0.7539552",
"0.75283855",
"0.75040907",
"0.7503145",
"0.7498271",
"0.7412663",
"0.73693025",
"0.7360746",
"0.7329229",
"0.72927",... | 0.80692214 | 0 |
Test for error if data_type = list but raw data file is in plate format. | def test_incorrect_data_type_list():
test_object = fa.read_in_envision(data_csv=plate_1, platemap_csv=plate_map_file, data_type='list', size=384) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_incorrect_data_type_plate():\n \n test_object = fa.read_in_envision(data_csv=list_A, platemap_csv=plate_map_file, data_type='plate', size=384)",
"def test_incorrect_data_type():\n \n test_object = fa.read_in_envision(data_csv=list_A, platemap_csv=plate_map_file, data_type='typo', siz... | [
"0.75342304",
"0.70626557",
"0.6768114",
"0.6571354",
"0.61076355",
"0.59984607",
"0.59412366",
"0.593715",
"0.58935404",
"0.5881785",
"0.58569247",
"0.5786611",
"0.57838047",
"0.5749198",
"0.574268",
"0.5735595",
"0.5733344",
"0.5718264",
"0.5713996",
"0.56484675",
"0.559914... | 0.7635421 | 0 |
Add a vertex to the graph. | def add_vertex(self, vertex_id):
self.vertices[vertex_id] = set() # set of edges from this vert
# a set is like a list except it allows O(1) lookups like a hashtable and it doesn't allow duplicates | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_vertex(self, vertex):\n raise NotImplementedError",
"def add_vertex(self, vertex):\n if isinstance(vertex, Vertex):\n self.vertices.append(vertex)\n return\n raise TypeError('Is not vertex instance!')",
"def add_vertex(self, vertex_name: n):\n new_verte... | [
"0.8703537",
"0.84338593",
"0.8423067",
"0.8409588",
"0.83660835",
"0.8317327",
"0.8255059",
"0.8086839",
"0.8082268",
"0.803738",
"0.80348116",
"0.7882737",
"0.78723216",
"0.7840483",
"0.7840483",
"0.7762625",
"0.775688",
"0.77160776",
"0.7714244",
"0.7668677",
"0.76634395",... | 0.72670186 | 39 |
Add a directed edge to the graph. | def add_edge(self, v1, v2):
# First we check to see if the vertices we're trying to connect exist
if v1 in self.vertices and v2 in self.vertices:
# If they do exist, we add v2 as a neighbor to v1
self.vertices[v1].add(v2)
else:
# If v1 or v2 does not exist, we... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_edge(self, edge):\n src = edge.get_source()\n dest = edge.get_destination()\n #weightEdge = WeightedEdge(src, dest, edge.get_total_distance(), edge.get_outdoor_distance())\n if not (src in self.edges and dest in self.edges):\n raise ValueError('Node not in graph')\n ... | [
"0.78169996",
"0.77789694",
"0.7618847",
"0.761851",
"0.75694674",
"0.7547367",
"0.7483565",
"0.7437083",
"0.74284625",
"0.7422367",
"0.741715",
"0.7337182",
"0.73281914",
"0.7266331",
"0.7227267",
"0.7212267",
"0.71977764",
"0.7194343",
"0.71735585",
"0.7168542",
"0.7152955"... | 0.6447642 | 88 |
Get all neighbors (edges) of a vertex. | def get_neighbors(self, vertex_id):
return self.vertices[vertex_id] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def neighbors_in(self, vertex):\n return list(self.neighbor_in_iterator(vertex))",
"def neighbors_out(self, vertex):\n return list(self.neighbor_out_iterator(vertex))",
"def get_neighbours(self, vertex):\n output = []\n \n if vertex in self.adjacency_list:\n for ne... | [
"0.8146008",
"0.78266084",
"0.78112674",
"0.7634123",
"0.76183206",
"0.7559868",
"0.7391218",
"0.73596346",
"0.73310196",
"0.7279731",
"0.71649474",
"0.7128683",
"0.7083494",
"0.7077735",
"0.7033856",
"0.69887614",
"0.69749075",
"0.6923719",
"0.68615776",
"0.6847223",
"0.6838... | 0.729323 | 13 |
Writes a flag to a register with the given offset.\n | def write_flag_data(self, flag, register_address, offset):
if len(flag) + offset > 8:
raise ValueError("Flag + offset exceeded 8 bit limit.")
register_value = self.read_byte_data(register_address)
for index, value in enumerate(flag):
if value:
register_va... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setFlag(flagbyte, pos, status):\n if status:\n return flagbyte | 2**pos\n else:\n return flagbyte & ~2**pos",
"def set_flag(self, flag_name, value):\n flags = {'C':0, # Carry\n 'Z':1, # Zero\n 'I':2, # Interrupt mask\n 'D':3, # De... | [
"0.6303939",
"0.62794644",
"0.6193683",
"0.61641306",
"0.6088857",
"0.5993474",
"0.596513",
"0.59287363",
"0.5836613",
"0.5812747",
"0.5805649",
"0.5772962",
"0.5758084",
"0.5718409",
"0.5704642",
"0.5610061",
"0.5600659",
"0.5600078",
"0.5501439",
"0.5494253",
"0.548575",
... | 0.7759315 | 0 |
The Proximity Interrupt Threshold sets the high and low trigger points for the comparison function which generates an interrupt. If the value generated by the proximity channel, crosses below the lower threshold or above the higher threshold, an interrupt may be signaled to the host processor. Interrupt generation is s... | def set_proximity_interrupt_thresholds(self, low_thr, high_thr):
self.write_byte_data(low_thr, APDS_9960.PROX_INT_LOW_THR_REG_ADDRESS)
self.write_byte_data(high_thr, APDS_9960.PROX_INT_HIGH_THR_REG_ADDRESS) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _proximity_thread(self):\n count = 0\n while True:\n print(\"---------------- Analizo si debo detectar enemigos - PROXIMITY\")\n print(\"----- DEBO?? ::::> self.enemy_not_detected = {}\".format(self.enemy_not_detected))\n while self.enemy_not_detected:\n ... | [
"0.5534539",
"0.54538596",
"0.5126924",
"0.51206297",
"0.505338",
"0.5048163",
"0.5048163",
"0.5048163",
"0.5048163",
"0.5048163",
"0.5022339",
"0.4987388",
"0.4979836",
"0.49741766",
"0.49654108",
"0.49539858",
"0.4941065",
"0.49398372",
"0.49256364",
"0.49235585",
"0.491772... | 0.6906886 | 0 |
Returns how many four byte data points UDLR are ready for read over I2C. One fourbyte dataset is equivalent to a single count. | def get_number_of_datasets_in_fifo(self):
return self.read_byte_data(APDS_9960.GESTURE_FIFO_LEVEL_REG_ADDRESS) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def raw_data_length(self):\n return self.unpack_dword(0x4)",
"def data_count(self):\n return(len(self.data))",
"def getDataSetCount(self):\n\t\treturn int(self.numberOfImages / self.slicesPerTimepoint)",
"def data_length(self):\n size = self.unpack_dword(0x4)\n if size >= 0x800000... | [
"0.6965965",
"0.6805894",
"0.677659",
"0.6650018",
"0.6626462",
"0.660655",
"0.6508911",
"0.6501165",
"0.6457129",
"0.63789034",
"0.6369483",
"0.63651574",
"0.6353523",
"0.634668",
"0.63127184",
"0.6292377",
"0.6277734",
"0.626514",
"0.62461203",
"0.62191695",
"0.6219098",
... | 0.6746333 | 3 |
Return product id of the order. | def product_id(self):
return self._product_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def product_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"product_id\")",
"def order_id(self) -> str:\n return pulumi.get(self, \"order_id\")",
"def product_id(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"product_id\")",
"def product_id(self) -> Optional[pulumi.I... | [
"0.75733906",
"0.74336404",
"0.73466593",
"0.7327513",
"0.69790107",
"0.69345057",
"0.6861878",
"0.6836638",
"0.6635784",
"0.6635784",
"0.6571606",
"0.65395075",
"0.64812005",
"0.63588506",
"0.62382644",
"0.6232359",
"0.62090987",
"0.6192391",
"0.6189691",
"0.61673254",
"0.60... | 0.7661305 | 2 |
Return item type of the order. | def item_type(self):
return self._item_type | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def item_type(self) -> str:\n return self.__item_type",
"def GetItemType(self, item):\r\n\r\n return item.GetType()",
"def item_type(self):\n pass",
"def _type(self, item):\n return self.cv.type(item)",
"def _get_item_type(item_dict):\n\n if 'object' in item_dict:\n ... | [
"0.7878613",
"0.7632085",
"0.76022285",
"0.72713494",
"0.7140311",
"0.65833795",
"0.65375483",
"0.653278",
"0.64914745",
"0.64649284",
"0.6431173",
"0.6399569",
"0.6393856",
"0.6391988",
"0.63863796",
"0.6381702",
"0.63592213",
"0.6328614",
"0.6316727",
"0.631637",
"0.6296000... | 0.78946465 | 0 |
Return item name of the order. | def name(self):
return self._name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_item_name(self):\n return self.__item_name",
"def getName(self,item):\n return item.s",
"def get_item_name(self, i):\n for item in self.items:\n if item['id'] == i:\n return item['localized_name']\n return 'Unknown Item'",
"def format_item(self, o... | [
"0.7870671",
"0.7556543",
"0.71382755",
"0.6934038",
"0.69025004",
"0.68930954",
"0.6725883",
"0.6696614",
"0.66641533",
"0.65920144",
"0.65798575",
"0.65130144",
"0.64259017",
"0.6419284",
"0.63608354",
"0.635453",
"0.6233386",
"0.6228149",
"0.6177948",
"0.61624074",
"0.6156... | 0.0 | -1 |
Return the holiday that the item for. | def holiday(self):
return self._holiday | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _holiday_parser(item):\n\n return item['summary'], item.get('start',{}).get('date'), item.get('end',{}).get('date')",
"def holiday_type() -> Holiday:\n return Holiday.EASTER",
"def holiday_type() -> Holiday:\n return Holiday.CHRISTMAS",
"def get_holiday(self, date):\n if date.... | [
"0.72972995",
"0.67561626",
"0.6577892",
"0.6061763",
"0.6009833",
"0.5928844",
"0.5921662",
"0.5920972",
"0.5895366",
"0.5789303",
"0.576882",
"0.57558805",
"0.57488185",
"0.5738588",
"0.5726189",
"0.56056666",
"0.5596636",
"0.5571406",
"0.554734",
"0.554123",
"0.5535749",
... | 0.81748694 | 0 |
Set the invalid notes. | def set_invalid_notes(self, error):
self._invalid_notes = error | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def invalid_notes(self):\n return self._invalid_notes",
"def notes(self, notes: str):\n self._notes = notes",
"def notes(self, notes):\n\n self._notes = notes",
"def notes(self, notes):\n\n self._notes = notes",
"def notes(self, notes):\n\n self._notes = notes",
"def no... | [
"0.730826",
"0.67267275",
"0.66282713",
"0.66282713",
"0.66282713",
"0.66282713",
"0.66282713",
"0.6261393",
"0.6240077",
"0.6159089",
"0.6155227",
"0.60829383",
"0.599079",
"0.5827429",
"0.5736566",
"0.5701913",
"0.5699494",
"0.5683367",
"0.5591186",
"0.5569768",
"0.547599",... | 0.84916085 | 0 |
Saves changes to DB. If there is `updated` field in model sets it's value to current time | def save(self, flush_only=False):
try:
# set `updated` field with current datetime
if 'updated' in self.columns and self.get('updated') is not None:
self.set(updated=text('now()'))
self.s.add(self)
if flush_only:
self.s.flush()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save(self):\n self.updated_at = datetime.now()",
"def save(self, *args, **kwargs):\n self.modify_ts = datetime.now()\n super(ModelBase, self).save(*args, **kwargs)",
"def save(self):\n from models import storage\n self.updated_at = datetime.now()\n storage.save... | [
"0.7989006",
"0.7342806",
"0.73408216",
"0.7330617",
"0.7323052",
"0.7323052",
"0.7223719",
"0.72018397",
"0.7156861",
"0.6995323",
"0.6935213",
"0.6935213",
"0.6843707",
"0.6843707",
"0.6829831",
"0.680846",
"0.680846",
"0.680846",
"0.6770967",
"0.6770967",
"0.67044",
"0.6... | 0.5886115 | 64 |
Assert create of coupon business from SugarCRM account. | def test_sync_biz_from_sugar_acct(self):
LOG.debug('test_sync_biz_from_sugar_acct')
business = Business.objects.get(id=114)
advertiser = business.advertiser
module = "Accounts"
query = build_recent_entry_query(module=module, test_mode=True,
get_modified=False, start=... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_create_coupon_definition(self):\n pass",
"def test_update_coupon_definition(self):\n pass",
"def test_client_bank_account_create(self):\n pass",
"def test_get_active_coupon(self):\n coupon = COUPON_FACTORY.create_coupon()\n slot = SLOT_FACTORY.create_slot(coupon=co... | [
"0.7462063",
"0.6744753",
"0.6724438",
"0.6466636",
"0.64611053",
"0.643641",
"0.6409974",
"0.6333359",
"0.62230194",
"0.6154744",
"0.5997458",
"0.5916436",
"0.58945185",
"0.58517826",
"0.5819267",
"0.58043146",
"0.57985806",
"0.5796583",
"0.5761732",
"0.5751245",
"0.57463956... | 0.6122855 | 10 |
Assert create of coupon business from SugarCRM contact. | def test_sync_from_sugar_contact(self):
LOG.debug('test_sync_from_sugar_contact')
business = Business.objects.get(id=114)
advertiser = Advertiser.objects.get(id=114)
email = advertiser.email
module = "Contacts"
query = build_recent_entry_query(module=module, test_mode=Tru... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_create_coupon_definition(self):\n pass",
"def test_website_companies_create(self):\n pass",
"def test_update_coupon_definition(self):\n pass",
"def test_create_account_campaign(self, create):\n \"\"\"Campaigns should be created\"\"\"\n row = {'PROJ_NAME1': 'Argenti... | [
"0.70949316",
"0.6541851",
"0.6399019",
"0.63015497",
"0.62419224",
"0.60687506",
"0.6056447",
"0.6038391",
"0.60067683",
"0.59705",
"0.59677804",
"0.59333086",
"0.589922",
"0.58825874",
"0.5880873",
"0.5877111",
"0.58503705",
"0.58325475",
"0.58100945",
"0.58008313",
"0.5798... | 0.60524577 | 7 |
Test task that will sync recently modified and created SugarCRM accounts and contacts data to coupon website. | def test_sync_modify_biz_from_sugar(self):
LOG.debug('test_sync_modify_biz_from_sugar')
sync_business_from_sugar(get_modified=True, sugar=self.sugar)
self.assertTrue(True) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_sync_biz_to_sugar_coupon(self):\n LOG.debug('test_sync_biz_to_sugar_coupon')\n consumer = Consumer.objects.get(id=300)\n consumer.first_name = 'Danielle'\n consumer.last_name = 'Dongo'\n consumer.save()\n coupon = Coupon.objects.get(id=300)\n location = Loc... | [
"0.7445045",
"0.71122766",
"0.6862755",
"0.682964",
"0.6565033",
"0.6416634",
"0.63961476",
"0.6234564",
"0.60413563",
"0.6014782",
"0.59478164",
"0.589701",
"0.5895136",
"0.5886317",
"0.5852639",
"0.58312035",
"0.58291084",
"0.5824226",
"0.57904667",
"0.57891405",
"0.5734122... | 0.61891896 | 8 |
This function prints and plots the confusion matrix. Normalization can be applied by setting `normalize=True`. | def plot_confusion_matrix(cm, classes,
normalize=False,
title='Confusion matrix',
cmap=plt.cm.Blues):
if normalize:
cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis]
print("Normalized confusion matrix")
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_confusion_matrix(cm, classes=[0,1], normalize=False, title='Confusion matrix', print_matrix=False):\n\n if normalize:\n cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis]\n print(\"Normalized confusion matrix\")\n else:\n print('Confusion matrix, without normalization')\n\n... | [
"0.8194862",
"0.80949175",
"0.8029915",
"0.8019153",
"0.79941195",
"0.7991258",
"0.7980955",
"0.7976606",
"0.79610753",
"0.79590565",
"0.79378676",
"0.7934962",
"0.7934504",
"0.79313844",
"0.7926313",
"0.7924577",
"0.79241234",
"0.7923211",
"0.7923023",
"0.7921931",
"0.791787... | 0.7845746 | 48 |
Sets the inventory_reference_type of this CreateAdsByInventoryReferenceRequest. | def inventory_reference_type(self, inventory_reference_type):
self._inventory_reference_type = inventory_reference_type | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inventory_reference_id(self, inventory_reference_id):\n\n self._inventory_reference_id = inventory_reference_id",
"def inventory_id(self, inventory_id):\n\n self._inventory_id = inventory_id",
"def inventory(self, inventory):\n\n self._inventory = inventory",
"def inventory_items(sel... | [
"0.64331234",
"0.5246117",
"0.5223081",
"0.49133226",
"0.47064462",
"0.4672102",
"0.46364635",
"0.46090922",
"0.46090922",
"0.46090922",
"0.46090922",
"0.45791408",
"0.45752478",
"0.45637342",
"0.45555532",
"0.45555532",
"0.45555532",
"0.4546563",
"0.45451772",
"0.45405617",
... | 0.8307037 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, CreateAdsByInventoryReferenceRequest):
return False
return self.__dict__ == other.__dict__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8088132",
"0.8088132",
"0.8054589",
"0.7982687",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.845611",
"0.8391477",
"0.8144138",
"0.81410587",
"0.8132492",
"0.8093973",
"0.80920255",
"0.80920255",
"0.80920255",
"0.8085325",
"0.8085325",
"0.8076365",
"0.8076365",
"0.8065748"
] | 0.0 | -1 |
Uses the information in the XML to create a Course object to send to Parse | def parse_create_course(xml_course):
attrs = [
"term-code",
"term-description",
'subject',
"course-number",
"school",
"department",
"title",
"description",
"credit-hours",
"distribution-group"
]
course = pull_attributes_from_xml(xml_course, attrs)
course["sections"] = []
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_course(xml_course):\n\n parse_course = parse_get_course(xml_course)\n if not parse_course: # Does not already exist, create\n parse_course = parse_create_course(xml_course)\n else:\n # TODO: Update existing attributes of the course here and upload the changes\n None\n parse_course_id = up... | [
"0.7376115",
"0.6733328",
"0.6598599",
"0.6522951",
"0.63766646",
"0.62547004",
"0.60987",
"0.60921395",
"0.60627925",
"0.6030125",
"0.6019453",
"0.6005106",
"0.5900326",
"0.58816576",
"0.5865308",
"0.5858704",
"0.5853114",
"0.5842916",
"0.5832726",
"0.5832424",
"0.5831467",
... | 0.79287744 | 0 |
Entirely processes a Course given it's XML data. Creates / Updates the corresponding Parse Course and Parse Section. | def process_course(xml_course):
parse_course = parse_get_course(xml_course)
if not parse_course: # Does not already exist, create
parse_course = parse_create_course(xml_course)
else:
# TODO: Update existing attributes of the course here and upload the changes
None
parse_course_id = upload_course(p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_create_course(xml_course):\n attrs = [\n \"term-code\",\n \"term-description\",\n 'subject',\n \"course-number\",\n \"school\",\n \"department\",\n \"title\",\n \"description\",\n \"credit-hours\",\n \"distribution-group\"\n ]\n course = pull_attributes_from_xml(xml_cours... | [
"0.6962763",
"0.64638436",
"0.641806",
"0.62422866",
"0.6193113",
"0.61114055",
"0.608011",
"0.6013513",
"0.6002378",
"0.56043005",
"0.5571442",
"0.5534993",
"0.5486418",
"0.5453523",
"0.5442029",
"0.54323494",
"0.5428582",
"0.5420072",
"0.5415792",
"0.5405431",
"0.5392446",
... | 0.8557731 | 0 |
Compute the mismatch mixing matrix for A(k) with an _lambdaexponentially decaying mixing coefficient in the Hamming distance (number of character mismatches). | def get_exp_mismatch_matrix(k, _lambda):
words = get_words(k)
N = len(words)
exp_mismatch_matrix = np.zeros((N, N))
for i in range(N):
exp_mismatch_matrix[i,i] = 1
for j in range(i+1, N):
exp_mismatch_matrix[i,j] = _lambda**Levenshtein.hamming(words[i], words[j])
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_mismatch_matrix(k,m):\n words = get_words(k)\n N = len(words)\n\n mismatch_matrix = np.zeros((N, N))\n for i in range(N):\n for j in range(i, N):\n if Levenshtein.hamming(words[i], words[j]) <= m:\n mismatch_matrix[i,j] = 1/2\n mismatch_matrix[j,i... | [
"0.60043955",
"0.584836",
"0.5295001",
"0.5183668",
"0.5108589",
"0.5089423",
"0.5051361",
"0.5040407",
"0.5032514",
"0.50196207",
"0.5013043",
"0.4982249",
"0.4963083",
"0.4911103",
"0.4889793",
"0.48831633",
"0.48796803",
"0.48700666",
"0.48386526",
"0.48216584",
"0.4814628... | 0.7275287 | 0 |
Returns true if the bounding boxes intersect | def intersects(self, other: "BB") -> bool:
return bool(lib.cpBBIntersects(self, other)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def doBoundingBoxesIntersect(self, other):\n if(self.upperLeft.x <= other.lowerRight.x and\n self.lowerRight.x >= other.upperLeft.x and\n self.upperLeft.y >= other.lowerRight.y and\n self.lowerRight.y <= other.upperLeft.y):\n return True\n return False"... | [
"0.7917236",
"0.7433382",
"0.73676354",
"0.7323342",
"0.7283105",
"0.72586185",
"0.7230588",
"0.72287357",
"0.7222845",
"0.72152424",
"0.71825683",
"0.7179442",
"0.71124595",
"0.70957017",
"0.70947075",
"0.70937395",
"0.7029807",
"0.70073956",
"0.6959474",
"0.6942189",
"0.693... | 0.6963489 | 18 |
Merges this and other then returns the area of the merged bounding box. | def merged_area(self, other: "BB") -> float:
return lib.cpBBMergedArea(self, other) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def intersect_over_union(self, other: 'BoundingBox2D') -> float:\n intersection = self.intersection(other)\n if intersection is None:\n return 0.0\n return intersection.area / (self.area + other.area - intersection.area)",
"def merge_boxes(b_a, b_b):\n x1 = min(b_a[0], b_b[... | [
"0.7157065",
"0.71257174",
"0.6863361",
"0.6718412",
"0.6672673",
"0.65338534",
"0.64984745",
"0.6486933",
"0.6463623",
"0.6392254",
"0.6305657",
"0.6289434",
"0.6286845",
"0.62425774",
"0.623435",
"0.6214841",
"0.6189725",
"0.6187245",
"0.61332756",
"0.61302435",
"0.61198205... | 0.8213908 | 0 |
Provide a certificate chain PEM file path via fixture. | def tls_certificate_chain_pem_path(tls_certificate):
with tls_certificate.private_key_and_cert_chain_pem.tempfile() as cert_pem:
yield cert_pem | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _use_certificate_chain_file_test(self, certdir):\n chain = _create_certificate_chain()\n [(cakey, cacert), (ikey, icert), (skey, scert)] = chain\n\n makedirs(certdir)\n\n chainFile = join_bytes_or_unicode(certdir, \"chain.pem\")\n caFile = join_bytes_or_unicode(certdir, \"ca.... | [
"0.65376246",
"0.6510968",
"0.64322776",
"0.6361593",
"0.60838246",
"0.60578936",
"0.59323585",
"0.5911285",
"0.5909131",
"0.586066",
"0.5757245",
"0.5733029",
"0.57099134",
"0.5704165",
"0.5615864",
"0.55440724",
"0.55197316",
"0.54616076",
"0.5460418",
"0.5451866",
"0.54236... | 0.7069549 | 0 |
'super' is called cause this class is part of the SpotifyClient mixin and all the constructors of mixin base classes should be called | def __init__(self, **config):
super().__init__(**config)
for required in [
"CLIENT_ID", "CLIENT_SECRET", "USER_ID"]:
if not required in config:
raise RuntimeError(
"Required key is missing from the config: {}".format(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, client):\n super().__init__(client)",
"def __init__(self, **kwargs):\n # Call superclass\n super().__init__(**kwargs)",
"def __init__(self, *args, **kwargs):\n self._initialize_protocols()\n super().__init__(*args, **kwargs)",
"def __init__(self, **kwargs... | [
"0.76301706",
"0.7138623",
"0.7082449",
"0.7049371",
"0.69989604",
"0.69989604",
"0.69989604",
"0.69989604",
"0.69989604",
"0.6977749",
"0.69485176",
"0.69485176",
"0.69299436",
"0.69299436",
"0.69299436",
"0.6924915",
"0.6923379",
"0.6895334",
"0.6895072",
"0.6895072",
"0.68... | 0.0 | -1 |
Returns the URL used to authorize Spotify to access the playlist | def start_login(self, controller=None,
scope=('user-modify-playback-state',
'playlist-modify-private',
'user-read-playback-state')):
authentication_params = {}
authentication_params['grant_type'] = 'authorization_code'
au... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getauthenticationurl():\n\n # read application keys from env variables\n appid, appsecret, redirecturi = readappkeys()\n\n # generate random state string for request (for security)\n state = ''.join(random.choice(string.ascii_lowercase + string.digits \n + string.ascii_uppercase) for... | [
"0.7664534",
"0.7005464",
"0.69552195",
"0.64460176",
"0.6185538",
"0.6177314",
"0.61346537",
"0.6055279",
"0.5944853",
"0.59444726",
"0.593703",
"0.5909125",
"0.5888972",
"0.5854268",
"0.58344334",
"0.5831299",
"0.5813125",
"0.58006614",
"0.5737664",
"0.57366407",
"0.5734806... | 0.0 | -1 |
Test that a token is created for the user | def test_create_token_for_user(self):
payload = {
'email': 'test@max.net',
'password': 'Testpass123',
'name': 'Maks'
}
create_user(**payload)
res = self.client.post(TOKEN_URL, payload)
self.assertIn('token', res.data)
self.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_create_token_valid(self):\n create_mock_user(**self.mock_user)\n res = self.client.post(TOKEN_URL, self.mock_user)\n\n self.assertEqual(res.status_code, status.HTTP_200_OK)\n self.assertIn('token', res.data)",
"def test_create_token_for_user(self):\n payload = {'email'... | [
"0.8524954",
"0.8461728",
"0.8460548",
"0.8412818",
"0.8412537",
"0.8401617",
"0.825214",
"0.8243027",
"0.82033753",
"0.8139369",
"0.7937181",
"0.79370046",
"0.79301524",
"0.78969824",
"0.7844167",
"0.78259856",
"0.7804769",
"0.7752505",
"0.77294105",
"0.7720604",
"0.7707844"... | 0.84151304 | 3 |
Test that token is not created if user doesn't exists | def test_create_token_no_user(self):
payload = {
'email': 'test@max.net',
'password': 'testpass',
'name': 'Maks'
}
res = self.client.post(TOKEN_URL, payload)
self.assertNotIn('token', res.data)
self.assertEqual(res.status_code, status... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_create_token_no_user(self):\n res = self.client.post(TOKEN_URL, self.mock_user)\n\n self.assertEqual(res.status_code, status.HTTP_400_BAD_REQUEST)\n self.assertNotIn('token', res.data)",
"def test_create_token_no_user(self):\n payload = {\n 'email': 'test@gmail.com... | [
"0.804403",
"0.79388356",
"0.78894347",
"0.7885779",
"0.7755042",
"0.7703482",
"0.76045763",
"0.75595903",
"0.7531418",
"0.7526247",
"0.749789",
"0.7478718",
"0.7438763",
"0.7421789",
"0.7401069",
"0.7393741",
"0.7387908",
"0.73829055",
"0.7354504",
"0.73526466",
"0.7351663",... | 0.7817135 | 4 |
Test retrieving profile for logged in user | def test_retrieve_profile_success(self):
res = self.client.get(ME_URL)
self.assertEqual(res.status_code, status.HTTP_200_OK)
self.assertEqual(res.data, {
'name': self.user.name,
'email': self.user.email,
}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_retrieve_profile(self):\n\n response = self.client.get(URL_ME)\n\n self.assertEqual(response.status_code, status.HTTP_200_OK)\n\n # Check that the user object returns as expected. There is no need\n # (and it is not secure) to return a password to client side.\n self.ass... | [
"0.8208589",
"0.807811",
"0.8027141",
"0.80075693",
"0.7999291",
"0.7981915",
"0.79818964",
"0.7970111",
"0.795909",
"0.7951995",
"0.79075676",
"0.79026365",
"0.78413916",
"0.7817132",
"0.7801892",
"0.77627635",
"0.77301943",
"0.77071506",
"0.76768214",
"0.7648913",
"0.758592... | 0.8024252 | 3 |
Return iterable with strip_value items removed from beginning. | def v0_lstrip(iterable, strip_value):
stripped = []
is_beginning = True
for item in iterable:
if is_beginning:
if item != strip_value:
is_beginning = False
else:
continue
stripped.append(item)
return stripped | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def v4_lstrip(iterable, strip_value):\n stripped = []\n def is_strip_value(value): return value == strip_value\n for item in dropwhile(is_strip_value, iterable):\n stripped.append(item)\n return stripped",
"def v1_lstrip(iterable, strip_value):\n stripped = []\n is_beginning = True\n ... | [
"0.77129996",
"0.7655893",
"0.75878036",
"0.7578346",
"0.73598844",
"0.73241323",
"0.7268078",
"0.7177186",
"0.71711046",
"0.6862552",
"0.68594253",
"0.66307306",
"0.6221924",
"0.61717254",
"0.6156851",
"0.60763013",
"0.6043025",
"0.59987134",
"0.59019655",
"0.5735523",
"0.57... | 0.77285135 | 0 |
Return iterable with strip_value items removed from beginning. | def v1_lstrip(iterable, strip_value):
stripped = []
is_beginning = True
for item in iterable:
if is_beginning and item == strip_value:
continue
is_beginning = False
stripped.append(item)
return stripped | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def v0_lstrip(iterable, strip_value):\n stripped = []\n is_beginning = True\n for item in iterable:\n if is_beginning:\n if item != strip_value:\n is_beginning = False\n else:\n continue\n stripped.append(item)\n return stripped",
"def... | [
"0.77279246",
"0.77117336",
"0.7585977",
"0.7576826",
"0.7358597",
"0.73228806",
"0.72670853",
"0.717575",
"0.71704465",
"0.6864692",
"0.6858694",
"0.6629628",
"0.62193835",
"0.61715555",
"0.6153395",
"0.60745984",
"0.6041615",
"0.5996829",
"0.59021205",
"0.57330346",
"0.5705... | 0.7655379 | 2 |
Return iterable with strip_value items removed from beginning. | def v2_lstrip(iterable, strip_value):
stripped = []
iterator = iter(iterable)
try:
item = next(iterator)
while item == strip_value:
item = next(iterator)
stripped.append(item)
except StopIteration:
pass
else:
for item in iterator:
strip... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def v0_lstrip(iterable, strip_value):\n stripped = []\n is_beginning = True\n for item in iterable:\n if is_beginning:\n if item != strip_value:\n is_beginning = False\n else:\n continue\n stripped.append(item)\n return stripped",
"def... | [
"0.77285135",
"0.77129996",
"0.7655893",
"0.7578346",
"0.73598844",
"0.73241323",
"0.7268078",
"0.7177186",
"0.71711046",
"0.6862552",
"0.68594253",
"0.66307306",
"0.6221924",
"0.61717254",
"0.6156851",
"0.60763013",
"0.6043025",
"0.59987134",
"0.59019655",
"0.5735523",
"0.57... | 0.75878036 | 3 |
Return iterable with strip_value items removed from beginning. | def v3_lstrip(iterable, strip_value):
stripped = []
iterator = iter(iterable)
for item in iterator:
if not item == strip_value:
stripped.append(item)
break
for item in iterator:
stripped.append(item)
return stripped | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def v0_lstrip(iterable, strip_value):\n stripped = []\n is_beginning = True\n for item in iterable:\n if is_beginning:\n if item != strip_value:\n is_beginning = False\n else:\n continue\n stripped.append(item)\n return stripped",
"def... | [
"0.77285135",
"0.77129996",
"0.7655893",
"0.75878036",
"0.73598844",
"0.73241323",
"0.7268078",
"0.7177186",
"0.71711046",
"0.6862552",
"0.68594253",
"0.66307306",
"0.6221924",
"0.61717254",
"0.6156851",
"0.60763013",
"0.6043025",
"0.59987134",
"0.59019655",
"0.5735523",
"0.5... | 0.7578346 | 4 |
Return iterable with strip_value items removed from beginning. | def v4_lstrip(iterable, strip_value):
stripped = []
def is_strip_value(value): return value == strip_value
for item in dropwhile(is_strip_value, iterable):
stripped.append(item)
return stripped | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def v0_lstrip(iterable, strip_value):\n stripped = []\n is_beginning = True\n for item in iterable:\n if is_beginning:\n if item != strip_value:\n is_beginning = False\n else:\n continue\n stripped.append(item)\n return stripped",
"def... | [
"0.77285135",
"0.7655893",
"0.75878036",
"0.7578346",
"0.73598844",
"0.73241323",
"0.7268078",
"0.7177186",
"0.71711046",
"0.6862552",
"0.68594253",
"0.66307306",
"0.6221924",
"0.61717254",
"0.6156851",
"0.60763013",
"0.6043025",
"0.59987134",
"0.59019655",
"0.5735523",
"0.57... | 0.77129996 | 1 |
Return iterable with strip_value items removed from beginning. | def v5_lstrip(iterable, strip_value):
def is_strip_value(value): return value == strip_value
return dropwhile(is_strip_value, iterable) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def v0_lstrip(iterable, strip_value):\n stripped = []\n is_beginning = True\n for item in iterable:\n if is_beginning:\n if item != strip_value:\n is_beginning = False\n else:\n continue\n stripped.append(item)\n return stripped",
"def... | [
"0.77279246",
"0.77117336",
"0.7655379",
"0.7585977",
"0.7576826",
"0.7358597",
"0.73228806",
"0.717575",
"0.71704465",
"0.6864692",
"0.6858694",
"0.6629628",
"0.62193835",
"0.61715555",
"0.6153395",
"0.60745984",
"0.6041615",
"0.5996829",
"0.59021205",
"0.57330346",
"0.57058... | 0.72670853 | 7 |
Return iterable with strip_value items removed from beginning. | def v6_lstrip(iterable, strip_value):
iterator = iter(iterable)
for item in iterator:
if item != strip_value:
yield item
break
for item in iterator:
yield item | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def v0_lstrip(iterable, strip_value):\n stripped = []\n is_beginning = True\n for item in iterable:\n if is_beginning:\n if item != strip_value:\n is_beginning = False\n else:\n continue\n stripped.append(item)\n return stripped",
"def... | [
"0.77285135",
"0.77129996",
"0.7655893",
"0.75878036",
"0.7578346",
"0.73241323",
"0.7268078",
"0.7177186",
"0.71711046",
"0.6862552",
"0.68594253",
"0.66307306",
"0.6221924",
"0.61717254",
"0.6156851",
"0.60763013",
"0.6043025",
"0.59987134",
"0.59019655",
"0.5735523",
"0.57... | 0.73598844 | 5 |
Return iterable with strip_value items removed from beginning. | def v6_lstrip(iterable, strip_value):
iterator = iter(iterable)
for item in iterator:
if item != strip_value:
yield item
break
yield from iterator | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def v0_lstrip(iterable, strip_value):\n stripped = []\n is_beginning = True\n for item in iterable:\n if is_beginning:\n if item != strip_value:\n is_beginning = False\n else:\n continue\n stripped.append(item)\n return stripped",
"def... | [
"0.77285135",
"0.77129996",
"0.7655893",
"0.75878036",
"0.7578346",
"0.73598844",
"0.7268078",
"0.7177186",
"0.71711046",
"0.6862552",
"0.68594253",
"0.66307306",
"0.6221924",
"0.61717254",
"0.6156851",
"0.60763013",
"0.6043025",
"0.59987134",
"0.59019655",
"0.5735523",
"0.57... | 0.73241323 | 6 |
Return iterable with strip_value items removed from beginning. | def v7_lstrip(iterable, strip_value):
iterator = iter(iterable)
for item in iterator:
if (callable(strip_value) and not strip_value(item)
or not callable(strip_value) and item != strip_value):
yield item
break
yield from iterator | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def v0_lstrip(iterable, strip_value):\n stripped = []\n is_beginning = True\n for item in iterable:\n if is_beginning:\n if item != strip_value:\n is_beginning = False\n else:\n continue\n stripped.append(item)\n return stripped",
"def... | [
"0.77285135",
"0.77129996",
"0.7655893",
"0.75878036",
"0.7578346",
"0.73598844",
"0.73241323",
"0.7268078",
"0.71711046",
"0.6862552",
"0.68594253",
"0.66307306",
"0.6221924",
"0.61717254",
"0.6156851",
"0.60763013",
"0.6043025",
"0.59987134",
"0.59019655",
"0.5735523",
"0.5... | 0.7177186 | 8 |
Return iterable with strip_value items removed from beginning. | def v8_lstrip(iterable, strip_value):
iterator = iter(iterable)
if callable(strip_value):
predicate = strip_value
else:
def predicate(value): return value == strip_value
for item in iterator:
if not predicate(item):
yield item
break
yield from iterator | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def v0_lstrip(iterable, strip_value):\n stripped = []\n is_beginning = True\n for item in iterable:\n if is_beginning:\n if item != strip_value:\n is_beginning = False\n else:\n continue\n stripped.append(item)\n return stripped",
"def... | [
"0.77279246",
"0.77117336",
"0.7655379",
"0.7585977",
"0.7576826",
"0.7358597",
"0.73228806",
"0.72670853",
"0.717575",
"0.6864692",
"0.6858694",
"0.6629628",
"0.62193835",
"0.61715555",
"0.6153395",
"0.60745984",
"0.6041615",
"0.5996829",
"0.59021205",
"0.57330346",
"0.57058... | 0.71704465 | 9 |
Return iterable with strip_value items removed from beginning. | def v9_lstrip(iterable, strip_value):
if callable(strip_value):
predicate = strip_value
else:
def predicate(value): return value == strip_value
return dropwhile(predicate, iterable) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def v0_lstrip(iterable, strip_value):\n stripped = []\n is_beginning = True\n for item in iterable:\n if is_beginning:\n if item != strip_value:\n is_beginning = False\n else:\n continue\n stripped.append(item)\n return stripped",
"def... | [
"0.77285135",
"0.77129996",
"0.7655893",
"0.75878036",
"0.7578346",
"0.73598844",
"0.73241323",
"0.7268078",
"0.7177186",
"0.71711046",
"0.6862552",
"0.66307306",
"0.6221924",
"0.61717254",
"0.6156851",
"0.60763013",
"0.6043025",
"0.59987134",
"0.59019655",
"0.5735523",
"0.57... | 0.68594253 | 11 |
Applies inplace linear activation | def __call__(self, x):
np.multiply(x, self.slope, out=x)
np.add(x, self.bias, out=x)
return x | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def linear_activation_forward(A_prev, W, b, activation):\n pass",
"def linear_activation_forward(A_prev, W, b, activation):\n Z, linear_cache = linear_forward(A_prev, W, b)\n if activation == 'sigmoid':\n activation_fun = sigmoid\n else:\n activation_fun = relu\n A, cache = activatio... | [
"0.78238016",
"0.7253499",
"0.7113381",
"0.71122736",
"0.70810336",
"0.7012244",
"0.69595957",
"0.6942727",
"0.69128925",
"0.68755966",
"0.6852831",
"0.6824166",
"0.6789728",
"0.67681146",
"0.67663103",
"0.6718598",
"0.66713166",
"0.6643897",
"0.65571713",
"0.6546967",
"0.654... | 0.0 | -1 |
Applies inverted sigmoid inplace | def __call__(self, x):
np.subtract(x, self.d, out=x)
np.divide(self.a, x, out=x)
np.subtract(x, self.b, out=x)
np.log(x, out=x)
np.divide(x, -self.e, out=x)
np.add(x, self.c, out=x)
return x | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inverse_sigmoid(x):\n y = -1 * np.log((1-x)/x)\n return y",
"def sigmoid(z):\r\n \r\n return vSigmoid(z);",
"def swish(x):\n return x * k.activations.sigmoid(x)",
"def swish(x):\n return x * tf.sigmoid(x)",
"def activation_sigmoid(self):\n self.value = 1 / (1 + np.e ** (-self.... | [
"0.75106734",
"0.75092953",
"0.73808044",
"0.73472565",
"0.73404986",
"0.7290867",
"0.7290837",
"0.7245116",
"0.72361183",
"0.7213144",
"0.7213144",
"0.7199016",
"0.7183686",
"0.7171895",
"0.7162724",
"0.71618813",
"0.7150425",
"0.7141738",
"0.7136035",
"0.7135243",
"0.712966... | 0.0 | -1 |
Obtaining a Pauli error rate from an empirical decay curve. | def pauli_error_fit(
num_cycle_range: np.ndarray, data: np.ndarray, *, num_qubits: int = 2, add_offset: bool = False
) -> Tuple[float, np.ndarray, np.ndarray]:
f_s = 1.0e2
def _exp_decay_with_offset(
length: np.ndarray, err: float, a_coeff: float, b_coeff: float
) -> np.ndarray:
p = 1.0... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pauli_error_to_decay_constant(self, pauli_error: float, num_qubits: int = 1):\n N = 2 ** num_qubits\n return 1 - (pauli_error / (1 - 1 / N / N))",
"def calc_error_amp(amp_pred, pdur, model):\n theta_pred = list(forward_pass(model, pdur, amp_pred))[0]\n return np.log(np.maximum(1e-... | [
"0.6633635",
"0.5984317",
"0.59809506",
"0.5942395",
"0.5937436",
"0.5909725",
"0.5794775",
"0.57891876",
"0.5784051",
"0.5758449",
"0.5750015",
"0.5750015",
"0.5688634",
"0.5685889",
"0.5682493",
"0.5680682",
"0.5667898",
"0.5656839",
"0.5617177",
"0.56053925",
"0.55998826",... | 0.54116875 | 36 |
Splits data into train/val/test subsets | def split(self, train_fraction=0.8, val_fraction=0.2, test_fraction=0, seed=1):
if self.is_initialized():
return
self.ensure_fraction_sum(train_fraction, val_fraction, test_fraction)
np.random.seed(seed)
self.samples = sorted(self.samples)
np.random.shuffle(self.sampl... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def train_val_test_split(data):\n raise NotImplementedError",
"def __split_dataset(self):\n self.train, self.valid, _, _ = train_test_split(self.data, self.data, test_size=0.2)\n self.valid, self.test, _, _ = train_test_split(self.valid, self.valid, test_size=0.5)",
"def split_data_into_train_... | [
"0.8326181",
"0.82755184",
"0.8240179",
"0.7841811",
"0.78244966",
"0.7819313",
"0.77936596",
"0.77811414",
"0.7773943",
"0.7643291",
"0.7630211",
"0.7630134",
"0.7604545",
"0.7580003",
"0.75724965",
"0.7525816",
"0.7521702",
"0.7519651",
"0.75031596",
"0.7492511",
"0.7489865... | 0.705187 | 73 |
The setter for the subject's education. | def education(self, education):
self.logger.debug("In 'education' setter.")
self._education = education | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subject(self, value):\n self.set_property(\"subject\", value)",
"def study(self, study):\n self.logger.debug(\"In 'study' setter.\")\n\n self._study = study",
"def set_subject(self, subject):\n self._subject = subject",
"def change_subject(self, new_subject):\n raise No... | [
"0.5795873",
"0.55750304",
"0.5570268",
"0.5530429",
"0.5493474",
"0.5493474",
"0.5493474",
"0.54005027",
"0.5381545",
"0.5318309",
"0.5318309",
"0.5307106",
"0.52891785",
"0.5287006",
"0.52413213",
"0.523876",
"0.52178764",
"0.51306283",
"0.51233983",
"0.5068059",
"0.5049448... | 0.84062594 | 0 |
The setter for the gestational age at delivery. | def ga_at_delivery(self, ga_at_delivery):
self.logger.debug("In 'ga_at_delivery' setter.")
self._ga_at_delivery = ga_at_delivery | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_age(self, age):\n self.__age = age",
"def age(self, age):\n\n self._age = age",
"def age(self, age):\n\n self._age = age",
"def set_age(self, age):\n self.age = float(age)",
"def set_age(self, newage):\n self.age = newage",
"def age(self):\n return self._... | [
"0.7584002",
"0.75798273",
"0.75798273",
"0.752224",
"0.7486885",
"0.74444014",
"0.7389936",
"0.7326969",
"0.72830474",
"0.72830474",
"0.72830474",
"0.7277231",
"0.7266985",
"0.72298354",
"0.7226066",
"0.718807",
"0.7165034",
"0.707837",
"0.70711815",
"0.7048963",
"0.70006585... | 0.0 | -1 |
Returns true if the current user has moderator access to this game. | def current_user_moderating(self):
return self.user_moderating(users.GetCurrentUser()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_moderator(self):\n return self.user_type == 'M'",
"def is_mod():\n\n async def predicate(ctx: commands.context):\n if any(role.name in MODERATOR_ROLES for role in ctx.message.author.roles):\n return True\n else:\n await ctx.send(\n f\"Sorry {ctx... | [
"0.8183338",
"0.75612557",
"0.7522311",
"0.74560916",
"0.74560916",
"0.74443835",
"0.73708737",
"0.7347426",
"0.7195451",
"0.71045125",
"0.70880973",
"0.70880973",
"0.7063466",
"0.704253",
"0.70394504",
"0.6947849",
"0.69445515",
"0.69445515",
"0.6938868",
"0.6932087",
"0.690... | 0.7404325 | 6 |
Returns true if the given user has moderator acces to this game. | def user_moderating(self, user):
if not user: return False
query = db.Query(GameModerator)
query.filter('game =', self)
query.filter('user =', user)
return query.get() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def checkIfAllowed(self, user):\n\n # Default case if mod access is not needed everyone has access\n if not self.modOnlyAccess:\n return True\n\n # Otherwise check the user's access level\n if user.modAccess == self.modOnlyAccess:\n return True\n else:\n ... | [
"0.7828556",
"0.77501905",
"0.7736339",
"0.7736339",
"0.76756227",
"0.75299066",
"0.73816484",
"0.73230696",
"0.73103917",
"0.729185",
"0.72802365",
"0.72083044",
"0.71758336",
"0.7058588",
"0.7058509",
"0.7045077",
"0.70308125",
"0.70189774",
"0.70164526",
"0.70089716",
"0.7... | 0.786476 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, SmartContractsExternalEvent):
return False
return self.__dict__ == other.__dict__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8089204",
"0.8089204",
"0.8055265",
"0.7983358",
"0.7967577",
"0.7967577",
"0.7967577",
"0.7967577",
"0.7967577",
"0.7967577",
"0.7967577",
"0.7967577",
"0.7967577",
"0.7967577",
"0.7967577",
"0.7967577",
"0.7967577",
"0.7967577",
"0.7967577",
"0.7967577",
"0.7967577",
"... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.845611",
"0.8391477",
"0.8144138",
"0.81410587",
"0.8132492",
"0.8093973",
"0.80920255",
"0.80920255",
"0.80920255",
"0.8085325",
"0.8085325",
"0.8076365",
"0.8076365",
"0.8065748"
] | 0.0 | -1 |
!Take a vector, normalize and rotate it 90 degrees. | def NR(ip, fp):
x = fp[0] - ip[0]
y = fp[1] - ip[1]
r = sqrt(x ** 2 + y ** 2)
return array([-y / r, x / r]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalize(vector):\n return vector / np.linalg.norm(vector)",
"def unit_vector(vector):\r\n return vector / np.linalg.norm(vector)",
"def unit_vector(vector):\r\n return vector / np.linalg.norm(vector)",
"def unit_vector(vector):\r\n return vector / np.linalg.norm(vector)",
"def normali... | [
"0.71244574",
"0.6952223",
"0.6952223",
"0.6952223",
"0.6928747",
"0.69084775",
"0.69084775",
"0.69084775",
"0.69084775",
"0.69084775",
"0.69084775",
"0.69084775",
"0.69084775",
"0.69084775",
"0.69084775",
"0.69084775",
"0.6848545",
"0.6826794",
"0.6784497",
"0.6762535",
"0.6... | 0.0 | -1 |
Add noncaching headers on every request. | def add_header(response):
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control
response.cache_control.no_store = True
return response | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_header(req):\n req.headers[\"Cache-Control\"] = \"no-cache\"\n return req",
"def disable_caching(self):\n\n def after_request(r: flask.Response):\n if 'Cache-Control' not in r.headers:\n r.headers['Cache-Control'] = 'no-store'\n return r\n\n ... | [
"0.74973166",
"0.748153",
"0.73780614",
"0.7354821",
"0.7340503",
"0.7238027",
"0.7234116",
"0.71540225",
"0.7139049",
"0.70819616",
"0.70819616",
"0.7081777",
"0.70774555",
"0.7069949",
"0.7069949",
"0.7069949",
"0.7069949",
"0.7069949",
"0.7069949",
"0.7069949",
"0.7069949"... | 0.74886334 | 2 |
Multiline string based on max available width. | def same_len(txt, name_len):
return '\n'.join(txt + ([' '] * (name_len - len(txt)))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _multiline_width(multiline_s, line_width_fn=len):\n return max(map(line_width_fn, re.split(\"[\\r\\n]\", multiline_s)))",
"def limit_max_len(data, indentation, max_length=MAX_LENGTH): \n buf = ''\n while len(data) > MAX_LENGTH:\n idx = data.rfind(' ', 0, MAX_LENGTH)\n buf += '%s\\n%... | [
"0.7045821",
"0.6897236",
"0.67795783",
"0.67193043",
"0.6708668",
"0.65434706",
"0.6513859",
"0.64862955",
"0.6335112",
"0.63170445",
"0.6309135",
"0.6297263",
"0.6276366",
"0.6260004",
"0.6234242",
"0.62333167",
"0.6220249",
"0.62160796",
"0.61966604",
"0.6147532",
"0.61455... | 0.0 | -1 |
Delete a number of messages from the channel. Default is 10. Max 100. | async def purge(self, ctx, msg_number: int = 10):
if ctx.guild.id == 202724765218242560:
return
if msg_number > 100:
await ctx.error("No more than 100 messages can be purged at a time.")
return
deleted = await ctx.channel.purge(limit=msg_number)
s =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def channel_(self, ctx, number=10):\n number = number if number <= 100 else 100\n question = await ctx.send(f\"this will delete the last {number} messages from ALL users. Continue?\")\n await question.add_reaction(self.reactions[0])\n await question.add_reaction(self.reactions[1])... | [
"0.7288479",
"0.72206223",
"0.7182962",
"0.7022472",
"0.6961094",
"0.69093484",
"0.6867969",
"0.6842305",
"0.6701014",
"0.6677718",
"0.6663868",
"0.666008",
"0.6650558",
"0.6520946",
"0.65097123",
"0.6386746",
"0.6380716",
"0.6371731",
"0.6360819",
"0.6308435",
"0.62655646",
... | 0.7220789 | 1 |
Function that find minimal element in array | def min_search(arr: Sequence) -> int:
if len(arr) == 0:
print("упс")
return
i = 0
min_index = 0
min_value = arr[0]
while i < len(arr) - 1:
i += 1
if arr[i] < min_value:
min_value = arr[i]
min_index = i
print(f"arr:{arr},\nmin:{min_value}; index:{min_index}")
return min_index | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def min(self):\n a = self.array_form\n min = len(a)\n for i in xrange(len(a)):\n if a[i] != i and a[i] < min:\n min = a[i]\n return min",
"def min_search(arr: Sequence) -> int:\n\tprint(arr)\n\tmin_index = None\n\tmin_elem = arr[0]\n\tfor i in range(1, len(ar... | [
"0.7925055",
"0.7658557",
"0.76490307",
"0.7593806",
"0.75074613",
"0.74905646",
"0.74420714",
"0.7398279",
"0.7398279",
"0.735186",
"0.7324894",
"0.7082873",
"0.70476097",
"0.70369023",
"0.7016719",
"0.7015526",
"0.7004855",
"0.6989546",
"0.6985163",
"0.69713104",
"0.6943967... | 0.72386086 | 11 |
Returns a dictionary containg the default settings specified in this class. These settings cover global toolbox settings, such as ``enableCExtensions``, as well as the image preprocessing settings (e.g. resampling). Feature class specific are defined in the respective feature classes and and not included here. Similarl... | def _getDefaultSettings(cls):
return {'minimumROIDimensions': 1,
'minimumROISize': None, # Skip testing the ROI size by default
'normalize': False,
'normalizeScale': 1,
'removeOutliers': None,
'resampledPixelSpacing': None, # No resampling by default
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def settings(self) -> Dict[str, Any]:\n settings = {}\n if self.pre_thresholder is not None:\n settings['pre_thresh'] = self.pre_thresholder.threshold\n if self.pre_thresholder.val_low_class != 0.:\n settings['pre_val_low'] = self.pre_thresholder.val_low_class\n ... | [
"0.7154207",
"0.70924383",
"0.6903164",
"0.68919384",
"0.68635166",
"0.68474275",
"0.6748116",
"0.67425704",
"0.672394",
"0.66872275",
"0.66056347",
"0.65817654",
"0.6545441",
"0.65379333",
"0.65102243",
"0.64229476",
"0.6391109",
"0.6390645",
"0.6373113",
"0.6338724",
"0.631... | 0.74119973 | 0 |
Returns a list of all possible feature classes. | def getFeatureClassNames(self):
return self.featureClasses.keys() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def classes(self):\n return list(self._classes_generator())",
"def all(cls):\n results = []\n for name in FEATURES:\n feat = cls.get_by_name(name)\n if feat is None:\n feat = cls(name=name)\n cls.query.session.add(feat)\n results... | [
"0.7083753",
"0.7047303",
"0.6986615",
"0.693242",
"0.6733783",
"0.6730487",
"0.67188895",
"0.6682392",
"0.6679798",
"0.66244197",
"0.65775675",
"0.65715474",
"0.65669453",
"0.65622187",
"0.65523064",
"0.65395606",
"0.65354544",
"0.65196466",
"0.65172577",
"0.65092283",
"0.64... | 0.76183635 | 0 |
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.8095378",
"0.80943215",
"0.7960329",
"0.785324",
"0.7844362",
"0.78259075",
"0.7812201",
"0.7812201",
"0.7812201",
"0.7812201",
"0.7812201",
"0.7812201",
"0.7812201",
"0.7812201",
"0.7812201",
"0.7812201",
"0.7812201",
"0.7812201",
"0.7812201",
"0.7812201",
"0.7812201",
... | 0.7749071 | 35 |
Finds the first occurrence of 'None' in the list of properties. | def find_first_none(self, properties):
for drink in properties:
iterate_drink = iter(drink)
next(iterate_drink)
for drink_property in iterate_drink:
split_property = drink_property.split(": ")[1].split(" //")[0]
if split_property == "None":
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_property(properties, key):\n matching = [prop.split('=').pop(1) for prop in properties\n if prop.startswith(key + '=')]\n if len(matching) > 1:\n raise ValueError('Property %r should appear only once in %r' %\n (key, properties))\n if '' in matching:\... | [
"0.6420576",
"0.6140944",
"0.56629044",
"0.5504727",
"0.5462736",
"0.5437577",
"0.53297234",
"0.52824485",
"0.5245571",
"0.52292776",
"0.5227138",
"0.5211976",
"0.51856893",
"0.5184328",
"0.5180561",
"0.5177724",
"0.516806",
"0.5162539",
"0.5130421",
"0.5128275",
"0.51195353"... | 0.8134218 | 0 |
Initializes the meter to DC voltage measurment in the 10V range | def hp3458a_init(hp_meter):
hp_meter.write("RESET")
hp_meter.write("TARM HOLD")
hp_meter.write("FUNC DCV") # Set to DC voltage measurment
hp_meter.write("RANGE 10") # Set to 10V range
hp_meter.write("LFREQ LINE") # Measure line freq and set rejection filter
hp_meter.write("NPLC 1")
hp_meter.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def configure_vdc(self, rng, res, unit = 'V'):\n self.write_to_serial(':conf:volt:dc ' + str(rng) + ',' + str(res))# + unit)",
"def setvoltages(self):\n pass",
"def meas_voltage(instrument, v_range=10, resolution=0.003):\n return float(instrument.query('MEAS:VOLTage:DC? %s,%s' % (v_range, reso... | [
"0.6578889",
"0.5966041",
"0.5959843",
"0.58004075",
"0.58004075",
"0.57944673",
"0.5790686",
"0.5748484",
"0.5745046",
"0.5723111",
"0.57070476",
"0.56898814",
"0.5680734",
"0.5679567",
"0.5679567",
"0.56482434",
"0.5646847",
"0.5607881",
"0.56076604",
"0.5604224",
"0.560302... | 0.0 | -1 |
r"""Close the websocket connection. | def on_close(self, ws, code, reason):
self.wsapp.keep_running = False
if not self.ws_opened.is_set():
self.ws_opened.set() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close(self) -> None:\n if self.websocket:\n self.websocket.stop()",
"def close(self) -> None:\n _LOGGER.info('Shutting down connections to deCONZ.')\n if self.websocket:\n self.websocket.stop()",
"async def close(self):\n await self._ws.close()\n pri... | [
"0.82686013",
"0.7933651",
"0.7698873",
"0.7587314",
"0.75302136",
"0.7504887",
"0.75026125",
"0.7472136",
"0.74413806",
"0.7424967",
"0.74112785",
"0.73001915",
"0.72993577",
"0.72989756",
"0.72845757",
"0.7276639",
"0.7242707",
"0.7239804",
"0.7239804",
"0.7239804",
"0.7239... | 0.0 | -1 |
Represent each Card as a concatenation of its rank and suit. | def __repr__(self):
return self.rank + self.suit | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return str(self.rank) + \" of \" + self.suit",
"def ascii_version_of_card(*cards):\n\n # we will use this to prints the appropriate icons for each card\n name_to_symbol = {\n 'Spades': '♠',\n 'Diamonds': '♦',\n 'Hearts': '♥',\n 'Clubs': '♣',\n ... | [
"0.71933305",
"0.71600074",
"0.71444017",
"0.7140631",
"0.70260257",
"0.70260257",
"0.6997441",
"0.69622666",
"0.6956081",
"0.69310045",
"0.69288784",
"0.6914523",
"0.67576605",
"0.6716822",
"0.66366667",
"0.6612663",
"0.6599204",
"0.6593373",
"0.6528129",
"0.65071744",
"0.65... | 0.7598367 | 0 |
Cards are == when one Card has the same rank or suit of another Card instance. | def __eq__(self, other_card):
if self.rank == other_card.rank or self.suit == other_card.suit:
return True
else:
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, card2):\n return self.suit == card2.suit and self.rank == card2.rank",
"def __eq__(self, other: Card) -> bool:\n return compare_map[self.number] == compare_map[other.number]",
"def __eq__(self, other):\n if isinstance(other, Card):\n return self.color == other.color and... | [
"0.87093216",
"0.78906995",
"0.77700496",
"0.74245775",
"0.7407949",
"0.7117948",
"0.7053784",
"0.70236933",
"0.6877931",
"0.687404",
"0.68026626",
"0.6787577",
"0.6734536",
"0.6732668",
"0.6705773",
"0.66778344",
"0.6657151",
"0.6649128",
"0.6634081",
"0.6603406",
"0.6591542... | 0.8623669 | 1 |
Recursively templateexpand a json dict against itself or other context. The context for string expansion is the json dict itself by default, updated by extra_context, if supplied. | def ExpandJsonTemplate(json_data, extra_context=None, use_self=True):
if use_self:
context = dict(json_data)
else:
context = {}
if extra_context:
context.update(extra_context)
def RecursiveExpand(obj):
if isinstance(obj, list):
return [RecursiveExpand(x) for ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def json_leaf_subst(exp, substitutions):\n def do_subst(e):\n return json_leaf_subst(e, substitutions)\n if isinstance(exp, dict):\n return {do_subst(k): do_subst(v) for k, v in exp.items()}\n elif isinstance(exp, list):\n return [do_subst(e) for e in exp]\n elif exp in substitutio... | [
"0.6263145",
"0.55062026",
"0.54617023",
"0.53140074",
"0.52904445",
"0.5242427",
"0.5238454",
"0.521097",
"0.52007663",
"0.5114993",
"0.5110396",
"0.5087918",
"0.50575686",
"0.501296",
"0.49815476",
"0.4947743",
"0.4945792",
"0.4896503",
"0.48905617",
"0.4872648",
"0.4816023... | 0.8101806 | 0 |
Return the directory of data files. | def data_dir():
return os.path.join(os.path.dirname(os.path.abspath(__file__)), 'data') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def data_directory(self):\n\n return self.get_raw(\"data_directory\")",
"def data_dir(self) -> Path:\n return self._data_dir",
"def get_data_dir(self):\n return self.data_dir",
"def data_dir(self):\n return self._data_dir",
"def data_dir(self):\n return self._data_dir",
... | [
"0.86678046",
"0.8487896",
"0.8462572",
"0.84176695",
"0.84176695",
"0.84165275",
"0.83920074",
"0.83725977",
"0.8331892",
"0.82320046",
"0.82109785",
"0.8151315",
"0.8066355",
"0.8062088",
"0.8061976",
"0.8047895",
"0.80455387",
"0.8033556",
"0.8001184",
"0.79925346",
"0.798... | 0.87103015 | 0 |
Combines list into a string of the form item1, item2, and item 3 | def comma_code(items):
item_len = len(items)
if item_len == 0:
return ''
elif item_len == 1:
return items[0]
return ', '.join(items[:-1]) + ', and ' + items[-1] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def join_list(items: Iterable[str]) -> str:\n\n return ITEM_SEPARATOR.join(items)",
"def list_str(lis):\r\n as_str = \"\"\r\n for item in lis:\r\n as_str += \" \" + str(item) + \",\"\r\n return as_str[:-1]",
"def concatenate_items(items, conjunction='and'):\n text = ''\n if not items:\... | [
"0.79991424",
"0.7775448",
"0.75652117",
"0.7435386",
"0.72728205",
"0.7271365",
"0.72299993",
"0.722568",
"0.70819163",
"0.7036277",
"0.70145047",
"0.70130634",
"0.6990181",
"0.69315577",
"0.6876183",
"0.68205476",
"0.6816648",
"0.67916524",
"0.6769555",
"0.67605346",
"0.673... | 0.6674709 | 24 |
Yield successive nsized chunks from l. | def chunks(l, n):
return[ l[i:i + n] for i in range(0, len(l), n)] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _chunk(self, l, n):\n for i in range(0, len(l) + 1, n):\n yield l[i:i + n]",
"def chunks(self, l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]",
"def __chunks(l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]",
"def get_chunks(self, ... | [
"0.8038813",
"0.79248375",
"0.7923423",
"0.7885103",
"0.78773195",
"0.7815877",
"0.77655786",
"0.77556044",
"0.77441615",
"0.7731815",
"0.77288336",
"0.772473",
"0.77028215",
"0.76889825",
"0.76889825",
"0.7664208",
"0.76570904",
"0.7655856",
"0.7655856",
"0.76458347",
"0.764... | 0.0 | -1 |
Converts decimal number into sexagesimal number parts. ``deci`` is the decimal number to be converted. ``precision`` is how close the multiple of 60 and 3600, for example minutes and seconds, are to 60.0 before they are rounded to the higher quantity, for example hours and minutes. | def decimal_to_base60(deci,precision=1e-8):
sign = "+" # simple putting sign back at end gives errors for small
# deg. This is because -00 is 00 and hence ``format``,
# that constructs the delimited string will not add '-'
# sign. So, carry it as a character.
if deci < 0:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def precision(self):\n string = self.ask('od;E;') # get the actual output\n i1 = string.find('.')\n # find the indices of the dot before the decimal part and the E before\n # the exponent\n i2 = string.find('E', i1)\n # calculate the number of digit in the... | [
"0.5545609",
"0.54595983",
"0.5409595",
"0.5327562",
"0.5315469",
"0.52859825",
"0.52043194",
"0.519569",
"0.5193756",
"0.51741165",
"0.515108",
"0.515045",
"0.5112662",
"0.500345",
"0.49701056",
"0.49647292",
"0.4951426",
"0.49483728",
"0.49165738",
"0.48891824",
"0.4876071"... | 0.62166643 | 0 |
A convenient string representation that contains the current yaml map of this yamlizable | def __repr__(self) -> str:
yaml_map = yamlmapper.yaml_map(self)
yaml_map_items = [f"{k}={v!r}" for k, v in sorted(yaml_map.items())]
return f"{self.__class__.__name__}({', '.join(yaml_map_items)})" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def yaml(self):\n return str(self.data)",
"def __str__(self):\n _dict = self._def.default.copy()\n _dict.update(self.__dict__)\n #return '%s(%r)' % (self.__class__, _dict)\n # If the yaml is too slow revert to the line above\n name = '%s <%s>' % (self.__class__.__name__,... | [
"0.7816891",
"0.7704461",
"0.7668333",
"0.74728835",
"0.74209595",
"0.7258811",
"0.7217699",
"0.71320325",
"0.71031713",
"0.70095026",
"0.6967369",
"0.69200975",
"0.6897495",
"0.6850851",
"0.6836524",
"0.6836524",
"0.6836524",
"0.6836524",
"0.6836524",
"0.6836524",
"0.6836524... | 0.7610701 | 3 |
Creates a Cell from a JSON dictionary. | def from_json(self, _json: Dict) -> "Cell":
cell = Cell(content=_json["content"], data=_json["data"])
cell.id = _json["id"]
return cell | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_json(cls, _json: Dict) -> \"Page\":\n\n page = cls(\n cells=[Cell.from_json(cell_json) for cell_json in _json[\"cells\"]],\n data=_json[\"data\"],\n )\n page.id = _json[\"id\"]\n return page",
"def from_dict(self, d):\n return Grid(**d)",
"def f... | [
"0.6552123",
"0.6535798",
"0.6277082",
"0.6269054",
"0.6266621",
"0.61997414",
"0.61492914",
"0.6125334",
"0.5983177",
"0.5935195",
"0.58735913",
"0.58735913",
"0.58735913",
"0.58735913",
"0.58735913",
"0.58735913",
"0.58735913",
"0.58735913",
"0.58735913",
"0.58735913",
"0.5... | 0.82266605 | 0 |
Does RV shifting work | def test_RV():
spec = IGRINSSpectrum(file=file)
assert spec.uncertainty is not None
assert hasattr(spec, "barycentric_correct")
correction_velocity = spec.estimate_barycorr()
assert isinstance(spec.RA, astropy.units.quantity.Quantity)
assert isinstance(spec.DEC, astropy.units.quantity.Quanti... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def right_shift_quirk(self):\n register = self.return_middle_registers(self.opcode)\n bits = self.registers[register[1]]\n self.registers[0xF] = bits & 0b1\n self.registers[register[0]] = self.registers[register[1]] >> 1\n logger.info(\"Shifted register V{} to the right into V{}(... | [
"0.69488525",
"0.68362254",
"0.67707986",
"0.67707986",
"0.66768026",
"0.6673234",
"0.66563946",
"0.66563946",
"0.64938307",
"0.64050066",
"0.63850296",
"0.6352056",
"0.6345997",
"0.6341593",
"0.62932235",
"0.62932235",
"0.62131655",
"0.61368865",
"0.6103431",
"0.6093303",
"0... | 0.0 | -1 |
The value of the property. | def value(self) -> str:
return self._value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(self):\n return self._value",
"def get_value(self):\n return self._value",
"def get_value(self):\n return self._value",
"def value(self):\n return self.__value",
"def value(self):\n return self.__value",
"def get_value(self):\n return self._value"... | [
"0.82087135",
"0.81645244",
"0.81645244",
"0.81625575",
"0.81625575",
"0.8161171",
"0.8161171",
"0.8161171",
"0.8132177",
"0.8132177",
"0.8132177",
"0.8080328",
"0.8080328",
"0.8080328",
"0.8080328",
"0.8080328",
"0.8080328",
"0.8080328",
"0.8080328",
"0.8080328",
"0.8080328"... | 0.80432713 | 44 |
Return the last values of all state variables in a SimState object. | def last_state(self):
return self._simstate | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_final_state(self):\n state = {}\n s = self.copy()\n clip = not np.isscalar(self['t'])\n if clip:\n # only get results for the last timepoint\n s.set_state(self.state[:, -1])\n \n for k in self.difeq_vars:\n state[k] = s[k]\n ... | [
"0.70501053",
"0.68264186",
"0.6813396",
"0.67094797",
"0.66886044",
"0.6674428",
"0.6615974",
"0.6521614",
"0.6480747",
"0.64383215",
"0.6368001",
"0.6361215",
"0.63596594",
"0.63395506",
"0.6314231",
"0.6235604",
"0.6213478",
"0.6176815",
"0.61695874",
"0.6163223",
"0.61559... | 0.7101281 | 0 |
A strategy that creates `Case` instances. Explicit `path_parameters`, `headers`, `cookies`, `query`, `body` arguments will be used in the resulting `Case` object. | def get_case_strategy( # pylint: disable=too-many-locals
draw: Callable,
endpoint: Endpoint,
hooks: Optional[HookDispatcher] = None,
feedback: Optional[Feedback] = None,
data_generation_method: DataGenerationMethod = DataGenerationMethod.default(),
path_parameters: Any = NOT_SET,
headers: A... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def request_case(self, casenum, case):\n # Anonymous or authenticated session?\n is_mod_request = case['method'].upper() in self.modification_methods\n needs_user = case.get('user', is_mod_request)\n if needs_user:\n session = self.user_session\n else:\n ses... | [
"0.575196",
"0.57027084",
"0.5673386",
"0.5494484",
"0.54804766",
"0.5334432",
"0.5334432",
"0.52071553",
"0.51731235",
"0.51614434",
"0.51614434",
"0.50898486",
"0.50793946",
"0.5054101",
"0.5024315",
"0.5018465",
"0.50131065",
"0.50022775",
"0.49648806",
"0.49112797",
"0.48... | 0.5888172 | 0 |
A GET request should simply return a 200. | def test_get(self):
response = self.client.get(self.url)
self.assertEqual(response.status_code, 200) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_response_200_on_get(self):\n pass",
"def test_get(self):\n self.assertEqual(200, self.response.status_code)",
"def test_get(self):\n self.assertEqual(200, self.response.status_code)",
"def test_get(self):\n self.assertEqual(200, self.resp.status_code)",
"def test_get(se... | [
"0.83019894",
"0.7618177",
"0.7618177",
"0.7606511",
"0.7606511",
"0.74461186",
"0.7405459",
"0.71480525",
"0.7101645",
"0.70365584",
"0.69865036",
"0.6959429",
"0.69543254",
"0.6887673",
"0.68825656",
"0.6864004",
"0.6860572",
"0.6855868",
"0.6817767",
"0.6748019",
"0.674660... | 0.7089127 | 10 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.