query stringlengths 9 9.05k | document stringlengths 10 222k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 4 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
get a stub that sends requests to a given peer | def get_stub(self, peer: PeerID) -> AuthRPCWrapper:
stub = super().get_stub(self.p2p, peer)
return AuthRPCWrapper(stub, AuthRole.CLIENT, self.authorizer, service_public_key=None) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def server_prober(stub, request):\n try:\n status = stub.ProbeStatus(request)\n except Exception as e:\n new_stub = shift_server()\n return new_stub\n else:\n return stub",
"def shift_server():\n global ALIVE\n if ALIVE == 0:\n ALIVE = 1\n elif ALIVE == 1:\n ... | [
"0.58286816",
"0.56329334",
"0.55941427",
"0.55800456",
"0.5554966",
"0.5400264",
"0.53861904",
"0.5328715",
"0.53022385",
"0.5250319",
"0.523606",
"0.5232564",
"0.52295834",
"0.5191481",
"0.5185965",
"0.5153067",
"0.5133774",
"0.513366",
"0.5125457",
"0.51184845",
"0.5117851... | 0.5873532 | 0 |
Sends message to slack | def send_to_slack(message):
if debug:
print(message)
return True
else:
slack_data = {'text': message, 'channel': slack_channel, "username": slack_username,
"icon_emoji": slack_icon_emoji}
response = requests.post(
slack_webhook_url, data=json.d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_slack(self, message):\n self.slack_client.api_call('chat.postMessage', channel=self.slack_channel, text=message, username=self.username, icon_emoji=self.slack_icon_emoji)\n print(\"Slack Notification sent\")",
"def send_message_to_slack(text):\n\n try:\n post = {\n \"t... | [
"0.84101546",
"0.7684406",
"0.7598026",
"0.759701",
"0.7475869",
"0.7443716",
"0.73746884",
"0.73610026",
"0.7242635",
"0.72030175",
"0.71689487",
"0.7116941",
"0.70332277",
"0.70283216",
"0.69573796",
"0.6946794",
"0.69313985",
"0.6919115",
"0.68725723",
"0.68689644",
"0.686... | 0.7816742 | 1 |
Test that the number of reported tune results is correct | def testNumIters(self):
ray_params = RayParams(cpus_per_actor=1, num_actors=2)
analysis = tune.run(
self.train_func(ray_params),
config=self.params,
resources_per_trial=ray_params.get_tune_resources(),
num_samples=2)
self.assertSequenceEqual(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def num_trials(self):",
"def test_getSampleCount(self):\r\n self.assertEqual(self.estimator1.getSampleCount(), 1)",
"def test_per_dqn(self):\n model = PERDQNLightning(self.hparams)\n result = self.trainer.fit(model)\n\n self.assertEqual(result, 1)",
"def test_num_evals(self):\n\t\... | [
"0.69545174",
"0.6756261",
"0.66614467",
"0.6616982",
"0.6616982",
"0.63123876",
"0.63104653",
"0.6298489",
"0.6272745",
"0.62067825",
"0.6199662",
"0.61982805",
"0.61766785",
"0.617246",
"0.6156057",
"0.6126327",
"0.61195016",
"0.61114615",
"0.6091615",
"0.6091615",
"0.60792... | 0.68699944 | 1 |
Test if error is thrown when using Tune with elastic training. | def testElasticFails(self):
ray_params = RayParams(
cpus_per_actor=1, num_actors=1, elastic_training=True)
with self.assertRaises(TuneError):
tune.run(
self.train_func(ray_params),
config=self.params,
resources_per_trial=ray_params.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testTrainingStopElastic(self):\n # The `train()` function raises a RuntimeError\n ft_manager = FaultToleranceManager.remote()\n\n ft_manager.schedule_kill.remote(rank=0, boost_round=3)\n ft_manager.schedule_kill.remote(rank=1, boost_round=6)\n ft_manager.delay_return.remote(\... | [
"0.6430487",
"0.58070004",
"0.5790569",
"0.57876545",
"0.57636374",
"0.57558906",
"0.5712776",
"0.5573787",
"0.5553651",
"0.5549851",
"0.5505793",
"0.5493457",
"0.5484655",
"0.5477935",
"0.547709",
"0.5445432",
"0.54301304",
"0.5421374",
"0.54188627",
"0.5409754",
"0.5395708"... | 0.76031387 | 0 |
If save_path is a file, use this path. Otherwise, join save_path and filename. If file does not end with suffix or best_suffix, then append suffix. If best==True, then append best_suffix. | def ckpt_path(save_path, filename=None, best=False):
if os.path.isfile(save_path):
return save_path
if not filename:
raise Exception("If save_path is not a file, must provide a filename.")
suffix = '.ckpt'
best_suffix = '.ckpt'
save_path = os.path.join(save_path, filename)
save_p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _make_save_path(self, save_path, save_name):\n if save_name.endswith('.txt'):\n path = os.path.join(save_path, save_name)\n else:\n self.save_name = save_name+'.txt'\n path = os.path.join(save_path, save_name)\n return path",
"def save_best(self, sess, sc... | [
"0.63478696",
"0.6004457",
"0.5805976",
"0.56676304",
"0.56426597",
"0.559139",
"0.55741334",
"0.5572959",
"0.5547498",
"0.55432194",
"0.55162865",
"0.54719764",
"0.5463675",
"0.5340421",
"0.53071415",
"0.527985",
"0.5276037",
"0.5257298",
"0.521184",
"0.51786846",
"0.5165969... | 0.6397553 | 0 |
[indique si la fleur est en fruit] | def est_fruit(self):
if self.age > 20 and self.age <31 and (self.fecondee==True):
return True
else:
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def one_v_one(description):\n return \"forebrain\" in description",
"def is_berry(fruit):\n if fruit == 'strawberry' or fruit == 'cherry' or fruit == 'blackberry':\n is_berry = True\n else:\n is_berry = False\n return is_berry",
"def checkFood(self, food):\n pass",
"def fruit... | [
"0.6146996",
"0.58440363",
"0.5632827",
"0.5613998",
"0.5475524",
"0.54726166",
"0.5427652",
"0.5422366",
"0.5414871",
"0.5388045",
"0.5361428",
"0.5353682",
"0.5340952",
"0.53375876",
"0.5328255",
"0.5300246",
"0.5295049",
"0.52606523",
"0.5251567",
"0.5237527",
"0.5227937",... | 0.6689607 | 0 |
Tests whether ``MessageApplication.__new__`` works as intended. | def test__MessageApplication__new__0():
message_application = MessageApplication()
_assert_fields_set(message_application) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test__MessageApplication__new__1():\n cover = Icon(ICON_TYPE_STATIC, 12)\n icon = Icon(ICON_TYPE_STATIC, 23)\n description = 'Afraid'\n name = 'Chata'\n \n message_application = MessageApplication(\n cover = cover,\n description = description,\n icon = icon,\n name... | [
"0.7948441",
"0.6673767",
"0.6402658",
"0.62554973",
"0.6174546",
"0.6069933",
"0.58999586",
"0.587314",
"0.58070815",
"0.57901084",
"0.5787674",
"0.56917095",
"0.56328523",
"0.5568717",
"0.55345166",
"0.55326825",
"0.54664826",
"0.54464966",
"0.5405169",
"0.54016685",
"0.539... | 0.7738738 | 1 |
Tests whether ``MessageApplication.__new__`` works as intended. | def test__MessageApplication__new__1():
cover = Icon(ICON_TYPE_STATIC, 12)
icon = Icon(ICON_TYPE_STATIC, 23)
description = 'Afraid'
name = 'Chata'
message_application = MessageApplication(
cover = cover,
description = description,
icon = icon,
name = name,
)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test__MessageApplication__new__0():\n message_application = MessageApplication()\n _assert_fields_set(message_application)",
"def test__MessageApplication__create_empty():\n message_application_id = 202304140000\n \n message_application = MessageApplication._create_empty(message_application_id... | [
"0.7738738",
"0.6673767",
"0.6402658",
"0.62554973",
"0.6174546",
"0.6069933",
"0.58999586",
"0.587314",
"0.58070815",
"0.57901084",
"0.5787674",
"0.56917095",
"0.56328523",
"0.5568717",
"0.55345166",
"0.55326825",
"0.54664826",
"0.54464966",
"0.5405169",
"0.54016685",
"0.539... | 0.7948441 | 0 |
Tests whether ``MessageApplication._create_empty`` works as intended. | def test__MessageApplication__create_empty():
message_application_id = 202304140000
message_application = MessageApplication._create_empty(message_application_id)
_assert_fields_set(message_application)
vampytest.assert_eq(message_application.id, message_application_id) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test__MessageApplication__new__0():\n message_application = MessageApplication()\n _assert_fields_set(message_application)",
"def test__MessageApplication__new__1():\n cover = Icon(ICON_TYPE_STATIC, 12)\n icon = Icon(ICON_TYPE_STATIC, 23)\n description = 'Afraid'\n name = 'Chata'\n \n ... | [
"0.68074656",
"0.6550681",
"0.64747626",
"0.64632654",
"0.64058954",
"0.6405656",
"0.6332513",
"0.6200997",
"0.61500394",
"0.6069676",
"0.60523784",
"0.6006606",
"0.59653187",
"0.59143025",
"0.58991927",
"0.58978826",
"0.58634174",
"0.585233",
"0.5838295",
"0.58012694",
"0.57... | 0.84340566 | 0 |
Tests whether ``MessageApplication.precreate`` works as intended. | def test__MessageApplication__precreate__0():
message_application_id = 202304140001
message_application = MessageApplication.precreate(message_application_id)
_assert_fields_set(message_application)
vampytest.assert_eq(message_application.id, message_application_id) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test__MessageApplication__precreate__1():\n message_application_id = 202304140002\n \n cover = Icon(ICON_TYPE_STATIC, 12)\n icon = Icon(ICON_TYPE_STATIC, 23)\n description = 'Afraid'\n name = 'Chata'\n \n message_application = MessageApplication.precreate(\n message_application_i... | [
"0.818382",
"0.6619707",
"0.6619707",
"0.6619707",
"0.6619707",
"0.6619707",
"0.64790577",
"0.64790577",
"0.6401003",
"0.5679449",
"0.5576985",
"0.55662435",
"0.5539417",
"0.5460761",
"0.5426637",
"0.5404863",
"0.54007214",
"0.5384768",
"0.5382076",
"0.5349702",
"0.53280884",... | 0.82373095 | 0 |
Tests whether ``MessageApplication.precreate`` works as intended. | def test__MessageApplication__precreate__1():
message_application_id = 202304140002
cover = Icon(ICON_TYPE_STATIC, 12)
icon = Icon(ICON_TYPE_STATIC, 23)
description = 'Afraid'
name = 'Chata'
message_application = MessageApplication.precreate(
message_application_id,
cov... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test__MessageApplication__precreate__0():\n message_application_id = 202304140001\n \n message_application = MessageApplication.precreate(message_application_id)\n \n _assert_fields_set(message_application)\n vampytest.assert_eq(message_application.id, message_application_id)",
"def PreCrea... | [
"0.82373095",
"0.6619707",
"0.6619707",
"0.6619707",
"0.6619707",
"0.6619707",
"0.64790577",
"0.64790577",
"0.6401003",
"0.5679449",
"0.5576985",
"0.55662435",
"0.5539417",
"0.5460761",
"0.5426637",
"0.5404863",
"0.54007214",
"0.5384768",
"0.5382076",
"0.5349702",
"0.53280884... | 0.818382 | 1 |
Performs dynamic decoding with `decoders`. Calls prepare() once and step() repeatedly on `Decoder` object. | def dynamic_ensemble_decode(
decoders,
encoder_outputs,
bridges,
target_modalities,
helper,
parallel_iterations=32,
swap_memory=False):
var_scope = tf.get_variable_scope()
# Properly cache variable values inside the while_loop
if var_scope.caching_devi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def handle_decode(self, encoded_data):\n \n config.COD_PROMPT = config.DEC_PROMPT\n print config.DEC_PROMPT + \" decoding...\"\n \n # while there is another decoder, run each item through the next decoder\n data = encoded_data\n success = False\n for decoder ... | [
"0.6254693",
"0.6162041",
"0.61465585",
"0.58814126",
"0.58171636",
"0.5766235",
"0.5721679",
"0.57103765",
"0.56933624",
"0.56929505",
"0.5663599",
"0.5662473",
"0.5655391",
"0.56234926",
"0.5605497",
"0.55574185",
"0.55421275",
"0.5532227",
"0.5525167",
"0.5495278",
"0.5479... | 0.646081 | 0 |
Creates ensemble weights from `weight_scheme`. Now, only weight_scheme="average" is available. | def get_ensemble_weights(self, num_models):
if self._weight_scheme == "average":
return [1.0 / float(num_models)] * int(num_models)
# TODO can also directly process weights, like "0.1,0.1"
raise NotImplementedError("This weight scheme is not implemented: {}."
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_weights_(self):\n raise NotImplementedError",
"def my_assign_weights(context, data):\n pass",
"def _initialize_weights(self):\n pass",
"def init_sg_weights(self):\n n = self.weights_shape[0] # size of current layer\n # pylint: disable=no-member\n A = np.random.randn(n, n) /... | [
"0.6262821",
"0.61145437",
"0.60712385",
"0.6055485",
"0.6023289",
"0.6004731",
"0.5968039",
"0.5957508",
"0.5849291",
"0.58011365",
"0.5791296",
"0.57805634",
"0.5744831",
"0.57313424",
"0.5698215",
"0.5691682",
"0.5655356",
"0.5649265",
"0.5646294",
"0.5644736",
"0.5632182"... | 0.7043752 | 0 |
Display the matrix using matplotlib, the title and the colormap of the plot are deduced from the 'kind' parameter. | def show_matrix(matrix,kind="temperature"):
if kind=="temperature":
cmap = "bwr"
plt.title("Temperature")
elif kind=="habitat":
cmap = "Greens"
plt.title("Habitat")
else:
cmap = "Blues"
plt.imshow(matrix,
interpolation='None',
cmap=cm... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plotmatrix(figurename,matrix,format='png',title=None,**kwargs):\n \n clip_min = kwargs.pop('clip_min', -np.inf)\n clip_max = kwargs.pop('clip_max', np.inf)\n cmap = kwargs.pop('cmap',cm.Reds)\n fig = plt.figure()\n if 'ticklabels1' in kwargs:\n plt.yticks(range(matrix.shape[0]))\n... | [
"0.73393327",
"0.6824164",
"0.6754047",
"0.6652263",
"0.66464734",
"0.66156816",
"0.66119856",
"0.6557846",
"0.6461226",
"0.6460314",
"0.64144105",
"0.64109826",
"0.64026165",
"0.6360712",
"0.6353278",
"0.6324502",
"0.6316336",
"0.6307886",
"0.63031375",
"0.6224941",
"0.61822... | 0.81292045 | 0 |
Wrap BaseForest._fit. This is a temporary measure prior to the BaseRegressor refactor. | def _fit(self, X, y):
return BaseTimeSeriesForest._fit(self, X, y) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fit(self):\n raise NotImplementedError",
"def fit(self):\n raise NotImplementedError # pragma: no cover",
"def _fit(self, dataset):\n raise NotImplementedError()",
"def fit(self):\n raise NotImplementedError('')",
"def fit():\n pass",
"def fit(self, X):\n ra... | [
"0.69541925",
"0.68776846",
"0.6877322",
"0.6838088",
"0.6818408",
"0.6792884",
"0.67886466",
"0.67886466",
"0.67186964",
"0.66682506",
"0.6631208",
"0.6604409",
"0.65886986",
"0.65886986",
"0.65886986",
"0.65496397",
"0.647449",
"0.646983",
"0.646983",
"0.64621794",
"0.64178... | 0.72887385 | 0 |
Override sklearn forest predict with BaseRegressor predict. | def predict(self, X):
return BaseRegressor.predict(self, X) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rf_predict(\n X_train: Array,\n y_train: Array,\n X_test: Array,\n y_test: Array = None,\n uncertainty: str = \"full\",\n **kwargs,\n) -> tuple[Array, Array, RandomForestRegressor]:\n forest = RandomForestRegressor(random_state=0, **kwargs)\n forest.fit(X_train, y_train)\n\n y_pred, ... | [
"0.6617279",
"0.65540373",
"0.65315056",
"0.65308774",
"0.645649",
"0.6376762",
"0.63436574",
"0.6324994",
"0.63162875",
"0.6204367",
"0.620004",
"0.6184136",
"0.6168078",
"0.6139887",
"0.6136203",
"0.6109132",
"0.61044425",
"0.61044425",
"0.61044425",
"0.61018896",
"0.609329... | 0.6686548 | 0 |
adjust the price (target) with 5% in a new columns adj_price and adj_price_sqrm | def add_average_discount_to_target(data):
data['adj_price'] = data.price.map(lambda x: (x - x * 0.05))
data['adj_price_sqrm'] = data.price_sqrm.map(lambda x: (x - x * 0.05))
return data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate_sell_price(price: float):\n return round(price * (1 + CONF.trade_advantage_in_percent / 100), 1)",
"def adjust_price(self, price):\n precision = self._price_limits[3] or 8\n tick_size = self._price_limits[2] or 0.00000001\n\n # adjusted price at precision and by step of pip ... | [
"0.563933",
"0.5638393",
"0.56193507",
"0.5573973",
"0.5563542",
"0.5502309",
"0.5340116",
"0.5308329",
"0.530606",
"0.52370214",
"0.5208151",
"0.51937336",
"0.5174869",
"0.51740295",
"0.5157858",
"0.51511836",
"0.5143063",
"0.5140745",
"0.51331997",
"0.5132746",
"0.5126579",... | 0.6864149 | 0 |
Additional column for the region needed for mapping the population, green areas etc. | def add_region_feature(data):
data.loc[:, 'region'] = data.loc[:, 'district'].apply(
lambda x: mapping.SOFIA_NEIGHBOURHOOD_TO_REGION_MAPPING[x]
)
return data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_population_feature(data):\n\n data.loc[:, 'population'] = data.loc[:, 'region'].apply(\n lambda x: mapping.SOFIA_REGIONS_POPULATION_MAPPING[x]\n )\n data['adj_population'] = data.population.map(lambda x: (x + x * 0.1))\n\n return data",
"def add_loc_cols(df):\r\n\r\n\tdf['STATE'] = [in... | [
"0.5962177",
"0.5869616",
"0.56979346",
"0.56446475",
"0.5435717",
"0.5430769",
"0.5374926",
"0.5374112",
"0.5373336",
"0.5350224",
"0.532746",
"0.5324471",
"0.5274696",
"0.5274696",
"0.5257323",
"0.5238317",
"0.5227888",
"0.5227888",
"0.5214392",
"0.5172477",
"0.5164993",
... | 0.656565 | 0 |
The population is divided into regions in Sofia. The last available data was in 2011 that shows that between 2001 and 2011 the population growth was a little more than 10 % average for all the districts. This means that we will adjust the number by +10% before the next population count in 2021. | def add_population_feature(data):
data.loc[:, 'population'] = data.loc[:, 'region'].apply(
lambda x: mapping.SOFIA_REGIONS_POPULATION_MAPPING[x]
)
data['adj_population'] = data.population.map(lambda x: (x + x * 0.1))
return data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def at_birth(df,variable,npoint):\n return df.groupby('cell')[['{}'.format('{}'.format(variable)),'pred_growth_rate']].apply(lambda x: x.head(npoint).mean()).rename(columns={'pred_length_box_um':'{}_at_birth'.format(variable)})",
"def average_population_grade(population):\r\n total = 0\r\n for individua... | [
"0.5535828",
"0.5507328",
"0.54799646",
"0.5471713",
"0.5456382",
"0.54437935",
"0.54347974",
"0.5403029",
"0.5403002",
"0.5346823",
"0.52930796",
"0.52916986",
"0.52910703",
"0.52808404",
"0.52757365",
"0.52700174",
"0.52281874",
"0.52259725",
"0.5220774",
"0.51936775",
"0.5... | 0.5599366 | 0 |
Additional column for counting the big supermarkets per district. | def add_supermarkets_feature(data):
data.loc[:, 'nr_supermarkets'] = data.loc[:, 'district'].apply(
lambda x: mapping.SOFIA_NEIGHBOURHOOD_SUPERMARKET_MAPPING[x])
return data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def per_cell_animal_count(self):\n print self.island.individuals()",
"def print_number_of_entities(self, entity_col):\n for df in self:\n print(\"# of entities: \", len(df[entity_col].unique()))",
"def __len__(self):\r\n if self.is_superset:\r\n length = 0\r\n ... | [
"0.5330675",
"0.5282973",
"0.5255991",
"0.5128409",
"0.51240784",
"0.5026904",
"0.502193",
"0.49998674",
"0.49924496",
"0.49710825",
"0.49595797",
"0.49419037",
"0.49380037",
"0.48994735",
"0.4898089",
"0.489673",
"0.48857796",
"0.48539412",
"0.4830413",
"0.48281297",
"0.4813... | 0.68234015 | 0 |
Additional bool column for metro station in district. | def add_metro_feature(data):
data.loc[:, 'has_metro'] = data.loc[:, 'district'].apply(
lambda x: mapping.SOFIA_METRO_TRUE_FALSE_MAPPING[x])
return data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def becomes_single_column(self):\n return self.becomes_column() and not self.is_gps()",
"def get_boolean(self, df):\n if not self.value:\n return False\n elif not self.par:\n return ()\n if self.variable_type == 'interval':\n return self._interval_bool... | [
"0.5492909",
"0.54807097",
"0.5474053",
"0.54708606",
"0.541572",
"0.5336358",
"0.53200907",
"0.5193005",
"0.50475645",
"0.50054103",
"0.49636742",
"0.49614355",
"0.4942129",
"0.49269125",
"0.49171716",
"0.48763788",
"0.48655918",
"0.48403075",
"0.4835898",
"0.4823209",
"0.48... | 0.60921067 | 0 |
Additional bool column for hospitals in each district. | def add_hospital_feature(data):
data.loc[:, 'has_hospital'] = data.loc[:, 'district'].apply(
lambda x: mapping.SOFIA_HOSPITALS_TRUE_FALSE_MAPPING[x])
return data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testHealthAssessHosp(self):\n attr = self.session.create_visit_attr()\n\n self.util.boolTypeTest(self, attr, \"hosp\")\n\n self.util.boolPropertyTest(self, attr, \"hosp\")",
"def exercise1():\n print(exercise1.__doc__)\n area = data['Area square miles'] = pd.Series([46.87, 176.53, ... | [
"0.5407677",
"0.53736824",
"0.53419423",
"0.5297726",
"0.4970331",
"0.48377848",
"0.48371673",
"0.47672835",
"0.47128576",
"0.4695646",
"0.46453887",
"0.46452537",
"0.46426442",
"0.45490533",
"0.4541565",
"0.45203283",
"0.44817874",
"0.4474086",
"0.44707337",
"0.4461174",
"0.... | 0.7443698 | 0 |
Based on mk_level2_fsf.py by Russell Poldrack (Simplified BSD license). | def mk_level2_fsf(
of,
model,
subj,
task=None,
runs=None,
fsf_fname=_opj('%(modeldir)s', 'task%(task)03d_2ndlvl.fsf'),
feat_inputdir=_opj('%(modeldir)s', 'task%(task).3i_run%(run).3i.feat'),
fsfstub_fname=None,
result_dir=None,
overwrite_re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mk_level1_fsf(\n of,\n model,\n subj,\n task,\n run,\n bold_fname=_opj('%(subdir)s', 'BOLD', 'task%(task)03d_run%(run)03d',\n 'bold.nii.gz'),\n # TODO more flexible output location\n fsf_fname=_opj('%(modeldir)s', 'task%(task).3i_ru... | [
"0.531481",
"0.5053373",
"0.48686805",
"0.47372434",
"0.4731332",
"0.47068286",
"0.46767756",
"0.46725553",
"0.46366653",
"0.4628272",
"0.45832887",
"0.45784652",
"0.4534064",
"0.45229214",
"0.44999015",
"0.44965637",
"0.4456667",
"0.44559452",
"0.4419189",
"0.44119292",
"0.4... | 0.53041863 | 1 |
Run through the logic of the unquote function. | def test_unquote(self):
self.assertEqual(unquote('foo%23bar'), 'foo#bar')
self.assertEqual(unquote('foo%23bar', ['#']), 'foo%23bar')
with self.assertRaises(TypeError):
unquote(None)
self.assertEqual(unquote(""), "")
self.assertEqual(unquote("abc123"), "abc123") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unquote(s, *a, **kw):\n return quote(s, *a, **kw)",
"def unquote(value, *args, **kwargs):\n return decode(parse.unquote(value), *args, **kwargs)",
"def unquote():\n def _unquote(quoted):\n return quoted.subexpression\n yield (\"(λ &[any] . any)\", _unquote)",
"def test_... | [
"0.6642955",
"0.66328686",
"0.6418451",
"0.61958",
"0.61934257",
"0.6182384",
"0.61153316",
"0.60987306",
"0.606723",
"0.60570073",
"0.5972834",
"0.59154767",
"0.5902977",
"0.5894338",
"0.58805674",
"0.58460903",
"0.57806385",
"0.57626176",
"0.5584996",
"0.5537941",
"0.551984... | 0.6665324 | 0 |
Run through the logic of the normalize_path function. | def test_normalize_path(self):
self.assertEqual(normalize_path("//////"), "/")
self.assertEqual(normalize_path("//"), "/")
self.assertEqual(normalize_path("//foo/bar//baz"), "/foo/bar/baz")
self.assertEqual(normalize_path("//foo/bar//baz/"), "/foo/bar/baz/")
self.assertEqual(norm... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _normalize_path(path):\n if path is None:\n directory = BASE_PATH\n path = ''\n else:\n path = op.normpath(path)\n directory = op.normpath(op.join(BASE_PATH, path))\n\n if not is_in_folder(BASE_PATH, directory):\n abort(404)\n\n if not op.exists(directory)... | [
"0.7186743",
"0.69471556",
"0.6927698",
"0.6767035",
"0.6454062",
"0.6428511",
"0.6416044",
"0.6339321",
"0.63254476",
"0.63088715",
"0.62542826",
"0.61721075",
"0.61079854",
"0.60850936",
"0.6003305",
"0.6003291",
"0.5992366",
"0.59839135",
"0.5982311",
"0.5890047",
"0.58793... | 0.7038862 | 1 |
Lists all values for a key. | def list_values(key):
return meta.list_values(key=key) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getall(self, key):\n return self.values.get(key, [])",
"def get_for_key(self, key) -> list:\n return [res[key] for res in self.list]",
"def getlist(self, key):\n try:\n return dict.__getitem__(self, key)\n except KeyError:\n return []",
"def get_list(key)... | [
"0.7794685",
"0.7193316",
"0.71820873",
"0.71327794",
"0.6970553",
"0.6915631",
"0.6872249",
"0.67926764",
"0.6746791",
"0.6683304",
"0.66489327",
"0.6641336",
"0.6589233",
"0.6562483",
"0.6562483",
"0.6562483",
"0.6554378",
"0.65395224",
"0.6538315",
"0.6502347",
"0.6489043"... | 0.8103035 | 0 |
Returns the Collatz sequence beginning with `n`. It is conjectured that Collatz sequences all end with `1`. Calls `collatz_step` at each iteration. | def collatz(n):
sequence = []
while n != 1:
if n > 1:
sequence = sequence + [n]
n = collatz_step(n)
elif n < 1:
n = collatz_step(n)
sequence = sequence + [n]
break
if n == 1:
sequence = sequence + [n]
return sequenc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def collatz(n):\n if n==1:\n return [n]\n \n if n>1:\n seq = [n]\n while n>1:\n n = collatz_step(n)\n seq.append(n)\n\n if seq[-1]==1:\n return seq",
"def collatz_step(n):\n if n<1:\n raise ValueError('Input must be greater than 0')\n ... | [
"0.83830476",
"0.7909489",
"0.7577504",
"0.7558608",
"0.7475624",
"0.7360087",
"0.7325965",
"0.7270145",
"0.7249773",
"0.72171444",
"0.71474427",
"0.67161584",
"0.6672091",
"0.6551856",
"0.5956467",
"0.59545493",
"0.58492994",
"0.58025",
"0.5543858",
"0.55369943",
"0.5479883"... | 0.80794156 | 1 |
Return a patch to update the port's physical network. | def _get_physnet_patch(self, physnet, port):
if (not CONF.processing.overwrite_existing
or port.physical_network == physnet):
return
return {'op': 'add', 'path': '/physical_network', 'value': physnet} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_patch_port_group(self):\n pass",
"def get_physnet(self, port, iface_name, introspection_data):",
"def fusion_api_edit_ethernet_network(self, body, uri, api=None, headers=None):\n return self.ethernet_network.update(body, uri, api, headers)",
"def test_networking_project_network_upd... | [
"0.58695257",
"0.5774932",
"0.5773838",
"0.5744404",
"0.57315767",
"0.5719085",
"0.56026155",
"0.5579877",
"0.5514237",
"0.5504025",
"0.54934007",
"0.5472406",
"0.54567254",
"0.539222",
"0.5383555",
"0.53722364",
"0.5357743",
"0.53411263",
"0.531233",
"0.5279417",
"0.5269543"... | 0.73884064 | 0 |
Process introspection data and patch port physical network. | def before_update(self, introspection_data, node_info, **kwargs):
inventory = utils.get_inventory(introspection_data)
ironic_ports = node_info.ports()
for iface in inventory['interfaces']:
if iface['name'] not in introspection_data['all_interfaces']:
continue
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_physnet(self, port, iface_name, introspection_data):",
"def treat_devices_added_or_updated(self, details):\n device = details['device']\n LOG.debug(\"Processing port: %s\", device)\n # REVISIT(ivar): this is not a public facing API, we will move to\n # the right method once th... | [
"0.6093292",
"0.575335",
"0.56939214",
"0.56011117",
"0.5584167",
"0.54978436",
"0.5490232",
"0.5483728",
"0.5449413",
"0.5399004",
"0.53555924",
"0.5347445",
"0.53461397",
"0.5274959",
"0.527264",
"0.52614754",
"0.52535933",
"0.52219194",
"0.52121663",
"0.5172295",
"0.515300... | 0.7502641 | 0 |
Predicts if a given text param is a tip or not. Returns a boolean value. | def predict(self, text):
prediction = self.pipeline.predict([text])
return bool(prediction[0]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_tip(text):\n\n amount = 0\n if re.search(r'I sent you a \\$[0-9]*\\.00 tip ♥', text):\n amount = re.match(r'I sent you a \\$([0-9]*)\\.00 tip ♥', text).group(1)\n Settings.maybe_print(\"successfully found tip\")\n Settings.dev_print(\"amount: {}\".format(amount... | [
"0.6787285",
"0.5593779",
"0.55277246",
"0.5444057",
"0.5432679",
"0.53986967",
"0.53676295",
"0.53673977",
"0.5325176",
"0.53108793",
"0.53067994",
"0.5298198",
"0.52494943",
"0.52251226",
"0.52155834",
"0.5207014",
"0.51662445",
"0.51548153",
"0.51505727",
"0.5148154",
"0.5... | 0.64676976 | 1 |
Returns the full path for the dataset file. | def dataset_path(cls):
basepath = os.path.dirname(__file__)
filepath = os.path.abspath(
os.path.join(basepath, "..", "datasets", get_env('DATA_FILENAME')))
return filepath | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def path(self):\n return self._data_file",
"def dataset_path(dataset, work_dir=consts.WORK_DIR):\r\n return join_path(work_dir, consts.DATA_DIR, dataset)",
"def get_filepath(filename):\n return os.path.join(\"datasets\", filename)",
"def dataset_dir(self):\n return self._dataset_dir",
"... | [
"0.8058205",
"0.80355954",
"0.7945212",
"0.77371156",
"0.7652561",
"0.7644312",
"0.7565171",
"0.75521266",
"0.7542085",
"0.75204843",
"0.7462107",
"0.7460071",
"0.7443824",
"0.7371767",
"0.7316586",
"0.73021555",
"0.72992235",
"0.7249082",
"0.7211426",
"0.7210987",
"0.7207542... | 0.87297165 | 0 |
Populate queue with messages containing S3 keys from 'prefix', grouped by the first occurrence of '/' after 'prefix'. If is required that the prefix ends with '/', which means that all the subdirs will be scanned. | def populate_queue_with_subdirs(bucket: str, prefix: str, queue: str) -> None:
# No reason to run the function without scanning subdirs
assert prefix[-1] == "/"
dirs = get_client("s3").list_objects_v2(
Bucket=bucket, Prefix=prefix, Delimiter="/",
)
# Paging is not supported here
asser... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_s3_files(bucket, prefix):\n \n s3 = boto3.client('s3')\n\n if type(prefix) != list:\n prefix = [prefix]\n \n # Loop over prefixes:\n file_list = []\n for p in prefix:\n \n # Load one prefix:\n response = s3.list_objects_v2(Bucket=bucket, Prefix=p)\n ... | [
"0.65747863",
"0.65253735",
"0.65112585",
"0.64017195",
"0.62606305",
"0.62546366",
"0.6225744",
"0.62026757",
"0.6166004",
"0.6156403",
"0.6142595",
"0.6133839",
"0.6086885",
"0.6068397",
"0.6056256",
"0.60536903",
"0.6052233",
"0.604813",
"0.603384",
"0.60187894",
"0.599217... | 0.77303046 | 0 |
(str) Encrypts the letters of a phrase by an offset | def encrypt(phrase, offset):
encrypted_phrase = "" #Empty string that will be populated with encrypted characters
for character in phrase:
unicode_value = ord(character) #Gets the unicode value for the character
if unicode_value >= 97 and unicode_value <= 122: #Unicode values for lower... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encrypt(text, offset):\r\n\r\n return format_text(text, offset)",
"def encrypt(text, offset):\n encrypted_text = \"\"\n for char in text:\n if ord(char) <= 64:\n encrypted_character = chr(ord(char))\n elif ord(char) < 90:\n encrypted_character = ord(char) + offset... | [
"0.789051",
"0.7881164",
"0.7432777",
"0.743228",
"0.73752034",
"0.73717153",
"0.7289788",
"0.7195223",
"0.71443444",
"0.7125594",
"0.70946026",
"0.7082661",
"0.6997202",
"0.69794333",
"0.69541246",
"0.6937674",
"0.69305736",
"0.6927407",
"0.6907248",
"0.6897459",
"0.6884718"... | 0.81793165 | 0 |
(str) Decrypts the letters of a phrase by an offset | def decrypt(phrase, offset):
return encrypt(phrase, 26 - offset) #Encrypting then decrypting by the same number will in effect encrypt by 26, looping back to the starting letters | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def decrypt(text, offset):\r\n return format_text(text, -offset)",
"def decrypt(text, offset):\n decrypted_text = \"\"\n for char in text:\n if ord(char) <= 64:\n decrypted_character = chr(ord(char))\n elif ord(char) <= 90:\n decrypted_character = ord(char) - offset\n... | [
"0.8053914",
"0.80221343",
"0.7361305",
"0.732292",
"0.72779155",
"0.7213974",
"0.7143914",
"0.7135272",
"0.70978755",
"0.70571774",
"0.699645",
"0.6964193",
"0.69637746",
"0.69365424",
"0.69018847",
"0.6900279",
"0.68594867",
"0.68542224",
"0.6836575",
"0.68228406",
"0.68148... | 0.87086564 | 0 |
(tuple) Finds the decryption offsets that will result in an English phrase, then prints them | def find_encryption_offsets(phrase):
possible_offsets = {} #Empty dictionary to be populated by valid offsets as the keys, and decrypted phrases as the values
for i in range(1, 26):
english_phrase = True #Initialised as True, then if it is still True after checking it is a valid phrase
decry... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_encrypt_or_decrypt(option, offset, text):\n if option == \"e\":\n encrypt_or_decrypt = \"encrypted \"\n function = encrypt\n else:\n encrypt_or_decrypt = \"decrypted \"\n function = decrypt\n \n if offset == 0:\n print(\"The \" + encrypt_or_decrypt + \"t... | [
"0.7052739",
"0.660296",
"0.6579963",
"0.64074355",
"0.63853496",
"0.6375597",
"0.6309714",
"0.62654096",
"0.6165342",
"0.6105011",
"0.6055026",
"0.6052835",
"0.5956748",
"0.5912489",
"0.5912052",
"0.5774893",
"0.5742476",
"0.5712354",
"0.57076085",
"0.56913203",
"0.5623541",... | 0.7051418 | 1 |
Blame something. This can be anything. | async def blame(self, ctx, *, the_blame: str):
if len(the_blame) > 1100:
return await ctx.send("Max blame length is 1100. Sorry.")
async with ctx.typing():
image = await self.request(endpoint="generators/blame", params=f"?name={the_blame}")
await ctx.send(f"**{ctx.author.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def DoMaliciousThings():\r\n\tprint(\"You are infected\")",
"def think(self):\n pass",
"def hire(name):\r\n print(\"A CEO cannot be hired outright\")",
"def silence(self):\n return 'Fine. Be that way!'",
"async def _bailout_heist(self, ctx, user: discord.Member=None):\r\n author... | [
"0.6400579",
"0.6223384",
"0.61093575",
"0.61012876",
"0.6063428",
"0.6029938",
"0.60248995",
"0.5914384",
"0.5907781",
"0.58853453",
"0.5845043",
"0.5832998",
"0.5768127",
"0.5746215",
"0.57017595",
"0.5700348",
"0.5680856",
"0.5654781",
"0.56456023",
"0.56436473",
"0.560754... | 0.67705065 | 0 |
You get a bob ross makeover. | async def bobross(self, ctx, member: discord.Member = None):
member = member if member else ctx.author
async with ctx.typing():
image = await self.request(endpoint="generators/bobross", params=f"?avatar={member.avatar_url_as(format='png')}")
await ctx.send(f"**{member.name}** just go... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rop():\n return",
"def make_move(self, request):\n game = get_by_urlsafe(request.urlsafe_game_key, Game)\n if game.game_over:\n raise endpoints.ForbiddenException(\n 'Illegal action: Game is already over.')\n\n HANDS = ['gun', 'water', 'snake']\n if re... | [
"0.58722734",
"0.55447125",
"0.5503272",
"0.5502197",
"0.5462816",
"0.5372951",
"0.53554696",
"0.5328905",
"0.532275",
"0.5309029",
"0.52666605",
"0.52522546",
"0.5248764",
"0.52413",
"0.5210267",
"0.52007526",
"0.518793",
"0.51843506",
"0.51795036",
"0.5164575",
"0.51561105"... | 0.5549154 | 1 |
You can make anyone become a challenger. | async def challenger(self, ctx, member: discord.Member = None):
member = member if member else None
async with ctx.typing():
image = await self.request(endpoint="generators/challenger", params=f"?avatar={member.avatar_url_as(format='png')}")
await ctx.send(f"**{member.name}** is now ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def plaguedoctor(self, ctx):\n currency = await bank.get_currency_name(ctx.guild)\n await self.config.user(ctx.author).gameRole.set(\"Doctor\")\n await self.notify_user(ctx=ctx, user=ctx.author, notificationType=\"doctor\")\n await ctx.send(f\"{ctx.author} has spent 10,000 {curren... | [
"0.61620516",
"0.5957869",
"0.5880904",
"0.58242786",
"0.56902057",
"0.56367546",
"0.55845785",
"0.5557291",
"0.5493999",
"0.5475206",
"0.5438497",
"0.54368716",
"0.5435145",
"0.5413625",
"0.540432",
"0.53667754",
"0.5364103",
"0.53528106",
"0.53496534",
"0.5336778",
"0.53266... | 0.5974989 | 1 |
Test the conversion of a dummy wheel foobar | def test_conversion(tmp_path, wheel_path):
os.chdir(str(tmp_path))
# convert wheel to debian source package
with patch.object(sys, 'argv', ['', '-x', str(wheel_path.parent)]):
with patch.object(wheel2deb.sys, "exit") as mock_exit:
wheel2deb.main()
assert mock_exit.call_args... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def wheel(string = None):\n None",
"def test_three_disemvowel_carson():\n from disemvowel_trolls import disemvowel\n try:\n assert disemvowel(0b1101) == TypeError\n except TypeError:\n print('Cannot take binary numbers!')",
"def test_dummy(self, data):\r\n source, expected = data... | [
"0.61710703",
"0.5704849",
"0.56919855",
"0.56591934",
"0.561975",
"0.5601396",
"0.55967706",
"0.5548598",
"0.5532267",
"0.55302954",
"0.54968655",
"0.54931015",
"0.5457107",
"0.5455384",
"0.54299057",
"0.54211265",
"0.5367547",
"0.5317658",
"0.52506894",
"0.52394545",
"0.522... | 0.58035195 | 1 |
Test starting aggregation when already running. | def test_start_already_running(self, mock_add_job, mock_get_job):
mock_get_job.return_value = MagicMock()
result = self.aggregator.start(self.node_id)
self.assertFalse(result)
self.assertFalse(mock_add_job.called) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_run_started(self):",
"def pytest_started_handling_group(session, worker):",
"def start_monitoring(self):\n pass",
"def test_001_start(self):\n HEADING()\n self.db.start()\n up = self.db.isup()\n result = up\n assert result",
"def process_test_start(sel... | [
"0.620224",
"0.6192483",
"0.61083657",
"0.6017111",
"0.59069383",
"0.5893984",
"0.58389163",
"0.5824268",
"0.5810762",
"0.5804959",
"0.5804544",
"0.5776305",
"0.57740265",
"0.576617",
"0.5732756",
"0.5713319",
"0.5702192",
"0.56798035",
"0.56587154",
"0.5643842",
"0.5602294",... | 0.6298067 | 0 |
Test stopping aggregation with nothing running. | def test_stop_nothing(self, mock_get_job):
mock_get_job.return_value = None
result = self.aggregator.stop(self.node_id)
self.assertFalse(result) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stopTestRun(self):",
"def test_terminate_run(self):\n pass",
"def test_999_stop(self):\n HEADING()\n self.db.stop()\n result = True\n assert result",
"def stopTest(self, test):",
"def stopTest(self, test):\n self.complete_output()",
"def test_none_meet(self, ... | [
"0.65075177",
"0.6409028",
"0.63663286",
"0.6074536",
"0.60525125",
"0.6051991",
"0.60442203",
"0.6043363",
"0.6023016",
"0.59951484",
"0.5951202",
"0.594287",
"0.59113306",
"0.58873826",
"0.5834736",
"0.58129764",
"0.5767303",
"0.5767132",
"0.57477456",
"0.57437325",
"0.5743... | 0.700267 | 0 |
Test storing data with an API error. | def test_store_data_api_error(self, mock_contact):
message = b'Something went wrong. Our team has been notified.'
mock_contact.side_effect = ApiException(
HTTPStatus.INTERNAL_SERVER_ERROR,
message
)
self.aggregator._store_data(self.node_id) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_error_logging(self):\n # Verify nothing in the journal\n assert len(Record.objects.recent('heartbeat')) == 0\n\n data = {\n 'experiment_version': '1',\n 'response_version': 1,\n 'person_id': 'joemamma',\n 'survey_id': 'foosurvey',\n ... | [
"0.6994985",
"0.6812882",
"0.68098664",
"0.67812014",
"0.6707243",
"0.66378",
"0.6635431",
"0.66223747",
"0.6614883",
"0.66063714",
"0.66034055",
"0.65716434",
"0.6560661",
"0.6547544",
"0.652576",
"0.6511458",
"0.65089375",
"0.6506325",
"0.6502515",
"0.6500235",
"0.64576375"... | 0.727082 | 0 |
Read response data from RS485, extract direction, convert it to text. finally print the direction text. | def read_response():
global rs485
# Response in 7 bytes
buf = bytearray( 7 )
rs485.read( buf )
#print( 'Buffer: ', hex(buf[0]), hex(buf[1]), hex(buf[2]), hex(buf[3]), hex(buf[4]), hex(buf[5]), hex(buf[6]) )
# Decode the response
# 0 & 1 are the slave addr + function code
if not( (buf[0... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def readAndRespond(self):\n\n if self.ser.isOpen():\n try:\n #Try to read\n self.ser.flushOutput()\n response = self.ser.readline()\n self.parseString(response)\n print response\n #if response.strip() == \"u... | [
"0.6458579",
"0.61260074",
"0.60657144",
"0.5817488",
"0.57004523",
"0.55808157",
"0.55629456",
"0.55170035",
"0.55125105",
"0.54584724",
"0.54464424",
"0.54396635",
"0.53551924",
"0.53175896",
"0.5272487",
"0.5263698",
"0.52636516",
"0.5250304",
"0.52358776",
"0.5232269",
"0... | 0.74575657 | 0 |
get the available computation devices (CPU & GPUs) Get the computation devices for deep learning experiments with given preferred list of GPU and flag for multiGPU computation. | def get_computation_devices(
preferred_gpu_list: Optional[List[int]],
multi_gpu_flag: bool,
) -> List[Device]:
# use CPU when GPUs are not preferred or not available
if (preferred_gpu_list is None) \
or (len(preferred_gpu_list) == 0) \
or (not torch.cuda.is_available()):... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def try_all_gpus(): #@save\n num_gpus = len(tf.config.experimental.list_physical_devices('GPU'))\n devices = [tf.device(f'/GPU:{i}') for i in range(num_gpus)]\n return devices if devices else [tf.device('/CPU:0')]",
"def detect_gpus():\n def worker(q):\n # `device_lib` will not release the me... | [
"0.7351089",
"0.711227",
"0.7013773",
"0.7013773",
"0.69962704",
"0.6990039",
"0.69724643",
"0.69648427",
"0.69502217",
"0.6850669",
"0.6835772",
"0.678422",
"0.67773485",
"0.675242",
"0.6687484",
"0.6627573",
"0.6611311",
"0.6611311",
"0.6591264",
"0.64701104",
"0.6435652",
... | 0.8674712 | 0 |
Test that you can add a text plugin | def test_add_edit_plugin(self):
# add a new text plugin
page_data = self.get_new_page_data()
response = self.client.post(URL_CMS_PAGE_ADD, page_data)
page = Page.objects.all()[0]
plugin_data = {
'plugin_type':"TextPlugin",
'language':settings.LANGUAGES[0][... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_gameAddText(self):\n # this is tested graphically, it is UI\n pass",
"def test_plugins():\n assert plugins.template.plugin_test() == True\n assert plugin_test() == True",
"def test_copy_textplugin(self):\n page = create_page(\"page\", \"nav_playground.html\", \"en\")\n ... | [
"0.7142208",
"0.6978258",
"0.69407517",
"0.69305396",
"0.6869483",
"0.68114066",
"0.6739826",
"0.668169",
"0.6654635",
"0.65116435",
"0.6424587",
"0.6378008",
"0.62111646",
"0.6171407",
"0.6164539",
"0.6146264",
"0.60773647",
"0.6075129",
"0.6025148",
"0.602333",
"0.60176533"... | 0.73295635 | 0 |
Test that copying plugins works as expected. | def test_copy_plugins(self):
# create some objects
page_en = create_page("CopyPluginTestPage (EN)", "nav_playground.html", "en")
page_de = create_page("CopyPluginTestPage (DE)", "nav_playground.html", "de")
ph_en = page_en.placeholders.get(slot="body")
ph_de = page_de.placeholder... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_custom_plugin(self):\n plugin_name = 'Druptest'\n source = os.path.join(self.current_dir, 'classes', plugin_name)\n target = os.path.join(expanduser('~'), '.drupdates', 'plugins', plugin_name)\n shutil.copytree(source, target)\n plugins = Plugin.get_plugins()\n as... | [
"0.72379047",
"0.68762565",
"0.68040013",
"0.679464",
"0.6739639",
"0.6720053",
"0.671467",
"0.6638799",
"0.65787935",
"0.64952445",
"0.6469627",
"0.6386378",
"0.6312222",
"0.6177669",
"0.6136663",
"0.6053952",
"0.60498655",
"0.601105",
"0.59868664",
"0.588027",
"0.58792764",... | 0.75676566 | 0 |
When removing a draft plugin we would expect the public copy of the plugin to also be removed | def test_remove_plugin_before_published(self):
# add a page
page_data = self.get_new_page_data()
response = self.client.post(URL_CMS_PAGE_ADD, page_data)
page = Page.objects.all()[0]
# add a plugin
plugin_data = {
'plugin_type':"TextPlugin",
'lang... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_plugin_data(self):",
"def unpublish(self, location):\r\n self.convert_to_draft(location)\r\n super(DraftModuleStore, self).delete_item(location)",
"def _delete_plugin_data(self):\n try:\n self.delete_plugin_data()\n except Exception as err:\n logging... | [
"0.71801907",
"0.6379829",
"0.63617396",
"0.6255437",
"0.61235017",
"0.6070682",
"0.60078716",
"0.5940099",
"0.588655",
"0.5859026",
"0.58552694",
"0.58488226",
"0.5808737",
"0.57944655",
"0.57893765",
"0.57401067",
"0.5739087",
"0.56985503",
"0.56859654",
"0.56834507",
"0.56... | 0.6627623 | 1 |
Test that copying of textplugins replaces references to copied plugins | def test_copy_textplugin(self):
page = create_page("page", "nav_playground.html", "en")
placeholder = page.placeholders.get(slot='body')
plugin_base = CMSPlugin(
plugin_type='TextPlugin',
placeholder=placeholder,
position=1,
language=self... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_copy_plugins(self):\n # create some objects\n page_en = create_page(\"CopyPluginTestPage (EN)\", \"nav_playground.html\", \"en\")\n page_de = create_page(\"CopyPluginTestPage (DE)\", \"nav_playground.html\", \"de\")\n ph_en = page_en.placeholders.get(slot=\"body\")\n ph_... | [
"0.70641947",
"0.6443434",
"0.64426214",
"0.6301122",
"0.61512595",
"0.58257747",
"0.5588954",
"0.55469763",
"0.55395544",
"0.54618496",
"0.5419054",
"0.5336528",
"0.5318562",
"0.52748966",
"0.52744967",
"0.52645534",
"0.52374196",
"0.5197857",
"0.5186564",
"0.5158541",
"0.51... | 0.76817626 | 0 |
Return an Elasticsearch filter for filtering out NIPSA'd annotations. The returned filter is suitable for inserting into an Es query dict. | def nipsa_filter(userid=None):
# If any one of these "should" clauses is true then the annotation will
# get through the filter.
should_clauses = [{"not": {"term": {"nipsa": True}}}]
if userid is not None:
# Always show the logged-in user's annotations even if they have nipsa.
should_cl... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def not_nipsad_annotations(userid):\n query = query_for_users_annotations(userid)\n query[\"query\"][\"filtered\"][\"filter\"][\"bool\"][\"must\"].append(\n {\"not\": {\"term\": {\"nipsa\": True}}})\n return query",
"def nipsad_annotations(userid):\n query = query_for_users_annotations(userid)... | [
"0.63167226",
"0.63064855",
"0.54988974",
"0.54932624",
"0.52538085",
"0.51746196",
"0.51345307",
"0.5108755",
"0.50105524",
"0.49214038",
"0.49028167",
"0.48722836",
"0.4862893",
"0.48593944",
"0.48433056",
"0.48307765",
"0.47609994",
"0.47577628",
"0.47521484",
"0.47493073",
... | 0.72393566 | 0 |
Return an Elasticsearch query for all the given user's annotations. | def query_for_users_annotations(userid):
return {
"query": {
"filtered": {
"filter": {
"bool": {
"must": [{"term": {"user": userid.lower()}}]
}
}
}
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _all_user_annotations_query(request, user):\n userid = util.user.userid_from_username(user.username, request)\n return {\n 'filtered': {\n 'filter': {'term': {'user': userid.lower()}},\n 'query': {'match_all': {}}\n }\n }",
"def nipsad_annotations(userid):\n qu... | [
"0.84776706",
"0.6552474",
"0.63611656",
"0.60318583",
"0.59738034",
"0.5916854",
"0.55968183",
"0.5592595",
"0.5590119",
"0.5431266",
"0.52867997",
"0.5285357",
"0.5262147",
"0.5254336",
"0.5243139",
"0.51481014",
"0.51313215",
"0.51166993",
"0.51010364",
"0.50775105",
"0.50... | 0.7565154 | 1 |
Return an Elasticsearch query for the user's NIPSA'd annotations. | def nipsad_annotations(userid):
query = query_for_users_annotations(userid)
query["query"]["filtered"]["filter"]["bool"]["must"].append(
{"term": {"nipsa": True}})
return query | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nipsa_filter(userid=None):\n # If any one of these \"should\" clauses is true then the annotation will\n # get through the filter.\n should_clauses = [{\"not\": {\"term\": {\"nipsa\": True}}}]\n\n if userid is not None:\n # Always show the logged-in user's annotations even if they have nipsa... | [
"0.7206935",
"0.70296365",
"0.6918794",
"0.66117877",
"0.57555217",
"0.56842613",
"0.52800405",
"0.519476",
"0.5101369",
"0.5007688",
"0.49125174",
"0.49125174",
"0.48912767",
"0.47703254",
"0.46712175",
"0.46712175",
"0.46326005",
"0.46066797",
"0.46025413",
"0.45956907",
"0... | 0.81125087 | 0 |
Return an Elasticsearch query for the user's nonNIPSA'd annotations. | def not_nipsad_annotations(userid):
query = query_for_users_annotations(userid)
query["query"]["filtered"]["filter"]["bool"]["must"].append(
{"not": {"term": {"nipsa": True}}})
return query | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nipsad_annotations(userid):\n query = query_for_users_annotations(userid)\n query[\"query\"][\"filtered\"][\"filter\"][\"bool\"][\"must\"].append(\n {\"term\": {\"nipsa\": True}})\n return query",
"def nipsa_filter(userid=None):\n # If any one of these \"should\" clauses is true then the a... | [
"0.7912646",
"0.73360676",
"0.66646075",
"0.637159",
"0.59995407",
"0.5719342",
"0.5719342",
"0.5572679",
"0.52060187",
"0.51259637",
"0.509457",
"0.5075936",
"0.50047857",
"0.49667862",
"0.4957798",
"0.4957798",
"0.484385",
"0.48353693",
"0.47016844",
"0.46956438",
"0.469315... | 0.83199334 | 0 |
Check whether string is pangram or not | def is_pangram(string):
a_pos = ord('a')
letters = [0] * 26
for char in string:
if char.isalpha():
letters[ord(char.lower()) - a_pos] += 1
return all(letters) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_pangram(sentence):\n\n result = set()\n \n for char in sentence:\n\n if char.lower().isalpha():\n\n result.add(char.lower())\n\n\n if len(result) == 26:\n\n return True\n\n else:\n\n return False",
"def is_pangram(sentence):\n\n alpha = set()\n is_alpha ... | [
"0.765777",
"0.76229423",
"0.7067474",
"0.7052863",
"0.70356065",
"0.67905444",
"0.6626908",
"0.6356645",
"0.6289239",
"0.6203266",
"0.61825436",
"0.6097621",
"0.606496",
"0.6038649",
"0.600517",
"0.6004086",
"0.59945667",
"0.5993878",
"0.59906876",
"0.59893674",
"0.5980515",... | 0.83000135 | 0 |
Test instructor creation with minimal data (email, password, role, birthday) | def test_create_instructor(self):
response = self.client.post(self.url, data=json.dumps(self.payload), content_type='application/json')
self.assertEqual(response.status_code, status.HTTP_200_OK, msg=response.content.decode())
self.assertEqual(Instructor.objects.count(), self.qty + 1)
sel... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_create_instructor_complete_data(self):\n response = self.client.post(self.url, data=json.dumps(self.payload_all), content_type='application/json')\n self.assertEqual(response.status_code, status.HTTP_200_OK, msg=response.content.decode())\n self.assertEqual(Instructor.objects.count(),... | [
"0.77973855",
"0.73921734",
"0.7269152",
"0.72092843",
"0.7193019",
"0.719033",
"0.7080006",
"0.70755994",
"0.69094527",
"0.6894123",
"0.68893015",
"0.67820835",
"0.67605054",
"0.6695033",
"0.6694981",
"0.6692216",
"0.6692216",
"0.6692216",
"0.6691131",
"0.66754854",
"0.66446... | 0.8086992 | 0 |
Test instructor creation with complete data (email, password, role, birthday, gender) | def test_create_instructor_complete_data(self):
response = self.client.post(self.url, data=json.dumps(self.payload_all), content_type='application/json')
self.assertEqual(response.status_code, status.HTTP_200_OK, msg=response.content.decode())
self.assertEqual(Instructor.objects.count(), self.qt... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_create_instructor(self):\n response = self.client.post(self.url, data=json.dumps(self.payload), content_type='application/json')\n self.assertEqual(response.status_code, status.HTTP_200_OK, msg=response.content.decode())\n self.assertEqual(Instructor.objects.count(), self.qty + 1)\n ... | [
"0.805841",
"0.7266817",
"0.71541744",
"0.705944",
"0.68980414",
"0.6877036",
"0.68710303",
"0.68508226",
"0.6850209",
"0.6784927",
"0.6781266",
"0.67804754",
"0.6769502",
"0.6686649",
"0.6650992",
"0.66394365",
"0.6631385",
"0.6631385",
"0.6631385",
"0.6592075",
"0.65870756"... | 0.786218 | 1 |
Test instructor creation twice (same data) | def test_create_instructor_twice(self):
response = self.client.post(self.url, data=json.dumps(self.payload_repeated), content_type='application/json')
self.assertEqual(response.status_code, status.HTTP_200_OK, msg=response.content.decode())
self.assertEqual(Instructor.objects.count(), self.qty +... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_create_instructor(self):\n response = self.client.post(self.url, data=json.dumps(self.payload), content_type='application/json')\n self.assertEqual(response.status_code, status.HTTP_200_OK, msg=response.content.decode())\n self.assertEqual(Instructor.objects.count(), self.qty + 1)\n ... | [
"0.769729",
"0.7488967",
"0.7205441",
"0.71792346",
"0.6808503",
"0.6688776",
"0.667985",
"0.6660535",
"0.6659116",
"0.6634877",
"0.65139055",
"0.650547",
"0.6502173",
"0.6455965",
"0.6444356",
"0.6410022",
"0.6375959",
"0.63648933",
"0.6356673",
"0.6341334",
"0.6340871",
"... | 0.7693801 | 1 |
Test instructor creation with missing birthday info | def test_create_instructor_missing_birthday(self):
response = self.client.post(self.url, data=json.dumps(self.payload_missing_birthday),
content_type='application/json')
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST, msg=response.content.decode())... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_birth_validation(self):",
"def test_create_student_missing_birthday(self):\n response = self.client.post(self.url, data=json.dumps(self.payload_missing_birthday),\n content_type='application/json')\n self.assertEqual(response.status_code, status.HTTP_400_... | [
"0.7039679",
"0.6868125",
"0.6761741",
"0.6733674",
"0.6697205",
"0.6690531",
"0.6585243",
"0.65621763",
"0.65392435",
"0.6535695",
"0.64939094",
"0.64026636",
"0.6383979",
"0.63214123",
"0.6286624",
"0.6255898",
"0.62543947",
"0.62521315",
"0.6212229",
"0.61938",
"0.6165529"... | 0.8111842 | 0 |
Test instructor creation with missing role info | def test_create_instructor_missing_role(self):
response = self.client.post(self.url, data=json.dumps(self.payload_missing_role),
content_type='application/json')
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST, msg=response.content.decode())
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_create_instructor(self):\n response = self.client.post(self.url, data=json.dumps(self.payload), content_type='application/json')\n self.assertEqual(response.status_code, status.HTTP_200_OK, msg=response.content.decode())\n self.assertEqual(Instructor.objects.count(), self.qty + 1)\n ... | [
"0.7794621",
"0.7467939",
"0.7449668",
"0.7408569",
"0.7357018",
"0.7348701",
"0.7240623",
"0.7208329",
"0.71653557",
"0.7107521",
"0.705882",
"0.6785346",
"0.67461926",
"0.6733531",
"0.66950613",
"0.66404426",
"0.66112673",
"0.6588831",
"0.65816295",
"0.6567953",
"0.6553653"... | 0.8201606 | 0 |
Test parent creation with minimal data (email, password, role, birthday) | def test_create_parent(self):
response = self.client.post(self.url, data=json.dumps(self.payload), content_type='application/json')
self.assertEqual(response.status_code, status.HTTP_200_OK, msg=response.content.decode())
self.assertEqual(Parent.objects.count(), self.qty + 1)
self.assert... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_create_parent_complete_data(self):\n response = self.client.post(self.url, data=json.dumps(self.payload_all), content_type='application/json')\n self.assertEqual(response.status_code, status.HTTP_200_OK, msg=response.content.decode())\n self.assertEqual(Parent.objects.count(), self.qt... | [
"0.7717782",
"0.7016609",
"0.6893099",
"0.67854035",
"0.67156076",
"0.668006",
"0.6613055",
"0.66108304",
"0.65245146",
"0.65000707",
"0.64178497",
"0.64178497",
"0.64178497",
"0.6329158",
"0.63214636",
"0.6318875",
"0.62952214",
"0.6155355",
"0.61476",
"0.61422133",
"0.61218... | 0.8012531 | 0 |
Test parent creation with complete data (email, password, role, birthday, gender) | def test_create_parent_complete_data(self):
response = self.client.post(self.url, data=json.dumps(self.payload_all), content_type='application/json')
self.assertEqual(response.status_code, status.HTTP_200_OK, msg=response.content.decode())
self.assertEqual(Parent.objects.count(), self.qty + 1)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_create_parent(self):\n response = self.client.post(self.url, data=json.dumps(self.payload), content_type='application/json')\n self.assertEqual(response.status_code, status.HTTP_200_OK, msg=response.content.decode())\n self.assertEqual(Parent.objects.count(), self.qty + 1)\n se... | [
"0.78743446",
"0.6740956",
"0.6684322",
"0.6632757",
"0.6584399",
"0.6516206",
"0.6486546",
"0.6486546",
"0.6486546",
"0.644505",
"0.6380854",
"0.6376411",
"0.6320839",
"0.63088953",
"0.62781596",
"0.62768555",
"0.62551355",
"0.6219303",
"0.62023044",
"0.6163518",
"0.61479264... | 0.76904285 | 1 |
Test parent creation twice (same data) | def test_create_parent_twice(self):
response = self.client.post(self.url, data=json.dumps(self.payload_repeated), content_type='application/json')
self.assertEqual(response.status_code, status.HTTP_200_OK, msg=response.content.decode())
self.assertEqual(Parent.objects.count(), self.qty + 1)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_lacking_parent(self):\n pass",
"def test_create_parent(self):\n response = self.client.post(self.url, data=json.dumps(self.payload), content_type='application/json')\n self.assertEqual(response.status_code, status.HTTP_200_OK, msg=response.content.decode())\n self.assertEqual... | [
"0.7327622",
"0.7291284",
"0.71750873",
"0.70575345",
"0.683957",
"0.68384427",
"0.68384427",
"0.6751094",
"0.6615504",
"0.66008794",
"0.65949416",
"0.65104157",
"0.65016395",
"0.64667857",
"0.63932925",
"0.63917375",
"0.6368658",
"0.63437235",
"0.6332753",
"0.6326015",
"0.63... | 0.7512109 | 0 |
Test parent creation with missing birthday info | def test_create_parent_missing_birthday(self):
response = self.client.post(self.url, data=json.dumps(self.payload_missing_birthday),
content_type='application/json')
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST, msg=response.content.decode())
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_date_of_birth(self):\n entries = {'uid=test,ou=people,dc=esmgquadrivium,dc=nl': {\n 'uid': ['test'],\n 'qDateOfBirth': [19951226],\n }}\n clone(entries)\n self.assertEqual(date(1995, 12, 26), Person.objects.first().date_of_birth)",
"def test_patient_date... | [
"0.66133535",
"0.6401738",
"0.6379002",
"0.63506204",
"0.626649",
"0.62616646",
"0.6258136",
"0.62263054",
"0.62263054",
"0.62263054",
"0.62263054",
"0.62263054",
"0.61226845",
"0.60851943",
"0.60197324",
"0.5982935",
"0.5950324",
"0.59245646",
"0.59155875",
"0.5864435",
"0.5... | 0.7909044 | 0 |
Test parent creation with missing role info | def test_create_parent_missing_role(self):
response = self.client.post(self.url, data=json.dumps(self.payload_missing_role),
content_type='application/json')
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST, msg=response.content.decode())
sel... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_lacking_parent(self):\n pass",
"def test_create_parent(self):\n response = self.client.post(self.url, data=json.dumps(self.payload), content_type='application/json')\n self.assertEqual(response.status_code, status.HTTP_200_OK, msg=response.content.decode())\n self.assertEqual... | [
"0.7173321",
"0.71174806",
"0.68135136",
"0.67152756",
"0.6665044",
"0.6665044",
"0.6665044",
"0.6665044",
"0.6665044",
"0.66351545",
"0.6623037",
"0.66228104",
"0.6481688",
"0.64460397",
"0.6426748",
"0.64100564",
"0.63996893",
"0.63996893",
"0.6395939",
"0.6361072",
"0.6360... | 0.78568757 | 0 |
Test student creation with minimal data (email, password, role, birthday) | def test_create_student(self):
response = self.client.post(self.url, data=json.dumps(self.payload), content_type='application/json')
self.assertEqual(response.status_code, status.HTTP_200_OK, msg=response.content.decode())
self.assertEqual(Student.objects.count(), self.qty + 1)
self.asse... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_create_student_complete_data(self):\n response = self.client.post(self.url, data=json.dumps(self.payload_all), content_type='application/json')\n self.assertEqual(response.status_code, status.HTTP_200_OK, msg=response.content.decode())\n self.assertEqual(Student.objects.count(), self.... | [
"0.75032836",
"0.7184321",
"0.7168117",
"0.71637297",
"0.7106433",
"0.7106433",
"0.7106433",
"0.7096027",
"0.708405",
"0.7001411",
"0.6965496",
"0.6905284",
"0.6900171",
"0.6865108",
"0.6859173",
"0.6856256",
"0.6814214",
"0.6801656",
"0.6801538",
"0.67724085",
"0.67493975",
... | 0.77380747 | 0 |
Test student creation with complete data (email, password, role, birthday, gender) | def test_create_student_complete_data(self):
response = self.client.post(self.url, data=json.dumps(self.payload_all), content_type='application/json')
self.assertEqual(response.status_code, status.HTTP_200_OK, msg=response.content.decode())
self.assertEqual(Student.objects.count(), self.qty + 1)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_create_student(self):\n response = self.client.post(self.url, data=json.dumps(self.payload), content_type='application/json')\n self.assertEqual(response.status_code, status.HTTP_200_OK, msg=response.content.decode())\n self.assertEqual(Student.objects.count(), self.qty + 1)\n ... | [
"0.7699759",
"0.7331721",
"0.71936333",
"0.71245515",
"0.7116897",
"0.7116897",
"0.7116897",
"0.70259297",
"0.70055175",
"0.69289756",
"0.6923009",
"0.6889131",
"0.6862286",
"0.6843992",
"0.68248117",
"0.67905575",
"0.677062",
"0.6760585",
"0.6741597",
"0.67381847",
"0.673227... | 0.7493841 | 1 |
Test student creation twice (same data) | def test_create_student_twice(self):
response = self.client.post(self.url, data=json.dumps(self.payload_repeated), content_type='application/json')
self.assertEqual(response.status_code, status.HTTP_200_OK, msg=response.content.decode())
self.assertEqual(Student.objects.count(), self.qty + 1)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_create_student(self):\n response = self.client.post(self.url, data=json.dumps(self.payload), content_type='application/json')\n self.assertEqual(response.status_code, status.HTTP_200_OK, msg=response.content.decode())\n self.assertEqual(Student.objects.count(), self.qty + 1)\n ... | [
"0.7176237",
"0.7174548",
"0.71448815",
"0.704746",
"0.70384395",
"0.6947368",
"0.69430256",
"0.6755699",
"0.6726912",
"0.66720057",
"0.6644916",
"0.6610038",
"0.6580926",
"0.6543243",
"0.6506587",
"0.65057766",
"0.64726734",
"0.6429931",
"0.64217025",
"0.6405076",
"0.6374276... | 0.74358004 | 0 |
Test student creation with missing birthday info | def test_create_student_missing_birthday(self):
response = self.client.post(self.url, data=json.dumps(self.payload_missing_birthday),
content_type='application/json')
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST, msg=response.content.decode())
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_create_instructor_missing_birthday(self):\n response = self.client.post(self.url, data=json.dumps(self.payload_missing_birthday),\n content_type='application/json')\n self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST, msg=response.content.d... | [
"0.7199732",
"0.7019023",
"0.6995882",
"0.69923717",
"0.6895691",
"0.6796359",
"0.67810917",
"0.66963357",
"0.644228",
"0.6409774",
"0.6269694",
"0.62652636",
"0.6264589",
"0.6253317",
"0.6228514",
"0.6179216",
"0.61280346",
"0.6105734",
"0.60952175",
"0.6064227",
"0.6063406"... | 0.780209 | 0 |
Test student creation with missing role info | def test_create_student_missing_role(self):
response = self.client.post(self.url, data=json.dumps(self.payload_missing_role),
content_type='application/json')
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST, msg=response.content.decode())
se... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_add_role(self):\n pass",
"def test_create_instructor_missing_role(self):\n response = self.client.post(self.url, data=json.dumps(self.payload_missing_role),\n content_type='application/json')\n self.assertEqual(response.status_code, status.HTTP_400... | [
"0.7202376",
"0.7189899",
"0.7092232",
"0.70697355",
"0.70014966",
"0.69190806",
"0.6832253",
"0.6723964",
"0.66927207",
"0.6688905",
"0.66311604",
"0.65885717",
"0.65753794",
"0.65148205",
"0.65141356",
"0.6511439",
"0.65093863",
"0.64881116",
"0.6481572",
"0.64582074",
"0.6... | 0.7844897 | 0 |
Read a toml string, but extends it by parsing $include to include other Toml files The next Toml file is inserted in place. | def _flatten_toml_string(self, content: str, local_search_path: str) -> str:
output_str = ""
for line in content:
if line.startswith(self.include_cmd + " "):
# import the next file in line
next_file = line.strip(self.include_cmd).strip()
output... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_toml(content):\n from toml import loads\n return loads(content)",
"def load_toml(self, toml_str): # type: (str) -> None\n self._toml = tomlkit.loads(toml_str)\n self._load_dict(self._toml.value)",
"def loads(xtext):\n\n class XmlLoads(object):\n \"\"\"\n ... | [
"0.5985448",
"0.58067685",
"0.5192504",
"0.5112522",
"0.5033513",
"0.5017051",
"0.49736485",
"0.49417657",
"0.49356148",
"0.4931559",
"0.48842973",
"0.4881478",
"0.4876239",
"0.48670778",
"0.4865844",
"0.48562425",
"0.48481768",
"0.48401296",
"0.48378825",
"0.48222765",
"0.48... | 0.5871916 | 1 |
Returns a tuple containing a set of all user permission names, and a set of all direct and inherited role names. | def allPermissionsRoles(self):
permSet = set()
for p in self.permissions:
permSet.add(p.name)
roleNameSet = set()
for role in self.roles:
rolePerms = set()
roleNameSet.add(role.name)
for perm in role.permissi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def permissions(self):\n perms = set()\n for g in self.groups:\n perms = perms | set(g.permissions)\n return perms",
"def get_granted_roles(self):",
"def get_all_permissions(self) -> set[tuple[str, str]]:\n return set(\n self.appbuilder.get_session.execute(\n ... | [
"0.6651237",
"0.658164",
"0.64076704",
"0.6305213",
"0.6285141",
"0.623088",
"0.6184744",
"0.61462337",
"0.60909164",
"0.5990684",
"0.5975998",
"0.5975998",
"0.59746265",
"0.595276",
"0.5930774",
"0.59035194",
"0.59011877",
"0.58839595",
"0.583101",
"0.5826767",
"0.5816657",
... | 0.70529693 | 0 |
Add a role from which permissions will be inherited. Checks to make sure not trying to inherit itself, and itself is not inherited down the line. Priority to arguments goes role, roleName, then roleId. | def inheritRole(self, role=None, roleName=None, kvDict=None):
return _modelActionBase(self, instance=role, instanceName=roleName, kvDict=kvDict,
model=get_model('role'), db=db, action='add', modelType='role', inherit=True) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_role(self, role, parents=[]):\r\n self._roles.setdefault(role, set())\r\n self._roles[role].update(parents)",
"def removeInheritedRole(self, role=None, roleName=None, kvDict=None):\n\n return _modelActionBase(self, instance=role, instanceName=roleName, kvDict=kvDict,\n ... | [
"0.74223286",
"0.6825309",
"0.6688563",
"0.6673416",
"0.6651328",
"0.6636815",
"0.65790045",
"0.64841187",
"0.64582",
"0.64572453",
"0.64176154",
"0.64043707",
"0.637732",
"0.6349665",
"0.6322872",
"0.6244851",
"0.624423",
"0.6229597",
"0.6223386",
"0.62183106",
"0.6210688",
... | 0.73552847 | 1 |
Remove a role from which permissions were inherited. Checks to make sure not trying to inherit itself, and itself is not inherited down the line. Priority to arguments goes role, roleName, then roleId. | def removeInheritedRole(self, role=None, roleName=None, kvDict=None):
return _modelActionBase(self, instance=role, instanceName=roleName, kvDict=kvDict,
model=get_model('role'), db=db, action='add', modelType='role', inherit=True) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_role(self, role):\n if role.name in [r.name for r in self.roles]:\n remaining_if_any_roles = [r.to_python() for r in self.roles if not r.name == role.name]\n if remaining_if_any_roles:\n return db[self.colNam].find_and_modify(query=dict(_id=self.id), update={'... | [
"0.72528136",
"0.6892453",
"0.68138254",
"0.6794808",
"0.6769324",
"0.6735325",
"0.6680242",
"0.66443104",
"0.6609181",
"0.65699977",
"0.6554231",
"0.6553536",
"0.65322053",
"0.65124947",
"0.64961034",
"0.6474033",
"0.64651",
"0.6438158",
"0.6403436",
"0.63929754",
"0.6341525... | 0.77075964 | 0 |
Returns a tuple containing a set of all role permission names, and a set including the role name and all inherited role names. | def allPermissionsRoles(self, previousRoleNames=None):
rolePermsSet = set()
if not previousRoleNames:
previousRoleNames = set()
# if role has already been counted, end recursion
if self.id in previousRoleNames:
return set(), set()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allPermissionsRoles(self):\n permSet = set()\n for p in self.permissions:\n permSet.add(p.name)\n roleNameSet = set()\n for role in self.roles:\n rolePerms = set()\n roleNameSet.add(role.name)\n for perm in ... | [
"0.79383904",
"0.67280906",
"0.6560671",
"0.64984804",
"0.6487448",
"0.64560986",
"0.6447328",
"0.6397908",
"0.63527834",
"0.6341074",
"0.63302255",
"0.62972397",
"0.623607",
"0.6231561",
"0.62071687",
"0.6184152",
"0.61313784",
"0.6122978",
"0.61156124",
"0.6103487",
"0.6095... | 0.73431504 | 1 |
Get the preassinged url to upload dna files | def get_dna_sequence_upload_url_view(request):
data = request.data
user = User.objects.get(username=request.user)
directory = Directory.objects.get(user=user)
directory_name = getattr(directory, 'name')
data["directory"] = getattr(directory, 'id')
dna_file_serializer = DNAFileSerializer(data... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def url(self):\n return self.get_upload_set().url(self.filename)",
"def file_url(self, fname):\n gs_url = f\"{self.gs_base_url}/{fname}\"\n return f\"{gs_url}\"",
"def action(self):\n return blobstore.create_upload_url(self.upload_url)",
"def get_url(self):\n return self.ge... | [
"0.68955094",
"0.63371044",
"0.6274509",
"0.61494476",
"0.61346567",
"0.609408",
"0.60846543",
"0.6081793",
"0.60447085",
"0.5990297",
"0.5953082",
"0.5948043",
"0.59462446",
"0.59444606",
"0.5941417",
"0.59151006",
"0.58459884",
"0.5796251",
"0.57842004",
"0.57773983",
"0.57... | 0.6438479 | 1 |
Request to get the default DNA Files. | def get_dna_bank_files(request):
user = User.objects.get(username=DEFAULT_USERNAME)
directory = Directory.objects.get(user=user)
dna_files = []
dna_files_query_set = DNAFile.objects.filter(
directory=directory, is_available=True)
for dna_file in dna_files_query_set:
dna_files.app... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_users_dna_file_details(request):\n\n user = User.objects.get(username=request.user)\n directory = Directory.objects.get(user=user)\n\n dna_files = []\n\n dna_files_query_set = DNAFile.objects.filter(\n directory=directory, is_available=True)\n\n for dna_file in dna_files_query_set:\n ... | [
"0.6044433",
"0.556103",
"0.5553544",
"0.5448227",
"0.5398903",
"0.5360307",
"0.5325434",
"0.522247",
"0.52170986",
"0.51599985",
"0.5155407",
"0.5117732",
"0.5115005",
"0.51137894",
"0.51118296",
"0.5083684",
"0.507383",
"0.50611573",
"0.505775",
"0.5035349",
"0.50209016",
... | 0.6477019 | 0 |
Request to get the DNA Files of the authenticated user. | def get_users_dna_file_details(request):
user = User.objects.get(username=request.user)
directory = Directory.objects.get(user=user)
dna_files = []
dna_files_query_set = DNAFile.objects.filter(
directory=directory, is_available=True)
for dna_file in dna_files_query_set:
dna_files... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_dna_bank_files(request):\n\n user = User.objects.get(username=DEFAULT_USERNAME)\n directory = Directory.objects.get(user=user)\n\n dna_files = []\n\n dna_files_query_set = DNAFile.objects.filter(\n directory=directory, is_available=True)\n\n for dna_file in dna_files_query_set:\n ... | [
"0.7363368",
"0.6090601",
"0.60854626",
"0.60225403",
"0.5861773",
"0.5856031",
"0.5812952",
"0.56845826",
"0.5641716",
"0.56278586",
"0.5582969",
"0.55632746",
"0.55632746",
"0.55632746",
"0.5561104",
"0.55126363",
"0.5475949",
"0.5418269",
"0.54156005",
"0.541434",
"0.54061... | 0.7595517 | 0 |
Load the BoW codebook and construct the kd search tree. Compute the nearest neighbor out of 3 for a 'new_data' sample by calling knn.find_nearest(new_data,3) | def getKNNClassifier():
codebook = loadCodebook()
args.nVisualWords = codebook.shape[0]
# find nearest neighbor in the codebook
knn = cv2.KNearest()
# construct kd-tree with labels from 0 - (nCodewords-1)
knn.train(codebook,np.arange(args.nVisualWords))
return knn | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nearest_neighbors_classifier(data):\n clf = KNeighborsClassifier(3, 'distance')\n clf.name = \"KNN\"\n train_predict_and_results(data, clf)",
"def kohonen():\n# plb.close('all')\n \n dim = 28*28\n data_range = 255.0\n \n # load in data and labels \n data = np.array(np.loadtxt... | [
"0.6259887",
"0.56187296",
"0.5618197",
"0.5392091",
"0.53918236",
"0.53887093",
"0.5382357",
"0.5338102",
"0.5305068",
"0.52694744",
"0.5260001",
"0.5255998",
"0.52079123",
"0.5196971",
"0.5183346",
"0.51783186",
"0.5176576",
"0.51722944",
"0.5166057",
"0.5163322",
"0.515192... | 0.646793 | 0 |
Load the feature statistics. | def loadFeatureStats():
print 'Loading feature statistics...'
featurestats = np.loadtxt(os.path.abspath(args.featurestats), dtype=np.float32)
print 'Done.'
return featurestats | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_features(self, features):\n pass\n # self.features = features",
"def load(self):\n all_ = self._fetch_features()\n features = {f.name: f for f in all_}\n self._cache = {n: self._state(features.get(n))\n for n in FEATURES.keys()}",
"def load_stat... | [
"0.68637323",
"0.6641995",
"0.6630883",
"0.6143179",
"0.61423624",
"0.61005014",
"0.5939163",
"0.58294743",
"0.57920194",
"0.57680583",
"0.5766087",
"0.57518077",
"0.57271814",
"0.5694278",
"0.56627154",
"0.5630877",
"0.5625008",
"0.56058234",
"0.5586172",
"0.5585735",
"0.558... | 0.8061477 | 0 |
Gets the asset tag of the given entity during upload. | def GetAssetTagsFromUploadRequest(self, entity, request):
return [] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_tag(self, tag, filename):\n return self.get_tag_batch(tag, [filename])[0]",
"def get(self, currency, entity):\n check_inputs(currency=currency, entity=entity)\n tags = entitiesDAO.list_entity_tags(currency, entity)\n return tags",
"def _get_tag(self):\n return self.__tag"... | [
"0.61146694",
"0.58778316",
"0.5813894",
"0.5805953",
"0.5650816",
"0.561922",
"0.56111354",
"0.56012976",
"0.55632",
"0.55189484",
"0.55128753",
"0.5499972",
"0.54612863",
"0.54450023",
"0.54363954",
"0.5431249",
"0.5408843",
"0.5406867",
"0.54059553",
"0.5365544",
"0.536494... | 0.6771434 | 0 |
Fills InventoryServicePassphraseProperties for entity. | def FillInventoryServicePropertiesDuringEscrow(self, entity, request):
return | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init(self, passphrase: str, **kwargs):\n # Initialise the KDF\n self._vault_kdf = init_kdf(**self._kdf_defaults)\n\n # Set up an empty state\n self._state = {}\n self.save(passphrase)",
"def copy_from_entity(self, entity):\n for prop in entity._EndpointsPropertyItervalue... | [
"0.5169703",
"0.48675728",
"0.47662935",
"0.44413066",
"0.44063464",
"0.4381093",
"0.43770158",
"0.43584442",
"0.43020535",
"0.429262",
"0.42704624",
"0.42688766",
"0.42578593",
"0.42572045",
"0.4243665",
"0.42318308",
"0.42251247",
"0.42053914",
"0.41994518",
"0.4174146",
"0... | 0.66786087 | 0 |
The function extract the https link from a given string | def find_https(x):
i = 0
start = None
end = None
for i in range(0,len(x)):
if i < (len(x) - 4):
string = x[i:i+4]
if string == "http":
start = i
if start != None and x[i] == '"':
end = i
return x[start:end] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_real_link(self, text):\n if text.startswith('https://www.google.com/url?'):\n return parse_qs(urlparse(text).query)['url'][0]\n\n return text",
"def https(url):\n if url[:8] == 'https://':\n return url\n if url[:7] != 'http://':\n return False\n return ... | [
"0.75003695",
"0.7102347",
"0.6790707",
"0.6652766",
"0.65266573",
"0.65216005",
"0.64578366",
"0.64120406",
"0.63907766",
"0.637306",
"0.6370608",
"0.6312711",
"0.6296061",
"0.6275339",
"0.6269629",
"0.6259579",
"0.6188896",
"0.61413676",
"0.60936826",
"0.6092776",
"0.607990... | 0.7502399 | 0 |
Function wrapper to find the maximum (or min) of a function using the scipy fminlike minimisation routines, allowing some of the parameters to be fixed. This requires a messy wrapper because none of the parameter vector passed to the fmin funcitons can be fixed! LogLikelihood function to optimise, of the form func(para... | def Optimise(LogLikelihood,par,func_args,fixed=None,type='max',method='NM',maxiter=10000, maxfun=10000, verbose=True):
if fixed==None:
var_par = np.copy(par)
#otherwise construct the parameter vector from var_par and fixed_par_val
else:
par = np.array(par)
fixed = np.array(fixed) #ensure fixed is a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fmax(func_to_maximize, initial_guess=0.5*V):\n func_to_minimize = lambda x : -func_to_maximize(x)\n return fmin(func_to_minimize, initial_guess, disp=False)[0]",
"def fmax(func_to_maximize, initial_guess=0):\n func_to_minimize = lambda x : -func_to_maximize(x)\n return fmin(func_to_minimi... | [
"0.7085272",
"0.67883414",
"0.6785883",
"0.66284406",
"0.6580602",
"0.64613897",
"0.6409272",
"0.6262781",
"0.6251602",
"0.6249426",
"0.6222751",
"0.62062293",
"0.6168339",
"0.61213404",
"0.6112865",
"0.6097352",
"0.5974419",
"0.59578776",
"0.59462065",
"0.58917284",
"0.58890... | 0.68643045 | 1 |
A naive implementation of the forward pass for a max pooling layer. | def max_pool_forward_naive(x, pool_param):
out = None
#############################################################################
# TODO: Implement the max pooling forward pass #
#############################################################################
pass
###############... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_pool_forward_naive(x, pool_param):\n out = None\n ###########################################################################\n # TODO: Implement the max pooling forward pass #\n ###########################################################################\n N,C,H,W ... | [
"0.8176104",
"0.7866907",
"0.7854871",
"0.76688087",
"0.763123",
"0.75106704",
"0.7398416",
"0.73303866",
"0.7267503",
"0.7173863",
"0.7142943",
"0.7042369",
"0.70236975",
"0.7022948",
"0.696239",
"0.68989724",
"0.689837",
"0.68944407",
"0.6884486",
"0.6883826",
"0.688134",
... | 0.7984787 | 1 |
A naive implementation of the backward pass for a max pooling layer. | def max_pool_backward_naive(dout, cache):
dx = None
#############################################################################
# TODO: Implement the max pooling backward pass #
#############################################################################
pass
#################... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_pool_backward_naive(dout, cache):\n x, pool_params = cache\n N, C, H, W = x.shape\n\n pool_height = pool_params['pool_height']\n pool_width = pool_params['pool_width']\n stride = pool_params['stride']\n\n Hc = (H - pool_height) / stride + 1\n Wc = (W - pool_width) / stride + 1\n\n dx = np.zeros(x.s... | [
"0.77614725",
"0.76357096",
"0.7491863",
"0.7489109",
"0.74684924",
"0.7454527",
"0.7403634",
"0.7400141",
"0.7351165",
"0.72067535",
"0.71149665",
"0.71029645",
"0.71029645",
"0.7050689",
"0.6985986",
"0.693516",
"0.6903203",
"0.6857985",
"0.6800385",
"0.6765994",
"0.6765765... | 0.80068 | 0 |
Computes the forward pass for spatial batch normalization. | def spatial_batchnorm_forward(x, gamma, beta, bn_param):
out, cache = None, None
#############################################################################
# TODO: Implement the forward pass for spatial batch normalization. #
# ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def spatial_batchnorm_forward(x, gamma, beta, bn_param):\n out, cache = None, None\n\n ###########################################################################\n # TODO: Implement the forward pass for spatial batch normalization. #\n # ... | [
"0.7394062",
"0.7037609",
"0.7005051",
"0.7002125",
"0.6987876",
"0.69365174",
"0.691629",
"0.68777937",
"0.6861998",
"0.6805032",
"0.68004656",
"0.67962664",
"0.678273",
"0.67058945",
"0.66437334",
"0.6576711",
"0.6567905",
"0.6561053",
"0.65598494",
"0.64757097",
"0.6439097... | 0.7471391 | 0 |
Computes the backward pass for spatial batch normalization. | def spatial_batchnorm_backward(dout, cache):
dx, dgamma, dbeta = None, None, None
#############################################################################
# TODO: Implement the backward pass for spatial batch normalization. #
# ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def spatial_batchnorm_backward(dout, cache):\n dx, dgamma, dbeta = None, None, None\n\n ###########################################################################\n # TODO: Implement the backward pass for spatial batch normalization. #\n # ... | [
"0.75364095",
"0.73951644",
"0.73047554",
"0.72159046",
"0.71643806",
"0.7082641",
"0.6987794",
"0.69790816",
"0.69370174",
"0.693398",
"0.6933647",
"0.6910771",
"0.6896396",
"0.6881379",
"0.6833048",
"0.6805785",
"0.68022525",
"0.6769649",
"0.6757795",
"0.6740955",
"0.672863... | 0.78398657 | 0 |
Submit a cluster of 5 scheduler universe jobs with equal priority, and wait until they finish running. | def submit_equal_priority_jobs(default_condor, path_to_sleep):
cluster = default_condor.submit(
{
"executable": path_to_sleep,
"arguments": "1",
"universe": "scheduler",
"log": "scheduler_priority-equal.log",
},
count=NUM_JOBS,
)
cluste... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def submitJobs(numOfScript):\n submit = False\n\n for i in range(numOfScript):\n if submit == False:\n numOfRun = int(os.popen('apstat | grep wchen | wc -l').read())\n maxJobs = int(open('runJobs.conf').read())\n jobToSubmit = maxJobs - numOfRun\n print 'job... | [
"0.67436427",
"0.6306559",
"0.6293074",
"0.5875799",
"0.5839556",
"0.5705015",
"0.56819105",
"0.5659902",
"0.55891097",
"0.55879664",
"0.55686307",
"0.55011",
"0.54970616",
"0.54581",
"0.54405975",
"0.5399429",
"0.5384534",
"0.5361854",
"0.53499293",
"0.53348976",
"0.53125435... | 0.6325101 | 1 |
Submit a cluster of 5 scheduler universe jobs with unequal priority, (proc 1 has priority = 1, proc 2 has priority = 2, etc.) and wait until they finish running. | def submit_unequal_priority_jobs(default_condor, path_to_sleep):
cluster = default_condor.submit(
{
"executable": path_to_sleep,
"arguments": "1",
"universe": "scheduler",
"log": "scheduler_priority-unequal.log",
"priority": "$(process)",
}... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def submitJobs(numOfScript):\n submit = False\n\n for i in range(numOfScript):\n if submit == False:\n numOfRun = int(os.popen('apstat | grep wchen | wc -l').read())\n maxJobs = int(open('runJobs.conf').read())\n jobToSubmit = maxJobs - numOfRun\n print 'job... | [
"0.6602641",
"0.64124155",
"0.6274278",
"0.5718874",
"0.571672",
"0.56453025",
"0.55025905",
"0.5481149",
"0.54473895",
"0.54327667",
"0.54327667",
"0.5420412",
"0.5390543",
"0.5334475",
"0.53291273",
"0.5319377",
"0.53153",
"0.5302234",
"0.5265775",
"0.5192927",
"0.51382375"... | 0.6622799 | 0 |
Simple approach to retrieving execute events. Open the job event log, iterate over the events in order and add all execute events to a list. | def equal_priority_execute_events(submit_equal_priority_jobs):
jel = htcondor.JobEventLog("scheduler_priority-equal.log")
execute_events = []
for event in jel.events(0):
if event.type == htcondor.JobEventType.EXECUTE:
execute_events.append(event)
return execute_events | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generateEvents(self, jobs):\n return []",
"def extract_execute_reports(events):\n result = []\n for e in events:\n evt = IpuTraceEvent.FromString(e)\n if evt.type == IpuTraceEvent.EXECUTE:\n try:\n module = evt.execute.module_name.decode('utf-8')\n rep = evt.execute.executio... | [
"0.64143986",
"0.62423444",
"0.6215877",
"0.5903895",
"0.59004354",
"0.58682936",
"0.5826749",
"0.5744079",
"0.5743282",
"0.5716527",
"0.5693448",
"0.5693024",
"0.5689468",
"0.5675863",
"0.5658283",
"0.56387347",
"0.5615506",
"0.56138927",
"0.55930614",
"0.55862117",
"0.55836... | 0.7135419 | 0 |
We expect equal priority jobs to run in the order they were submitted, which means they should run in jobidorder. Simple approach, just iterate over the list of events in a forloop and make sure proc ids appear in ascending order. | def test_equal_priority_jobs_run_in_submit_order(
self, equal_priority_execute_events
):
for i in range(1, NUM_JOBS):
assert (
JobID.from_job_event(equal_priority_execute_events[i]).proc
> JobID.from_job_event(equal_priority_execute_events[i - 1]).proc
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_unequal_priority_jobs_run_in_priority_order(\n self, unequal_priority_execute_events\n ):\n assert (\n sorted(\n unequal_priority_execute_events,\n key=lambda event: JobID.from_job_event(event),\n reverse=True,\n )\n ... | [
"0.74742603",
"0.7011296",
"0.6303329",
"0.6300982",
"0.59918326",
"0.5927309",
"0.5818697",
"0.58018124",
"0.5766598",
"0.56478244",
"0.56222457",
"0.5613897",
"0.55461574",
"0.54555684",
"0.54496646",
"0.54344493",
"0.53668815",
"0.5358708",
"0.53512025",
"0.5326702",
"0.53... | 0.802852 | 0 |
We expect unequal priority jobs to run in the order of priority, which for the set up above, means they should run in reversejobidorder. Josh's Pythonic approach using the sorted() function. | def test_unequal_priority_jobs_run_in_priority_order(
self, unequal_priority_execute_events
):
assert (
sorted(
unequal_priority_execute_events,
key=lambda event: JobID.from_job_event(event),
reverse=True,
)
== unequ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sort(self):\n self.tasks = sorted(self.tasks, key=lambda k: k.priority, reverse=True)",
"def test_equal_priority_jobs_run_in_submit_order(\n self, equal_priority_execute_events\n ):\n for i in range(1, NUM_JOBS):\n assert (\n JobID.from_job_event(equal_priori... | [
"0.7085913",
"0.6868466",
"0.6545962",
"0.6380382",
"0.6318971",
"0.6241187",
"0.62095785",
"0.6170921",
"0.6158344",
"0.60485375",
"0.60366434",
"0.6019585",
"0.5960103",
"0.5953529",
"0.59490013",
"0.59163475",
"0.59153193",
"0.5906476",
"0.58942324",
"0.58792806",
"0.58281... | 0.7440909 | 0 |
Gets the app_version_id of this AppInstallVersion. | def app_version_id(self):
return self._app_version_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def version_id(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"version_id\")",
"def get_version(self):\n data = self._get('app_version')\n return data['version']",
"def app_id(self):\n return self._app_id",
"def app_installation_id(self) -> Optional[pulumi.Input... | [
"0.73907787",
"0.73413086",
"0.7314593",
"0.728456",
"0.7267986",
"0.72030914",
"0.71844697",
"0.7167349",
"0.71540904",
"0.7137058",
"0.71128243",
"0.7077404",
"0.70418143",
"0.692636",
"0.69067955",
"0.6888486",
"0.6833583",
"0.6801371",
"0.674614",
"0.6674054",
"0.66592836... | 0.8765454 | 0 |
Sets the app_version_id of this AppInstallVersion. | def app_version_id(self, app_version_id):
self._app_version_id = app_version_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def app_version_id(self):\n return self._app_version_id",
"def app_id(self, app_id):\n\n self._app_id = app_id",
"def app_id(self, app_id):\n self._app_id = app_id",
"def setAppID(self, appid):\n\t\tself.config.APP_ID = appid",
"def __set_version_id(self):\r\n VersionId = self.c... | [
"0.6932447",
"0.6734854",
"0.6730428",
"0.65842754",
"0.6257902",
"0.6219609",
"0.6186703",
"0.6186703",
"0.5993434",
"0.5832336",
"0.5735562",
"0.57286",
"0.5630821",
"0.56066996",
"0.55946344",
"0.55857974",
"0.5575322",
"0.553692",
"0.5533564",
"0.5533564",
"0.5527333",
... | 0.8455981 | 0 |
Gets the version_code of this AppInstallVersion. | def version_code(self):
return self._version_code | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def version_code(self):\n return self.proto.details.appDetails.versionCode",
"def version_code(self) -> str:\n return pulumi.get(self, \"version_code\")",
"def version_code(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"version_code\")",
"def code_version(self):\n\n ... | [
"0.85095084",
"0.81484383",
"0.77529484",
"0.74329233",
"0.6954358",
"0.68858784",
"0.6868219",
"0.68313825",
"0.6803722",
"0.6803722",
"0.6803722",
"0.6803722",
"0.67462796",
"0.6620829",
"0.6620829",
"0.6620829",
"0.6620829",
"0.6598778",
"0.6593169",
"0.65157115",
"0.65157... | 0.8613739 | 0 |
Sets the version_code of this AppInstallVersion. | def version_code(self, version_code):
self._version_code = version_code | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_pkg_verif_code(self, doc, code):\n self.assert_package_exists()\n if not self.package_verif_set:\n self.package_verif_set = True\n match = self.VERIF_CODE_REGEX.match(code)\n if match:\n doc.package.verif_code = match.group(self.VERIF_CODE_CODE_... | [
"0.6724488",
"0.6579566",
"0.6568599",
"0.6568599",
"0.64402825",
"0.63804847",
"0.6379982",
"0.6379982",
"0.6379158",
"0.6373244",
"0.6364363",
"0.63410264",
"0.6326873",
"0.62825185",
"0.6040121",
"0.6036478",
"0.6006555",
"0.59921587",
"0.5891643",
"0.5890285",
"0.5869265"... | 0.84236884 | 0 |
Sets the build_number of this AppInstallVersion. | def build_number(self, build_number):
self._build_number = build_number | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_api_version(self, build_api_version):\n\n self._build_api_version = build_api_version",
"def hxdp_build_version(self, hxdp_build_version):\n\n self._hxdp_build_version = hxdp_build_version",
"def builder_version(self, builder_version):\n\n self._builder_version = builder_version"... | [
"0.68347824",
"0.6542784",
"0.63321733",
"0.61955804",
"0.6025173",
"0.57602996",
"0.5734798",
"0.56555605",
"0.56424505",
"0.56424505",
"0.56350744",
"0.561939",
"0.55984825",
"0.55984825",
"0.55925083",
"0.55788165",
"0.5573151",
"0.5573151",
"0.5573151",
"0.5573151",
"0.55... | 0.779044 | 0 |
Gets the hash_string of this AppInstallVersion. | def hash_string(self):
return self._hash_string | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_hash(self) -> str:\n return self.__hash.hexdigest()",
"def hash(self) -> str:\n return pulumi.get(self, \"hash\")",
"def hash(self):\n return self._hash",
"def hex(self) -> str:\n return self.__hash.hexdigest()",
"def hash(self):\n return hashlib.sha256(self.to_js... | [
"0.7808271",
"0.75277394",
"0.7086749",
"0.7050276",
"0.6995493",
"0.69806534",
"0.6962277",
"0.69613755",
"0.69579947",
"0.68826467",
"0.68826467",
"0.6855191",
"0.68526024",
"0.68239284",
"0.6819731",
"0.6798659",
"0.6748978",
"0.67443216",
"0.672221",
"0.6707711",
"0.66975... | 0.75950706 | 1 |
Sets the hash_string of this AppInstallVersion. | def hash_string(self, hash_string):
self._hash_string = hash_string | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hash(self, hash):\n\n self._hash = hash",
"def hash(self, hash):\n\n self._hash = hash",
"def hash_id(self, hash_id):\n\n self._hash_id = hash_id",
"def extended_hash(self, extended_hash):\n\n self._extended_hash = extended_hash",
"def distro_hash(self, distro_hash):\n\n ... | [
"0.6830537",
"0.6830537",
"0.61648875",
"0.5996138",
"0.59633523",
"0.58904546",
"0.57719904",
"0.57527906",
"0.5745238",
"0.57317674",
"0.57154334",
"0.56932443",
"0.56654274",
"0.56648725",
"0.56562525",
"0.565159",
"0.56116676",
"0.5534566",
"0.5495819",
"0.54931486",
"0.5... | 0.7424539 | 0 |
Instantiates LaserStabilizer script object for stabilizing the laser | def __init__(self, config='toptica_laser_stabilization', ao_client=None, ai_client=None):
# Instantiate GUI
self.gui = Window(
gui_template='power_stabilizer',
host=get_ip()
)
self.widgets = get_gui_widgets(self.gui, p_setpoint=1, p_outputVoltage=1, label_power=1... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def launch(**kwargs):\n\n logger, loghost, logport, clients, guis, params = unpack_launcher(**kwargs)\n config = load_config(kwargs['config'], logger=logger)\n\n\n ao_client = find_client(logger, clients, 'nidaqmx')\n ai_client = find_client(logger, clients, 'nidaqmx_ai')\n\n # Instantiate Monitor s... | [
"0.630868",
"0.5851401",
"0.5740374",
"0.57391673",
"0.5730571",
"0.5719369",
"0.569621",
"0.56436825",
"0.561999",
"0.56145674",
"0.5545288",
"0.554523",
"0.54974353",
"0.54517597",
"0.5440188",
"0.5434769",
"0.54197156",
"0.5411297",
"0.5384036",
"0.5377103",
"0.5363766",
... | 0.6353341 | 0 |
This method turns on power stabilizationpdate_vs to False to not update the setpoint from the GUI | def start(self, update_st_gui=True, display_pts = 5000):
if update_st_gui:
#First, update the setpoint based on the text in the GUI
self._update_voltageSetpoint_fromGUI()
self._set_output_voltage_from_label()
#Update hte PID parameters, which will save the new setpoi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _update_voltageSetpoint_fromGUI(self):\n self.voltageSetpoint = self.widgets['p_setpoint'].value()/self.gain",
"def setPowerIfNecessary(self):\n if self.p.power == 0 and self.p.powerDensity > 0:\n self.setPowerFromDensity()",
"def update_newly_set_ref_V_ampl(self):\n self.ql... | [
"0.68056685",
"0.6062927",
"0.5977094",
"0.58374494",
"0.58165467",
"0.5786206",
"0.57856846",
"0.5702661",
"0.56750655",
"0.56670874",
"0.56664824",
"0.5656362",
"0.5651878",
"0.55967134",
"0.5574887",
"0.5557816",
"0.55409354",
"0.5536943",
"0.55261093",
"0.5524713",
"0.551... | 0.6440012 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.