query stringlengths 10 2k | document stringlengths 20 51.2k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
Sets the weight of this LineFormat. | def weight(self, weight):
self.container['weight'] = weight | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_lineweight(self, lineweight: float) -> None:\n self.lineweight = self.parent.get_lineweight_index(lineweight)",
"def set_weight(self, weight):\n self.weight = weight",
"def setweight(self, weight):\n self.weight = weight",
"def setWeight(self, weight):\n self.weight = weig... | [
"0.80716527",
"0.74060506",
"0.7369034",
"0.73661226",
"0.73319167",
"0.7323442",
"0.72640914",
"0.7140751",
"0.70639926",
"0.7047764",
"0.7047764",
"0.7047764",
"0.6934218",
"0.6897095",
"0.67603225",
"0.67044294",
"0.66979",
"0.66586983",
"0.6626613",
"0.6558203",
"0.647771... | 0.6582243 | 19 |
Gets the end_arrowhead_style of this LineFormat. | def end_arrowhead_style(self):
return self.container['end_arrowhead_style'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def end_arrowhead_style(self, end_arrowhead_style):\n\n self.container['end_arrowhead_style'] = end_arrowhead_style",
"def begin_arrowhead_style(self):\n return self.container['begin_arrowhead_style']",
"def end_arrowhead_width(self):\n return self.container['end_arrowhead_width']",
"def... | [
"0.77092713",
"0.7272764",
"0.6287812",
"0.6084276",
"0.60672146",
"0.5991115",
"0.59807634",
"0.586301",
"0.564425",
"0.56248534",
"0.55664504",
"0.555117",
"0.554134",
"0.55410343",
"0.553501",
"0.55176103",
"0.55033123",
"0.54943496",
"0.54932714",
"0.54609245",
"0.5415793... | 0.8839698 | 0 |
Gets the cap_type of this LineFormat. | def cap_type(self):
return self.container['cap_type'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def line_type(self) -> int:\n if self._line_type is None:\n return 1\n return max(self._line_type, 1)",
"def line_cap(self):\n return self._line_cap",
"def getCap(self):\n return self.CAP",
"def cap_type(self, cap_type):\n\n self.container['cap_type'] = cap_type"... | [
"0.6421291",
"0.6375408",
"0.61032367",
"0.60707563",
"0.58827",
"0.5823752",
"0.5769501",
"0.5769501",
"0.57526004",
"0.57526004",
"0.57526004",
"0.57526004",
"0.57526004",
"0.57526004",
"0.57526004",
"0.57526004",
"0.57526004",
"0.57526004",
"0.57526004",
"0.57526004",
"0.5... | 0.7713071 | 0 |
Returns the string representation of the model | def to_str(self):
return pformat(self.to_dict()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _repr_model_(self):\n return str(self)",
"def __str__(self):\n\n return str(self.model)",
"def get_model_string(self):\n raise NotImplementedError()",
"def __str__(self):\n return self.model",
"def serialize_model(self):\n return dill.dumps(self.model)",
"def __str_... | [
"0.8602374",
"0.85093755",
"0.8237104",
"0.8050309",
"0.80128866",
"0.79348034",
"0.78766525",
"0.77898884",
"0.7786461",
"0.7745792",
"0.7627315",
"0.76055235",
"0.757999",
"0.7514394",
"0.75038797",
"0.75035286",
"0.74850684",
"0.7440529",
"0.74325883",
"0.74239755",
"0.740... | 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 return not self == other",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other):\n return self.__dict__ != other.__dict__",
"def __eq__(self, other):\n return not self.__ne__(other)",
... | [
"0.8410411",
"0.8391477",
"0.8172175",
"0.81410587",
"0.80920255",
"0.8088807",
"0.80676955"
] | 0.0 | -1 |
Gets the deployment uri of the model from AIP. | def _get_deployment_uri(
model_endpoint_uri: str,
credentials: Optional[google.auth.credentials.Credentials] = None) -> str:
response = http_utils.make_get_request_to_ai_platform(model_endpoint_uri,
credentials)
if 'deploymentUri' not in response:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deployment_uri(self) -> str:\n return pulumi.get(self, \"deployment_uri\")",
"def predict_http_uri(self) -> Optional[str]:\n if not self._gca_resource.deployed_models:\n return None\n return self._gca_resource.deployed_models[0].private_endpoints.predict_http_uri",
"def url(... | [
"0.71741164",
"0.65361845",
"0.6322761",
"0.6294079",
"0.6248871",
"0.6186277",
"0.60625374",
"0.60256034",
"0.5950626",
"0.5902039",
"0.5898833",
"0.58544767",
"0.5844667",
"0.574928",
"0.5732559",
"0.57122797",
"0.5707462",
"0.57058287",
"0.5672635",
"0.5636868",
"0.5624922... | 0.6989445 | 1 |
Gets a mapping between modality and input lists. | def create_modality_inputs_map_from_metadata(
explain_md: explain_metadata.ExplainMetadata) -> Dict[str, List[str]]:
modality_input_list_map = collections.defaultdict(list)
for input_metadata in explain_md.inputs:
input_name = input_metadata.name
input_modality = input_metadata.modality
input_encod... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inputs(self) -> Mapping[str, Mapping[int, str]]:\n raise NotImplementedError()",
"def map(self) -> dict:\n return self._modmap.map(getattr(self._entrymod, \"__name__\", self._entrymod))",
"def _build_map(list_models: Iterable[ListModelDictType]) -> dict[str, ListModel]:\n return {\n ... | [
"0.60858107",
"0.569282",
"0.55369955",
"0.54261005",
"0.53956527",
"0.53733957",
"0.53107536",
"0.5288724",
"0.5286025",
"0.52659374",
"0.52564394",
"0.5238105",
"0.5231749",
"0.52042866",
"0.5193108",
"0.5187516",
"0.51790404",
"0.5160426",
"0.5152938",
"0.51311624",
"0.511... | 0.64126444 | 0 |
Creates a b64 str from an ndarray. | def encode_ndarray_as_b64str(array: np.ndarray):
raw_img = Image.fromarray(np.uint8(np.array(array)), 'RGB')
buffer = io.BytesIO()
raw_img.save(buffer, format='jpeg')
return base64.b64encode(buffer.getvalue()).decode('utf-8') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_numpy_to_base64_image_string(image_np):\n \n image_pil = Image.fromarray(image_np)\n \n buffer = BytesIO()\n image_pil.save(buffer, format=\"JPEG\")\n base64_img_string = base64.b64encode(buffer.getvalue())\n \n base64_img_string_with_metadata = \"data:image/jpg;base64,{}\".form... | [
"0.68991804",
"0.68281645",
"0.6769865",
"0.6769304",
"0.6723649",
"0.6710222",
"0.6646762",
"0.6620321",
"0.6435662",
"0.6410475",
"0.63358736",
"0.6306398",
"0.6234404",
"0.62169605",
"0.6214705",
"0.62074625",
"0.6207414",
"0.61983603",
"0.6183557",
"0.61699486",
"0.613638... | 0.794518 | 0 |
Ensure that any authenticated member can access the project list api. | def test_project_list(self):
# Populating the test DB w/1 project
response = self.client_auth.post(self.project_list_url, self.project)
response = self.client_auth.get(self.project_list_url)
self.assertEqual(response.status_code, status.HTTP_200_OK,
"status_code ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testAccessAllowed(self):\n for user in (self.guest, self.contributor, self.delegate, self.owner, self.root):\n response = self.runGet(user)\n self.response_200(response)\n self.assertInContext(\"project\")\n self.assertInContext(\"object_list\")",
"def test_... | [
"0.7223157",
"0.70889086",
"0.6935408",
"0.68831325",
"0.6851847",
"0.68149674",
"0.67460996",
"0.67328423",
"0.67024386",
"0.6655941",
"0.66477454",
"0.65526843",
"0.6538331",
"0.6494377",
"0.6460793",
"0.6430356",
"0.64188814",
"0.6398611",
"0.63983464",
"0.63637817",
"0.63... | 0.63266784 | 24 |
Ensure that any authenticated member can access the project detail api. | def test_project_detail(self):
response = self.client_auth.post(self.project_list_url, self.project)
first_project = Project.objects.first()
url = reverse("project-detail",
kwargs={"pk": first_project.pk})
response = self.client_auth.get(url)
self.assertEqua... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_project_detail_allowed(self):\n\n\t\tself.client.login(username='user1', password='user1')\n\t\tresponse = self.client.get(reverse('media_classification:project_detail', kwargs={'pk': self.p0.pk}))\n\t\tself.assertEqual(response.status_code, 200)",
"def test_project_detail_forbidden(self):\n\n\t\tself.c... | [
"0.7802614",
"0.7330825",
"0.6925852",
"0.67673534",
"0.6717921",
"0.6669285",
"0.6653537",
"0.655141",
"0.65303487",
"0.6498173",
"0.64822066",
"0.6458565",
"0.6409801",
"0.6367061",
"0.63624316",
"0.6351998",
"0.63437754",
"0.6328007",
"0.63033533",
"0.6256836",
"0.6238721"... | 0.59990984 | 39 |
Ensure that a member cannot access the activity api of an organizaiton that they are not part of. | def test_project_other_organization_member_access(self):
# create a member from another org than "An organization"
new_org_member = self.project_manager_data
new_org_member["member"]["email"] = "neworg@email.com"
new_org_member["member"]["organization"]["organization_name"] = "neworg"
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_edit_logged_activity_by_non_owner_is_unsuccessful(self):\n self.header[\"Authorization\"] = self.generate_token(\n self.test_user2_payload\n )\n\n response = self.client.put(\n f'/api/v1/logged-activities/{self.log_alibaba_challenge.uuid}',\n data=json... | [
"0.65203846",
"0.6017275",
"0.6005539",
"0.5917122",
"0.5910491",
"0.5887991",
"0.5884519",
"0.5856617",
"0.5817205",
"0.5779231",
"0.5764889",
"0.5756503",
"0.5733165",
"0.5705944",
"0.57034147",
"0.5691833",
"0.5664609",
"0.5657376",
"0.565585",
"0.56346875",
"0.56138057",
... | 0.0 | -1 |
Get the state of this virus particle's resistance to a drug. This method is called by getResistPop() in Patient to determine how many virus particles have resistance to a drug. | def getResistance(self, drug):
return self.resistances.get(drug, False) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getResistPop(self, drugResist):\r\n population = 0\r\n for v in self.viruses:\r\n resist_all = True\r\n for drug in drugResist:\r\n if not v.getResistance(drug):\r\n resist_all = False\r\n if resist_all: population += 1\r\n ... | [
"0.6927966",
"0.6281582",
"0.57770663",
"0.5560278",
"0.55481225",
"0.5520171",
"0.5479069",
"0.544509",
"0.5404817",
"0.529549",
"0.52733773",
"0.52592915",
"0.52566266",
"0.5215509",
"0.5211022",
"0.52091855",
"0.5204572",
"0.5186965",
"0.51830834",
"0.5173535",
"0.5172379"... | 0.70666414 | 0 |
Returns the drugs that are being administered to this patient. | def getPrescriptions(self):
return self.meds | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getDevelAdmins(self):\n\t\tpass",
"def getDevelAdmins(self):\n pass",
"def get_administrators(self, ):\n return self._administrators",
"def get_all_administrators():\n return User.objects.filter(groups__name=\"administrators\")",
"def admins(self):\n return User.objects.filter... | [
"0.68790174",
"0.6828954",
"0.6440081",
"0.60974514",
"0.60429883",
"0.58811134",
"0.58811134",
"0.58811134",
"0.58811134",
"0.58811134",
"0.58811134",
"0.58811134",
"0.58811134",
"0.58354753",
"0.57628804",
"0.57458514",
"0.5744399",
"0.5667993",
"0.5636484",
"0.56104743",
"... | 0.0 | -1 |
Calculate the (mean squared) reconstruction error for some data. | def get_reconstr_error(self, data: np.ndarray) -> np.ndarray:
self.model.eval()
return self.model(torch.from_numpy(data)).detach().numpy() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reconstruction_error(self):\n G = -0.5 * self.dist_matrix_**2\n G_center = KernelCenterer().fit_transform(G)\n evals = self.kernel_pca_.eigenvalues_\n return np.sqrt(np.sum(G_center**2) - np.sum(evals**2)) / G.shape[0]",
"def error(self):\n error = 0.0\n\n for r in s... | [
"0.7063246",
"0.69156355",
"0.67198724",
"0.6684825",
"0.6621007",
"0.6571533",
"0.6541907",
"0.6511839",
"0.64659244",
"0.64366686",
"0.6433047",
"0.6424173",
"0.6409529",
"0.6398657",
"0.63961864",
"0.63898784",
"0.63863105",
"0.63385123",
"0.6313663",
"0.6312744",
"0.63102... | 0.0 | -1 |
Calculates the gaussian lineshape for FFT fitting. | def gauss_fft(frequencies, freq_in, window_param, harmonic=1):
f = frequencies
f_tilde = freq_in
w_tilde = 2 * np.pi * f_tilde
b = window_param
k = harmonic
ns = frequencies.size
# Using frequency list to find dt based on Nyquist sampling theorem
dt = -1 / (2 * frequencies[0])
x = (... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gaussian_lines(lbda,x0,sigma,amplitudes=None):\n \n gauss_array = stats.norm.pdf(np.asarray([lbda]*len(x0)).T,\n loc=x0, scale=sigma)\n if amplitudes is not None:\n return np.dot(gauss_array,amplitudes)\n \n return np.sum(gauss_array,axis=1)",
"def polyGa... | [
"0.60316503",
"0.5648254",
"0.5616934",
"0.5606034",
"0.5605732",
"0.5596007",
"0.55091566",
"0.5490589",
"0.5441433",
"0.54052585",
"0.53979665",
"0.5388391",
"0.53873634",
"0.5373343",
"0.5373343",
"0.53573084",
"0.53547883",
"0.53492135",
"0.53241116",
"0.53230387",
"0.531... | 0.0 | -1 |
Draws the textbox on the screen. | def draw(self, display):
display.blit(self.textBox, (self.rect.x + 5, self.rect.y + 5))
pygame.draw.rect(display, self.color, self.rect, 2) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def draw(self):\n\n self.display.blit(self.textBox, (self.rect.x + 5, self.rect.y + 5))",
"def draw(self, display):\n\n display.blit(self.textBox, (self.rect.x + 5, self.rect.y + 5))\n self.UpdateText(self.text)",
"def draw(self, display):\n\n display.blit(self.textBox, (self.rect.x... | [
"0.8365043",
"0.79160124",
"0.77885264",
"0.7592745",
"0.75732994",
"0.7447107",
"0.73796296",
"0.7235911",
"0.72089124",
"0.7205874",
"0.71513623",
"0.7096512",
"0.705544",
"0.70317495",
"0.70242995",
"0.70206636",
"0.69798636",
"0.697068",
"0.69060194",
"0.6875955",
"0.6855... | 0.7696377 | 3 |
Sets the value of the other toggle. This is used when the user clicks on one toggle, then the "otherToggle" is set to inactive. | def SetOtherToggle(self, otherToggle):
self.otherToggle = otherToggle | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def toggleValue(self):\r\n self.value = not self.value\r\n return self.value",
"def toggle(self, value):\n\n pass",
"def event_switch_2_on(self, ioname, iovalue):\n if self.main_state and not self.door_2_state:\n if not self.door_1_state:\n self.door_2_stat... | [
"0.6175479",
"0.61079156",
"0.5973659",
"0.58984095",
"0.58891726",
"0.5888559",
"0.58156437",
"0.57411367",
"0.5651598",
"0.56361675",
"0.561746",
"0.5561147",
"0.5504994",
"0.53910077",
"0.53575975",
"0.53575975",
"0.5354167",
"0.53501403",
"0.53501403",
"0.5296764",
"0.529... | 0.7879947 | 0 |
Sets the current toggle to active, and the otherToggle to inactive. Changes the color and text of the toggles. This also determines the game mode to be played. | def Toggle(self, UI):
mode = 0 if self.text == "NORMAL" else 1
UI.SetGameMode(mode)
self.text += " X"
self.color = ActiveColor
self.isActive = not self.isActive
self.UpdateToggle()
self.otherToggle.text = self.otherToggle.text[:-4]
self.otherToggle.co... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def SetOtherToggle(self, otherToggle):\n\n self.otherToggle = otherToggle",
"def toggle(self):\n if self.is_active:\n self.off()\n else:\n self.on()",
"def switch_turn(self):\r\n if self.turn == 'black':\r\n self.turn = 'white'\r\n elif self.t... | [
"0.64159346",
"0.60656136",
"0.58918154",
"0.5878201",
"0.5827202",
"0.57517576",
"0.5647139",
"0.56183696",
"0.56028634",
"0.5562899",
"0.55537933",
"0.55447596",
"0.5514066",
"0.5505651",
"0.5481253",
"0.5470613",
"0.54522276",
"0.5435755",
"0.53947556",
"0.53843397",
"0.53... | 0.73980504 | 0 |
This function is responsible for drawing the clock on the gameboard. pygrame.draw.rect will draw both rectangles and text/text2 will specify the words stated on the rectangles. Blit will simply display the text on the screen. | def draw_clock(self,start):
self.mytime = str(int(start) - int(self.offset))
pygame.draw.rect(self.display, (112, 128, 144), self.myClock)
pygame.draw.rect(self.display, (112, 128, 144), self.secondsTimer)
text2= self.clock_font.render( "Time: ", True, (250, 250, 250))
text = se... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def draw_clock(self):\r\n\t\tbtn_back = BooterButton(self.frame_back_button, command=self.back_clicked)\r\n\t\tbtn_back.grid(row=0, column=0, padx=10)\r\n\t\r\n\t\tbtn_back.apply_back_image()\r\n\r\n\t\tself.lbl_task = BooterLabel(self.frame_back_button)\r\n\t\tself.lbl_task.grid(row=0, column=1)\r\n\t\tself.displ... | [
"0.7244781",
"0.7002384",
"0.6821739",
"0.67661643",
"0.6759515",
"0.6758294",
"0.67352843",
"0.67303157",
"0.6705939",
"0.66946894",
"0.66858536",
"0.6653926",
"0.66425395",
"0.6565545",
"0.65552324",
"0.65489054",
"0.6534148",
"0.65254456",
"0.64801794",
"0.64726675",
"0.64... | 0.670186 | 9 |
Decodes the provided JWT into dictionaries. Parses the provided token and extracts its header values and claims. Note that this function does not perform any verification on the token content. Nor does it attempt to verify the token signature. Th only validation it performs is for the proper formatting/encoding of the ... | def decode(token):
if token.count(b'.') != 2:
raise crypt.AppIdentityError(('Wrong number of segments'
' in token: {0}').format(token))
header, payload, _ = token.split(b'.')
header_dict = json.loads(_urlsafe_b64decode(header).decode('utf-8'))
payload_dict =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def decode_token():\n token = request.headers.get('Authorization')\n if token is None:\n return {}\n\n if token.startswith('Bearer '):\n _, token = token.split(' ', 1)\n\n pub_key = fetch_public_key(current_app)\n audiences = get_audiences()\n\n decoded_token = None\n\n for aud i... | [
"0.6921814",
"0.68958163",
"0.6817422",
"0.68060917",
"0.6717217",
"0.6674888",
"0.65972304",
"0.6591243",
"0.6533726",
"0.65193003",
"0.650684",
"0.6470142",
"0.6442137",
"0.63050765",
"0.6296217",
"0.6254509",
"0.62311053",
"0.62190247",
"0.6192709",
"0.6192709",
"0.6184974... | 0.6601505 | 6 |
Split a list into groups of `group_size`, and display each group on it's own embed. | def grouped(
items: list,
*,
title: str,
group_size: int = 3,
url: Any = Embed.Empty,
colour: EmbedColour = EmbedColour.Info,
) -> menus.MenuPages:
embeds = []
for chunk in chunked(items, group_size):
embeds.append(
Embed(
title=title,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def divide_list(big_list, num_groups):\n seed = 10\n random.seed(seed)\n random.shuffle(big_list)\n return [big_list[i::num_groups] for i in xrange(num_groups)]",
"def chunks(list_, size):\n for i in range(0, len(list_), size):\n yield list_[i:i + size]",
"def split_chunks(l, chun... | [
"0.6711075",
"0.6351069",
"0.6311723",
"0.6251903",
"0.62339026",
"0.6178609",
"0.61703485",
"0.6166712",
"0.6155374",
"0.61104876",
"0.6056454",
"0.6056454",
"0.60337013",
"0.59888154",
"0.5933117",
"0.59311295",
"0.5924009",
"0.5905787",
"0.5898398",
"0.58839273",
"0.584159... | 0.67086196 | 1 |
Return whether the given list of numbers is lucky. A lucky list contains at least one number divisible by 7. | def has_lucky_number(nums):
for num in nums:
if num % 7 == 0:
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has23(nums):\n if 2 in nums or 3 in nums:\n return True\n else:\n return False",
"def are_list_prime_digits(lst: list[int]) -> bool:\n for x in lst:\n if not only_prime_digits(x):\n return False\n\n return True",
"def has_seven(k):\n if k % 10 == 7:\n r... | [
"0.67215353",
"0.6362793",
"0.6352103",
"0.6352103",
"0.6352103",
"0.6322741",
"0.6311042",
"0.6288961",
"0.6242273",
"0.62331736",
"0.59063333",
"0.5900404",
"0.5828345",
"0.57841384",
"0.57551396",
"0.5710682",
"0.56035423",
"0.55897313",
"0.5566779",
"0.5524199",
"0.550439... | 0.8294376 | 0 |
Given a list of meals served over some period of time, return True if the same meal has ever been served two days in a row, and False otherwise. | def menu_is_boring(meals):
for i in range(len(meals)-1):
if meals[i] == meals[i+1]:
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_duplicates(the_list):\n\n for day in the_list:\n if the_list.count(day) > 1:\n return True\n return False",
"def are_meetings_colliding( meeting_a, meeting_b ):\n for time in range( meeting_a[0], meeting_a[1] - 1 ):\n if time == meeting_b[0] or time == meeting_b[1] - 1:\n ... | [
"0.6402204",
"0.56970125",
"0.5626569",
"0.55979633",
"0.55607694",
"0.55462575",
"0.55037",
"0.54993606",
"0.54724354",
"0.5462649",
"0.5450771",
"0.5440217",
"0.54314977",
"0.5419809",
"0.5397673",
"0.5393025",
"0.5373781",
"0.53183025",
"0.5263752",
"0.52442276",
"0.523263... | 0.6147374 | 1 |
Tests the initialization of pandas data frames | def test_pandas_data_frame():
single_cube = df.DagmcFile(test_env['single_cube'])
single_cube_query = dq.DagmcQuery(single_cube)
exp_vert_data = pd.DataFrame()
assert(single_cube_query._vert_data.equals(exp_vert_data))
exp_tri_data = pd.DataFrame()
assert(single_cube_query._tri_data.equals(exp_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_init_df(test_pd_df, index):\n\n # set a value to `nan` to check that timeseries columns are ordered correctly\n test_pd_df.loc[0, test_pd_df.columns[5]] = np.nan\n\n # any number of columns can be set as index\n df = test_pd_df.copy() if index is None else test_pd_df.set_index(index)\n obs ... | [
"0.74483216",
"0.7141947",
"0.6935924",
"0.69252837",
"0.68796515",
"0.6730357",
"0.6687295",
"0.662319",
"0.6622229",
"0.65747225",
"0.64973086",
"0.6487461",
"0.64259994",
"0.64063287",
"0.6378973",
"0.6372781",
"0.6370663",
"0.6347604",
"0.634414",
"0.6340104",
"0.6306313"... | 0.6956942 | 2 |
Compute the weight fraction for all elements in this region. \f[ f_{i}^{w} = \frac{f_{i}^{A} \cdot A_{i}}{\sum_{j} f_{j}^{A} \cdot A_{j}} \f] | def computeWeightFractions(self):
total = 0.0
for index, atomicNumber in enumerate(self.atomicNumbers):
total += self.atomicFractions[index] * ElementProperties.getAtomicMass_g_mol(atomicNumber)
weightFractions = []
for index, atomicNumber in enumerate(self.atomicNumbers):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def weight(self):\n P = self.parent().weight_lattice_realization()\n alpha = list(P.simple_roots())\n return -sum(sum(x) * alpha[i] for i,x in enumerate(self))",
"def weight(self):\n P = self.parent().weight_lattice_realization()\n alpha = list(P.simple_root... | [
"0.6642452",
"0.6642452",
"0.6335757",
"0.6316102",
"0.62911767",
"0.6283605",
"0.6239061",
"0.62257475",
"0.6218833",
"0.62043834",
"0.6185994",
"0.6169361",
"0.6162179",
"0.6157665",
"0.61419624",
"0.61332166",
"0.612873",
"0.61168927",
"0.61093676",
"0.61093175",
"0.609168... | 0.67849326 | 0 |
Initialize a clean call object for a target, config, product combination and an imaging stage. | def task_initialize_clean_call(
self,
target = None,
config = None,
product = None,
extra_ext_in = None,
suffix_in = None,
extra_ext_out = None,
stage = 'dirty',
):
# check user input.
if target is None or config is None or pro... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self,product,pilInfo,multiPilFlag,siteID):\n self.__product = product\n self.__pilInfo = pilInfo\n self.__multiPilFlag = multiPilFlag\n self.__siteID = siteID",
"def __init__(self, image, target):\n\n self._image = image\n self._target = ta... | [
"0.6131332",
"0.57911474",
"0.5533622",
"0.5497846",
"0.5480113",
"0.54554796",
"0.5431306",
"0.5404018",
"0.5351127",
"0.53424937",
"0.53368187",
"0.52997625",
"0.52819216",
"0.52617466",
"0.52329457",
"0.52304155",
"0.5227347",
"0.52116585",
"0.51968014",
"0.5193547",
"0.51... | 0.74653494 | 0 |
Returns the icon for the conditions of the given day. | def get_icon(self, day):
file = ICON_PATH.format(day.icon_id)
if os.path.isfile(file):
im = Image.open(file)
return im
return self.threshold_bitmap(self.cached_bitmap(day.icon_url, day.icon_file, ICON_SIZE)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def icon(self):\n if SENSOR_TYPES[self.sensor_type][0] == \"PM2.5\":\n return 'mdi:thought-bubble-outline'\n elif SENSOR_TYPES[self.sensor_type][0] == \"PM10\":\n return 'mdi:thought-bubble'\n elif SENSOR_TYPES[self.sensor_type][2] == None:\n return 'mdi:cloud-... | [
"0.6618499",
"0.62749517",
"0.624488",
"0.62416536",
"0.624112",
"0.6106162",
"0.61059296",
"0.60825825",
"0.6076961",
"0.6073708",
"0.6004456",
"0.59948146",
"0.5986068",
"0.59008396",
"0.58359057",
"0.58291644",
"0.57746637",
"0.5765443",
"0.56916386",
"0.56891197",
"0.5687... | 0.7491296 | 0 |
Encodes a tree to a single string. | def serialize(self, root):
self.enc = []
self._preorder(root)
return ','.join(map(lambda x: str(x), self.enc)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encodeTree(self, tree, key):\n return self.encode(pickle.dumps(tree), key)",
"def serialize(self, root):\n if not root:\n return \"n\"\n s = \"\"\n stack = [root]\n while (stack):\n root = stack.pop(0)\n if root:\n s += str(ro... | [
"0.78278124",
"0.7515946",
"0.71304095",
"0.7053364",
"0.7031874",
"0.6999469",
"0.6999095",
"0.69672054",
"0.69332165",
"0.68838483",
"0.68657243",
"0.68548083",
"0.6809354",
"0.6801677",
"0.67984694",
"0.6773517",
"0.6766546",
"0.6754318",
"0.67507386",
"0.6745785",
"0.6664... | 0.59906393 | 79 |
Unauthenticated with a log having member of other chitty time greater than 4 minutes all valid case test the PUT | def test_update_view(self):
# Unauthenticated
log1 = LogFactory()
url = self.get_url('detail', kwargs = {'pk': log1.pk})
response = self.client.patch(url, {}, format = 'json')
self.assertEqual(response.status_code, status.HTTP_401_UNAUTHORIZED)
# Log having member of ot... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_edit_logged_activity_that_is_no_longer_pending(self):\n self.log_alibaba_challenge.status = 'approved'\n self.alibaba_ai_challenge.save()\n\n response = self.client.put(\n f'/api/v1/logged-activities/{self.log_alibaba_challenge.uuid}',\n data=json.dumps(self.payl... | [
"0.65003484",
"0.6116288",
"0.61034876",
"0.6016777",
"0.59794736",
"0.5962726",
"0.58502597",
"0.57448924",
"0.5692066",
"0.5660136",
"0.5630734",
"0.5589779",
"0.5579797",
"0.557385",
"0.55685675",
"0.5562887",
"0.5559504",
"0.5549899",
"0.5542724",
"0.55323815",
"0.5531459... | 0.65991724 | 0 |
`to_python_value` should transform `int` microtimestamp to `datetime`. | def test_to_python_value(self):
examples = [0.000001, 1.000001]
expected_values = [
datetime(1970, 1, 1, 0, 0, 0, 1),
datetime(1970, 1, 1, 0, 0, 1, 1),
]
for example, expected in zip(examples, expected_values):
self.assertEqual(values.DateTime.to_pyth... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_python(self, val):\n return datetime.datetime.fromtimestamp(val)",
"def to_datetime(value):\n return epoch + timedelta(seconds=value)",
"def to_timestamp(datetime_value):\n return int((datetime_value - datetime(1970, 1, 1, tzinfo=utc)).total_seconds())",
"def _deserialize(self, value: int... | [
"0.7423316",
"0.71147764",
"0.6806906",
"0.6726147",
"0.66486096",
"0.661392",
"0.6599055",
"0.64883494",
"0.6465951",
"0.643977",
"0.6399242",
"0.628554",
"0.6271516",
"0.6247524",
"0.62111753",
"0.61700594",
"0.61426806",
"0.6129336",
"0.61071026",
"0.6099965",
"0.60982686"... | 0.60660994 | 21 |
Converts Q tensor to epsilon tensor | def Q2eps(tensor, no = 1.5, ne = 1.6,scale_factor = 1., out = None):
qtensor = np.asarray(tensor)
if qtensor.shape[-1] == 6:
qdiag = qtensor[...,0:3]
qoff = qtensor[...,3:]
elif qtensor.shape[-2:] == (3,3):
mask_off = np.array(((False,True,True),(False,False,True),(False,False,Fals... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def epsilon(self):\n return - EARTH_GRAVITATION / self.a / 2",
"def epsilon(self):\n return self.V ** 2 / 2 - EARTH_GRAVITATION / self.R",
"def safe_divide_act(q,eps=10**-5):\n return q/(eps+torch.norm(q,dim=-1,keepdim=True))",
"def epsilon():\n return Variable.from_jvalue(callZooFunc... | [
"0.61134434",
"0.6090571",
"0.60587054",
"0.5985887",
"0.59435767",
"0.5883658",
"0.5805444",
"0.57214147",
"0.57146716",
"0.5710583",
"0.56898093",
"0.56844735",
"0.5596255",
"0.55663407",
"0.5552154",
"0.5549742",
"0.5548452",
"0.5548452",
"0.55149895",
"0.5511501",
"0.5494... | 0.6610552 | 0 |
Returns r vector array of given shape. | def _r3(shape):
az, ay, ax = [np.arange(-l / 2. + .5, l / 2. + .5) for l in shape]
zz,yy,xx = np.meshgrid(az,ay,ax, indexing = "ij")
return xx, yy, zz | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_array(self, shape: Tuple[int, ...], dtype: DTypeLike) -> np.ndarray:\n size = int(np.product(shape)) * np.dtype(dtype).itemsize\n return self._wrapped[:size].view(dtype).reshape(shape)",
"def vec(x: Array) -> Array:\n return np.ravel(x, order='F')",
"def vector(self) -> np.ndarray:\n ... | [
"0.6434383",
"0.6363099",
"0.6232438",
"0.61759263",
"0.6172348",
"0.6132952",
"0.60683775",
"0.60187966",
"0.59930277",
"0.59652483",
"0.59080386",
"0.5876806",
"0.58515966",
"0.58473015",
"0.5776747",
"0.5726885",
"0.57161415",
"0.5714488",
"0.5707749",
"0.5687014",
"0.5645... | 0.5470755 | 29 |
Return the repository path | def get_repositorypath():
return ConfigurationVariables()['repositorypath'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def repo_dir(self):\n return self.__repo_dir__",
"def repository_path(self):\n return self._path_from_chromium_base('build')",
"def repo_path(self):\n p = os.path.join(get_lsstsw_build_dir(), self.name)\n if not os.path.exists(p):\n raise_with_traceback(\n ... | [
"0.8230605",
"0.8205546",
"0.7967884",
"0.78831106",
"0.7854384",
"0.7707406",
"0.762352",
"0.7578513",
"0.7541321",
"0.75308096",
"0.75308096",
"0.7424971",
"0.73792297",
"0.73624325",
"0.7356596",
"0.7297499",
"0.7284265",
"0.7280442",
"0.72572017",
"0.7187021",
"0.71859086... | 0.8680554 | 0 |
Return the log path | def log_path(ec=None):
date = time.strftime("%Y%m%d")
timestamp = time.strftime("%H%M%S")
return log_file_format(return_directory=True, ec=ec, date=date, timestamp=timestamp) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def logs_path(self):\n return self._logs_path",
"def path(self):\n return self._log_folder",
"def get_log_path():\n return config.get(\"etc\", \"log_path\")",
"def get_log_path() -> Union[str, None]:\n return os.path.dirname(__logfile)",
"def get_logdir(self):\n return self.logdi... | [
"0.85999",
"0.8456981",
"0.8297879",
"0.82132983",
"0.7985218",
"0.7952553",
"0.7884615",
"0.7869173",
"0.7848313",
"0.7818272",
"0.7814555",
"0.7800567",
"0.7755425",
"0.77215874",
"0.7706112",
"0.7635677",
"0.76081634",
"0.7584541",
"0.7524275",
"0.75019795",
"0.7475983",
... | 0.7693436 | 15 |
Returns the path to the output folder which holds the database and graphs | def output_directory():
return os.path.join(project_directory(), "outputs") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def graphs_directory():\n return os.path.join(output_directory(), \"graphs\")",
"def get_out_path(self):\r\n return join_path(self.get_data_path(), consts.OUTPUT_DIR)",
"def get_output_path(self):\n return self.output_path + self.folder_name",
"def path(self):\n cwd = osp.abspath('')\... | [
"0.786216",
"0.739662",
"0.7318249",
"0.7147801",
"0.7077921",
"0.7045917",
"0.7026591",
"0.7004164",
"0.69723594",
"0.69723594",
"0.69252515",
"0.6894938",
"0.6715963",
"0.67156893",
"0.6708006",
"0.669696",
"0.6691165",
"0.667392",
"0.66451854",
"0.66311014",
"0.6600702",
... | 0.68194956 | 12 |
Get dataset element for given input and target indices each index is tuple (idx_scene, idx_rig, idx_cam) Does not add "ref" data! | def _get_elem(self, idxs_in, idxs_tgt):
assert self.n_in == len(idxs_in)
assert self.n_tgt == len(idxs_tgt)
# Load all images from 2 lists
images_in = [self._load_image(i) for i in idxs_in]
images_tgt = [self._load_image(i) for i in idxs_tgt]
# Create the result dict
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __getitem__(self, index):\n datapoint = self.data[index]\n target = self.target[index]\n return datapoint, target",
"def __getitem__(self, index):\n inputs, targets = self.compute_input_output(index)\n #print(\"---------------\"+str(inputs[0].shape))\n #print(\"-----... | [
"0.6160577",
"0.6128572",
"0.5983769",
"0.5893534",
"0.5730427",
"0.5683442",
"0.56667584",
"0.5625717",
"0.5615936",
"0.5591306",
"0.5549182",
"0.55485743",
"0.55422133",
"0.55217195",
"0.5497959",
"0.5497959",
"0.549565",
"0.54760426",
"0.545875",
"0.54562336",
"0.5447276",... | 0.6146822 | 1 |
Randomly rotate an image by a random angle (max_angle, max_angle). | def _random_rotation_3d(batch, max_angle):
size = batch.shape
batch = np.squeeze(batch)
batch_rot = np.zeros(batch.shape)
for i in range(batch.shape[0]):
if bool(random.getrandbits(1)):
image1 = np.squeeze(batch[i])
# rotate along z-axis
angle = random.uniform... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def RandomRotate90():\n return lambda img: img.rotate(random.sample([0, 90, 180, 270], k=1)[0])",
"def rnd_rotation(self, image, range=[0,180]):\n img = image\n num_rows, num_cols = img.shape[:2]\n rotation_matrix = cv2.getRotationMatrix2D((num_cols / 2, num_rows / 2), np.random.randint(... | [
"0.7698097",
"0.71958184",
"0.7112762",
"0.6959546",
"0.69430995",
"0.68799126",
"0.6776666",
"0.6564856",
"0.6554723",
"0.6490815",
"0.6369123",
"0.6338896",
"0.6327699",
"0.6327699",
"0.6247693",
"0.6227628",
"0.61698586",
"0.60889614",
"0.60371614",
"0.60343",
"0.603426",
... | 0.66943336 | 7 |
weight, if given, is the string/name of the edge attr in nxG to use for weights in the resulting cugraph obj. If nxG has no edge attributes, weight is ignored even if specified. | def convert_from_nx(nxG, weight=None):
if nx is None:
raise RuntimeError("NetworkX could not be imported, "
"cannot convert nxG")
if type(nxG) == nx.classes.graph.Graph:
G = cugraph.Graph()
elif type(nxG) == nx.classes.digraph.DiGraph:
G = cugraph.DiGraph()... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _weight(weight, edge):\n if isinstance(weight, float) or isinstance(weight, int):\n return float(weight)\n if isinstance(weight, str) and weight in edge:\n return edge[weight]\n return 1.0",
"def add_node(self, node, weight=None):\n # Check for networkx 2.0 syntax\n if is... | [
"0.68158984",
"0.6446289",
"0.6343857",
"0.6294084",
"0.6272866",
"0.6236943",
"0.62187326",
"0.6150676",
"0.61194265",
"0.6115129",
"0.6110154",
"0.61026204",
"0.60323614",
"0.59901017",
"0.5983623",
"0.5983623",
"0.5983623",
"0.5971239",
"0.5955525",
"0.59551257",
"0.594012... | 0.5856763 | 24 |
Updates plant model by adding a sample if the tolerance of the prediction is violated. | def update(self, query_state, query_action, predicted_state_prime, truth_state_prime):
if self._training_mode_flag:
self.logger.debug("Updating plant model")
query_features = self.like_me(
self.merge_state_action(query_state, query_action)
)
truth... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_surrogate(self, model, model_sample, sample_point):\n model.update_parameters(sample_point,model_sample)\n return model",
"def update(self, prediction):\n pass",
"def update(self, answer):\n item = self.items[answer.user_id, answer.place_id]\n\n shift = ans... | [
"0.57031304",
"0.56914586",
"0.5639249",
"0.56306124",
"0.55623114",
"0.55047953",
"0.54949635",
"0.54686004",
"0.54401326",
"0.5415544",
"0.53972596",
"0.5395276",
"0.53612196",
"0.53607523",
"0.53525925",
"0.5301482",
"0.5264156",
"0.5232235",
"0.52242535",
"0.518891",
"0.5... | 0.524054 | 17 |
Check Not Null constraint. | def _insert_ana_null(self, ana_table_name, cols, vals):
# count "NULL"s
ana_table = self._select(ana_table_name, ['*'])
null_cnt = {}
total_cnt = {}
for row in ana_table:
col_name = row['col_name']
null_cnt[col_name] = [row['null_cnt'], False]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def require_not_null(arg, arg_name: str):\n DbcUtil.require(arg is not None, 'required that ' + arg_name + ' must NOT be None')",
"def canBeNull(self):\n for constraint in self.table.constraints:\n if self in constraint.affectsColumns:\n if constraint.type is Constraint.NO... | [
"0.71991485",
"0.71888846",
"0.71332186",
"0.7075558",
"0.70340973",
"0.6634652",
"0.6599142",
"0.6562348",
"0.6540667",
"0.64895165",
"0.62212306",
"0.6184108",
"0.6176896",
"0.6165315",
"0.61603445",
"0.6113714",
"0.609941",
"0.6095632",
"0.60825413",
"0.60630214",
"0.60573... | 0.0 | -1 |
Chunks given table into multiple smaller ones. Tables that osquery yields can be arbitrarily large. Because GRR's messages cannot be arbitrarily large, it might happen that the table has to be split into multiple smaller ones. Note that that serialized response protos are going to be slightly bigger than the specified ... | def ChunkTable(table: rdf_osquery.OsqueryTable,
max_chunk_size: int) -> Iterator[rdf_osquery.OsqueryTable]:
def ByteLength(string: Text) -> int:
return len(string.encode("utf-8"))
def Chunk() -> rdf_osquery.OsqueryTable:
result = rdf_osquery.OsqueryTable()
result.query = table.query
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _chunks(self, items, limit):\n for i in range(0, len(items), limit):\n yield items[i:i + limit]",
"def chunk(g: Iterable, size=10000):\n chunk = []\n for item in g:\n chunk.append(item)\n if len(chunk) >= size:\n yield chunk\n chunk = []\n if len... | [
"0.63100475",
"0.6179341",
"0.5931903",
"0.5920969",
"0.58679813",
"0.58319664",
"0.5802846",
"0.57792455",
"0.5739697",
"0.5708675",
"0.5697942",
"0.5697942",
"0.5661865",
"0.5633946",
"0.563326",
"0.56188196",
"0.5610491",
"0.5601642",
"0.55686885",
"0.5528484",
"0.55093336... | 0.7756363 | 0 |
Generator which yields a chunk data of size BUFFER_SIZE at one time | def data_feeder(file_path):
LINE_COUNT = 0
fp = open(file_path, mode='r')
# chunk = [None] * BUFFER_SIZE
fp.readline()
while True:
try:
chunk = [None] * BUFFER_SIZE
for i in range(BUFFER_SIZE):
next_item = json.loads(fp.readline().replace(',\n', '\n'))... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def chunk_iter(source, chunk_size):\n for index in range(0, len(source), chunk_size):\n yield source[index:index+chunk_size]",
"def read_buf_gen(reader, size_hint=2**20):\n buf = reader(size_hint)\n while buf:\n yield buf\n buf = reader(size_hint)",
"def gen_chunks(self, gen):\n ... | [
"0.72980285",
"0.7220657",
"0.72160417",
"0.7181291",
"0.7120256",
"0.7111821",
"0.71000683",
"0.7073819",
"0.7073384",
"0.70708674",
"0.70100623",
"0.69729054",
"0.6947049",
"0.6873412",
"0.68538105",
"0.68523514",
"0.68366754",
"0.6821147",
"0.67720824",
"0.67585605",
"0.67... | 0.0 | -1 |
Compute fluid density field at locations. | def fluid_density(self, locs):
(npts, dim) = locs.shape
fluid_density = rho_f * numpy.ones((1, npts, 1), dtype=numpy.float64)
return fluid_density | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def density(self):\n return self.fluid.density(self.T_C)",
"def fluid_deriv(self):\n deriv = np.zeros((self.num_nw_fluids * self.num_o, 1 + self.num_o,\n self.num_nw_vars))\n k = 0\n for o in self.outl:\n i = 0\n for fluid in self.nw_flui... | [
"0.65392536",
"0.6464276",
"0.6463336",
"0.6450021",
"0.63122445",
"0.63036996",
"0.61948353",
"0.6194634",
"0.6164142",
"0.6062837",
"0.60102654",
"0.59465545",
"0.5933119",
"0.59243524",
"0.5914223",
"0.58545625",
"0.57982457",
"0.575489",
"0.574552",
"0.57085073",
"0.56778... | 0.76802284 | 0 |
Initialize the Client class. | def __init__(self):
print("You:: Whoa! Marriage Arrangements?!!") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_up(self):\n\n self.client = Client()",
"def __init__(self):\n self.cl = client()",
"def __init__(self):\n self._client = None",
"def __init__(self):\n self._client = None",
"def __init__(self, client):\n self.client = client",
"def __init__(self, client):\n ... | [
"0.8101358",
"0.79476804",
"0.78862846",
"0.78862846",
"0.7771892",
"0.7771892",
"0.7771892",
"0.7771892",
"0.760762",
"0.75126886",
"0.75126886",
"0.74670607",
"0.7450179",
"0.74415165",
"0.7424135",
"0.73913676",
"0.7287466",
"0.7241298",
"0.7240052",
"0.72324497",
"0.72225... | 0.0 | -1 |
Create a copy of this object | def copy(self):
new_obj = DataObject()
new_obj.data = self.data.copy()
return new_obj | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def copy(self):\n return self.__class__(self, copy=True)",
"def __copy__(self):\n return self.copy()",
"def copy(self):\n return self",
"def __deepcopy__(self):\n return self",
"def copy(self):\n return self.__class__(self)",
"def copy(self):\n return self.__clas... | [
"0.87964857",
"0.8641381",
"0.8620861",
"0.85309654",
"0.85264844",
"0.85077643",
"0.8425597",
"0.8395931",
"0.8380197",
"0.8380197",
"0.8380197",
"0.8379219",
"0.8363808",
"0.8356687",
"0.8350817",
"0.83497334",
"0.8348871",
"0.8346249",
"0.832502",
"0.8322749",
"0.8322749",... | 0.0 | -1 |
Gets the full name of the person | def full_name(self):
first = self.first.capitalize()
last = self.last.capitalize()
output = f'{first} {last}'
return(output) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_full_name(self):\n return self.name + self.last_name",
"def get_full_name(self):\n full_name = '%s %s' % (self.id_persona.nombre, self.id_persona.apellidos)\n return full_name.strip()",
"def get_full_name(self):\n\t\treturn \"{} {}\".format(self.First_name, self.Last_name)",
"def... | [
"0.840717",
"0.83223796",
"0.82198757",
"0.8188289",
"0.81653166",
"0.81653166",
"0.81653166",
"0.81653166",
"0.81653166",
"0.81653166",
"0.81653166",
"0.81653166",
"0.81653166",
"0.81653166",
"0.81653166",
"0.81653166",
"0.81653166",
"0.81653166",
"0.81653166",
"0.81653166",
... | 0.75812984 | 95 |
gets the full name length | def __len__(self):
return(len(self.full_name())) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def namelength(self):\n return self[\"namelength\"]",
"def truncated_name(self):\n return self.name[:20]",
"def max_name_length(self):\n return None",
"def name_length(self) -> int:\n # Note that this function needs to be annotated with a return type so that pydantic\n # c... | [
"0.8126787",
"0.74455124",
"0.74089926",
"0.7349187",
"0.73468614",
"0.7327348",
"0.7194951",
"0.7058772",
"0.70052737",
"0.6953169",
"0.69373494",
"0.6924872",
"0.6903364",
"0.6874179",
"0.68728447",
"0.68728447",
"0.68728447",
"0.68728447",
"0.68728447",
"0.68728447",
"0.68... | 0.79260474 | 1 |
Check whether a given data is an ndarray. | def is_ndarray(data_to_check):
flag = False
if isinstance(data_to_check, np.ndarray):
flag = True
return flag | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_ndarray(data):\n if data.__class__ is not np.ndarray:\n raise TypeError(\"Argument of type numpy.ndarray expected\")",
"def _is_array(obj):\r\n return isinstance(obj, np.ndarray)",
"def isarray(x):\r\n\r\n try:\r\n return isinstance(x, array)\r\n except:\r\n return Fa... | [
"0.8602496",
"0.77947587",
"0.760893",
"0.75478977",
"0.7478363",
"0.72610986",
"0.725495",
"0.7254067",
"0.7198201",
"0.7097226",
"0.7071142",
"0.706791",
"0.6849216",
"0.6769056",
"0.67420024",
"0.6733615",
"0.6672",
"0.6666211",
"0.6649274",
"0.6615218",
"0.66011655",
"0... | 0.8656015 | 0 |
Convert data to numpy array (containing only floats). | def to_ndarray(data_in, float_array=True):
if is_root(data_in):
data_in = root2array(**data_in) # why **? it's a root dict
# change numpy.void to normal floats
if isinstance(data_in, (pd.Series, pd.DataFrame)):
test_sample = data_in.iloc[0]
else:
test_sample = data_in[0]
if ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def datum_to_array(datum):\n if len(datum.data):\n return np.fromstring(datum.data, dtype=np.uint8).reshape(\n datum.channels, datum.height, datum.width)\n else:\n return np.array(datum.float_data).astype(float).reshape(\n datum.channels, datum.height, datum.width)",
"de... | [
"0.7342582",
"0.7185037",
"0.71687496",
"0.7110717",
"0.69681305",
"0.6794476",
"0.66499776",
"0.6641928",
"0.6595015",
"0.65299165",
"0.64606863",
"0.64386034",
"0.64264417",
"0.63958293",
"0.63862485",
"0.6323282",
"0.6303818",
"0.6285961",
"0.62715375",
"0.6270051",
"0.624... | 0.7394415 | 0 |
The interface device name. | def name(self):
return self.data['name'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def device_name(self) -> str:\n return self._device_name",
"def get_device_name(self, device_path: str) -> str:\n return self._properties[device_path][defs.DEVICE_INTERFACE][\"Name\"]",
"def name(self):\n return self.device_name",
"def name(self):\n return self.device.name",
"de... | [
"0.8409797",
"0.8277129",
"0.8248542",
"0.8091121",
"0.80248815",
"0.8020685",
"0.8014048",
"0.79819435",
"0.79819435",
"0.7947921",
"0.792767",
"0.79068875",
"0.78487",
"0.782612",
"0.781116",
"0.7766065",
"0.7762573",
"0.77561635",
"0.76955956",
"0.76007646",
"0.75060785",
... | 0.0 | -1 |
Return the path of a Clip used for the internal shark representation | def source_path(self):
return 'clips/{0}'.format(self.id) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clips(self) -> Path:\n # simple case - path is already absolute\n clip_dir = Path(self.clip_directory)\n if clip_dir.is_absolute():\n return clip_dir\n # try relative to current working directory\n filename = Path.cwd() / clip_dir\n if filename.exists():\n ... | [
"0.710071",
"0.65920776",
"0.6242647",
"0.62321275",
"0.603604",
"0.60082334",
"0.5957091",
"0.5904986",
"0.58265054",
"0.5817413",
"0.58083755",
"0.5800321",
"0.5782769",
"0.575579",
"0.57519156",
"0.5739873",
"0.5716705",
"0.5715926",
"0.56922656",
"0.56786007",
"0.5667453"... | 0.6841282 | 1 |
Check if number is prime. | def is_prime(num):
if num <= 1:
return False
if num > 2:
for i in range(2, num):
if (num % i) == 0:
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_prime(num: int) -> bool:\n pass",
"def is_prime(number: int) -> bool:\n if number < 2:\n return False\n elif number == 2:\n return True\n else:\n divisor_number = 2\n while divisor_number <= math.sqrt(number):\n if number % divisor_number == 0:\n ... | [
"0.84863883",
"0.8195242",
"0.8181863",
"0.8091397",
"0.80625623",
"0.80599093",
"0.80535525",
"0.8027277",
"0.800855",
"0.7992177",
"0.79889935",
"0.7962955",
"0.79386413",
"0.7916318",
"0.7912551",
"0.7890966",
"0.7884201",
"0.7884201",
"0.78722215",
"0.7856927",
"0.7825415... | 0.77367586 | 29 |
create an EgressNetworkPolicy This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. | def create_network_openshift_io_v1_egress_network_policy_for_all_namespaces(self, body, **kwargs):
kwargs['_return_http_data_only'] = True
if kwargs.get('callback'):
return self.create_network_openshift_io_v1_egress_network_policy_for_all_namespaces_with_http_info(body, **kwargs)
els... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_network_openshift_io_v1_namespaced_egress_network_policy(self, namespace, body, **kwargs):\n kwargs['_return_http_data_only'] = True\n if kwargs.get('callback'):\n return self.create_network_openshift_io_v1_namespaced_egress_network_policy_with_http_info(namespace, body, **kwarg... | [
"0.74296445",
"0.66253906",
"0.65625155",
"0.6341136",
"0.5992609",
"0.5973307",
"0.58352846",
"0.5804603",
"0.57577384",
"0.57169944",
"0.5642022",
"0.5634511",
"0.55831796",
"0.54667866",
"0.52771425",
"0.5274845",
"0.5267017",
"0.5249369",
"0.51839864",
"0.5074986",
"0.503... | 0.62866235 | 4 |
create an EgressNetworkPolicy This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. | def create_network_openshift_io_v1_egress_network_policy_for_all_namespaces_with_http_info(self, body, **kwargs):
all_params = ['body', 'pretty']
all_params.append('callback')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_network_openshift_io_v1_namespaced_egress_network_policy(self, namespace, body, **kwargs):\n kwargs['_return_http_data_only'] = True\n if kwargs.get('callback'):\n return self.create_network_openshift_io_v1_namespaced_egress_network_policy_with_http_info(namespace, body, **kwarg... | [
"0.74310374",
"0.6628057",
"0.65640515",
"0.6342637",
"0.6288912",
"0.5994",
"0.5974281",
"0.5835601",
"0.58073074",
"0.57587516",
"0.5719643",
"0.56431997",
"0.56367403",
"0.54682237",
"0.52771074",
"0.5276431",
"0.5267725",
"0.5250542",
"0.51852125",
"0.5076375",
"0.5040627... | 0.55866194 | 13 |
create an EgressNetworkPolicy This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. | def create_network_openshift_io_v1_namespaced_egress_network_policy(self, namespace, body, **kwargs):
kwargs['_return_http_data_only'] = True
if kwargs.get('callback'):
return self.create_network_openshift_io_v1_namespaced_egress_network_policy_with_http_info(namespace, body, **kwargs)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_network_openshift_io_v1_namespaced_egress_network_policy_with_http_info(self, namespace, body, **kwargs):\n\n all_params = ['namespace', 'body', 'pretty']\n all_params.append('callback')\n all_params.append('_return_http_data_only')\n all_params.append('_preload_content')\n ... | [
"0.66253906",
"0.65625155",
"0.6341136",
"0.62866235",
"0.5992609",
"0.5973307",
"0.58352846",
"0.5804603",
"0.57577384",
"0.57169944",
"0.5642022",
"0.5634511",
"0.55831796",
"0.54667866",
"0.52771425",
"0.5274845",
"0.5267017",
"0.5249369",
"0.51839864",
"0.5074986",
"0.503... | 0.74296445 | 0 |
create an EgressNetworkPolicy This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. | def create_network_openshift_io_v1_namespaced_egress_network_policy_with_http_info(self, namespace, body, **kwargs):
all_params = ['namespace', 'body', 'pretty']
all_params.append('callback')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_network_openshift_io_v1_namespaced_egress_network_policy(self, namespace, body, **kwargs):\n kwargs['_return_http_data_only'] = True\n if kwargs.get('callback'):\n return self.create_network_openshift_io_v1_namespaced_egress_network_policy_with_http_info(namespace, body, **kwarg... | [
"0.74310374",
"0.65640515",
"0.6342637",
"0.6288912",
"0.5994",
"0.5974281",
"0.5835601",
"0.58073074",
"0.57587516",
"0.5719643",
"0.56431997",
"0.56367403",
"0.55866194",
"0.54682237",
"0.52771074",
"0.5276431",
"0.5267725",
"0.5250542",
"0.51852125",
"0.5076375",
"0.504062... | 0.6628057 | 1 |
list or watch objects of kind EgressNetworkPolicy This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. | def list_network_openshift_io_v1_egress_network_policy_for_all_namespaces(self, **kwargs):
kwargs['_return_http_data_only'] = True
if kwargs.get('callback'):
return self.list_network_openshift_io_v1_egress_network_policy_for_all_namespaces_with_http_info(**kwargs)
else:
(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_network_openshift_io_v1_egress_network_policy_for_all_namespaces_with_http_info(self, **kwargs):\n\n all_params = ['pretty', 'field_selector', 'label_selector', 'resource_version', 'timeout_seconds', 'watch']\n all_params.append('callback')\n all_params.append('_return_http_data_only'... | [
"0.68457",
"0.67139566",
"0.6604685",
"0.6153015",
"0.6125474",
"0.6064989",
"0.5947351",
"0.5814869",
"0.5794281",
"0.5673655",
"0.5562451",
"0.553133",
"0.55203706",
"0.54956096",
"0.54793125",
"0.54048604",
"0.5074269",
"0.5022551",
"0.4977682",
"0.49671748",
"0.49375805",... | 0.64015186 | 3 |
list or watch objects of kind EgressNetworkPolicy This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. | def list_network_openshift_io_v1_egress_network_policy_for_all_namespaces_with_http_info(self, **kwargs):
all_params = ['pretty', 'field_selector', 'label_selector', 'resource_version', 'timeout_seconds', 'watch']
all_params.append('callback')
all_params.append('_return_http_data_only')
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_network_openshift_io_v1_namespaced_egress_network_policy_with_http_info(self, namespace, **kwargs):\n\n all_params = ['namespace', 'pretty', 'field_selector', 'label_selector', 'resource_version', 'timeout_seconds', 'watch']\n all_params.append('callback')\n all_params.append('_return... | [
"0.6714681",
"0.6605856",
"0.6403013",
"0.615389",
"0.6126964",
"0.606649",
"0.59496355",
"0.5816745",
"0.5797173",
"0.5676244",
"0.55644155",
"0.55336046",
"0.5522652",
"0.5498081",
"0.54820603",
"0.5406501",
"0.5076582",
"0.50236964",
"0.49797103",
"0.49683613",
"0.4936172"... | 0.684613 | 0 |
list or watch objects of kind EgressNetworkPolicy This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. | def list_network_openshift_io_v1_namespaced_egress_network_policy(self, namespace, **kwargs):
kwargs['_return_http_data_only'] = True
if kwargs.get('callback'):
return self.list_network_openshift_io_v1_namespaced_egress_network_policy_with_http_info(namespace, **kwargs)
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_network_openshift_io_v1_egress_network_policy_for_all_namespaces_with_http_info(self, **kwargs):\n\n all_params = ['pretty', 'field_selector', 'label_selector', 'resource_version', 'timeout_seconds', 'watch']\n all_params.append('callback')\n all_params.append('_return_http_data_only'... | [
"0.68457",
"0.67139566",
"0.64015186",
"0.6153015",
"0.6125474",
"0.6064989",
"0.5947351",
"0.5814869",
"0.5794281",
"0.5673655",
"0.5562451",
"0.553133",
"0.55203706",
"0.54956096",
"0.54793125",
"0.54048604",
"0.5074269",
"0.5022551",
"0.4977682",
"0.49671748",
"0.49375805"... | 0.6604685 | 2 |
list or watch objects of kind EgressNetworkPolicy This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. | def list_network_openshift_io_v1_namespaced_egress_network_policy_with_http_info(self, namespace, **kwargs):
all_params = ['namespace', 'pretty', 'field_selector', 'label_selector', 'resource_version', 'timeout_seconds', 'watch']
all_params.append('callback')
all_params.append('_return_http_dat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_network_openshift_io_v1_egress_network_policy_for_all_namespaces_with_http_info(self, **kwargs):\n\n all_params = ['pretty', 'field_selector', 'label_selector', 'resource_version', 'timeout_seconds', 'watch']\n all_params.append('callback')\n all_params.append('_return_http_data_only'... | [
"0.684613",
"0.6605856",
"0.6403013",
"0.615389",
"0.6126964",
"0.606649",
"0.59496355",
"0.5816745",
"0.5797173",
"0.5676244",
"0.55644155",
"0.55336046",
"0.5522652",
"0.5498081",
"0.54820603",
"0.5406501",
"0.5076582",
"0.50236964",
"0.49797103",
"0.49683613",
"0.4936172",... | 0.6714681 | 1 |
Cache value and return it | def testargs(value=''):
try:
rval = testargs._value
except AttributeError:
testargs._value = value
rval = testargs._value
if value != '':
testargs._value = value
return rval | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_cached_value(self):\n if not self.cache_ttl or not self.redis.exists(self._cache_key):\n return None\n else:\n return self.redis.get(self._cache_key).decode()",
"def retrieve_from_cache(self):\n return 0",
"def get(self, *args, **kwargs):\n return self.... | [
"0.75589705",
"0.7292145",
"0.72915393",
"0.7286973",
"0.72516304",
"0.72248274",
"0.7207716",
"0.72038037",
"0.71670556",
"0.7156641",
"0.71436477",
"0.71041965",
"0.7101798",
"0.7090028",
"0.702257",
"0.702035",
"0.6980243",
"0.69734144",
"0.6971394",
"0.6955956",
"0.691668... | 0.0 | -1 |
Return the logpath for this test. The test can specify the basename but does not have to. | def logpath(self, basename=''):
if basename == '':
basename = "test_default_hpss_crawl.log"
rval = self.tmpdir(basename)
return rval | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_log_path() -> Union[str, None]:\n return os.path.dirname(__logfile)",
"def path(self):\n return self._log_folder",
"def logs_path(self):\n return self._logs_path",
"def get_log_file(self):\n return self._log_filename",
"def fake_log_filename(self) -> str:\n return \"test_log.... | [
"0.72362876",
"0.7096593",
"0.6910288",
"0.67949444",
"0.6739757",
"0.6653794",
"0.6628266",
"0.66259706",
"0.65730613",
"0.6569356",
"0.65394855",
"0.65251374",
"0.6512052",
"0.6499563",
"0.649409",
"0.6469224",
"0.6469224",
"0.6468619",
"0.6429375",
"0.6413701",
"0.6407454"... | 0.85418457 | 0 |
Render the XML node to a string. The string representation is rendered as canonical c14n XML, to make verification and signing possible. | def get_xml_string(self) -> str:
return etree.tostring(self.xml, method='c14n', exclusive=True).decode('utf-8') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __repr__(self):\n if self.node:\n return self.node.toprettyxml()\n else: return \"\"",
"def __str__(self):\n rendered = self.render()\n\n builder = ElementTree.TreeBuilder()\n rendered._add_to_builder(builder)\n root = builder.close()\n\n string = E... | [
"0.7340909",
"0.70447594",
"0.7024068",
"0.69450396",
"0.69450396",
"0.69450396",
"0.69450396",
"0.69450396",
"0.69450396",
"0.69450396",
"0.69450396",
"0.69450396",
"0.69450396",
"0.69450396",
"0.69450396",
"0.69450396",
"0.69450396",
"0.69450396",
"0.69450396",
"0.69450396",
... | 0.8029537 | 0 |
Test offset inputs. This test uses the same graph arrangement as test_two_merged_inputs(), but for this test case, none of the inputs have perfect alignment. | def test_offset_inputs(self):
clear_graph()
timeseries_1 = [[isodate.parse_date('2000-01-01'), 1]]
timeseries_2 = [[isodate.parse_date('2000-01-02'), 200],
[isodate.parse_date('2000-01-03'), 300]]
emit_data_block_1 = EmitTimeSeries(timeseries_1)
emit_dat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_operator_same_size_global_offset_array(self):\n ndim = 5\n length = 4\n\n for op in STANDARD_OPERATORS | IN_PLACE_OPERATORS:\n for forward in [True, False]:\n (original, offset_array) = self.generate_data(ndim, length)\n operate_param = GlobalO... | [
"0.6469151",
"0.63827974",
"0.63710725",
"0.6036114",
"0.59978807",
"0.5921578",
"0.5919103",
"0.5865728",
"0.5800081",
"0.57384145",
"0.5719047",
"0.56275564",
"0.5608383",
"0.5583671",
"0.5505369",
"0.54523915",
"0.54519516",
"0.54188013",
"0.5387927",
"0.53860897",
"0.5365... | 0.7696678 | 0 |
Converts record into a PipelineEntity. | def to_entity(record):
return PipelineEntity({
'id': record.id,
'name': record.name,
}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_record(entity):\n return PipelineStore(**entity.to_native())",
"def transform(self, record):\n if record is None:\n return None\n\n # If we've got a list, hope it's a list of records. Recurse,\n # calling transform() on each of the list elements in order and\n ... | [
"0.7408635",
"0.58673936",
"0.57366174",
"0.57065475",
"0.56248754",
"0.56170416",
"0.55109197",
"0.5493652",
"0.5483048",
"0.5431157",
"0.5406677",
"0.53828156",
"0.5377747",
"0.53558624",
"0.5301662",
"0.527424",
"0.52612156",
"0.522003",
"0.52147186",
"0.5210329",
"0.51595... | 0.8939616 | 0 |
Fix the visible bias. Do not update them in learning. | def fix_vis_bias(self,a=None,fix_a_log_ind=None):
if a is not None:
self.a=a # reset a
if len(self.crbms)>0:
self.crbms[0].a=a # reset the first crbm's visiable bias
self.if_fix_vis_bias=True
self.fix_a_log_ind=fix_a_log_ind
if self.fix... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def adjust_bias(self):\n self.bias += self.lr * self.delta",
"def updateBias(self, learningRate):\r\n self.setBias(self.getBias() + learningRate * self.getDelta())",
"def init_forget_bias(self):\n with torch.no_grad():#so the optimizer doesn't know about this ;)\n self.rnn.bias_... | [
"0.67653173",
"0.66092193",
"0.6570411",
"0.63828033",
"0.6344882",
"0.6197467",
"0.609668",
"0.59750575",
"0.59422886",
"0.59422886",
"0.5921578",
"0.59129065",
"0.5887856",
"0.5863979",
"0.5851074",
"0.5851046",
"0.5845586",
"0.5841695",
"0.5834693",
"0.5824782",
"0.580758"... | 0.7187474 | 0 |
Sets the clock to a specific time. | def set_time(self, t):
if self.paused:
self.offset = t
else:
self.offset = t - time.time() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_time(self, time):\n self.game_inst.set_time(time)",
"def set_time(self, time):\n pass",
"def set_time(self, time):\n self._set_time(time, True)",
"def set_time(self, time):\n\n self.time.set_value(time)",
"def setTime(self, time):\n self._time = time",
"def set_... | [
"0.82741815",
"0.7997598",
"0.7986172",
"0.79012996",
"0.775609",
"0.77396864",
"0.72467864",
"0.71540993",
"0.7120612",
"0.70832545",
"0.70560807",
"0.7037896",
"0.70016575",
"0.70016575",
"0.70016575",
"0.70016575",
"0.70016575",
"0.70016575",
"0.6995467",
"0.6981888",
"0.6... | 0.68944085 | 21 |
Return the first index of a pair of elements where the earlier element is not less than the later elements. If no such pair exists, return 1. | def first_bad_pair(sequence):
for i in range(len(sequence)-1):
if sequence[i] >= sequence[i+1]:
return i
return -1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bisect_lt(sorted_array: List[int], value: int):\n\n if sorted_array[0] < value:\n index: int = bisect_left(sorted_array, value) - 1\n\n return index, sorted_array[index]\n\n return None, None",
"def earliest_second1(X, A):\n \n appeared_so_far = set()\n \n for second, position... | [
"0.69905037",
"0.6662757",
"0.6367298",
"0.63345945",
"0.63040656",
"0.6298637",
"0.6180058",
"0.6095914",
"0.6085673",
"0.6053269",
"0.59968466",
"0.5985406",
"0.5977649",
"0.59602636",
"0.59583604",
"0.5956844",
"0.5942789",
"0.5928106",
"0.5909363",
"0.588771",
"0.58818454... | 0.71288514 | 0 |
Return whether it is possible to obtain a strictly increasing sequence by removing no more than one element from the array. | def almostIncreasingSequence(sequence):
j = first_bad_pair(sequence)
if j == -1:
return True # List is increasing
# We know from j that all pairs before j are okay
# Thus, we can only pass the REMAINING values from j-1:j
# and then j+1 to end
if first_bad_pair(sequence[j-1:j] + sequ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def almostIncreasingSequence(sequence: List[int]) -> bool:\n last = None\n removed_index = None\n broke = False\n for i, el in enumerate(sequence):\n if last is None:\n last = el\n elif last < el:\n last = el\n else:\n if removed_index is not None:\... | [
"0.74622965",
"0.69994855",
"0.6431615",
"0.6383345",
"0.61973816",
"0.6164658",
"0.6140723",
"0.6140723",
"0.6140723",
"0.6115278",
"0.6103405",
"0.60751903",
"0.60730296",
"0.60727155",
"0.60595864",
"0.60537463",
"0.60351455",
"0.6015505",
"0.599575",
"0.5979879",
"0.59372... | 0.6967681 | 2 |
Create object of type ToneAnalyzer for a specific API key and URL pair. Loads tone data from a previously created JSON file if such a file is specified and exists. Preconditions The file specified by `json_file' (or `_DEFAULT_JSON_FILENAME') must be formated in same fashion as `_save_tone()'. | def __init__(self, api_key_env, api_url_env, json_file=None):
load_dotenv()
self._api_key = os.getenv(api_key_env)
self._api_url = os.getenv(api_url_env)
# TODO: Write exception class for filename validation.
if json_file is not None:
assert type(json_file) == str, "... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_tones_from_file(self, filename=None):\n in_filename = self._json_file if filename is None else filename\n try:\n with open(in_filename, 'r') as infile:\n return json.load(infile)\n except FileNotFoundError: # trying to open non-existent file\n pri... | [
"0.66093093",
"0.61116266",
"0.61051875",
"0.6103965",
"0.6103965",
"0.6045756",
"0.5904668",
"0.55999506",
"0.55999506",
"0.5554338",
"0.548396",
"0.5477249",
"0.54715693",
"0.546149",
"0.54344803",
"0.5384135",
"0.5345197",
"0.53312355",
"0.5329094",
"0.52458817",
"0.524169... | 0.633695 | 1 |
helper function, softmax with beta | def _softmax(z, beta):
assert beta > 0
# softmax the input to a valid PMF
pi_a = F.softmax(torch.squeeze(z / beta), dim=0)
# make sure the output is valid
if torch.any(torch.isnan(pi_a)):
raise ValueError(f'Softmax produced nan: {z} -> {pi_a}')
return pi_a | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def softmax(Qs, beta):\n\n num = np.exp(Qs * beta)\n den = np.exp(Qs * beta).sum()\n return num / den",
"def softmax(Qs, beta):\n num = np.exp(Qs * beta)\n den = np.exp(Qs * beta).sum()\n return num / den",
"def softmax(x):\r\n return np.exp(x) / np.sum(np.exp(x), axis=0)",
"def softmax(... | [
"0.8352897",
"0.83200246",
"0.7661302",
"0.7648125",
"0.76184887",
"0.76184887",
"0.76184887",
"0.76184887",
"0.76184887",
"0.76184887",
"0.76184887",
"0.7615418",
"0.7582815",
"0.75746965",
"0.7569716",
"0.7528",
"0.7524546",
"0.7524003",
"0.7513178",
"0.7505361",
"0.750144"... | 0.7616794 | 11 |
Set the label initialization sequence. (MLF) | def initLabel(self):
cmd = [0x00] * 8
self.buildCommand(cmd) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _label_tary_initial(self):\n for var in self._variable_iterator():\n if not var.has_unitary_definition():\n var.tary = 'multitary'\n elif var.antecedents(ignore_pseudo=True) == []:\n var.tary = 'unitary'\n else: \n var.tary ... | [
"0.62437826",
"0.61880636",
"0.60434693",
"0.6016381",
"0.6015763",
"0.5936153",
"0.59259063",
"0.59258956",
"0.59258956",
"0.59258956",
"0.59258956",
"0.59258956",
"0.59258956",
"0.59258956",
"0.59258956",
"0.58236474",
"0.581564",
"0.5776792",
"0.5747045",
"0.5727166",
"0.5... | 0.701338 | 0 |
Given a plain text password, return it's bcrypt hash. The password is first hashed via SHA256 then B64encoded to prevent null byte issues and circumvent the 72char limit imposed by bcrypt. | def hash(cls, plain_text):
sha256_encoded = hashlib.sha256(plain_text.encode('utf-8'))
b64_encoded = base64.b64encode(sha256_encoded.digest())
return bcrypt.hashpw(b64_encoded, bcrypt.gensalt()).decode('utf-8') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hash_password(password: str) -> bytes:\n pwd = password.encode('utf-8')\n salt = bcrypt.gensalt()\n hashed = bcrypt.hashpw(pwd, salt)\n return hashed",
"def hash_password(password: str) -> bytes:\n encoded = password.encode()\n hashed = bcrypt.hashpw(encoded, bcrypt.gensalt())\n return h... | [
"0.79803306",
"0.7948095",
"0.78860366",
"0.7666171",
"0.7644294",
"0.7616584",
"0.75133955",
"0.75075597",
"0.74144286",
"0.73687625",
"0.7331713",
"0.7320855",
"0.7316937",
"0.7306186",
"0.7296499",
"0.72563624",
"0.72530997",
"0.72530997",
"0.72530997",
"0.7234138",
"0.721... | 0.7859023 | 3 |
Given a plain_text password and a bcrypt hash, check if it matches the hash. The plain test password is prehashed identically to the hash() function. | def verify(cls, plain_text, hashed):
sha256_encoded = hashlib.sha256(plain_text.encode('utf-8'))
b64_encoded = base64.b64encode(sha256_encoded.digest())
return bcrypt.checkpw(b64_encoded, hashed.encode('utf-8')) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_is_password_matching(self):\n\n password = \"8wpyathgors\"\n hashed_password = bcrypt.hashpw(password.encode(\"utf-8\"), bcrypt.gensalt())\n self.assertEqual(\n util.is_password_matching(password, hashed_password.decode(\"utf-8\")), True\n )",
"def is_correct_passw... | [
"0.81978035",
"0.8061723",
"0.78780365",
"0.78152806",
"0.77815676",
"0.75899076",
"0.7579343",
"0.7565499",
"0.7551752",
"0.75420785",
"0.75384825",
"0.7518256",
"0.7507118",
"0.74929976",
"0.74832404",
"0.74289477",
"0.7377142",
"0.7359197",
"0.73503584",
"0.7318151",
"0.73... | 0.785663 | 3 |
Tell user that the restaurant is open | def open_restaurant(self):
print(self.restaurant_name.title() + " is open.") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def open_restaurant(self):\n print('The restaurant is now open for business!')",
"def open_restaurant(self):\n print(\"\\tThe restaurant is open now.\")",
"def open_restaurant(self):\n\t\tprint(f\"{self.name.title()} is now open for business.\")",
"def open_restaurant(self):\n print(self... | [
"0.84814614",
"0.8309194",
"0.8303476",
"0.83002234",
"0.83002234",
"0.82954466",
"0.82954466",
"0.8225114",
"0.8225114",
"0.821856",
"0.8214794",
"0.8214144",
"0.8210817",
"0.8199823",
"0.8198387",
"0.8188398",
"0.8187063",
"0.816809",
"0.8157224",
"0.8118855",
"0.80770874",... | 0.82314336 | 7 |
Set the number of customers that have been served. | def set_number_served(self, customers):
self.number_served = customers | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_number_served(self, num_customers):\r\n self.number_served = num_customers",
"def set_number_served(self, customers):\n self.number_served = customers",
"def set_number_served(self,customers):\n\t\tself.number_served += customers\n\t\tprint(self.name + \" has served \" + str(self.number_s... | [
"0.8520396",
"0.84518945",
"0.8344245",
"0.81206894",
"0.8005112",
"0.76871496",
"0.754766",
"0.7490499",
"0.7324868",
"0.7131121",
"0.70427346",
"0.69925416",
"0.6905083",
"0.6605221",
"0.6570967",
"0.65301",
"0.6503032",
"0.64889383",
"0.6456298",
"0.64449733",
"0.62329537"... | 0.85227627 | 0 |
Initiate User first name, last name, age and gender | def __init__(self, first_name, last_name, age, gender):
self.first_name = first_name
self.last_name = last_name
self.age = age
self.gender = gender
self.login_attempts = 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def describe_user(self):\n print(self.first_name.title() + ' ' + self.last_name.title()\n + ' is a ' + self.gender + ' aged ' + str(self.age) + '.')",
"def describe_user(self):\r\n full_name = self.first_name + \" \" + self.last_name\r\n print(\"The user's name is \" + full_name... | [
"0.7039994",
"0.6980359",
"0.6770487",
"0.6745841",
"0.672862",
"0.6703181",
"0.66612107",
"0.6609884",
"0.6520581",
"0.6516321",
"0.65156245",
"0.6502057",
"0.6499929",
"0.64656997",
"0.64566207",
"0.64566207",
"0.6446024",
"0.6417015",
"0.6417015",
"0.6417015",
"0.64107513"... | 0.7045241 | 0 |
Increments the number of login attempts by the user | def increment_login_attempts(self):
self.login_attempts += 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def increment_login_attempts(self):\r\n\t\tself.login_attempts +=1",
"def increment_login_attempts(self):\n\t\tself.login_attempts += 1",
"def increment_login_attempts(self):\n\t\tself.login_attempts += 1",
"def increment_login_attempts(self):\n\t\tself.login_attempts += 1",
"def increment_login_attempts(s... | [
"0.8980915",
"0.893185",
"0.893185",
"0.893185",
"0.893185",
"0.8854607",
"0.8854607",
"0.8854607",
"0.8854607",
"0.8854607",
"0.8854607",
"0.88051933",
"0.87030697",
"0.85568",
"0.85183024",
"0.85120475",
"0.8299111",
"0.7589291",
"0.7335565",
"0.71931064",
"0.7156828",
"0... | 0.8981156 | 2 |
Get command line arguments. | def get_options(argv):
options = sf.utils.Struct()
if '-help' in argv:
print(__doc__)
exit()
args = sf.options.get_options(argv)
try:
options.input = args['args'][0]
options.output = args['args'][1]
except:
print(__doc__)
exit(1)
if '-showfig' ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def command_line_args(self) -> Optional[str]:\n return pulumi.get(self, \"command_line_args\")",
"def command_line_args(self) -> Optional[str]:\n return pulumi.get(self, \"command_line_args\")",
"def command_line_args(self) -> Optional[str]:\n return pulumi.get(self, \"command_line_args\")... | [
"0.75216156",
"0.75216156",
"0.75216156",
"0.75216156",
"0.75216156",
"0.75216156",
"0.74243534",
"0.74060434",
"0.7394306",
"0.7373861",
"0.73489547",
"0.7305792",
"0.7296137",
"0.72873765",
"0.72663695",
"0.7261827",
"0.7260028",
"0.72498846",
"0.7245708",
"0.7234266",
"0.7... | 0.0 | -1 |
Two resource objects that represent the same entity in the cloud should be considered equal if they have the same ID. If they don't have IDs, but their attribute info matches, they are equal. | def __eq__(self, other):
if not isinstance(other, self.__class__):
return False
if hasattr(self, "id") and hasattr(other, "id"):
return self.id == other.id
return self._info == other._info | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return (self.__class__ == other.__class__ and\n self.entity_id == other.entity_id and\n self.state == other.state and\n self.attributes == other.attributes)",
"def __eq__(self, other):\n return self.getId() == other.getId()",
... | [
"0.72587746",
"0.7046016",
"0.69998443",
"0.6854494",
"0.68401664",
"0.6837916",
"0.68242264",
"0.6801343",
"0.67947435",
"0.6768385",
"0.6740888",
"0.6703752",
"0.66985303",
"0.6696171",
"0.6664283",
"0.6640958",
"0.66332376",
"0.66168195",
"0.6611452",
"0.6594029",
"0.65679... | 0.6794373 | 9 |
Generate memory and perform experience play to player. Differ from pretrain() by saving only steps with nonzero reward. | def pretrain_v2(env: ConnectFourEnv, params: Dict, player: DeepQPlayer):
# If the player is not deepQ player, it's meaningless to pre-train.
if not isinstance(player, DeepQPlayer):
return
print(f"Pre-train {player!r}")
print("-" * 30)
memory_size = params["REPLAY_BUFFER_MAX_LENGTH"]
re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pretrain(env: ConnectFourEnv, params: Dict, player: DeepQPlayer):\n\n # If the player is not deepQ player, it's meaningless to pre-train.\n if not isinstance(player, DeepQPlayer):\n return\n\n print(f\"Pre-train {player!r}\")\n print(\"-\" * 30)\n memory_size = params[\"REPLAY_BUFFER_MAX_... | [
"0.70746505",
"0.70407206",
"0.687269",
"0.6853764",
"0.6811145",
"0.6735651",
"0.6732636",
"0.6672132",
"0.666721",
"0.6666001",
"0.66469115",
"0.6644111",
"0.66359895",
"0.66291755",
"0.65930235",
"0.6543712",
"0.6524382",
"0.65038085",
"0.64895076",
"0.64849347",
"0.646788... | 0.7146514 | 0 |
Returns toplevel XTSM element | def getOwnerXTSM(self):
if self.__parent__:
return self.__parent__.getOwnerXTSM()
else:
return self | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_root(self):\n he = sciter.dom.HELEMENT()\n ok = _api.SciterGetRootElement(self.hwnd, ctypes.byref(he))\n sciter.dom.Element._throw_if(ok)\n return sciter.dom.Element(he) if he else None",
"def _elem_root(self):\n # type: () -> etree._Element\n return self._tree.g... | [
"0.66003186",
"0.63864386",
"0.6377824",
"0.615943",
"0.60851187",
"0.60828626",
"0.5952801",
"0.5951511",
"0.59402204",
"0.58850193",
"0.581106",
"0.58098286",
"0.58087426",
"0.5805496",
"0.5805496",
"0.5786929",
"0.5751049",
"0.5650796",
"0.56232893",
"0.56213754",
"0.56160... | 0.58914924 | 9 |
Searches up the XTSM tree for the first ancestor of the type tagtype, returning the match, or None if it reaches toplevel without a match | def getFirstParentByType(self,tagtype):
if self.get_tag()==tagtype:
return self
else:
if self.__parent__:
return self.__parent__.getFirstParentByType(tagtype)
else: return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def findTypeParent(element, tag):\n \n p = element\n while True:\n p = p.getparent()\n if p.tag == tag:\n return p\n \n # Not found\n return None",
"def find_ancestor(self, node_type: Type['Node']) -> Optional['Node']:\n curr = self.parent\n while curr and... | [
"0.7115129",
"0.6956271",
"0.6279645",
"0.6240738",
"0.60415435",
"0.5972227",
"0.58248526",
"0.5754183",
"0.5714181",
"0.5665742",
"0.5511527",
"0.54972935",
"0.5445878",
"0.54240996",
"0.54075646",
"0.53945583",
"0.53578043",
"0.53565913",
"0.53552115",
"0.5349458",
"0.5281... | 0.7042987 | 1 |
Returns all XTSM children of the node as a list | def getChildNodes(self):
if (type(self._seq).__name__=='NoneType'): return []
return [a for a in self._seq if type(a)!=type(u'')] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getchildren(self):\n if self.parser == XML_node.etree:\n return [XML_node(a, self.parser) for a in self.data.getchildren()]",
"def get_child_nodes(node):\r\n return list(iter_child_nodes(node))",
"def get_children(self):\n return [ch for ch in self.children]",
"def get_list_of... | [
"0.80315626",
"0.7975073",
"0.77948064",
"0.75176865",
"0.7493291",
"0.74786955",
"0.74424595",
"0.74394333",
"0.7427382",
"0.74252117",
"0.73915315",
"0.73803055",
"0.7357779",
"0.7317168",
"0.73161143",
"0.73033607",
"0.7301767",
"0.7301767",
"0.7297658",
"0.72690725",
"0.7... | 0.7092967 | 30 |
Returns a list of all descendents of given type | def getDescendentsByType(self,targetType):
res=[]
for child in self.getChildNodes():
if hasattr(child,'getDescendentsByType'):
res.extend(child.getDescendentsByType(targetType))
if hasattr(self,targetType): res.extend(getattr(self,targetType))
return res | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all_descendants(parent):\n children = parent.__subclasses__()\n descendants = children[:]\n for child in children:\n descendants += get_all_descendants(child)\n return descendants",
"def getTypeAndAllChildTypes(type):\n\n alreadyFoundTypeNames = []\n ret = []\n __getTypeAndAll... | [
"0.7492029",
"0.7284355",
"0.706108",
"0.7049739",
"0.7030809",
"0.70048213",
"0.6967375",
"0.6824794",
"0.6731192",
"0.6727062",
"0.66374415",
"0.6627029",
"0.6606128",
"0.64750165",
"0.64457756",
"0.643574",
"0.6433537",
"0.6412507",
"0.6396683",
"0.6385625",
"0.63730973",
... | 0.6902124 | 7 |
XDIM constant representing the width of the game YDIM constant representing the height of the game XY_GOAL node (tuple of integers) representing the location of the goal | def getNewPoint(XDIM,YDIM,XY_GOAL):
a = random.random()
if a < 0.05:
return XY_GOAL
else:
w = random.uniform(0,XDIM)
h = random.uniform(0,YDIM)
return (w,h) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_dim(self) -> u.Quantity:\n if self.x > self.y:\n return self.x\n return self.y",
"def get_goal(self):\n if self.get_cell(self.__size - 1).is_goal():\n return self.__size - 1\n else:\n for z in range(self.__size.z):\n for y in range(self.__size... | [
"0.5981963",
"0.5976097",
"0.5918543",
"0.5857839",
"0.573199",
"0.5695254",
"0.5653236",
"0.5622336",
"0.5609152",
"0.5606117",
"0.5592452",
"0.5575604",
"0.5474258",
"0.54592186",
"0.54547894",
"0.5431321",
"0.5395365",
"0.5386764",
"0.53667974",
"0.5343697",
"0.5339522",
... | 0.58169425 | 4 |
initialise Trie with root node | def __init__(self):
self.root = TrieNode() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n self.root = TrieNode('.')",
"def __init__(self):\n self.root = Trie.Node()",
"def __init__(self):\r\n self._root = TrieNode()",
"def __init__(self):\n self.root = TrieNode(\"*\")",
"def __init__(self):\r\n self.root = TrieNode()",
"def __init__(sel... | [
"0.87351626",
"0.8687553",
"0.8661108",
"0.8618725",
"0.8602777",
"0.8602777",
"0.847146",
"0.8331106",
"0.8299978",
"0.8241691",
"0.81845164",
"0.81845164",
"0.80712664",
"0.80116624",
"0.7760215",
"0.75544834",
"0.73534024",
"0.73534024",
"0.73534024",
"0.7263445",
"0.72370... | 0.8629351 | 17 |
Setter of op name. | def op_name(self, name):
self._op_name = name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def op_name(self):\n return self._op_name",
"def nameop(op, name):\n op = tf.identity(op, name=name)\n return op",
"def test_name_setter(self):\n\n class DummyOp(qml.operation.Operator):\n r\"\"\"Dummy custom operator\"\"\"\n num_wires = 1\n\n op = DummyOp(wires... | [
"0.76873386",
"0.7406731",
"0.72421366",
"0.71447194",
"0.70913136",
"0.70423734",
"0.70082194",
"0.6966818",
"0.69550323",
"0.6931697",
"0.6909298",
"0.6895045",
"0.6895045",
"0.6845244",
"0.6804268",
"0.6796993",
"0.6757629",
"0.66991794",
"0.66991794",
"0.6694516",
"0.6686... | 0.90119886 | 0 |
returns the team participation in categories. | def get_participations():
return_dict = cache_mgr.get_cache("team_participation")
if return_dict is None:
p_settings, _ = ParticipationSetting.objects.get_or_create(pk=1)
return_dict = {
"participation_100": [],
"participation_75": [],
"participation_50": [],
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_category(self):\n return self.event.get_user_category(self.person)",
"def get_team(channel : discord.TextChannel) -> Optional[str]:\n category_channel = bot.get_channel(channel.category_id)\n if category_channel:\n team = category_channel.name.lower()\n if team in get_subs():\n... | [
"0.5974274",
"0.54598886",
"0.5429746",
"0.5406873",
"0.5347431",
"0.53003263",
"0.5229469",
"0.52133363",
"0.52133363",
"0.52131766",
"0.5193813",
"0.5181991",
"0.51501596",
"0.514003",
"0.5139238",
"0.51243937",
"0.5096113",
"0.5096113",
"0.5082725",
"0.50518745",
"0.505055... | 0.51666397 | 12 |
Fits data into a type. The data is expected to be JSONdecoded values (strings, ints, bools, etc). On failure a ValueError will arise and if an error reporter is set it will be sent the node to generate the error report. Notes You'll notice down there some "root_injector" business and might wonder what the fuck is this.... | def fit(self, t: Type[T], value: Any) -> T:
node = self._as_node(value)
try:
out = self.fit_node(t, node)
except ValueError:
if self.error_reporter:
self.error_reporter.report(node)
raise
else:
for injector in self.root_in... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, data: Union[int, float]) -> None:\n assert (isinstance(data, int) or isinstance(data,float))\n self.data: Union[int, float] = data\n self.leftChild: Optional[Node] = None\n self.rightChild: Optional[Node] = None",
"def __init__(self, data, left=None, right=None, par... | [
"0.58732086",
"0.55895096",
"0.5578405",
"0.5540939",
"0.5420598",
"0.5408107",
"0.5408107",
"0.5408107",
"0.5408107",
"0.5408107",
"0.53921604",
"0.53609616",
"0.536063",
"0.53276855",
"0.5326077",
"0.53241205",
"0.5316722",
"0.5298755",
"0.5255692",
"0.52344596",
"0.5216268... | 0.5850629 | 1 |
Sets up an omnipower test fixture with at least one telegram stored in log. | def omnipower_setup():
# Maybe not a good idea to do default initialization here,
# as we are likely to remove deafult values in the future
omnipower = OmniPower()
# List of telegrams to include in the log
telegrams = [b'27442d2c5768663230028d208e11de0320188851bdc4b72dd3c2954a341be369e9089b4eb3858... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUp(self): #pylint: disable=invalid-name\n self.fixtures = '/test_graph/fixtures/hb_graph'",
"def setUp(self):\n self.pkmn = BuildPokemonBattleWrapper()\n \n self.message = \" hurt.\"\n self.pkmn2 = BuildPokemonBattleWrapper()\n self.leech = Leech(self.pkmn2, self.... | [
"0.6382942",
"0.63316774",
"0.63142985",
"0.62816375",
"0.6271225",
"0.625135",
"0.6245013",
"0.6237627",
"0.621211",
"0.6186797",
"0.61668843",
"0.61578584",
"0.614531",
"0.6144198",
"0.6133648",
"0.61297596",
"0.61236477",
"0.6121773",
"0.61208624",
"0.61136776",
"0.6110222... | 0.7082941 | 0 |
Test that a single MeterMeasurement dumped to JSON can be recovered correctly. | def test_json_single_measurement(omnipower_setup):
# Set up fixture
omnipower = omnipower_setup
# Attempt to dump a single MeterMeasurement to JSON
# The MeterMeasurement to dump, just use first object in log
ref_obj = omnipower.measurement_log[0]
# The resulting JSON-formatted string
tes... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_as_dict(MeasureFix, keys):\n # Load in fixture\n m1, m2, m3, m4, meterID, testdateTime = MeasureFix\n k1, k2, k3, k4 = keys\n\n # Test with fixture-values\n # Instantiate MeterMeasurement object and test __init__function\n omni_power_frame = MeterMeasurement(meterID, testdateTime)\n a... | [
"0.6451415",
"0.6317492",
"0.6226849",
"0.6226122",
"0.61758476",
"0.6150637",
"0.6134984",
"0.6056305",
"0.60548645",
"0.6017923",
"0.5974019",
"0.5972226",
"0.5938648",
"0.59011155",
"0.58978504",
"0.5875485",
"0.5861224",
"0.5856227",
"0.5851629",
"0.583996",
"0.582994",
... | 0.8688378 | 0 |
Decode batch of segmentation masks. | def decode_cloth_labels(pt_tensor, num_images=-1, num_classes=n_classes):
# change to H x W x C order
tf_order = pt_tensor.permute(0, 2, 3, 1)
argmax = tf_order.argmax(dim=-1, keepdim=True)
mask = argmax.cpu().numpy()
n, h, w, c = mask.shape
if num_images < 0:
num_images = n
assert(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def decode_batch(self,segm_scores, link_scores):\n\n batch_size = segm_scores.shape[0]\n batch_mask = []\n for image_idx in range(batch_size):\n image_pos_pixel_scores = segm_scores[image_idx, :, :]\n image_pos_link_scores = link_scores[image_idx, :, :, :]\n ma... | [
"0.69471914",
"0.65917313",
"0.6476038",
"0.6453731",
"0.62706256",
"0.6236773",
"0.6208762",
"0.6208762",
"0.61323774",
"0.60698414",
"0.60698414",
"0.6057216",
"0.6053106",
"0.60050404",
"0.59929025",
"0.5951539",
"0.5951539",
"0.5950269",
"0.5931906",
"0.5930082",
"0.59111... | 0.0 | -1 |
store the state of the root logger and disable it | def __enter__(self):
if self._root_logger is None:
self._root_logger = logging.getLogger()
self._state = self._root_logger.disabled
self._root_logger.disabled = True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __exit__(self, *args):\n self._root_logger.disabled = self._state",
"def undo_logger_setup():\n root_logger.removeHandler(handler)\n gym.logger.setLevel(logging.NOTSET)",
"def disable_logging(cls):\n for handler in logging.root.handlers[:]:\n logging.root.removeHandler(handle... | [
"0.7866209",
"0.726455",
"0.68288654",
"0.6825043",
"0.67732525",
"0.66917765",
"0.64992094",
"0.6381488",
"0.6340059",
"0.6283723",
"0.6277375",
"0.6270196",
"0.62519246",
"0.622101",
"0.620414",
"0.6174601",
"0.6167875",
"0.61457545",
"0.6128074",
"0.6068261",
"0.6055735",
... | 0.77889884 | 1 |
converts a logging level name to the numeric representation | def get_loglevel_from_name(name_or_int):
# see whether it is already an integer
if isinstance(name_or_int, int):
return name_or_int
# convert it from the name
level = logging.getLevelName(name_or_int.upper())
if isinstance(level, int):
return level
else:
raise ValueE... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name2level(name):\n return LogLevel._name2levels[name.upper()]",
"def convert_to_log_level(txt):\n # If it is already an int, return it.\n if isinstance(txt, int):\n return txt\n # Does it represent an int? If so return it.\n try:\n return int(txt)\n except:\n pass\n ... | [
"0.7460283",
"0.72409314",
"0.71757966",
"0.7144645",
"0.7135125",
"0.71200883",
"0.6736888",
"0.6724137",
"0.67209184",
"0.66892654",
"0.65403634",
"0.65398043",
"0.6507842",
"0.63094926",
"0.62720346",
"0.62516975",
"0.62427205",
"0.6161489",
"0.6132446",
"0.60662574",
"0.6... | 0.68168795 | 6 |
When reassigning an addon make sure we don't give it a duplicate slug. | def test_reassign(self):
# Create an addon by user 1.
r = self.client.post(self.add_url, self.data, follow=True)
# Create an addon by user 2 with matching slug.
self.login_regular()
r = self.client.post(self.add_url, self.data, follow=True)
# Add user1 to user 2.
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_duplicate_slug(self):\n self.client.post(self.add_url, self.data, follow=True)\n r = self.client.post(self.add_url, self.data, follow=True)\n eq_(r.context['form'].errors['slug'][0],\n 'This url is already in use by another collection')",
"def _create_slug(self):\n ... | [
"0.67315876",
"0.6695341",
"0.6694121",
"0.66386753",
"0.6569398",
"0.6568142",
"0.6543975",
"0.64857197",
"0.64718676",
"0.6447113",
"0.6390646",
"0.63538855",
"0.63419926",
"0.63325274",
"0.6295083",
"0.6295083",
"0.6283232",
"0.6266904",
"0.6266365",
"0.62416",
"0.62207466... | 0.5745188 | 50 |
Displays the name of the object in a vieweraware manner. | def get_display_name(self, looker, **kwargs):
if self.locks.check_lockstring(looker, "perm(Builder)"):
return "{} ({}) ({})".format(self.db.cname, self.name, self.id)
return self.db.cname | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\r\n return self.objectname",
"def get_display_name(self, object):\n name = self.get_object_name(object)\n if (not name):\n name = self.get_object_model_name()\n return name",
"def display_name(self):\n raise NotImplementedError",
"def get_name(... | [
"0.729906",
"0.7192035",
"0.70794266",
"0.69680023",
"0.6961991",
"0.6961991",
"0.69159687",
"0.6913194",
"0.6911171",
"0.6911171",
"0.69071597",
"0.6855217",
"0.6852832",
"0.6852832",
"0.6852832",
"0.6842077",
"0.68337494",
"0.68337494",
"0.6833491",
"0.68253785",
"0.6818402... | 0.0 | -1 |
Returns the size of the set | def size(self):
return self.__count | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __len__(self) -> int:\n return len(self._iset)",
"def __len__(self):\n return len(self._set) + len(self._list)",
"def getSetItemsCount(self):\n sets = self.__getSets()\n return [len(arr) for arr in sets.values()]",
"def cardinality(self):\n try:\n return Inte... | [
"0.83714473",
"0.80237055",
"0.8010193",
"0.79647154",
"0.78988105",
"0.7809823",
"0.77707493",
"0.76368177",
"0.76368177",
"0.76285917",
"0.7626176",
"0.75904316",
"0.7541104",
"0.75161004",
"0.7493493",
"0.7456729",
"0.74226713",
"0.74182135",
"0.74182135",
"0.7410142",
"0.... | 0.76241255 | 11 |
Returns a new set with all the elements in the two sets without duplicating any values | def union(self, other_set):
union_set = Set()
for value in self.__collection:
union_set.add(value)
for value in other_set.values():
union_set.add(value)
return union_set | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def symmetric_difference(self, other_set):\n\n new_set = Set()\n \n # elements set1 has but not set 2\n for elem in self:\n if other_set.contains(elem) == False:\n new_set.add(elem)\n\n for elem in other_set:\n if self.contains(elem) == False:\... | [
"0.7667601",
"0.75277627",
"0.7525846",
"0.7371463",
"0.73470974",
"0.73174566",
"0.7243826",
"0.7184732",
"0.7176538",
"0.7164945",
"0.7145514",
"0.71137726",
"0.7104618",
"0.7092508",
"0.7092508",
"0.70775527",
"0.70770097",
"0.7058405",
"0.70530134",
"0.70307267",
"0.70074... | 0.7070459 | 17 |
Returns a new set with the items not present in the both | def difference(self, other_set):
difference_set = Set()
other_set_values = other_set.values()
for value in self.__collection:
if value not in other_set_values:
difference_set.add(value)
return difference_set | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def difference(self, other_set):\n\n new_set = Set()\n\n for elem in self:\n if other_set.contains(elem) == False:\n new_set.add(elem)\n return new_set",
"def difference(self, other):\n difference = MySet()\n for elem in self.set:\n if not o... | [
"0.79124063",
"0.7752594",
"0.76325625",
"0.7629235",
"0.7624036",
"0.7492819",
"0.74579954",
"0.7387201",
"0.7385571",
"0.73257",
"0.73197085",
"0.7215945",
"0.72058326",
"0.7181188",
"0.6942299",
"0.6941978",
"0.6939337",
"0.6898841",
"0.68805873",
"0.68784624",
"0.684501",... | 0.7642267 | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.