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 |
|---|---|---|---|---|---|---|
Trim test name. Trailing underscore and digits are removed | def trimname(name):
while name[-1].isdigit():
name = name[:-1]
if name[-1] == '_':
name = name[:-1]
return name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _bcl_scrub_name(name):\n return re.sub('[^0-9a-zA-Z\\-\\_]+', '_', name)",
"def sanitize_luxcore_name(string):\r\n return re.sub(\"[^_0-9a-zA-Z]+\", \"__\", string)",
"def sanitize(name):\n return re.sub(\"\\\\W|^(?=\\\\d)\", \"_\", name)",
"def clean_name(name: str) -> str:\n if not re.m... | [
"0.71240914",
"0.7014796",
"0.6977775",
"0.69493306",
"0.6906782",
"0.68239003",
"0.6814305",
"0.67782086",
"0.6774865",
"0.6748891",
"0.6720217",
"0.6686653",
"0.66298926",
"0.66074145",
"0.6594536",
"0.658955",
"0.6579875",
"0.65704846",
"0.65164113",
"0.6481974",
"0.647058... | 0.81550294 | 0 |
If dask is enabled for this environment, return dask array of values. Otherwise, return values. | def dask_arr(vals):
try:
import dask.array as da
return da.from_array(vals, chunks=2)
except ImportError:
return vals | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getNdArray(self):\n futures = self.client.map(_call_getNdArray, self.vecDask, pure=False)\n arrays = self.client.gather(futures)\n return arrays",
"def to_dask_array(self, chunk_size=(1, 6000, 6000)):\r\n try:\r\n import dask.array as da\r\n except ImportError:\r... | [
"0.6385144",
"0.5988612",
"0.59288013",
"0.59288013",
"0.59189385",
"0.5897733",
"0.58678585",
"0.58226806",
"0.5817331",
"0.5713514",
"0.57126224",
"0.5692706",
"0.5659076",
"0.5645981",
"0.56129605",
"0.5596002",
"0.5583527",
"0.55436844",
"0.5494371",
"0.5455237",
"0.54032... | 0.6958613 | 0 |
Get the drone's current acceleration, angles and position. | def get_odometry(self):
acceleration = self.gyro.getValues()
angles = self.imu.getRollPitchYaw()
position = self.gps.getValues()
compass = self.compass.getValues()
north_deg = np.arctan2(compass[0], compass[1])
north_deg = (north_deg - 1.5708) / np.pi * 180
if n... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_acceleration(self):\n return self.acceleration",
"def acceleration(self):\n return self.__accel",
"def get_orbit_data(self):\n orbit = self.orbit()\n\n return orbit.apoapsis_altitude, orbit.periapsis_altitude, orbit.inclination, orbit.eccentricity",
"def get_pos_and_orient... | [
"0.6734967",
"0.657277",
"0.6041919",
"0.60196203",
"0.60196203",
"0.60196203",
"0.600712",
"0.600095",
"0.5997669",
"0.59740686",
"0.59517837",
"0.59185386",
"0.5823333",
"0.57753307",
"0.5772175",
"0.57661915",
"0.57624006",
"0.57556576",
"0.57218945",
"0.568433",
"0.568429... | 0.6740883 | 0 |
Plots the predicted vs the observed values Arguments > the test target variable values, the predictions, a boolean indicating if predictions are from a ols model, and the glm fitted model to make tests on pearson / deviance residuals the figure size, a boolean to indicate if the plot has to be saved or not, the prefix ... | def plot_observed_predicted(y_data, y_predict, ols_line=False, model_fit=None, figsize=(15, 10), save=False, end_name_fig='', folder='Charts'):
end_name_fig = end_name_fig + '_' if end_name_fig is not None else ''
fig, ax = plt.subplots(figsize=figsize)
ax.scatter(y_data, y_predict)
if... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_predictions(y, yhat, title=\"Predictions vs Actual\", output_dir=None):\n\n fig = plt.figure(figsize=(15, 6))\n plt.xlabel('Time')\n plt.ylabel('PM10')\n plt.plot(y, label=\"actual\", figure=fig)\n plt.plot(yhat, label=\"predicted\", figure=fig)\n plt.title(title)\n fig.legend()\n\n ... | [
"0.7064655",
"0.69476485",
"0.66331583",
"0.6632691",
"0.657829",
"0.65760475",
"0.6493739",
"0.6390811",
"0.63791186",
"0.636725",
"0.636572",
"0.63477945",
"0.63430333",
"0.63425857",
"0.6339547",
"0.6329973",
"0.63261044",
"0.6313217",
"0.6296309",
"0.6284836",
"0.6281209"... | 0.7368396 | 0 |
returns channel vertical unit | def get_channel_v_unit(self)->float:
return self.__channel_v_unit | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_channel_h_unit(self)->float: \n return self.__channel_h_unit",
"def get_channel_value(channel):\n channel = channel / 255.0\n if channel <= 0.03928:\n channel = channel / 12.92\n else:\n channel = ((channel + 0.055) / 1.055) ** 2.4\n return channel",
"def out_channel(se... | [
"0.7504972",
"0.66034764",
"0.6283613",
"0.61666226",
"0.6021952",
"0.59227955",
"0.59116703",
"0.5894933",
"0.583893",
"0.5770274",
"0.5755843",
"0.5745898",
"0.57395035",
"0.5708975",
"0.57006365",
"0.5696517",
"0.564767",
"0.5642291",
"0.5637985",
"0.56072503",
"0.56072193... | 0.75776786 | 0 |
returns channel horizontal unit | def get_channel_h_unit(self)->float:
return self.__channel_h_unit | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_channel_v_unit(self)->float:\n return self.__channel_v_unit",
"def out_channel(self) -> int:\n return self._get_divisible_channel(self.args[0] * self.width_multiply)",
"def get_channel_value(channel):\n channel = channel / 255.0\n if channel <= 0.03928:\n channel = channel / ... | [
"0.6576367",
"0.65336204",
"0.65198475",
"0.6282698",
"0.60510427",
"0.6022523",
"0.5969941",
"0.59571755",
"0.5952133",
"0.59292036",
"0.5856703",
"0.57807666",
"0.5776836",
"0.5775047",
"0.57557046",
"0.5753962",
"0.5749723",
"0.5748173",
"0.5718844",
"0.5693396",
"0.563825... | 0.79741836 | 0 |
Sets up ImageNet dataset for the tests. | def setUp(self):
self.batch_size = 1
self.imagenet_inception_v3 = testproblems.imagenet_inception_v3(
self.batch_size) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup(self):\n\n folder_name, file_name, url, md5 = self.resource\n dataset_folder = os.path.join(self.data_root, folder_name)\n if not os.path.exists(dataset_folder):\n sh_utils.download_and_extract_archive(url, dataset_folder, md5, file_name)\n\n test_transform = tv_tra... | [
"0.73884267",
"0.73769605",
"0.73480946",
"0.7330498",
"0.7310901",
"0.7310901",
"0.7258694",
"0.7240208",
"0.71069247",
"0.699991",
"0.6989749",
"0.6985504",
"0.69805586",
"0.6951331",
"0.69471484",
"0.69404054",
"0.6881817",
"0.6881221",
"0.676448",
"0.6756336",
"0.6737488"... | 0.6964756 | 13 |
Helper to create an initialized Variable with weight decay. Note that the Variable is initialized with a truncated normal distribution. A weight decay is added only if one is specified. | def _variable_with_weight_decay(self, name, shape, wd):
var = self._variable_on_device(
name,
shape,
tf.contrib.layers.xavier_initializer_conv2d(uniform=True))
if wd is not None:
weight_decay = tf.multiply(tf.nn.l2_loss(var), wd,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _variable_with_weight_decay(name, shape, stddev, wd):\n var = variable(\n name,\n shape,\n initializer=tf.truncated_normal_initializer(stddev=stddev, dtype=tf.float32))\n if wd is not None:\n weight_decay = tf.multiply(tf.nn.l2_loss(var), wd, name='weight_loss')\n tf.ad... | [
"0.75135535",
"0.74281675",
"0.74257743",
"0.7330802",
"0.7330802",
"0.7315695",
"0.7315142",
"0.72744447",
"0.72729135",
"0.726398",
"0.7253641",
"0.7236708",
"0.7194579",
"0.71026814",
"0.69684446",
"0.67315996",
"0.6716141",
"0.66752493",
"0.6562407",
"0.65493554",
"0.6548... | 0.67978245 | 15 |
Test that the Calendar Page can be accessed | def test_calendar(self):
response = self.app.get("/schedule")
self.assertTrue(response.status_code, 200) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_calendar_view_list(self):\n response = self.client.get('/module/calendar/')\n self.assertEqual(response.status_code, 200)\n self.assertTemplateUsed(response, 'frontend/appointment/calendar/list.html')\n\n request = self.factory.get('/module/calendar/')\n request.user = s... | [
"0.7689714",
"0.7473764",
"0.73709065",
"0.73606986",
"0.72446615",
"0.71482205",
"0.70722246",
"0.6964074",
"0.69296104",
"0.69061553",
"0.68505865",
"0.681398",
"0.67192847",
"0.6714032",
"0.6704237",
"0.6704237",
"0.66931295",
"0.6682147",
"0.664953",
"0.6631372",
"0.65950... | 0.7985945 | 0 |
Test that the Calendar Page can be accessed | def test_campers(self):
response = self.app.get("/campers")
self.assertTrue(response.status_code, 200) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_calendar(self):\n response = self.app.get(\"/schedule\")\n self.assertTrue(response.status_code, 200)",
"def test_calendar_view_list(self):\n response = self.client.get('/module/calendar/')\n self.assertEqual(response.status_code, 200)\n self.assertTemplateUsed(respons... | [
"0.7985945",
"0.7689714",
"0.7473764",
"0.73709065",
"0.73606986",
"0.72446615",
"0.71482205",
"0.70722246",
"0.6964074",
"0.69296104",
"0.69061553",
"0.68505865",
"0.681398",
"0.67192847",
"0.6714032",
"0.6704237",
"0.6704237",
"0.66931295",
"0.6682147",
"0.664953",
"0.66313... | 0.0 | -1 |
Tests whether put event endpoint is working fine | def test_put_event_on_calendar_endpoint(self):
camp_group = CampGroup('falcons', 'yellow')
start = datetime.now()
end = datetime.now()
camp_event = CampEvent("basketball", start, end)
camp_group.events.append(camp_event)
db.session.add(camp_group)
db.session.add(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_put(self):\n url = reverse('events:EventView')\n response = self.client.post(url, self.valid_payload, format='json')\n self.assertEqual(response.status_code, status.HTTP_201_CREATED)\n\n url = reverse('events:EventUpdateDeleteView', args={response.data['id']})\n response... | [
"0.8075736",
"0.7791941",
"0.76807094",
"0.75236446",
"0.7523296",
"0.74803066",
"0.7453159",
"0.73838425",
"0.7259203",
"0.7256426",
"0.7205512",
"0.71617454",
"0.7017496",
"0.7013021",
"0.699852",
"0.69816107",
"0.6972454",
"0.69720274",
"0.6957384",
"0.69355863",
"0.688974... | 0.61890584 | 83 |
Get currently active restrictions. | async def current(self) -> dict:
return await self._request("get", "restrictions/currently") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def active_temporal_constraints(self,assignments):\n return [t for t in self.temporal_constraints if t.is_active(assignments)]",
"def get_active(self):\n return self.get_challenges().filter(status='A')",
"def attribute_restrictions(self):\n return self._attribute_restrictions",
"async de... | [
"0.61726195",
"0.604122",
"0.60070765",
"0.5842691",
"0.5729121",
"0.5638984",
"0.56301856",
"0.5566356",
"0.55462164",
"0.5517872",
"0.5517572",
"0.5499043",
"0.54741156",
"0.54694414",
"0.5435181",
"0.5429092",
"0.5385967",
"0.5385967",
"0.5385967",
"0.53777176",
"0.5370474... | 0.7281368 | 0 |
Get a list of restrictions that are active over the next hour. | async def hourly(self) -> list:
data: dict = await self._request("get", "restrictions/hourly")
return data["hourlyRestrictions"] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __timeRestriction():\n restriction = {\"M\": [\"7:00\", \"9:30\"],\n \"A\": [\"16:00\", \"19:30\"]}\n return restriction",
"def available_hours_by_day(self, day, condition):\r\n if condition == \"close\":\r\n pass\r\n all_hours = [i for i in range(... | [
"0.5671755",
"0.56123126",
"0.54429984",
"0.54202163",
"0.54171014",
"0.5416793",
"0.5391014",
"0.5375272",
"0.5334575",
"0.52817655",
"0.5269839",
"0.52209896",
"0.5206575",
"0.5148325",
"0.5117789",
"0.5111155",
"0.51000863",
"0.50923085",
"0.5064847",
"0.50285864",
"0.5023... | 0.7541006 | 0 |
Test the accesprtrisk POST endpoint is fails if fingerprint/token empty or not passed | def test_acceptrisk(client):
g.test_authorized_for = []
res = client.post("/v0/acceptrisk", json={"fingerprint": "", "token": ""})
assert res.json.get("message") == "acceptrisk failed"
res = client.post("/v0/acceptrisk", json={})
assert res.json.get("status") == "error" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_add_hmac_signature_post_without_data(self):\n resp = self.client.post(\"/\")\n status_code = resp.status_code\n self.assertTrue(status_code == 403)",
"def test_acknowledge_error_no_fingerprint_passed(client):\n g.test_authorized_for = []\n res = client.get(\"/v0/acknowledge\")... | [
"0.63460875",
"0.6291374",
"0.62895226",
"0.61612487",
"0.61563206",
"0.61203927",
"0.6111593",
"0.6083697",
"0.6049535",
"0.6027298",
"0.6026439",
"0.60003674",
"0.59834933",
"0.59827775",
"0.59636027",
"0.5960315",
"0.5936208",
"0.5921884",
"0.59144443",
"0.5904803",
"0.589... | 0.69678193 | 0 |
Test the snooze endpoint fails when no data is passed | def test_snooze_error(bad_client):
res = bad_client.post("/v0/snooze")
assert res.json
assert res.status == "500 INTERNAL SERVER ERROR" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_snooze(client):\n g.test_authorized_for = []\n res = client.post(\n \"/v0/snooze\",\n json={\n \"fingerprint\": \"forseti_f0743042e3bbea4a1b163f5accd4c366\",\n \"token\": \"7ec8a1ee4308d2d07f71fd5a1c844582cfcca56e915c06fc9518ad5e22c5e718\",\n },\n )\n ... | [
"0.6614686",
"0.6248566",
"0.62112606",
"0.6006811",
"0.5996833",
"0.59901345",
"0.5988002",
"0.5897616",
"0.5870692",
"0.58668613",
"0.5857681",
"0.58492845",
"0.58399224",
"0.58320653",
"0.58241725",
"0.5823704",
"0.5816402",
"0.57879",
"0.57765996",
"0.5753684",
"0.5747796... | 0.690529 | 0 |
Test the falsepositive GET endpoint works | def test_falsepositive(client):
g.test_authorized_for = []
res = client.get("/v0/falsepositive" + get_request_args)
assert "Thanks! We’ve marked this as a false positive" in res.data.decode("utf-8") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_GET(self):\n if not self.url:\n return\n response = self.client.get(self.url, {}, format='json')\n self.assertIn(response.status_code, [status.HTTP_405_METHOD_NOT_ALLOWED,\n status.HTTP_401_UNAUTHORIZED])",
"def test_two_legged_... | [
"0.80965966",
"0.8055937",
"0.78537846",
"0.77405953",
"0.76633084",
"0.7638649",
"0.7638649",
"0.7624558",
"0.7624558",
"0.7622345",
"0.7564098",
"0.7564098",
"0.7528899",
"0.7374196",
"0.73609835",
"0.73575425",
"0.73251873",
"0.7317519",
"0.7306199",
"0.73061717",
"0.72877... | 0.7528197 | 13 |
Test the falsepositive POST endpoint works | def test_falsepositive_post(client):
g.test_authorized_for = []
res = client.post("/v0/falsepositive", json=post_json_data)
expected_response = '{"msg":"Thanks! We\\u2019ve marked this as a false positive",' '"status":"ok"}'
assert expected_response in res.data.decode("utf-8") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_POST(self):\n if not self.url:\n return\n response = self.client.post(self.url, {}, format='json')\n self.assertIn(response.status_code, [status.HTTP_405_METHOD_NOT_ALLOWED,\n status.HTTP_401_UNAUTHORIZED])",
"def test_post(self... | [
"0.78419614",
"0.7821615",
"0.77443194",
"0.75878584",
"0.75878584",
"0.75724036",
"0.75543857",
"0.75409836",
"0.75027764",
"0.74899936",
"0.7487769",
"0.7457565",
"0.73363507",
"0.73339754",
"0.7309678",
"0.7300413",
"0.72734815",
"0.72463965",
"0.7244759",
"0.7231521",
"0.... | 0.79738975 | 0 |
Total fitness for a population. | def _get_total_fitness(self, populations, function):
total_fit = []
for population in populations:
total_fit.append(sum([function.fit(*arg) for arg in population]))
return total_fit | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calc_sum_fitness(self):\n fitness: float = 0\n for c in self.characters:\n fitness += c.fitness\n self.sum_fitness = round(fitness, 3)",
"def average_fitness(self):\n return sum([e.fitness for e in self.population]) / len(self.population)",
"def fitness(self):\r\n ... | [
"0.7726892",
"0.7629518",
"0.7619074",
"0.7609879",
"0.76037",
"0.7589788",
"0.7589788",
"0.75354797",
"0.74984604",
"0.74781245",
"0.7415565",
"0.7409352",
"0.7398601",
"0.73509455",
"0.7200175",
"0.7166285",
"0.7107916",
"0.71075547",
"0.71062714",
"0.7098343",
"0.7047722",... | 0.74317366 | 10 |
Return the fitness for a population. | def _get_fit_pop(self, populations, run_f, local_mins):
pops = self._clean_populations(populations)
fitness_per_pop = self._get_total_fitness(pops, run_f)
total_fit = sum(fitness_per_pop)
fit_ratio = self._get_fitness_increes(fitness_per_pop, run_f)
best_pop = self._get_best(po... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fitness(self):\n pass",
"def fitness(self,*val):\n if len(val): self._fitness = val[0]\n return self._fitness",
"def fitness(self) -> float:\n return self._fitness",
"def fitness(self):\n # TO BE DECIDED\n return 1",
"def calculate_fitness(self, **kwargs):\n ... | [
"0.7603592",
"0.75739765",
"0.7481248",
"0.7422643",
"0.7410513",
"0.73986024",
"0.73078567",
"0.7185464",
"0.71550083",
"0.7110808",
"0.708471",
"0.70745575",
"0.706798",
"0.70573884",
"0.70544034",
"0.7023663",
"0.69622827",
"0.68912315",
"0.68696064",
"0.68443084",
"0.6828... | 0.0 | -1 |
r""" Normalize the rows of a CSR matrix by their L2 norm. If copy is True, returns a copy of the normalized matrix. | def csr_l2normalize(mat, copy=False, **kargs):
if copy is True:
mat = mat.copy()
nrows = mat.shape[0]
nnz = mat.nnz
ind, val, ptr = mat.indices, mat.data, mat.indptr
# normalize
for i in range(nrows):
rsum = 0.0
for j in range(ptr[i], ptr[i + 1]):
rsum += val[... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def csr_l2normalize(mat, copy=False, **kargs):\n if copy is True:\n mat = mat.copy()\n nrows = mat.shape[0]\n nnz = mat.nnz\n ind, val, ptr = mat.indices, mat.data, mat.indptr\n # normalize\n for i in range(nrows):\n rsum = 0.0 \n for j in range(ptr[i], ptr[i+1]):\n ... | [
"0.8116126",
"0.8116126",
"0.8104463",
"0.625892",
"0.6154076",
"0.6145391",
"0.6106992",
"0.5897903",
"0.5848271",
"0.5841817",
"0.5835596",
"0.5824375",
"0.5809842",
"0.5804764",
"0.5788648",
"0.5748995",
"0.57324773",
"0.5712761",
"0.56899893",
"0.56520987",
"0.5616385",
... | 0.8099067 | 3 |
Construct an instance of 'cls' wrapping the given Z3 ref object. | def _wrap(cls, z3ref):
if not isinstance(z3ref, cls._z3_ref_type):
raise TypeError("%s expected %s, got %s" %
(cls.__name__, cls._z3_ref_type.__name__,
strtype(z3ref)))
obj = cls.__new__(cls)
obj._v = z3ref
return obj | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _instantiate(cls, **kwargs):\n return cls(**kwargs)",
"def _instantiate(clz, **data):\n\n new_obj = clz()\n setattr(new_obj, \"data\", data)\n for key, val in deepcopy(data).items():\n setattr(new_obj, key, val)\n return new_obj",
"def __newobj__(cls, *args):\n... | [
"0.5984306",
"0.5936363",
"0.58834",
"0.56847954",
"0.56678057",
"0.56522536",
"0.55891865",
"0.55891865",
"0.55503154",
"0.55362654",
"0.5494425",
"0.5493427",
"0.5492987",
"0.54186773",
"0.54163224",
"0.54092693",
"0.53798634",
"0.53672254",
"0.53672254",
"0.53672254",
"0.5... | 0.82835186 | 0 |
Convert a value to a simsym.Symbolic. If ref is a Z3 symbolic value, wraps it in a simsym.Symbolic. Otherwise, if ref is a concrete type supported by the symbolic engine, returns value. Otherwise, raises TypeError. | def wrap(ref):
if isinstance(ref, (bool, int, long, float)):
# Concrete type supported by Z3
return ref
if not isinstance(ref, z3.ExprRef):
raise TypeError("Not a bool, int, long, float, or z3.ExprRef")
if isinstance(ref, z3.ArithRef):
return SArith._wrap(ref)
if isins... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unwrap(val):\n\n if isinstance(val, Symbolic):\n return val._v\n return val",
"def _resolve_symbolic(maybe_iter, input_values,\n intermediate_values):\n if not isinstance(maybe_iter, str) and isinstance(maybe_iter, abc.Iterable):\n return tuple([\n _resolve_symbol... | [
"0.5515622",
"0.51134956",
"0.5090437",
"0.5090437",
"0.5056816",
"0.49731916",
"0.49648315",
"0.48597607",
"0.48476207",
"0.47848654",
"0.47534943",
"0.46728557",
"0.46585596",
"0.46440724",
"0.46035984",
"0.46020555",
"0.4579055",
"0.44834858",
"0.44757518",
"0.44642594",
"... | 0.606186 | 0 |
Check if this is a Platts or Argus Symbol | def check_pra_symbol(symbol):
# Platts
if len(symbol) == 7 and symbol[:2] in [
'PC', 'PA', 'AA', 'PU', 'F1', 'PH', 'PJ', 'PG', 'PO', 'PP', ]:
return True
# Argus
if '.' in symbol:
sm = symbol.split('.')[0]
if len(sm) == 9 and sm.startswith('PA'):
return True
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_symbol(p):\n return len(p) == 1 and p.isalpha()",
"def is_symbol(obj):\n return isinstance(obj, Symbol)",
"def true(symbol):\n return True",
"def is_prop_symbol(s):\n return is_symbol(s) and s[0].isupper() and s != 'TRUE' and s != 'FALSE'",
"def is_simple_symbol(obj):\n return is_symb... | [
"0.68986434",
"0.6448035",
"0.6361411",
"0.6275516",
"0.60835963",
"0.60694957",
"0.6053714",
"0.60150236",
"0.59025276",
"0.5873287",
"0.58428925",
"0.58054507",
"0.5776006",
"0.56334746",
"0.56215125",
"0.55964434",
"0.55645627",
"0.5558268",
"0.5543414",
"0.55267763",
"0.5... | 0.64930016 | 1 |
Modified by is set to None if modified outside of django admin. Modified is still changed on save call. | def test_modified_by_without_admin(self):
self.subject.title = 'Subject 1(modified)'
self.now += second
self.subject.save(update_fields=['title'])
self.assert_object_fields(
self.subject,
modified_by=None,
modified=self.now) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_model(self, request, obj, form, change):\r\n if change:\r\n obj.updated_by = request.user\r\n obj.save()",
"def save_model(self, request, instance, form, change):\r\n instance.updated_by = request.user\r\n instance.save()",
"def save_model(self, request, instance... | [
"0.7437896",
"0.7180372",
"0.7180372",
"0.7090333",
"0.70522547",
"0.6615123",
"0.6615123",
"0.65913403",
"0.65204614",
"0.6418178",
"0.6414522",
"0.6414522",
"0.6414522",
"0.63978577",
"0.63685197",
"0.63685197",
"0.63355553",
"0.6331915",
"0.6259178",
"0.625399",
"0.625399"... | 0.64805883 | 9 |
Created_by remains untouched, modified_by is set to logged user. | def test_changeform_save(self):
self.update_object(
self.subject,
created_by=self.test_user,
modified_by=self.test_user)
super().test_changeform_save()
self.assert_object_fields(
self.subject,
created_by=self.test_user,
mo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def form_valid(self, form):\n form.instance.last_modified_by = self.request.user\n return super().form_valid(form)",
"def save_model(self, request, obj, form, change):\r\n if change:\r\n obj.updated_by = request.user\r\n obj.save()",
"def created_by(self):\n return... | [
"0.7216171",
"0.69248897",
"0.6874285",
"0.6831821",
"0.6831821",
"0.6831821",
"0.6831821",
"0.6831821",
"0.6831821",
"0.67866844",
"0.67866844",
"0.67866844",
"0.67866844",
"0.6761844",
"0.6704343",
"0.66462237",
"0.66462237",
"0.663191",
"0.6616106",
"0.64910734",
"0.647867... | 0.0 | -1 |
Return the degree of this vertex. | def degree(self) -> int:
return len(self.neighbours) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def degree(self):\n return self.graph.degree()",
"def degree(self):\n return self._degree",
"def degree(self):\n return self._degree",
"def degree(self):\n return self._deg",
"def degree(self):\n return self.parent()._degree",
"def degree(self, v):\n self._valida... | [
"0.8183806",
"0.7921751",
"0.7921751",
"0.79165566",
"0.77771294",
"0.76639247",
"0.75070786",
"0.7499989",
"0.736234",
"0.73322713",
"0.72892946",
"0.69866824",
"0.6893338",
"0.68803465",
"0.6878239",
"0.6846072",
"0.68184274",
"0.6766892",
"0.659883",
"0.64483196",
"0.64088... | 0.67819 | 19 |
Initialize an empty graph (no vertices or edges). | def __init__(self) -> None:
self._vertices = {}
# This call isn't necessary, except to satisfy PythonTA.
WikiGraph.__init__(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _init_graph(self):\n self.G = nx.Graph()\n self.G.add_nodes_from([1,2,3,4,5])\n self.G.add_edges_from([(1,2),(2,3),(2,4)\\\n ,(2,5),(3,4),(4,5)])",
"def empty_instance():\n from weighted_graph import Graph\n return Graph()",
"def __init__(self):\n se... | [
"0.7230173",
"0.7162825",
"0.7122258",
"0.69666773",
"0.69421315",
"0.6894478",
"0.68916893",
"0.6838316",
"0.6832277",
"0.66973096",
"0.6604605",
"0.6588477",
"0.65383786",
"0.64769727",
"0.64750296",
"0.6468457",
"0.64567405",
"0.64469624",
"0.6436645",
"0.63707316",
"0.635... | 0.65639895 | 12 |
Add a vertex with the given name to this graph. The new vertex is not adjacent to any other vertices. Do nothing if the given item is already in this graph. | def add_vertex(self, name: Any, url: str) -> None:
if name not in self._vertices:
self._vertices[name] = _WeightedVertex(name, url) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_vertex(self, vertex_name: n):\n new_vertex = Vertex(vertex_name)\n self._graph[new_vertex.name] = new_vertex",
"def add_vertex(self, item: Any, kind: str) -> None:\n if item not in self._vertices:\n self._vertices[item] = _Vertex(item, kind)",
"def __add__(self, vertex):... | [
"0.78088045",
"0.76754266",
"0.7170296",
"0.7009771",
"0.6965828",
"0.69535965",
"0.6944086",
"0.68660486",
"0.68256646",
"0.6762711",
"0.66448575",
"0.66357887",
"0.6628702",
"0.66168725",
"0.6543393",
"0.65381444",
"0.65115047",
"0.64644927",
"0.64432496",
"0.6432111",
"0.6... | 0.7446481 | 2 |
Add an edge between the two vertices with the given items in this graph, with the given weight. Raise a ValueError if name1 or name2 do not appear as vertices in this graph. | def add_edge(self, name1: Any, name2: Any, weight: float = 1.0) -> None:
if name1 in self._vertices and name2 in self._vertices:
v1 = self._vertices[name1]
v2 = self._vertices[name2]
# Add the new edge
v1.neighbours[v2] = weight
v2.neighbours[v1] = we... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_edge(self, item1: Any, item2: Any, weight: Union[int, float]) -> None:\n if item1 in self._vertices and item2 in self._vertices:\n v1 = self._vertices[item1]\n v2 = self._vertices[item2]\n\n # Add the new edge\n v1.neighbours[v2] = weight\n v2.n... | [
"0.8471875",
"0.7469214",
"0.7435859",
"0.7384033",
"0.73706025",
"0.73696065",
"0.73466545",
"0.73101956",
"0.71395665",
"0.7016145",
"0.6925965",
"0.6905159",
"0.68877935",
"0.6885009",
"0.6875684",
"0.68618804",
"0.68274486",
"0.6823421",
"0.6819064",
"0.68122125",
"0.6793... | 0.89244914 | 0 |
The subscriber MUST confirm that the hub.topic corresponds to a pending subscription or unsubscription that it wishes to carry out. If so, the subscriber MUST respond with an HTTP success (2xx) code with a response body equal to the hub.challenge parameter. If the subscriber does not agree with the action, the subscrib... | def on_subscribe(self, request, ssn):
if 'hub.challenge' not in request.GET:
logger.error(f'Missing hub.challenge in subscription verification {ssn.pk}!')
tasks.save.delay(
pk = ssn.pk,
subscribe_status = 'verifyerror',
verifyerror_count = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_validation(self):\n challenge = \"challenge-string\"\n data = {\n 'hub.mode': 'subscribe',\n 'hub.verify_token': settings.VERIFY_TOKEN,\n 'hub.challenge': challenge\n }\n c = Client()\n response = c.get(self.webhook, data=data)\n s... | [
"0.60750276",
"0.5895427",
"0.5820841",
"0.58171",
"0.5772382",
"0.5770824",
"0.56958306",
"0.5681194",
"0.5680302",
"0.56726277",
"0.5623982",
"0.5599367",
"0.5583839",
"0.5580166",
"0.55568177",
"0.5552328",
"0.5538173",
"0.5511604",
"0.5500044",
"0.5446147",
"0.5441971",
... | 0.6904333 | 0 |
Function to return the best movies for specific user | def get_recommended_movies(base_queryset, gender, age):
def get_age_range(age):
age_ranges = (
(18, 25),
(26, 30),
(31, 35),
(36, 40),
(41, 45),
(46, 50),
(51, 55),
(56, 60),
)
age_range = None
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def recommend(self, user):\n K = self.n_sim_user\n N = self.n_rec_movie\n rank = dict()\n watched_movies = self.trainset[user]\n\n # v=similar user, wuv=similarity factor\n for v, wuv in sorted(self.user_sim_mat[user].items(),\n key=itemgetter(1... | [
"0.7131356",
"0.6987773",
"0.66233724",
"0.6575672",
"0.6495953",
"0.6458982",
"0.64512557",
"0.6430177",
"0.64061326",
"0.63526034",
"0.62809634",
"0.62043494",
"0.61872363",
"0.61540073",
"0.6107974",
"0.60853076",
"0.6071952",
"0.6060481",
"0.60545695",
"0.6022957",
"0.601... | 0.6071229 | 17 |
Tokenization which casts a chunking problem into a tagging problem. This task has to create batch of tokens containing both [CLS] and [SEP] since it's usually the first task and later tasks might need them. | def __init__(self,
trn: str = None,
dev: str = None,
tst: str = None,
sampler_builder: SamplerBuilder = None,
dependencies: str = None,
scalar_mix: ScalarMixWithDropoutBuilder = None,
use_raw_hidden_st... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _parse_tokens(chunk, format=[WORD, POS, CHUNK, PNP, REL, ANCHOR, LEMMA]):\n tokens = []\n # Only process <chunk> and <chink> elements, \n # text nodes in between return an empty list.\n if not (chunk.tag == XML_CHUNK or chunk.tag == XML_CHINK):\n return []\n type = chunk.get(XML_TYPE, \"O... | [
"0.62005997",
"0.60916",
"0.59187293",
"0.5694986",
"0.5670036",
"0.56464285",
"0.56464094",
"0.55769926",
"0.5563655",
"0.5544452",
"0.5516463",
"0.5512171",
"0.5492686",
"0.54837084",
"0.5482791",
"0.54778945",
"0.54392177",
"0.543641",
"0.543641",
"0.5435659",
"0.543473",
... | 0.0 | -1 |
Initialize datasets for training | def init_datasets(self, display_samples = False):
print("==> Loading images from ", self.img_dir)
self.image_data_gen = ImageDataGenerator(
rescale=1./255,
#rotation_range=30,
#shear_range=30,
#width_shift_range=.15,
#height_shift_range=.15,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prepare_data(self):\n try:\n self.train_dataset = self.datasets['train']\n self.val_dataset = self.datasets['val']\n try:\n self.test_dataset = self.datasets['test']\n except:\n pass\n except Exception as e:\n pr... | [
"0.79750913",
"0.75937706",
"0.75151575",
"0.7498987",
"0.74836475",
"0.74688107",
"0.7395552",
"0.73210615",
"0.71998334",
"0.719473",
"0.71639323",
"0.7152245",
"0.7140968",
"0.7117662",
"0.7117109",
"0.7109672",
"0.7083545",
"0.7082305",
"0.70727843",
"0.70727843",
"0.7037... | 0.7470057 | 5 |
Return a shallow copy of the context with the given span. | def _with_span(self, span):
# type: (Span) -> Context
return self.__class__(
trace_id=span.trace_id, span_id=span.span_id, meta=self._meta, metrics=self._metrics, lock=self._lock
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_span_context(self) -> \"SpanContext\":\n return SpanContext(\n trace_id=int(self.elastic_span.transaction.trace_parent.trace_id, base=16),\n span_id=int(self.elastic_span.id, base=16),\n is_remote=False,\n trace_flags=TraceFlags(\n TraceFlag... | [
"0.63736594",
"0.63414156",
"0.6171217",
"0.6128476",
"0.6102834",
"0.5706204",
"0.56493527",
"0.53448355",
"0.5241233",
"0.5175",
"0.5158708",
"0.5064938",
"0.50357324",
"0.5028173",
"0.502645",
"0.49929136",
"0.49408257",
"0.4898603",
"0.48948324",
"0.484029",
"0.4827315",
... | 0.7799171 | 0 |
Get the origin of the trace. | def dd_origin(self):
# type: () -> Optional[Text]
return self._meta.get(ORIGIN_KEY) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def origin(self):\n return getattr(self.canvas.layout, 'origin', Stacked._origin)",
"def origin(self):\n return self._origin",
"def origin(self):\n return self._origin",
"def origin(self):\n return self._origin",
"def origin(self):\n return self._origin",
"def get_origi... | [
"0.77281773",
"0.7687419",
"0.7687419",
"0.7687419",
"0.7687419",
"0.76614225",
"0.7512945",
"0.750142",
"0.74824816",
"0.7455095",
"0.74301136",
"0.7393026",
"0.73884094",
"0.7311039",
"0.7311039",
"0.7311039",
"0.7167827",
"0.71040565",
"0.70231783",
"0.69829834",
"0.696334... | 0.6581665 | 26 |
Set the origin of the trace. | def dd_origin(self, value):
# type: (Optional[Text]) -> None
with self._lock:
if value is None:
if ORIGIN_KEY in self._meta:
del self._meta[ORIGIN_KEY]
return
self._meta[ORIGIN_KEY] = value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_origin(self, origin):\n self.origin = origin\n self.__symbol_set.update(origin)",
"def set_origin(self, origin_x, origin_y):\r\n self.x = origin_x - (self.rect.width / 2)\r\n self.y = origin_y + self.rect.height\r\n self._update_rect()",
"def _set_origin_value(self, o... | [
"0.73052305",
"0.7164384",
"0.71055984",
"0.7035219",
"0.68193966",
"0.67631555",
"0.67419386",
"0.64130515",
"0.63981974",
"0.6355662",
"0.6251785",
"0.6050141",
"0.6046345",
"0.5972191",
"0.5972191",
"0.5972191",
"0.59647226",
"0.5962997",
"0.5924368",
"0.5924368",
"0.59243... | 0.5966799 | 16 |
Apply a transform to a given pose. | def transform(self, passed_stamped_pose):
# Creating / Updating transform with latest translation and rotation.
transform = TransformStamped()
transform.header = rospy.get_rostime()
transform.transform.translation = Point(self.translation[0],self.translation[1], 0.0)
transform.tr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def do_transform_pose(transform: Transform, pose: Pose) -> Pose:\n transform_mat = alloy.math.transformation_matrix_from_array(alloy.ros.transform_to_numpy(transform))\n pose_mat = alloy.math.transformation_matrix_from_array(alloy.ros.pose_to_numpy(pose))\n #combine two transformation matrix\n trans_po... | [
"0.77716047",
"0.6756425",
"0.67537993",
"0.66222256",
"0.64996296",
"0.64882475",
"0.6372686",
"0.636316",
"0.63158613",
"0.62992144",
"0.62744737",
"0.619426",
"0.6129586",
"0.60735744",
"0.60518163",
"0.60129255",
"0.5996214",
"0.5935687",
"0.592775",
"0.5924709",
"0.59177... | 0.708058 | 1 |
Return number of edges. Note that for undirected graphs each edges are counted twice. | def num_edges(self):
return sum(len(v.adj) for v in self.vertices.values()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def number_of_edges(self) -> int:\n return self.graph.number_of_edges()",
"def return_num_edges(self):\n return sum(map(lambda x: len(x),self.__adj))",
"def num_edges(self):\n return sum(1 for _ in self.iteredges())",
"def edge_count(self) -> int:\n return self._n_edges",
"def e... | [
"0.8719795",
"0.8660583",
"0.8626477",
"0.8551925",
"0.8549056",
"0.85058194",
"0.84867245",
"0.847382",
"0.835261",
"0.8274995",
"0.8218321",
"0.82064015",
"0.8188518",
"0.8179152",
"0.81417686",
"0.8128503",
"0.8081128",
"0.8048379",
"0.8033064",
"0.8028972",
"0.8015658",
... | 0.8539096 | 5 |
Return number of vertices. | def num_vertices(self):
return len(self.vertices) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def return_num_vertices(self):\n return self.__size",
"def num_vertices(self):\n return len(self)",
"def get_vertices_count(self) -> int:\n # TODO: verify the following claim:\n raise NotImplementedError",
"def vertexCount(self):\n return self._nVertices",
"def num_vertic... | [
"0.8946443",
"0.89405364",
"0.8939045",
"0.8931984",
"0.887809",
"0.87912714",
"0.87674755",
"0.8682573",
"0.8579149",
"0.85759246",
"0.8522487",
"0.8505311",
"0.83833855",
"0.80782884",
"0.8061895",
"0.802625",
"0.78798425",
"0.7853293",
"0.7685195",
"0.7587386",
"0.75402313... | 0.8981266 | 1 |
Set email template id. | def set_email_template_id(self, email_template_id):
self.email_template_id = email_template_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def template_id(self, template_id):\n\n self._template_id = template_id",
"def get_email_template_id(self):\n return self.email_template_id",
"def id_template_notificacao(self, id_template_notificacao):\n self._id_template_notificacao = id_template_notificacao",
"def set_template(self, t... | [
"0.73850626",
"0.7111155",
"0.6877127",
"0.6289229",
"0.62773335",
"0.6274462",
"0.62440306",
"0.60256773",
"0.5934045",
"0.5934045",
"0.5932743",
"0.5932743",
"0.566941",
"0.5656785",
"0.5649218",
"0.5597014",
"0.5583831",
"0.5582144",
"0.5545122",
"0.5469994",
"0.54267526",... | 0.84797746 | 0 |
Get email template id. | def get_email_template_id(self):
return self.email_template_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def template_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"template_id\")",
"def template_id(self):\n return self._template_id",
"def template_id(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"template_id\")",
"def template_id(self) -> Optional[pulumi.Inp... | [
"0.79660094",
"0.78993857",
"0.7757478",
"0.7757478",
"0.7056596",
"0.70498353",
"0.7020445",
"0.6945055",
"0.6945055",
"0.6942765",
"0.6774855",
"0.6714761",
"0.6714761",
"0.6622749",
"0.6394606",
"0.6352376",
"0.6161674",
"0.60567147",
"0.5967014",
"0.5947593",
"0.59383005"... | 0.8802528 | 0 |
Draws the 3D axes on an image. | def draw_axes3d(image, euler_angles, tdx=None, tdy=None, size=100.0):
yaw, pitch, roll = deg_to_rad(euler_angles, to_list=True, right_hand=True)
if tdx != None and tdy != None:
tdx = tdx
tdy = tdy
else:
height, width = image.shape[:2]
tdx = weight / 2
tdy = height / ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot3d(self):\n plot_rupture_wire3d(self)",
"def test_plot_with_axes_or_figure(img_3d_mni):\n figure = plt.figure()\n plot_img(img_3d_mni, figure=figure)\n ax = plt.subplot(111)\n plot_img(img_3d_mni, axes=ax)\n plt.close()",
"def show_3d(ax, pixels, colors, axis_labels):\n scale =... | [
"0.64506495",
"0.6278418",
"0.6254556",
"0.6205596",
"0.6161973",
"0.60464656",
"0.6046308",
"0.600582",
"0.5994575",
"0.5968867",
"0.59513676",
"0.5934624",
"0.58870924",
"0.5857459",
"0.58425695",
"0.5815853",
"0.58145833",
"0.58145833",
"0.57967013",
"0.5794237",
"0.577449... | 0.73046637 | 0 |
Checks whether the board is solved or not. | def is_solved(self):
if not self._find_empty():
return True
else:
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_if_solved(self):\n for cell in self.board.values():\n if not cell.value:\n return False\n return True",
"def is_solved(self):\n # Asserting board is valid.\n if not self.is_legal():\n return False\n\n # Asserting board is filled.\n... | [
"0.8470595",
"0.8114887",
"0.7891128",
"0.77872354",
"0.7759085",
"0.7747135",
"0.76414233",
"0.75952727",
"0.7529135",
"0.7492625",
"0.7371261",
"0.73381066",
"0.7332263",
"0.7331484",
"0.7326093",
"0.73241985",
"0.72522503",
"0.72451514",
"0.72391206",
"0.7230613",
"0.72227... | 0.7082771 | 27 |
Checks whether the board has a valid solution. | def is_solvable(self):
self_copy = deepcopy(self)
return self_copy.solve() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_if_solved(self):\n for cell in self.board.values():\n if not cell.value:\n return False\n return True",
"def is_solved(self):\n # Asserting board is valid.\n if not self.is_legal():\n return False\n\n # Asserting board is filled.\n... | [
"0.8348135",
"0.82367474",
"0.8045484",
"0.79936874",
"0.77613413",
"0.76790583",
"0.7624782",
"0.7575733",
"0.7532027",
"0.7502791",
"0.7450173",
"0.7407652",
"0.7395023",
"0.72859126",
"0.7277562",
"0.72702205",
"0.72692674",
"0.72460085",
"0.7218122",
"0.7200171",
"0.71942... | 0.0 | -1 |
Gets an artifact object by parsing metadata or creating one from uri. | def get_artifact(self) -> artifact.Artifact:
if self.metadata_file and self.output_name:
return entrypoint_utils.get_artifact_from_output(
self.metadata_file, self.output_name)
else:
# Provide an empty schema when returning a raw Artifact.
result = art... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_artifact(self) -> artifact.Artifact:\n if self.metadata_file and self.output_name:\n return entrypoint_utils.get_artifact_from_output(\n self.metadata_file, self.output_name)\n else:\n # Provide an empty schema when returning a raw Artifact.\n result = artifact.Artifact(\n ... | [
"0.73309535",
"0.63287866",
"0.6281482",
"0.60381526",
"0.59055823",
"0.58875287",
"0.5870152",
"0.5822744",
"0.5775459",
"0.57070494",
"0.55334526",
"0.5480483",
"0.54525334",
"0.54401195",
"0.5386478",
"0.538284",
"0.5382396",
"0.5366674",
"0.5360486",
"0.5255901",
"0.52537... | 0.7244576 | 1 |
Model Initializer You can declare and initialize any layer if you want. | def __init__(self, config: BertConfig):
super().__init__(config)
### YOUR CODE HERE
self.num_labels = config.num_labels # [0, 1] (start or end)
self.bert = BertModel(config)
self.qa_outputs = nn.Linear(config.hidden_size, config.num_labels) # TODO: Not a separate FFN ? (For ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_model(self):\n pass",
"def initialize_model(self):\n pass",
"def initialize(self, model):\n pass",
"def __init__(self, **kwargs):\n super(Model, self).__init__(**kwargs)",
"def __init__(self, config):\n super().__init__()\n self.model_list = []\n se... | [
"0.77228475",
"0.76004523",
"0.727436",
"0.7254214",
"0.7250149",
"0.71041113",
"0.69881296",
"0.69840264",
"0.69840264",
"0.6958712",
"0.6927824",
"0.6921423",
"0.69014156",
"0.6867702",
"0.6867702",
"0.6867702",
"0.6867702",
"0.6837752",
"0.6812339",
"0.6773809",
"0.675587"... | 0.0 | -1 |
Return the name of the sensor. | def name(self) -> str:
return self.dev.label | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name(self):\n return self._sensor.name",
"def get_sensor_name(self):\n return self.data[1]",
"def name(self):\n return self.device.device_data[self.device_id]['name'] + \\\n f' {self._sensor_type}'",
"def name(self):\n return f\"{self._name} {SENSOR_TYPES[self.senso... | [
"0.9189599",
"0.91678053",
"0.8901546",
"0.87707126",
"0.8511107",
"0.84797406",
"0.84445643",
"0.82992035",
"0.8186399",
"0.8105673",
"0.807955",
"0.80660135",
"0.8049639",
"0.7702056",
"0.7613606",
"0.76128423",
"0.7602013",
"0.7602013",
"0.7602013",
"0.75404775",
"0.751766... | 0.0 | -1 |
Return the measurement unit for the sensor. | def native_unit_of_measurement(self) -> str | None:
if self.dev.name.endswith("_temp"):
if self.dev.system.temp_unit == "F":
return UnitOfTemperature.FAHRENHEIT
return UnitOfTemperature.CELSIUS
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unit_of_measurement(self):\n return self.sensor_type[\"unit\"]",
"def unit_of_measurement(self):\n return SENSOR_TYPES[self.sensor][1]",
"def unit_of_measurement(self):\n return SENSOR_UNITS.get(self._sensor_name, None)",
"def unit_of_measurement(self):\n return SENSOR_UNITS.g... | [
"0.9089372",
"0.9006016",
"0.90041214",
"0.90041214",
"0.8983275",
"0.89551437",
"0.89438057",
"0.8915654",
"0.8915654",
"0.88822985",
"0.8880866",
"0.8862371",
"0.8862371",
"0.88586926",
"0.88586926",
"0.8844444",
"0.8844444",
"0.88438356",
"0.8706195",
"0.86535406",
"0.8639... | 0.79812896 | 75 |
Return one buffer from the output queue Blocks until a buffer is processed. Use this as an alternative to accessing `output_queue` directly. | def __call__(self) -> buffer.Buffer:
processed_buffer = self.output_queue.get()
return processed_buffer | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_output_queue(self):\n return self.__output_queue",
"def _get_output_queue(self):\n return self.__output_queue",
"def _get_output_queue(self):\n return self.__output_queue",
"def _get_output_queue(self):\n return self.__output_queue",
"def _get_output_queue(self):\n return self.__out... | [
"0.68955415",
"0.68955415",
"0.68955415",
"0.68955415",
"0.68955415",
"0.68955415",
"0.68779105",
"0.68635947",
"0.67699355",
"0.67699355",
"0.6705216",
"0.6668473",
"0.65481323",
"0.6357703",
"0.6357703",
"0.63442063",
"0.63387764",
"0.63279146",
"0.6314779",
"0.63071185",
"... | 0.773006 | 0 |
Creates graph embedding from an objectfeature matrix, initialize weights with squared euclidian distances |x_i x_j|^2_2 | def make_graph_from_vectors(X, *, knn_edges, random_edges=0, virtual_vertices=0, deduplicate=True,
directed=True, verbose=False, squared=False, GraphEmbeddingClass=GraphEmbedding,
**kwargs):
num_vectors, vector_dim = X.shape
X = np.require(check_numpy(X), ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def weighted_l2(X, ebunch):\n edge_embeds = np.zeros((len(ebunch), len(X[list(X.keys())[0]])))\n i = 0\n for edge in ebunch:\n edge_embeds[i] = np.power(X[str(edge[0])] - X[str(edge[1])], 2)\n i += 1\n return edge_embeds",
"def feature_calculator(args, graph):\n index_1 = [edge[0] fo... | [
"0.5758024",
"0.57548845",
"0.57177687",
"0.5623388",
"0.5577876",
"0.5574585",
"0.5535546",
"0.55147815",
"0.5509414",
"0.5494725",
"0.5489557",
"0.5439207",
"0.5389404",
"0.53848916",
"0.5372104",
"0.5353971",
"0.532885",
"0.529276",
"0.5291068",
"0.5269377",
"0.52516",
"... | 0.5256838 | 20 |
Creates, updates, or removes campaign budgets. Operation statuses are returned. | def MutateCampaignBudgets(self, request, context):
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_budget(client, customer_id):\n # Retrieves the campaign budget service.\n campaign_budget_service = client.get_service(\"CampaignBudgetService\")\n # Retrieves a new campaign budget operation object.\n campaign_budget_operation = client.get_type(\"CampaignBudgetOperation\")\n # Creates a ... | [
"0.6464796",
"0.63622",
"0.59848386",
"0.5884108",
"0.5866087",
"0.58280236",
"0.56706417",
"0.5582636",
"0.55547863",
"0.5508841",
"0.5488699",
"0.5474242",
"0.5391885",
"0.53655475",
"0.53486246",
"0.5348118",
"0.53460944",
"0.5308283",
"0.52788013",
"0.51960504",
"0.515808... | 0.67903715 | 0 |
Returns a JSON Response, transferring 'context' to make the payload. | def render_to_json_response(self, context, **response_kwargs):
return JsonResponse(
self.get_data(context),
**response_kwargs
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render_to_response(self, context):\n return self.get_json_response(self.convert_context_to_json(context))",
"def render_to_json_response(self, context, **response_kwargs):\n return HttpResponse(\n self.convert_context_to_json(context),\n content_type='application/json',\n ... | [
"0.7552076",
"0.7530701",
"0.7530701",
"0.75134236",
"0.7465408",
"0.74349207",
"0.741543",
"0.7136026",
"0.70741844",
"0.69158274",
"0.678056",
"0.67733705",
"0.65795076",
"0.6515663",
"0.6512717",
"0.6507841",
"0.6491044",
"0.64715093",
"0.6464057",
"0.6464057",
"0.6464057"... | 0.73916304 | 11 |
Evaluate the inputs passing through the neural network using the network's current weights. Do not pass the outputs through the activation function. | def getOutputNoActivation(self, inputs):
if self.bias:
inputs = np.concatenate((inputs, np.ones((inputs.shape[0], 1))), axis=1)
self.outputNodes = np.dot(inputs, self.weights.T)
return self.outputNodes | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute(self, inputs):\n\t\tres = inputs\n\t\tfor layer in range(self.layersNumber):\n\t\t\tweight = self.weights[layer]\n\t\t\tbias = self.biases[layer]\n\t\t\tres = fActivation(np.dot(weight, res) + bias)\n\t\treturn res",
"def activate(self, inputs):\n # Calculate values of hidden nodes\n hi... | [
"0.73332393",
"0.70607084",
"0.6857448",
"0.6832462",
"0.68274665",
"0.67964464",
"0.678698",
"0.67697275",
"0.673289",
"0.6725282",
"0.66532546",
"0.6651004",
"0.6644665",
"0.66444266",
"0.66286016",
"0.6607871",
"0.6593125",
"0.65469193",
"0.6541385",
"0.65374684",
"0.65189... | 0.59410363 | 95 |
Create a temporary directory and set it as the working directory. The directory will be deleted after the test has finished. | def chdir_tmp(self):
dirname = make_tempdir()
os.chdir(dirname)
return dirname | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tempdir():\n\n # Create a directory and return the path\n return tempfile.mkdtemp()",
"def fresh_directory():\n os.chdir(tempfile.mkdtemp())",
"def make_tempdir():\n global _TEMPDIR\n if not _TEMPDIR:\n _TEMPDIR = tempfile.mkdtemp()\n return _TEMPDIR",
"def makeTempDirParent():\n... | [
"0.8053021",
"0.7932606",
"0.778138",
"0.7732583",
"0.76873714",
"0.7661656",
"0.76601213",
"0.76544577",
"0.7649532",
"0.7639966",
"0.7621081",
"0.762085",
"0.7582958",
"0.756467",
"0.7545179",
"0.75436336",
"0.75006163",
"0.7482322",
"0.7482083",
"0.74478585",
"0.7441297",
... | 0.7606997 | 13 |
Return the transport associated with a RBClient. This allows tests to avoid reaching into | def get_rbclient_transport(self, client):
return client._transport | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transport(self):\n return self._transport",
"def transport(self) -> TraceServiceTransport:\n return self._client.transport",
"def transport(self) -> Controller2Transport:\n return self._client.transport",
"def transportprotocol(self) :\n\t\ttry :\n\t\t\treturn self._transportprotocol... | [
"0.720157",
"0.715187",
"0.68909246",
"0.6889413",
"0.68748546",
"0.6810661",
"0.6787923",
"0.6758744",
"0.67065334",
"0.66278625",
"0.6612025",
"0.6505736",
"0.6481111",
"0.644201",
"0.6407169",
"0.639981",
"0.6343092",
"0.6295848",
"0.62566745",
"0.6161145",
"0.61522084",
... | 0.80893886 | 0 |
Get the current central core configuration. | def get(self):
return self._get() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_config(self):\n if self.allow_reco():\n return self.chs_config()\n else:\n return self.get_config_j(self.id)",
"def get_config(self):\n return self.config",
"def getConfig(self):\n return self.cp",
"def config(self):\n return self._cfg",
"def... | [
"0.70110065",
"0.68458223",
"0.6843044",
"0.6755136",
"0.67283046",
"0.67258465",
"0.67065775",
"0.6673397",
"0.66640633",
"0.6652268",
"0.66416216",
"0.6632141",
"0.65946966",
"0.65592647",
"0.65592647",
"0.65592647",
"0.65592647",
"0.65592647",
"0.65592647",
"0.65592647",
"... | 0.0 | -1 |
Get the current central core configuration. | def _get(self):
path = self.router.central_core
response = self.request(method="get", path=path)
return response | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_config(self):\n if self.allow_reco():\n return self.chs_config()\n else:\n return self.get_config_j(self.id)",
"def get_config(self):\n return self.config",
"def getConfig(self):\n return self.cp",
"def config(self):\n return self._cfg",
"def... | [
"0.70110065",
"0.68458223",
"0.6843044",
"0.6755136",
"0.67283046",
"0.67258465",
"0.67065775",
"0.6673397",
"0.66640633",
"0.6652268",
"0.66416216",
"0.6632141",
"0.65946966",
"0.65592647",
"0.65592647",
"0.65592647",
"0.65592647",
"0.65592647",
"0.65592647",
"0.65592647",
"... | 0.0 | -1 |
Return mean huber loss. Same as huber_loss, but takes the mean over all values in the output tensor. | def mean_huber_loss(y_true, y_pred, max_grad=1.):
return tf.reduce_mean(huber_loss(y_true, y_pred, max_grad)) # todo no need to specify axis right | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mean_huber_loss(y_true, y_pred, max_grad=0.5):\n error = y_true - y_pred\n try:\n loss = tf.select(tf.abs(error)<max_grad, 0.5*tf.square(error), max_grad*(tf.abs(error)-0.5*max_grad))\n except:\n loss = tf.where(tf.abs(error)<max_grad, 0.5*tf.square(error), tf.abs(error)-0.5)\n return... | [
"0.6766739",
"0.67017496",
"0.6599769",
"0.65873843",
"0.6584056",
"0.6450187",
"0.6385766",
"0.6323731",
"0.6271205",
"0.6257646",
"0.62275946",
"0.622599",
"0.6188861",
"0.61835504",
"0.61835504",
"0.6156784",
"0.6153587",
"0.61460465",
"0.6117496",
"0.6111047",
"0.6105345"... | 0.7829019 | 0 |
Serialises the data from the output from find_and_replace_non_unique_ids to file, using yaml. | def write_data(filename: str, old_position: dict, new_position: dict) -> None:
combined = {"old_positions": old_position, "new_positions": new_position}
with open(filename, "w") as f:
yaml.dump(combined, f)
return | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def store_as_yaml(dataset, dataset_file):\n\n with open(dataset_file, 'w') as outfile:\n yaml.safe_dump(dataset, outfile, default_flow_style=False)",
"def generate_duplicates_yaml():\n\n platform = PlatformType.mitx.name\n duplicates_url = settings.DUPLICATE_COURSES_URL\n\n if duplicates_url i... | [
"0.61111265",
"0.60390544",
"0.5931046",
"0.59104526",
"0.590826",
"0.58810896",
"0.58156246",
"0.57599306",
"0.5737577",
"0.5737577",
"0.5736008",
"0.57307065",
"0.5666501",
"0.563186",
"0.5608232",
"0.55911064",
"0.55909365",
"0.55868685",
"0.5571124",
"0.55708694",
"0.5559... | 0.52302486 | 61 |
Is the field an instance of ForeignKeyField | def isForeignKey(cls, _field):
return isinstance(_field, fields.ForeignKeyField) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isForeignKey(self):\n return self._foreignKey",
"def isReferenceField(cls, _field):\n return isinstance(_field, fields.ReferenceField)",
"def _is_foreign_key(self, key):\n return self._in_keys(key, self._foreign_keys)",
"def _filter_fk(self, field):\n if isinstance(field, mode... | [
"0.7385436",
"0.6818853",
"0.66329867",
"0.639971",
"0.63582295",
"0.60421264",
"0.59516984",
"0.59092355",
"0.59085447",
"0.5867065",
"0.58271986",
"0.5801916",
"0.5727197",
"0.5721409",
"0.56951076",
"0.5641257",
"0.56094176",
"0.5575522",
"0.5509661",
"0.54601115",
"0.5435... | 0.84272885 | 0 |
Is the field an instance of ReferenceField | def isReferenceField(cls, _field):
return isinstance(_field, fields.ReferenceField) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_reference(self):\n return self.resource.is_reference()",
"def ISREF(value):\n return isinstance(value, Record)",
"def isReference(node):\n return bool(isinstance(node, nodes.Referential)\n and node.get(DuAttrRefid, None))",
"def is_reference(type):\n nake_type = re... | [
"0.70503026",
"0.6971584",
"0.6860959",
"0.6648625",
"0.6475184",
"0.64700997",
"0.6323128",
"0.63142174",
"0.6276078",
"0.62411976",
"0.62350345",
"0.62182367",
"0.60769534",
"0.6070035",
"0.6047259",
"0.60373795",
"0.60080355",
"0.59823424",
"0.59769225",
"0.59321284",
"0.5... | 0.89687663 | 0 |
Transform a list with items that can be commaseparated strings, into a pure list where the commaseparated strings become multiple items. | def pure_list(comma_list):
pure_items = []
for comma_item in comma_list:
for item in comma_item.split(','):
pure_items.append(item)
return pure_items | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def listify(item, do_strip=False):\n if not item:\n return []\n elif isinstance(item, list):\n return item\n elif isinstance(item, string_types) and item.count(','):\n if do_strip:\n return [token.strip() for token in item.split(',')]\n else:\n return item... | [
"0.7179106",
"0.66279626",
"0.6516726",
"0.64671993",
"0.642363",
"0.6416306",
"0.6330024",
"0.6321033",
"0.6118869",
"0.6109607",
"0.6100593",
"0.6099057",
"0.608053",
"0.607933",
"0.6059785",
"0.6039588",
"0.60308623",
"0.5940047",
"0.5934668",
"0.5923463",
"0.5922006",
"... | 0.66680217 | 1 |
Returns the expected filename for a field mapping. | def get_field_mapping_filename(field_name: str, config_location: str) -> str:
return os.path.join(config_location, field_name + ".csv") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_filename(self):\n name, ext = self.fkit.filename.rsplit('.', 1)\n if self._field.extension():\n ext = self._field.extension()\n return '.'.join((name, ext))",
"def _filename(self, key):\n return os.path.join(self.root, key[:2], key)",
"def get_filename(self, latex... | [
"0.66968954",
"0.61458874",
"0.60980326",
"0.6046104",
"0.6001821",
"0.5956408",
"0.5899312",
"0.58976954",
"0.5891226",
"0.5888431",
"0.58561045",
"0.5848892",
"0.5842924",
"0.584156",
"0.57972866",
"0.57848626",
"0.5770495",
"0.5770495",
"0.5770495",
"0.5770495",
"0.5770495... | 0.7250896 | 0 |
Creates a button, binds click function, then returns bound button. | def bitmapButton(parent,bitmap,pos=defPos,size=defSize,style=wx.BU_AUTODRAW,val=defVal,
name='button',id=defId,onClick=None,tip=None):
gButton = wx.BitmapButton(parent,id,bitmap,pos,size,style,val,name)
if onClick: gButton.Bind(wx.EVT_BUTTON,onClick)
if tip: gButton.SetToolTip(tooltip(tip))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_button( self, button_text = \"default text\", command = None ):\n a_button = Tk.Button( self.bottom_inner_frame ,\n width = self.button_width,\n height = self.button_height,\n text = button_text )\n ... | [
"0.7435694",
"0.7229133",
"0.71560407",
"0.7127161",
"0.7080185",
"0.67517674",
"0.67455953",
"0.67308664",
"0.67093664",
"0.6638193",
"0.65848595",
"0.6583531",
"0.6475878",
"0.64487845",
"0.6426186",
"0.6332437",
"0.6271003",
"0.6233129",
"0.622035",
"0.6219451",
"0.6213258... | 0.54861474 | 63 |
Creates a button, binds click function, then returns bound button. | def button(parent,label='',pos=defPos,size=defSize,style=0,val=defVal,
name='button',id=defId,onClick=None,tip=None):
gButton = wx.Button(parent,id,label,pos,size,style,val,name)
if onClick: gButton.Bind(wx.EVT_BUTTON,onClick)
if tip: gButton.SetToolTip(tooltip(tip))
return gButton | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_button( self, button_text = \"default text\", command = None ):\n a_button = Tk.Button( self.bottom_inner_frame ,\n width = self.button_width,\n height = self.button_height,\n text = button_text )\n ... | [
"0.7435694",
"0.7229133",
"0.71560407",
"0.7127161",
"0.7080185",
"0.67517674",
"0.67308664",
"0.67093664",
"0.6638193",
"0.65848595",
"0.6583531",
"0.6475878",
"0.64487845",
"0.6426186",
"0.6332437",
"0.6271003",
"0.6233129",
"0.622035",
"0.6219451",
"0.62132585",
"0.6154361... | 0.67455953 | 6 |
Creates a checkBox, binds check function, then returns bound button. | def checkBox(parent,label='',pos=defPos,size=defSize,style=0,val=defVal,
name='checkBox',id=defId,onCheck=None,tip=None):
gCheckBox = wx.CheckBox(parent,id,label,pos,size,style,val,name)
if onCheck: gCheckBox.Bind(wx.EVT_CHECKBOX,onCheck)
if tip: gCheckBox.SetToolTip(tooltip(tip))
return gC... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _create_boolean_widget(self,frame,name,widget_options):\n # CB: might be necessary to pass actions to command option of Checkbutton;\n # could be cause of test pattern boolean not working?\n return T.Checkbutton(frame,variable=self._tkvars[name],**widget_options)",
"def _add_checkbox(sel... | [
"0.7246346",
"0.6896391",
"0.67318606",
"0.67060286",
"0.66508985",
"0.6586965",
"0.6507119",
"0.64163613",
"0.6388825",
"0.622165",
"0.6055966",
"0.60486764",
"0.60372674",
"0.5997291",
"0.58785844",
"0.5864053",
"0.58617795",
"0.5830746",
"0.57529384",
"0.57421136",
"0.5724... | 0.666468 | 4 |
Show as save dialog and return selected path(s). | def askOpenMulti(parent,title='',defaultDir='',defaultFile='',wildcard='',style=wx.OPEN|wx.MULTIPLE):
return askOpen(parent,title,defaultDir,defaultFile,wildcard,style ) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _savedir(self):\n logger.debug(\"Popping SaveDir browser\")\n return filedialog.askdirectory(**self._kwargs)",
"def on_btn_savepath_clicked(self):\n self.getPath = QtGui.QFileDialog.getExistingDirectory(self, u\"请选择保存目录\", \"D:/\")\n if self.getPath:\n self.save_path.se... | [
"0.7375323",
"0.7187845",
"0.7127748",
"0.70555836",
"0.70133",
"0.7002035",
"0.6954976",
"0.69275206",
"0.67720366",
"0.66581434",
"0.6636599",
"0.6636599",
"0.6636599",
"0.6636599",
"0.6602468",
"0.6563865",
"0.6540085",
"0.6533056",
"0.65095466",
"0.6434699",
"0.6398928",
... | 0.0 | -1 |
Show as save dialog and return selected path(s). | def askSave(parent,title='',defaultDir='',defaultFile='',wildcard='',style=wx.OVERWRITE_PROMPT):
return askOpen(parent,title,defaultDir,defaultFile,wildcard,wx.SAVE|style ) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _savedir(self):\n logger.debug(\"Popping SaveDir browser\")\n return filedialog.askdirectory(**self._kwargs)",
"def on_btn_savepath_clicked(self):\n self.getPath = QtGui.QFileDialog.getExistingDirectory(self, u\"请选择保存目录\", \"D:/\")\n if self.getPath:\n self.save_path.se... | [
"0.7375577",
"0.71880114",
"0.7128151",
"0.70571244",
"0.7013393",
"0.7001609",
"0.6956035",
"0.69280124",
"0.67726994",
"0.66591763",
"0.6636251",
"0.6636251",
"0.6636251",
"0.6636251",
"0.66033393",
"0.6540389",
"0.65326446",
"0.6509606",
"0.64357394",
"0.63991845",
"0.6392... | 0.65645885 | 15 |
Handles check/uncheck of listbox item. | def DoCheck(self,event):
index = event.GetSelection()
item = self.items[index]
if self.list.IsChecked(index):
self.data.check(item)
else:
self.data.uncheck(item)
#self.list.SetSelection(index)
| {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def toggleSelection(self):\n for item in self.getItemsToModify():\n checked = item.checkState() == Qt.Checked\n item.setCheckState(Qt.Unchecked if checked else Qt.Checked)",
"def toggleSelection(self):\n for item in self.getItemsToModify():\n checked = item.checkSta... | [
"0.6389433",
"0.6389433",
"0.63568246",
"0.615058",
"0.6132804",
"0.6095146",
"0.6073441",
"0.6053361",
"0.60470706",
"0.6043434",
"0.6015061",
"0.5820112",
"0.58010817",
"0.5760291",
"0.57388926",
"0.57261515",
"0.5700131",
"0.5675417",
"0.566511",
"0.5608375",
"0.5608375",
... | 0.78296554 | 0 |
Refreshes detail view associated with data from item. | def RefreshDetails(self,item=None):
if self.details: return self.details.RefreshDetails(item)
item = item or self.GetDetailsItem()
if item not in self.data: item = None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def refresh_view(self):\n # self.view_model.query_str = \"\"\n self.query_header.content.text = query_title_bar_text(self.shared_state)\n # self.view_model.update_results()\n self.layout.focus(self.query_window)",
"def UpdateView(self):\n self.View._viewData = self.Model.ModelV... | [
"0.5743998",
"0.57085985",
"0.56979203",
"0.5664591",
"0.5640707",
"0.56036884",
"0.5577011",
"0.5474274",
"0.5447553",
"0.5367607",
"0.5362728",
"0.531397",
"0.5282327",
"0.5262525",
"0.5258731",
"0.5255793",
"0.5245294",
"0.52236515",
"0.5215616",
"0.5215616",
"0.5215616",
... | 0.6904836 | 0 |
Get the lines of code that the node and its subnodes use. | def get_node_loc(node):
lineno = node.lineno
end_lineno = get_last_deep_child(node).lineno
return end_lineno - lineno | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __traverse_node(self, node):\n lines = []\n for path, node_elem in node.filter(javalang.tree.BinaryOperation):\n if node_elem.operator == 'instanceof' and node_elem.operandl.position is not None:\n code_line = node_elem.operandl.position.line or node_elem.operandr.positi... | [
"0.7152288",
"0.66824484",
"0.66344756",
"0.6440581",
"0.6206178",
"0.6206178",
"0.61716527",
"0.6089086",
"0.6060339",
"0.600778",
"0.59911066",
"0.5978553",
"0.59715766",
"0.5950308",
"0.5936817",
"0.59323347",
"0.5916408",
"0.5860236",
"0.5823209",
"0.582284",
"0.5802366",... | 0.5695479 | 25 |
Converts the given filenames to a TFRecord dataset. | def _convert_dataset(split_name, filenames, class_names_to_ids, dataset_dir, image_dir):
assert split_name in ['train', 'validation']
num_per_shard = int(math.ceil(len(filenames) / float(_NUM_SHARDS)))
with tf.Graph().as_default():
image_reader = ImageReader()
with tf.Session('') as sess:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_dataset(filenames, labels):\n \n dataset = tf.data.Dataset.from_tensor_slices((filenames, labels))\n \n dataset.shuffle(buffer_size=SHUFFLE_BUFFER_SIZE)\n \n dataset = dataset.map(parse_function, num_parallel_calls=AUTOTUNE)\n \n dataset = dataset.batch(BATCH_SIZE)\n\n dataset... | [
"0.71074826",
"0.70367724",
"0.683471",
"0.6802104",
"0.6760165",
"0.66578007",
"0.66416466",
"0.6630453",
"0.6606462",
"0.65135723",
"0.6509902",
"0.64944094",
"0.64616096",
"0.64320374",
"0.6403151",
"0.6399892",
"0.63923943",
"0.6390357",
"0.6380028",
"0.6367752",
"0.63493... | 0.646716 | 12 |
Return host system operating system name. | def this_host():
host_os = platform.system()
print('This platform OS is: ', host_os)
return | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetOSName():\n return Config.osName_",
"def get_os() -> str:\n system = platform.system().lower()\n\n if system == \"linux\":\n machine = os.uname().machine\n if machine.startswith(\"arm\") or machine.startswith(\"aarch\"):\n system = \"pi\"\n\n return system + \"_\" + p... | [
"0.8023683",
"0.79081106",
"0.78539985",
"0.78465235",
"0.7843631",
"0.7767595",
"0.7758105",
"0.77418315",
"0.7710122",
"0.7709596",
"0.76654994",
"0.7644235",
"0.7627454",
"0.7567968",
"0.7565096",
"0.75471234",
"0.74880415",
"0.74880415",
"0.74636155",
"0.74636155",
"0.743... | 0.7787934 | 5 |
Take a string and convert it into a double. | def to_number(param, in_str):
try:
return float(in_str)
except ValueError:
return exit_msg(f"Bad Request: Wrong type, expected 'number' for parameter '{param}'") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_numeric(s):\n\n try:\n s = float(s)\n except Exception as e:\n log.debug('Caught `{e!s}` trying to cast {s!r} to numeric'.format(**locals()))\n pass\n return s",
"def parse_speed(as_str: str) -> float:\n return float(as_str.rstrip(\"x\"))",
"def read_double(data):\n s_type = \"=%s\" % ... | [
"0.6272326",
"0.62525314",
"0.6190242",
"0.6158842",
"0.61583114",
"0.6114014",
"0.61105806",
"0.6098815",
"0.6037773",
"0.59816813",
"0.5963465",
"0.5907899",
"0.5887347",
"0.5861354",
"0.58581877",
"0.5845295",
"0.5836272",
"0.5803914",
"0.5790063",
"0.5752489",
"0.57493865... | 0.52444255 | 61 |
Returns a connection to the censys collection in MongoDB | def get_censys_connection(self):
return self.m_connection.censys | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _connect(self):\n conn = pymongo.MongoClient(self._config.get('mongodb', 'host'), self._config.getint('mongodb', 'port'))\n db = conn[self._config.get('mongodb', 'db')]\n return db[self._config.get('mongodb', 'collection')]",
"def database_connectivity():\n\n port = \"mongodb://localh... | [
"0.782547",
"0.77023333",
"0.74356955",
"0.7431915",
"0.73336554",
"0.7140692",
"0.70895797",
"0.7088628",
"0.70545083",
"0.7052098",
"0.70196015",
"0.70158327",
"0.6987332",
"0.69450134",
"0.68569076",
"0.684479",
"0.6824026",
"0.68133295",
"0.674745",
"0.67216206",
"0.67141... | 0.69530636 | 13 |
Returns a connection to the last_ct_ids collection in MongoDB | def get_ct_last_index_connection(self):
return self.m_connection.ct_last_index | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cursor():\n return get_dbconn(\"nldn\").cursor()",
"def get_db_collection():\n\n client = MongoClient(\n app.config['MONGODB_URI'],\n connectTimeoutMS=app.config['MONGODB_TIMEOUT'],\n serverSelectionTimeoutMS=(\n app.config['MONGODB_TIMEOUT']+app.config['MONGODB_TIMEOUT_... | [
"0.60253525",
"0.5974483",
"0.5882721",
"0.58384573",
"0.5731674",
"0.5711065",
"0.5651506",
"0.56328756",
"0.558326",
"0.5581118",
"0.5569706",
"0.555313",
"0.5533397",
"0.5526276",
"0.55135167",
"0.5508135",
"0.5498127",
"0.5482214",
"0.54733324",
"0.5447398",
"0.54338455",... | 0.6688377 | 0 |
Returns a connection to the graphs_data collection in MongoDB | def get_graphs_data_connection(self):
return self.m_connection.graphs_data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def connectToMongo():\n mongodb_uri = os.environ.get(\"DATABASE_URI\", \"\") or \"mongodb://localhost:27017\" \n client = pymongo.MongoClient(mongodb_uri)\n return client.insights_db # Declare the DB",
"def _connect(self):\n conn = pymongo.MongoClient(self._config.get('mongodb', 'host'), self._c... | [
"0.71303535",
"0.6752937",
"0.66683614",
"0.6662404",
"0.662421",
"0.65790325",
"0.6575704",
"0.6527069",
"0.64899653",
"0.6472103",
"0.64191157",
"0.639359",
"0.62934864",
"0.6265373",
"0.62650543",
"0.61731476",
"0.6150299",
"0.61460453",
"0.61189723",
"0.604981",
"0.602790... | 0.6227059 | 15 |
Returns a connection to the tpd_graphs collection in MongoDB | def get_tpd_graphs_connection(self):
return self.m_connection.tpd_graphs | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def connectToMongo():\n mongodb_uri = os.environ.get(\"DATABASE_URI\", \"\") or \"mongodb://localhost:27017\" \n client = pymongo.MongoClient(mongodb_uri)\n return client.insights_db # Declare the DB",
"def _connect(self):\n conn = pymongo.MongoClient(self._config.get('mongodb', 'host'), self._c... | [
"0.71814483",
"0.672997",
"0.6666397",
"0.66459334",
"0.6629866",
"0.65488553",
"0.65435636",
"0.65285206",
"0.6513681",
"0.64366007",
"0.6434958",
"0.63366956",
"0.6257432",
"0.62558484",
"0.62114686",
"0.61865944",
"0.6184602",
"0.6152251",
"0.61175215",
"0.61008173",
"0.60... | 0.646508 | 9 |
Removes all tables from the soup that have no text. Returns the new soup without modifying the given one. | def remove_empty_tables(soup):
return remove_empty_tags(soup, 'table') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_tags(text):\n\n global cleanr\n global cleann\n global cleans\n try:\n text = BeautifulSoup(text)\n for table in text.findAll(\"table\"):\n table.extract()\n text = text.text\n text = re.sub(cleanr, '', text)\n text = re.sub(cleann, '', text)\n ... | [
"0.6805244",
"0.6785531",
"0.6287626",
"0.6243459",
"0.6180959",
"0.6091687",
"0.6030799",
"0.5865926",
"0.5837205",
"0.57718617",
"0.5563778",
"0.5542399",
"0.55412924",
"0.5487297",
"0.5471029",
"0.5457722",
"0.54362434",
"0.5379455",
"0.5378453",
"0.53756607",
"0.5370078",... | 0.847815 | 0 |
Removes all tags from the soup that have no text. Returns the new soup without modifying the given one. | def remove_all_empty_tags(soup):
return remove_empty_tags(soup, soup.name, recursive=True) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_empty_tags(soup, tag_name, recursive=False):\n new_soup = BeautifulSoup(str(soup))\n for tag in new_soup.findAll(tag_name, recursive=recursive):\n if not tag.text:\n tag.extract()\n return new_soup",
"def remove_unwanted_tags(soup: bs4.BeautifulSoup):\n for tag in soup.fi... | [
"0.79349655",
"0.71811426",
"0.70803815",
"0.7009293",
"0.7009293",
"0.7007247",
"0.69525814",
"0.6898706",
"0.6779394",
"0.67730886",
"0.6750407",
"0.67294395",
"0.6721262",
"0.671552",
"0.67132527",
"0.66762805",
"0.6676049",
"0.66689956",
"0.66639185",
"0.6656823",
"0.6641... | 0.7659507 | 1 |
UserPassesTestMixin func to check that currently logged in user only updates his own posts | def test_func(self):
post = self.get_object()
return self.request.user == post.author | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_func(self):\r\n post = self.get_object()\r\n if self.request.user == post.author:\r\n return True\r\n return False",
"def test_func(self):\r\n post = self.get_object()\r\n if self.request.user == post.author:\r\n return True\r\n return Fals... | [
"0.76159376",
"0.76159376",
"0.76159376",
"0.7577924",
"0.7215892",
"0.71615696",
"0.7070172",
"0.7012062",
"0.69996357",
"0.6907214",
"0.6874985",
"0.6816819",
"0.6779473",
"0.6739526",
"0.67211556",
"0.6709576",
"0.66801035",
"0.66151124",
"0.65749997",
"0.65714014",
"0.656... | 0.7478359 | 4 |
UserPassesTestMixin func to check that currently logged in user only updates his own posts | def test_func(self):
post = self.get_object()
return self.request.user == post.author | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_func(self):\r\n post = self.get_object()\r\n if self.request.user == post.author:\r\n return True\r\n return False",
"def test_func(self):\r\n post = self.get_object()\r\n if self.request.user == post.author:\r\n return True\r\n return Fals... | [
"0.76159376",
"0.76159376",
"0.76159376",
"0.7577924",
"0.7215892",
"0.71615696",
"0.7070172",
"0.7012062",
"0.69996357",
"0.6907214",
"0.6874985",
"0.6816819",
"0.6779473",
"0.6739526",
"0.67211556",
"0.6709576",
"0.66801035",
"0.66151124",
"0.65749997",
"0.65714014",
"0.656... | 0.7478359 | 5 |
r"""Computes the sum of elements across dimensions of a tensor. | def reduce_sum(
input_tensor: remote_blob_util.BlobDef,
axis: Optional[Union[int, Sequence[int]]] = None,
keepdims: bool = False,
name: Optional[str] = None,
) -> remote_blob_util.BlobDef:
name = _gen_unique_name_if_need(name, "ReduceSum_")
axis = _check_axis(axis, input_tensor.shape)
if le... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sum(tensor, axis=None):\n raise NotImplementedError",
"def dim_zero_sum(x: Tensor) ->Tensor:\n return torch.sum(x, dim=0)",
"def sum_ft(tensor):\n return tensor.sum(dim=0).sum(dim=-1)",
"def _sum_ft(tensor):\n return tensor.sum(dim=0).sum(dim=-1)",
"def sum(input, axis=None, dtype=None,... | [
"0.7880893",
"0.7370583",
"0.7248803",
"0.71802616",
"0.70768285",
"0.70659",
"0.69955844",
"0.68799156",
"0.6748178",
"0.6718928",
"0.66578144",
"0.6611527",
"0.6543459",
"0.6539365",
"0.6538227",
"0.6531902",
"0.650106",
"0.637124",
"0.63639957",
"0.6327988",
"0.63081074",
... | 0.62859255 | 23 |
Create a Bspline object. | def __init__(self, knot_vector, order):
kv = np.atleast_1d(knot_vector)
if kv.ndim > 1:
raise ValueError("knot_vector must be Python list or rank-1 array, but got rank = %d" % kv.ndim)
self.knot_vector = kv
order = int(order)
if order < 0:
raise ValueErro... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bspline_curve2d():\n # Create a curve instance\n curve = BSpline.Curve()\n\n # Set curve degree\n curve.degree = 3\n\n # Set control points\n curve.ctrlpts = [[5.0, 5.0], [10.0, 10.0], [20.0, 15.0], [35.0, 15.0], [45.0, 10.0], [50.0, 5.0]]\n\n # Set knot vector\n curve.knotvector = [0.0... | [
"0.73281366",
"0.70782965",
"0.7023574",
"0.69228184",
"0.6487202",
"0.63032895",
"0.6302113",
"0.62486124",
"0.6045412",
"0.60236543",
"0.59955406",
"0.5938153",
"0.59154654",
"0.58759046",
"0.57749164",
"0.5767548",
"0.5693311",
"0.5595948",
"0.5594315",
"0.5577319",
"0.555... | 0.0 | -1 |
Return the configuration of the task. | def configuration(self) -> Dict[str, Any]:
return {self.__class__.__qualname__: self._param_names} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def config(self):\n if self._config is None:\n try:\n task_conf = CONF.workflow.tasks[self.task_type]\n except KeyError:\n task_conf = {}\n self._config = CONF.workflow.task_defaults.overlay(task_conf)\n return self._config",
"def get_c... | [
"0.8110393",
"0.74886656",
"0.743297",
"0.74315304",
"0.7273687",
"0.72494054",
"0.72271204",
"0.71950656",
"0.71950656",
"0.71662724",
"0.71640706",
"0.71592134",
"0.71592134",
"0.71592134",
"0.71592134",
"0.71592134",
"0.71592134",
"0.71592134",
"0.71592134",
"0.71592134",
... | 0.0 | -1 |
Given a json, parses it into a ``Release`` object instance. | def parse_json(cls, dataset_slug: str, team_slug: str, payload: Dict[str, Any]) -> "Release":
try:
export_date: datetime.datetime = datetime.datetime.strptime(payload["inserted_at"], "%Y-%m-%dT%H:%M:%S%z")
except ValueError:
# For python version older than 3.7
export_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_json(cls, tag_json):\n return cls.from_dict(json.loads(tag_json))",
"def from_string(json_string):\n\n\td = json.loads(json_string)\n\treturn Album.from_dict(d)",
"def from_json(cls, b):\n return cls.from_dict(json.loads(b))",
"def fromJson(json):\r\n raise NotImplementedError(\... | [
"0.6226123",
"0.59959364",
"0.5992087",
"0.5930515",
"0.59220415",
"0.59220415",
"0.5918766",
"0.58461064",
"0.58219",
"0.57936513",
"0.57768416",
"0.5772652",
"0.5772421",
"0.5766209",
"0.5733358",
"0.5732681",
"0.5729308",
"0.5729308",
"0.5729308",
"0.56183887",
"0.5568135"... | 0.6493187 | 0 |
Returns the path o the given shared library. | def find_library(name):
import ctypes.util as cutil
path = cutil.find_library(name)
if path is None:
raise RuntimeError('Library {} not found'.format(name))
# Under mac, find_library
# returns the full path
if platform == 'darwin':
return path
print('Searching for: {}'.f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lib_name_path(interface, simulator):\n library_name_path = os.path.join(libs_dir, lib_name(interface, simulator))\n\n # On Windows use mixed mode \"c:/a/b/c\" as this work in all cases\n if os.name == \"nt\":\n return library_name_path.replace(\"\\\\\", \"/\")\n\n return library_name_path",
... | [
"0.73209095",
"0.7305792",
"0.6953573",
"0.6795129",
"0.677516",
"0.6719516",
"0.6588378",
"0.65015465",
"0.64732563",
"0.6451129",
"0.6404593",
"0.6404315",
"0.639825",
"0.63355803",
"0.6322773",
"0.6201567",
"0.61907214",
"0.6188458",
"0.6153564",
"0.611482",
"0.61111724",
... | 0.5577048 | 78 |
check for invalid chars since json won't like them. | def check_string( pname, use ):
for l in pname:
if l in string.letters: continue
if l in string.digits : continue
if l =='_' : continue
print( "your "+use+" (" + pname + ") contains invalid characters, please choose another one!" )
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _has_non_ascii_characters(data_string):\r\n try:\r\n data_string.encode('ascii')\r\n except UnicodeEncodeError:\r\n return True\r\n\r\n return False",
"def validate(data, badchars):\n assert(all(b not in data for b in badchars))",
"def test_allowed_chars(self):\n hash_val =... | [
"0.6663892",
"0.65883464",
"0.64845735",
"0.6477893",
"0.64567995",
"0.6448015",
"0.6395608",
"0.63609254",
"0.6267732",
"0.6266307",
"0.62547594",
"0.62412846",
"0.6224537",
"0.62145126",
"0.621228",
"0.61963785",
"0.61885875",
"0.61489767",
"0.61423796",
"0.6141949",
"0.613... | 0.56976396 | 64 |
Sets the download_forward_video_url of this SafetyEvent. | def download_forward_video_url(self, download_forward_video_url):
self._download_forward_video_url = download_forward_video_url | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def download_inward_video_url(self, download_inward_video_url):\n\n self._download_inward_video_url = download_inward_video_url",
"def download_tracked_inward_video_url(self, download_tracked_inward_video_url):\n\n self._download_tracked_inward_video_url = download_tracked_inward_video_url",
"def... | [
"0.71895134",
"0.66868573",
"0.6335735",
"0.624638",
"0.6107497",
"0.5783416",
"0.57079214",
"0.55839044",
"0.5492797",
"0.5484394",
"0.54561996",
"0.5448861",
"0.5382462",
"0.53666663",
"0.53569263",
"0.5281433",
"0.5225917",
"0.52033174",
"0.51723194",
"0.5118871",
"0.50897... | 0.8657472 | 0 |
Sets the download_inward_video_url of this SafetyEvent. | def download_inward_video_url(self, download_inward_video_url):
self._download_inward_video_url = download_inward_video_url | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def download_tracked_inward_video_url(self, download_tracked_inward_video_url):\n\n self._download_tracked_inward_video_url = download_tracked_inward_video_url",
"def download_forward_video_url(self, download_forward_video_url):\n\n self._download_forward_video_url = download_forward_video_url",
... | [
"0.7921948",
"0.70898306",
"0.635656",
"0.63039243",
"0.6151189",
"0.5616079",
"0.55175763",
"0.5511",
"0.5356824",
"0.53234196",
"0.5307592",
"0.52722126",
"0.525273",
"0.52520794",
"0.5231377",
"0.51995486",
"0.5195516",
"0.51579744",
"0.5133653",
"0.5133653",
"0.51084244",... | 0.8604821 | 0 |
Sets the download_tracked_inward_video_url of this SafetyEvent. | def download_tracked_inward_video_url(self, download_tracked_inward_video_url):
self._download_tracked_inward_video_url = download_tracked_inward_video_url | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def download_inward_video_url(self, download_inward_video_url):\n\n self._download_inward_video_url = download_inward_video_url",
"def download_forward_video_url(self, download_forward_video_url):\n\n self._download_forward_video_url = download_forward_video_url",
"def download_url(self, download... | [
"0.82232356",
"0.6819027",
"0.612807",
"0.6037965",
"0.58802545",
"0.57711107",
"0.53986216",
"0.5358078",
"0.5297466",
"0.52838945",
"0.5227802",
"0.5189525",
"0.5168482",
"0.5149672",
"0.5143424",
"0.51138514",
"0.50846434",
"0.4995515",
"0.49805617",
"0.49324816",
"0.48966... | 0.85388047 | 0 |
Sets the id of this SafetyEvent. | def id(self, id):
self._id = id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_id(self, id_):\n\n self.id_ = id_",
"def set_id(self, id):\n self.__id = id",
"def set_id(self, id):\n\n\t\tif id is not None and not isinstance(id, int):\n\t\t\traise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: id EXPECTED TYPE: int', None, None)\n\t\t\n\t\tself.__id = id\n\t\tself.__k... | [
"0.74641925",
"0.7451308",
"0.73163545",
"0.72352475",
"0.7202481",
"0.7130674",
"0.7130674",
"0.7130674",
"0.70476913",
"0.70476913",
"0.70476913",
"0.70476913",
"0.70476913",
"0.7015671",
"0.70018154",
"0.70018154",
"0.70018154",
"0.70018154",
"0.70018154",
"0.70018154",
"0... | 0.0 | -1 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, SafetyEvent):
return False
return self.to_dict() == other.to_dict() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8088132",
"0.8088132",
"0.8054589",
"0.7982687",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
if not isinstance(other, SafetyEvent):
return True
return self.to_dict() != other.to_dict() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.845611",
"0.8391477",
"0.8144138",
"0.81410587",
"0.8132492",
"0.8093973",
"0.80920255",
"0.80920255",
"0.80920255",
"0.8085325",
"0.8085325",
"0.8076365",
"0.8076365",
"0.8065748",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
... | 0.0 | -1 |
Create and save a User with the given email and password. | def _create_user(self, FirstName,LastName, EmailId, MobileNo, password=None, **extra_fields):
if not (FirstName and LastName):
raise ValueError("The user's Name must be set")
if not EmailId:
raise ValueError('The given EmailId must be set')
if not password:
ra... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _create_user(self, email, password, **extra_fields):\n if not email:\n raise ValueError('The given email must be set')\n email = self.normalize_email(email)\n user = self.model(email=email, **extra_fields)\n user.set_password(password)\n user.save(using=self._db)\n return user",
"def... | [
"0.85437864",
"0.8511318",
"0.85077024",
"0.8502027",
"0.85019606",
"0.84889764",
"0.84889764",
"0.84882575",
"0.84882575",
"0.84882575",
"0.84854496",
"0.84765774",
"0.84759104",
"0.8474798",
"0.8474798",
"0.8474798",
"0.8474798",
"0.8474798",
"0.8474798",
"0.8474798",
"0.84... | 0.0 | -1 |
Tries to create and return a Reikna Thread object to use for running some computations on the GPU | def __getGPUthread(self, interactive, force) :
#first try to import Reikna
try :
import reikna as rk
except ModuleNotFoundError :
if force: raise
self.logger.warningglobal("Reikna isn't installed. Please install with 'pip install reikna' to use GPU devices.")
return None
#create... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _create_thread(self, target=None, **kwargs):\n return PyonThread(target=target, **kwargs)",
"def _make_thread(self):\r\n pass",
"def create_cpu():\n return CPU()",
"def _create_device(self):\n return torch.device(\"cuda\" if torch.cuda.is_available() else \"cpu\")",
"def __init_... | [
"0.6633362",
"0.63477606",
"0.598097",
"0.5869066",
"0.5738364",
"0.56859076",
"0.56484777",
"0.56102",
"0.5587253",
"0.5574241",
"0.5572997",
"0.55295205",
"0.5514328",
"0.5500659",
"0.5500659",
"0.54142284",
"0.54116327",
"0.53980833",
"0.5387243",
"0.53567404",
"0.5355811"... | 0.8046737 | 0 |
Sync all models to tables. | def sync_tables():
sync_table(ShoppingList)
sync_table(User)
sync_table(Category)
sync_table(Feed)
sync_table(News)
sync_table(Photo)
sync_table(Profile)
sync_table(Video)
sync_type(FeedPhoto)
sync_type(NewsPhoto) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def smart_syncdb_migrate(self):\n local('python manage.py syncdb')\n local('python manage.py migrate')\n local('python manage.py syncdb --all')",
"def clean_all_db():\n for model in [\n Component, Arch, AutoCase, AutoCaseFailure, Bug, Linkage, WorkItem,\n Document, P... | [
"0.6620603",
"0.6476668",
"0.6472778",
"0.63637924",
"0.6263696",
"0.6245379",
"0.6230628",
"0.6226646",
"0.61964387",
"0.613512",
"0.6112172",
"0.61082697",
"0.6099713",
"0.60785496",
"0.6072165",
"0.6035786",
"0.602687",
"0.602687",
"0.602687",
"0.600396",
"0.60036236",
"... | 0.732601 | 0 |
Converts a datetime into a unix timestamp | def to_timestamp(dt):
return time.mktime(dt.timetuple()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def datetimeToUnix(date):\n return int(time.mktime(date.timetuple())*1000)",
"def datetime2UnixTime(dt):\n\n # UTC unix timestamp\n unix_timestamp = (dt - datetime(1970, 1, 1)).total_seconds()\n\n return unix_timestamp",
"def _datetime_to_timestamp(self, dt):\n return time.mktime(dt.timetupl... | [
"0.7977827",
"0.79362136",
"0.78430486",
"0.78125924",
"0.77786964",
"0.75946146",
"0.7588915",
"0.74927264",
"0.7470787",
"0.7444948",
"0.743911",
"0.7392661",
"0.7367776",
"0.731468",
"0.7310463",
"0.72314173",
"0.72071636",
"0.7172963",
"0.71390635",
"0.71252745",
"0.71217... | 0.737631 | 12 |
Records a persistent mapping from Target to CMakeTargetPair. set_persisted_canonical_name allows a persistent predefined mapping from bazel target to a cmake name/alias. This allows overriding the name generated automatically by bazel_to_cmake, and is set from the third_party_http_archive target_mapping setting. | def set_persisted_canonical_name(
self,
target_id: TargetId,
cmake_target_pair: CMakeTargetPair,
):
assert cmake_target_pair.cmake_package is not None
assert cmake_target_pair.cmake_package == self.cmake_project_name
assert target_id.repository_id == self.repository_id
self.persisted... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def target_name(self, target_name):\n\n self._target_name = target_name",
"def target_name(self, target_name):\n\n self._target_name = target_name",
"def label_to_generated_cmake_target(\n target_id: TargetId, cmake_project: CMakePackage\n) -> CMakeTargetPair:\n\n parts: List[str] = []\n par... | [
"0.49158657",
"0.49158657",
"0.4695424",
"0.4620354",
"0.45314237",
"0.45199314",
"0.45183888",
"0.44321936",
"0.4429328",
"0.44133565",
"0.44092792",
"0.44066602",
"0.43756932",
"0.43690133",
"0.43675116",
"0.43641126",
"0.4340352",
"0.4329119",
"0.4303348",
"0.4303009",
"0.... | 0.70736945 | 0 |
Return a D1 system metadata object for the given resource as pyxb object. | def get_d1_sys_meta(self):
sm = SysMeta()
sm.access_policy = self._acl
sm.checksum_algorithm = self._checksum_algorithm
sm.checksum_value = self._checksum_value
sm.file_name = self._file_name
sm.format_identifier = self._format_identifier
sm.identifier = self._ide... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def metadata(self):\r\n return resources.Metadata(self)",
"def get_meta(_id):\n dataset = ESDataset.get(id=_id, ignore=404, _source=\"_meta\")\n\n if dataset:\n return RegistryDocument.wraps(dataset).meta\n\n raise NoEntityError(f\"dataset {_id} does not exist.\")",
"def get_info_from_os... | [
"0.53266287",
"0.531142",
"0.53103733",
"0.5187505",
"0.51795727",
"0.51647687",
"0.5113323",
"0.51082945",
"0.50071",
"0.49793917",
"0.49203324",
"0.4915369",
"0.49085894",
"0.49076936",
"0.48395476",
"0.4825762",
"0.4812233",
"0.47979882",
"0.47979882",
"0.47979882",
"0.479... | 0.590774 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.