query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Print method for a dictionary containing logged metrics
def print_metric_dict(self, metric_dict): print("".join([" {}: {:4f},".format(k, v) for k, v in metric_dict.items()]))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_dict(dict_to_print: dict, message: str = ''):\n for k1, v1 in dict_to_print.items():\n log.info(f'{message} {k1}: {v1} ')\n print(f'{message} {k1}: {v1} ')", "def print_metrics(result):\n logging.log(LOG_LEVEL_OUTPUT_INFO,\n '------------------------------------------------...
[ "0.68076295", "0.6793415", "0.6780916", "0.66786313", "0.66669387", "0.6662592", "0.6627376", "0.64810866", "0.6405025", "0.64022094", "0.6373481", "0.6365978", "0.6318629", "0.6294091", "0.6287451", "0.6203851", "0.6132739", "0.6093371", "0.60847807", "0.60809046", "0.607914...
0.7865434
0
Convert an output_dict to numpy
def finalize_output_dict(self, output_dict): return {key: output_dict[key].cpu().numpy() for key in output_dict.keys()}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _dict2arr(self, key):\r\n # Prepare the matrix for the output:\r\n arr = np.empty((self._n_process,\r\n self._n_process,\r\n self.frequencies.shape[0]))\r\n\r\n arr.fill(np.nan)\r\n\r\n # 'Translate' from dict form into matrix form:\r\n ...
[ "0.65616953", "0.649378", "0.6439087", "0.6342832", "0.6280157", "0.62757164", "0.6249945", "0.6249945", "0.6249945", "0.6222419", "0.62178284", "0.6200131", "0.6184096", "0.6082242", "0.6074912", "0.5980199", "0.5936356", "0.59348", "0.59199387", "0.59100753", "0.5909368", ...
0.708859
0
Sends a batch to the device
def transform_batch(self, the_batch): return ( arg.to(self.device) if isinstance(arg, torch.Tensor) else arg for arg in the_batch )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _send(self, batch):\n return self.agent.emitBatch(batch)", "def write(self, batch):\n time.sleep(self.WRITE_DELAY)", "def _send_batch(self, base_url, endpoint, batch, dataset_id=None, dataset_version=None, retries=0):\n try:\n params = {'data': base64.b64encode(json.dumps(ba...
[ "0.7803405", "0.6906683", "0.6884981", "0.6867618", "0.6812799", "0.6451357", "0.6415528", "0.6384111", "0.6380887", "0.6335173", "0.6286703", "0.6191601", "0.6096197", "0.6065941", "0.6065582", "0.60095805", "0.5960957", "0.5959823", "0.5923621", "0.59161496", "0.587319", ...
0.0
-1
Initialize the weights with Glorot initilization
def weights_init(m): if ( isinstance(m, nn.Linear) or isinstance(m, nn.EmbeddingBag) or isinstance(m, nn.Embedding) or isinstance(m, SparseLinear) ): nn.init.xavier_normal_(m.weight)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_weight(self):\n init_bn(self.norm0)", "def _initialize_weights(self):\n pass", "def init_weights(self):\n # Initialize weights\n self.apply(self._init_weights)", "def init_weights(self, init_w=3e-3):\n self.l3.weight.data.uniform_(-init_w, init_w)\n self.l3....
[ "0.77464277", "0.77000946", "0.7654312", "0.7586706", "0.7586706", "0.7573792", "0.7558622", "0.7346543", "0.73462576", "0.73323685", "0.72910225", "0.7271283", "0.7249364", "0.7227278", "0.72014505", "0.71860826", "0.71860826", "0.71860826", "0.7170588", "0.7168318", "0.7163...
0.0
-1
A learning rate scheduler
def init_scheduler(self): gamma = self.config_dict.get("gamma") if gamma is None: return None else: return torch.optim.lr_scheduler.ExponentialLR(self.optimizer, gamma=gamma)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scheduler(epoch_idx, lr):\n new_lr = lr\n if (epoch_idx == 60 or epoch_idx == 120 or epoch_idx == 160\n or epoch_idx == 260 or epoch_idx == 320 or epoch_idx == 360):\n new_lr *= 0.2\n \"\"\"\n if epoch_idx == 200:\n new_lr = 0.1\n \"\"\"\n return new_lr", "def update_le...
[ "0.77524346", "0.7731428", "0.76842254", "0.7560328", "0.75120646", "0.7460543", "0.7310491", "0.7296485", "0.7284341", "0.7246998", "0.72235614", "0.7219927", "0.72191936", "0.7198546", "0.7141376", "0.7127686", "0.711566", "0.7062372", "0.70451397", "0.7035816", "0.70277953...
0.0
-1
Method that trains the model.
def train(self, data_dict, label_dict): loaders = self.init_loaders(data_dict, label_dict) best_performance = 1e18 loss_dict = self.init_loss_dict() performance_dict = self.init_performance_dict() for epoch in range(self.config_dict["num_epochs"]): print("Epoch {}/{}...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(self) -> None:\n self.model = self.trainer.train_model(self.model, self.data)", "def train(self):\n self.log(f\"{self.cur_file_path}\\t\\tInfo: train method invoked!\")\n self.log(f\"{self.cur_file_path}\\t\\tInfo: training {self.model.__class__.__name__} model!\")\n\n self.mo...
[ "0.76057404", "0.70823634", "0.70483696", "0.6999701", "0.6999701", "0.6999701", "0.6999701", "0.6999701", "0.6930223", "0.6923963", "0.6825983", "0.6824352", "0.6808843", "0.67518955", "0.67273754", "0.66657704", "0.6662347", "0.664981", "0.66335243", "0.6629425", "0.6620171...
0.0
-1
For a trained model, produce predictions on a test set and log performance.
def predict(self, data_dict, label_dict, phases=["test"]): loaders = self.init_loaders_predict(data_dict, label_dict) loss_dict = self.init_loss_dict(phases=phases) performance_dict = self.init_performance_dict(phases=phases) self.model.train(False) with torch.no_grad(): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def predict_1(trained_model, X_test, y_test):\n # Predict with test data\n start_time = timeit.default_timer()\n test_prediction = trained_model.predict(X_test)\n end_time = timeit.default_timer()\n time = end_time - start_time\n speed = int(X_test.shape[0] / time)\n \n # Get loss and accur...
[ "0.7433368", "0.7235656", "0.7221366", "0.7122205", "0.71137774", "0.70894", "0.7076145", "0.6997703", "0.69476736", "0.6934658", "0.6781472", "0.6741361", "0.6727157", "0.67259717", "0.6684905", "0.6679547", "0.6674972", "0.6671401", "0.6667228", "0.66626805", "0.6654434", ...
0.0
-1
Save the model weights to a file
def load_weights(self, the_path): self.model.load_state_dict(torch.load(the_path))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_model_weights(self, filename):\n self.model.save_weights(filename)", "def save(self, filename):\n self.model.save_weights(filename)", "def save(self, weights_file):\r\n \r\n self.model.save_weights(weights_file)", "def save_model(self, file_name):\n\t\tself.model.save_wei...
[ "0.86688316", "0.8494868", "0.8445515", "0.842721", "0.81561077", "0.81176925", "0.80864245", "0.80843157", "0.807408", "0.80392736", "0.8010617", "0.7911202", "0.7900337", "0.7885706", "0.78201246", "0.7809018", "0.7809018", "0.7775706", "0.7772423", "0.7765674", "0.77317846...
0.0
-1
Load model weights from a file
def save_weights(self, the_path): torch.save(self.model.state_dict(), the_path)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_model_weights(self, filename):\n self.model.load_weights(filename)", "def load_weights(self, filepath):\n self.model.load_weights(filepath)", "def load_weights(self, weight_file):\r\n self.model.load_weights(weight_file)", "def load(self, filename):\n self.model.load_weig...
[ "0.85630643", "0.8497746", "0.84459174", "0.83577466", "0.8329198", "0.8200193", "0.8053279", "0.79106265", "0.77857363", "0.77445644", "0.77445644", "0.773851", "0.7673229", "0.76723", "0.76715297", "0.7625602", "0.7509261", "0.7446895", "0.7375588", "0.7346362", "0.7315756"...
0.0
-1
Processes the result_dict returned from train and predict to a dataframe
def process_result_dict( the_dict, names=["metric", "phase", "epoch", "performance"] ): result = ( pd.DataFrame(the_dict) .reset_index() .melt(id_vars="index") .set_index(["index", "variable"]) .value.apply(pd.Series) .stack() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def predict(data: pd.DataFrame) -> pd.DataFrame:\n return pd.DataFrame(data={\"prediction\": trained_model.predict(data)})", "def prepare_reg_data_for_prediction(dataframe, model_dict, user_keyword, task_name):\r\n parent_dir = Path.cwd().parent\r\n pickle_dir = parent_dir.joinpath('default_results', 'p...
[ "0.7190073", "0.70932055", "0.7054436", "0.6945927", "0.6861902", "0.6841876", "0.6822922", "0.68050545", "0.6769638", "0.67412", "0.67346233", "0.668083", "0.66397685", "0.66279286", "0.6624465", "0.6601365", "0.6547838", "0.6529019", "0.65209436", "0.6500446", "0.6457109", ...
0.60460955
68
Creates data loaders from inputs
def init_datasets(self, data_dict, label_dict): ## If data is count, then convert any sparse inputs to sparse tensors convert_sparse = self.config_dict.get("sparse_mode") == "count" splits = data_dict.keys() dataset_dict = { key: ArrayDataset( data_dict[key]...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_data_loaders(args, tokenizer):\n personachat = get_dataset(tokenizer, args.dataset_path, args.dataset_cache, args.train_lang)\n _ = personachat.pop(\"test\", None)\n logger.info(\"Build inputs and labels\")\n datasets = {\"train\": [], \"valid\": []}\n\n if args.train_lang in [\"En\", \"Fr\"...
[ "0.7164973", "0.6952015", "0.6815742", "0.6736966", "0.66130817", "0.65923643", "0.65912664", "0.6540567", "0.6521354", "0.6456177", "0.6426", "0.6398036", "0.6369821", "0.6331816", "0.63271666", "0.63155395", "0.62999266", "0.62793946", "0.6273316", "0.6219768", "0.621602", ...
0.0
-1
Creates data loaders from inputs
def init_datasets(self, data_dict, label_dict): splits = data_dict.keys() dataset_dict = { key: ArrayDataset(data_dict[key], torch.LongTensor(label_dict[key])) for key in splits } return dataset_dict
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_data_loaders(args, tokenizer):\n personachat = get_dataset(tokenizer, args.dataset_path, args.dataset_cache, args.train_lang)\n _ = personachat.pop(\"test\", None)\n logger.info(\"Build inputs and labels\")\n datasets = {\"train\": [], \"valid\": []}\n\n if args.train_lang in [\"En\", \"Fr\"...
[ "0.7164973", "0.6952015", "0.6815742", "0.6736966", "0.66130817", "0.65923643", "0.65912664", "0.6540567", "0.6521354", "0.6456177", "0.6426", "0.6398036", "0.6369821", "0.6331816", "0.63271666", "0.63155395", "0.62999266", "0.62793946", "0.6273316", "0.6219768", "0.621602", ...
0.0
-1
Creates data loaders from inputs
def init_datasets(self, data_dict, label_dict): splits = data_dict.keys() dataset_dict = { key: ArrayDataset( data_dict[key], torch.LongTensor(label_dict[key]), convert_sparse=False ) for key in splits } return dataset_dict
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_data_loaders(args, tokenizer):\n personachat = get_dataset(tokenizer, args.dataset_path, args.dataset_cache, args.train_lang)\n _ = personachat.pop(\"test\", None)\n logger.info(\"Build inputs and labels\")\n datasets = {\"train\": [], \"valid\": []}\n\n if args.train_lang in [\"En\", \"Fr\"...
[ "0.7164973", "0.6952015", "0.6815742", "0.6736966", "0.66130817", "0.65923643", "0.65912664", "0.6540567", "0.6521354", "0.6456177", "0.6426", "0.6398036", "0.6369821", "0.6331816", "0.63271666", "0.63155395", "0.62999266", "0.62793946", "0.6273316", "0.6219768", "0.621602", ...
0.0
-1
Before making a Horror check, pass a Will(2) check or or automatically fail the Horror check and the Combat check.
def do (combat, investigator, monster): if not arkham.SkillCheck (arkham.checkbase_will, -2) \ .check (combat.game, investigator, monster): arkham.horror_check_fail_hook (combat, investigator, monster) arkham.combat_check_fail_hook (combat, investigator, monster) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def violated(self) -> bool:\n ...", "def is_code_good(safe_from_bugs, ready_for_change, easy_to_understand):\n pass # your code here!", "def test_case_01(self):\n if True:\n self.fail()", "def yes_straw_warts():\n check50.run(\"python3 palindrome.py\"\n ).stdout(\"Word? ...
[ "0.64148474", "0.62276626", "0.62077415", "0.6134191", "0.6079475", "0.6018244", "0.59867847", "0.59776276", "0.59311575", "0.5890044", "0.58643305", "0.5857824", "0.583788", "0.58364505", "0.58267814", "0.57766104", "0.57690376", "0.575865", "0.5753784", "0.574064", "0.57406...
0.59249634
9
The function for visualization part, which put the image at the coordinates given by their coefficients of the first two principal components (with translation and scaling).
def visualize(scores, faces): pc_min, pc_max = np.min(scores, 0), np.max(scores, 0) pc_scaled = (scores - pc_min) / (pc_max - pc_min) fig, ax = plt.subplots() for i in range(len(faces)): imagebox = offsetbox.OffsetImage(faces[i, :].reshape(64,64).T, cmap=plt.cm.gray, zoom=0.5) box = offsetbox.Annotati...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def imageTransform(self):\n ims = self.imageShape\n acs = self.activeShape\n dx = self.colVector\n dy = self.rowVector\n\n p0 = self.activeOrigin\n p1 = p0 + acs[2] * dx\n p2 = p0 + acs[1] * dy\n\n # print p0, p1, p2\n # print acs, dx, dy\n\n lo...
[ "0.6416975", "0.61704147", "0.597055", "0.5963477", "0.59180105", "0.59046805", "0.5800297", "0.57753825", "0.57661474", "0.5761173", "0.574527", "0.57417595", "0.57272846", "0.5723522", "0.5722225", "0.5721283", "0.5695308", "0.5683096", "0.5645696", "0.5644838", "0.5627811"...
0.0
-1
Wrap text base on specified width. This is to enable text of width more than the image width to be display nicely.
def text_wrap(text, font, max_width): lines = [] # If the text width is smaller than the image width, then no need to split # just add it to the line list and return if font.getsize(text)[0] <= max_width: lines.append(text) else: #split t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wrap(text, width):\n return reduce(lambda line, word, width=width: '%s%s%s' %\n (line,\n ' \\n'[(len(line)-line.rfind('\\n')-1\n + len(word.split('\\n',1)[0]\n ) >= width)],\n word),\n ...
[ "0.77212054", "0.7677073", "0.7373964", "0.7262366", "0.7167212", "0.7148782", "0.71379614", "0.7093672", "0.6978543", "0.6674887", "0.664697", "0.661815", "0.6578309", "0.63843834", "0.63253736", "0.62787217", "0.6248526", "0.6241001", "0.6179365", "0.6177945", "0.6159852", ...
0.7328348
3
Make segment from depth with maintaining autograds
def _depth_to_segment(self, depth): segment = depth.clone() segment[segment > 0] = 1 return segment
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_segments(self, set_depth=True, input_rec_track=None,\r\n overwrite_rec_seg=False): \r\n grd = self.grd\r\n if input_rec_track is None:\r\n rec_track = self.rec_track\r\n else:\r\n rec_track = input_rec_track\r\n ndetects = len(rec_trac...
[ "0.6346272", "0.55502045", "0.53198504", "0.5308074", "0.52996415", "0.5294643", "0.52734846", "0.52599484", "0.5258782", "0.52077454", "0.5194362", "0.51922286", "0.51793945", "0.5163334", "0.5136648", "0.51229006", "0.51084447", "0.5101351", "0.5093862", "0.50675523", "0.50...
0.68593705
0
If Git is not installed, an error is raised.
def test_no_git(update_command, monkeypatch): def monkeypatch_verify_git(*a, **kw): raise BriefcaseCommandError("Briefcase requires git, but it is not installed") monkeypatch.setattr(Git, "verify", monkeypatch_verify_git) # The command will fail tool verification. with pytest.raises( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_git():\n return exists('.git') and not islink('.git')", "def git():\n pass", "def check_git_support():\n proc = Popen(['git', '--version'], shell=True, stdout=PIPE,)\n msg, _ = proc.communicate()\n msg = msg.decode('utf-8')\n if \"git version\" in msg:\n return True\n return ...
[ "0.72600806", "0.7235981", "0.7087292", "0.70814955", "0.70313644", "0.6984936", "0.68741906", "0.6841148", "0.6674682", "0.66489965", "0.66269165", "0.65899247", "0.6487578", "0.64224684", "0.63142633", "0.6286285", "0.61454767", "0.6125078", "0.60956454", "0.6093241", "0.60...
0.6082657
20
The update command can be called.
def test_update(update_command, first_app, second_app): # Configure no command line options options = update_command.parse_options([]) update_command(**options) # The right sequence of things will be done assert update_command.actions == [ # Host OS is verified ("verify-host",), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def commandUpdate(self):\n pass", "def update(self, args):\n pass", "def update( ):\r\n pass", "def update(self, *args, **kwargs):\n pass", "def update(self, *args, **kwargs):\n pass", "def update(self, *args, **kwargs):\n pass", "def update(self, *args, **kw):...
[ "0.87618816", "0.825447", "0.8079909", "0.80792075", "0.80792075", "0.80792075", "0.7963038", "0.7945506", "0.77488786", "0.77488786", "0.7737234", "0.76793903", "0.7672432", "0.7672432", "0.7672432", "0.7672432", "0.7672432", "0.7672432", "0.7672432", "0.7672432", "0.7672432...
0.0
-1
The update command can be called to update a single app from the config.
def test_update_single(update_command, first_app, second_app): # Configure no command line options options = update_command.parse_options([]) update_command(app=update_command.apps["first"], **options) # The right sequence of things will be done assert update_command.actions == [ # Host OS...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_app(AppId=None, Name=None, Description=None, DataSources=None, Type=None, AppSource=None, Domains=None, EnableSsl=None, SslConfiguration=None, Attributes=None, Environment=None):\n pass", "def update_app(self):\n\n param = self.chose_param_value(\"--app\")\n self._check_path_availabil...
[ "0.7257244", "0.7042199", "0.6770846", "0.66939366", "0.6647963", "0.6625775", "0.65863806", "0.6582075", "0.65323645", "0.6495462", "0.64680827", "0.64351773", "0.63800484", "0.6278911", "0.62050945", "0.61821496", "0.6160247", "0.61068285", "0.6099533", "0.6068487", "0.6016...
0.651214
9
The update command can be called, requesting a requirements update.
def test_update_with_requirements(update_command, first_app, second_app): # Configure a requirements update options = update_command.parse_options(["-r"]) update_command(**options) # The right sequence of things will be done assert update_command.actions == [ # Host OS is verified ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cmd_update(self):\n self.update_repository()\n results = self.results.getvalue()\n if results:\n print('---')\n print(results, end='')", "def update(self, **kwargs):\n self.configure(**kwargs)\n self.get_all_requirements()\n self.apply_updates(\...
[ "0.7011183", "0.6856793", "0.6732378", "0.6684744", "0.66132265", "0.65518045", "0.65518045", "0.65518045", "0.6539952", "0.6523198", "0.64990246", "0.6492051", "0.648081", "0.64599496", "0.6453116", "0.63374", "0.63153756", "0.6298275", "0.6262488", "0.6257006", "0.62292224"...
0.6955482
1
The update command can be called, requesting a resources update.
def test_update_with_resources(update_command, first_app, second_app): # Configure no command line options options = update_command.parse_options(["--update-resources"]) update_command(**options) # The right sequence of things will be done assert update_command.actions == [ # Host OS is ve...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update():\n return 'update api in put'", "def update_resources(self, request):\n request.worker.update_resources(request.message.test_id,\n request.message.resources)\n\n return SuccessReply()", "def update_resources(self):\n\n self.update(True...
[ "0.7013169", "0.7003805", "0.69948435", "0.68963915", "0.6825095", "0.6825095", "0.6825095", "0.6806165", "0.6780289", "0.6660201", "0.66097593", "0.65787137", "0.65782666", "0.6517696", "0.6516429", "0.64839077", "0.6473455", "0.6463394", "0.64549226", "0.64234906", "0.64168...
0.6317555
25
The update command can be called, requesting an app support update.
def test_update_with_support(update_command, first_app, second_app): # Configure no command line options options = update_command.parse_options(["--update-support"]) update_command(**options) # The right sequence of things will be done assert update_command.actions == [ # Host OS is verifi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def help_update(self):\n print(UPDATE)", "def AppUpdateApp(self, request, context):\n context.code(beta_interfaces.StatusCode.UNIMPLEMENTED)", "def update(self):\n return self._process('update')", "def update():\n return 'update api in put'", "def support(bot, update):\n bot.send_m...
[ "0.6904008", "0.67756623", "0.6702708", "0.667266", "0.66239464", "0.660917", "0.6564031", "0.6543759", "0.6534289", "0.6514299", "0.6492303", "0.64033645", "0.63888717", "0.63788426", "0.63758796", "0.6318172", "0.63120097", "0.62984824", "0.6280934", "0.6279764", "0.6255501...
0.6522031
9
[Not Anymore] DFSbased enumeration of each possible numset This is just brute force right now, will find faster way to do it later.
def generateNumsets(G): # paths = [] # # path = [0] # for edge in nx.dfs_edges(G, 0): # if edge[0] == path[-1]: # path.append(edge[1]) # else: # paths.append(path) # search_index = 2 # while search_in...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def beautifulSubsets(self, nums: List[int], k: int) -> int:\n\n \"\"\"\n queue = deque([([], -1)])\n res = 0\n\n while queue:\n cur, idx = queue.popleft()\n res += 1\n\n for i in range(idx + 1, len(nums)):\n if nums[i] - k in cur or nums[i...
[ "0.6050747", "0.58646107", "0.5835313", "0.5814192", "0.5803843", "0.57862395", "0.56802076", "0.565998", "0.56545377", "0.5646759", "0.56391", "0.56056905", "0.56009036", "0.557824", "0.55607307", "0.55480886", "0.55398595", "0.553104", "0.55174726", "0.5494305", "0.5489702"...
0.60728484
0
Choose the entity from the `ent_inds` which exactly matches the entity name in terms of ngram tfidf vector
def __vote_best_entity(self, ent_inds, scores, phrase): sorted_scores = [(k, v) for k, v in sorted(scores.items(), key=lambda s: s[1], reverse=True)] phrase_vec = self.vectorizer.transform([phrase]) if self.args.use_mm_subset: tfidf_cossim = linear_kernel(ph...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_entity(text_raw, id_, predictions, tok_to_orig_start_index,\n tok_to_orig_end_index):\n entity_list = []\n for i in range(len(predictions)):\n if [id_] in predictions[i]:\n j = 0\n while i + j + 1 < len(predictions):\n if [1] in predictions[...
[ "0.59135014", "0.5836269", "0.5584508", "0.55675554", "0.54100394", "0.53996557", "0.5396855", "0.53903174", "0.5357121", "0.5339213", "0.5294186", "0.52863014", "0.52570397", "0.52552134", "0.5253027", "0.5250587", "0.52390045", "0.5228001", "0.52206033", "0.5211869", "0.520...
0.5915391
0
Generates a class which raises an import error when initialised. e.g. SomeClass = missing_import('SomeClass') will make SomeClass() raise ImportError
def missing_import(name, fail_msg=''): def init(self, *args, **kwargs): raise ImportError( f'The class {name} you tried to call is not importable; ' f'this is likely due to it not doing installed. ' f'{f"Fail Message: {fail_msg}" if fail_msg else ""}' ) return...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def import_class(import_str):\n mod_str, _sep, class_str = import_str.rpartition('.')\n try:\n __import__(mod_str)\n return getattr(sys.modules[mod_str], class_str)\n except (ImportError, ValueError, AttributeError), exc:\n logging.debug('Inner Exception: %s', exc)\n raise", ...
[ "0.6505684", "0.6362478", "0.62814814", "0.6249061", "0.6086552", "0.60478055", "0.60290587", "0.60029995", "0.5892807", "0.586532", "0.57888514", "0.5755527", "0.5744472", "0.5704701", "0.56653976", "0.56465465", "0.55793685", "0.5562586", "0.55564654", "0.5541481", "0.55187...
0.71129656
0
Linear method Initialize values of min and max as minimum and maximum of the first two elements respectively. Starting from 3rd, compare each element with max and min, and change max and min accordingly
def getminmax_linear_search(arr): if len(arr) == 0: return None, None if len(arr) == 1: return arr[0], arr[0] min_num = None max_num = None if arr[0] > arr[1]: max_num = arr[0] min_num = arr[1] else: max_num = arr[1] min_num = arr[0] for idx...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def min_max(lst):\r\n my_min = None\r\n my_max = None\r\n for num in lst:\r\n if (my_min and my_max) is not None:\r\n # recalculate running min and max:\r\n if num < my_min:\r\n my_min = num\r\n continue\r\n if num > my_max:\r\n ...
[ "0.6753846", "0.6643425", "0.660284", "0.65657634", "0.65287554", "0.6473833", "0.64729667", "0.6457443", "0.64056796", "0.6392092", "0.63540506", "0.63523", "0.6349318", "0.63200366", "0.6304633", "0.62783235", "0.6268798", "0.6261143", "0.6177004", "0.6167668", "0.61549836"...
0.59900177
35
Tournament Method Divide the array into two parts and compare the maximums and minimums of the two parts to get the maximum and the minimum of the whole array.
def getminmax_tournament(arr, low, high): if low == high: return arr[low], arr[low] if abs(low - high) == 1: min_num = None max_num = None if arr[low] > arr[high]: max_num = arr[low] min_num = arr[high] else: max_num = arr[high] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def min_max(arr, arr_size):\n max_t = arr[0]\n min_t = arr[0]\n for i in range(arr_size):\n if arr[i] > max_t:\n max_t = arr[i]\n if arr[i] < min_t:\n min_t = arr[i]\n return min_t, max_t", "def tournament( pl, game ):\r\n\tlosses=[0...
[ "0.6058381", "0.55852354", "0.5572735", "0.5561582", "0.54773295", "0.5432018", "0.5413174", "0.53873384", "0.5380784", "0.537343", "0.53635126", "0.5344056", "0.53209466", "0.53140825", "0.53017104", "0.5293402", "0.5270293", "0.52500576", "0.5192956", "0.5190301", "0.518893...
0.68295705
0
Compare in pairs If n is odd then initialize min and max as first element. If n is even then initialize min and max as minimum and maximum of the first two elements respectively. For rest of the elements, pick them in pairs and compare their maximum and minimum with max and min respectively.
def getminmax_pair_compare(arr): if len(arr) == 0: return None, None if len(arr) == 1: return arr[0], arr[0] min_num = None max_num = None index = 0 if len(arr) % 2 == 0: if arr[0] > arr[1]: max_num = arr[0] min_num = arr[1] else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pairs_upto(n):\n return ((a, b)\n for a in range(1, n)\n for b in range(1, n)\n if a <= b)", "def getminmax_tournament(arr, low, high):\n if low == high:\n return arr[low], arr[low]\n\n if abs(low - high) == 1:\n min_num = None\n max_num = None\n...
[ "0.6786804", "0.62690365", "0.5994578", "0.589454", "0.58620936", "0.57882094", "0.5732618", "0.56569004", "0.56277883", "0.560861", "0.56031567", "0.55943364", "0.55386573", "0.5536303", "0.5491848", "0.5489913", "0.54479414", "0.5440645", "0.541281", "0.540084", "0.53986096...
0.69033545
0
Checks whether an executable is in the user's search path. This expects a name without any systemspecific executable extension. It will append the proper extension as necessary. For example, use "myapp" and not "myapp.exe". This will return True if the app is in the path, or False otherwise. Taken from djblets.util.fil...
def is_exe_in_path(name): if sys.platform == 'win32' and not name.endswith('.exe'): name += '.exe' for dir in os.environ['PATH'].split(os.pathsep): if os.path.exists(os.path.join(dir, name)): return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_in_path(self):\n exe = self.command.split()[0]\n for try_path in os.environ[\"PATH\"].split(os.pathsep):\n try_path = try_path.strip('\"')\n exe_try = os.path.join(try_path, exe).strip()\n if os.path.isfile(exe_try) and os.access(exe_try, os.X_OK):\n ...
[ "0.7964499", "0.75925285", "0.74517477", "0.7201914", "0.7171159", "0.7160815", "0.7160815", "0.7151977", "0.71429574", "0.7139493", "0.7132476", "0.7113784", "0.70644397", "0.7055049", "0.70248353", "0.6968808", "0.69569904", "0.69459975", "0.6837878", "0.68116426", "0.67874...
0.80723464
0
Create a temporary file and return the path. If not manually removed, then the resulting temp file will be removed when
def make_tempfile(content=None, prefix='rbtools.', suffix=None, filename=None): if filename is not None: tmpdir = make_tempdir() tmpfile = os.path.join(tmpdir, filename) with open(tmpfile, 'wb') as fp: if content: fp.write(content) else: with tempfile...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_temporary_file():\n f = NamedTemporaryFile(delete=False)\n return f.name", "def make_temp_file():\n with tempfile.NamedTemporaryFile() as f:\n return f.name", "def temporary_file(request):\n file_handle, path = tempfile.mkstemp()\n os.close(file_handle)\n\n def cleanup():\n ...
[ "0.833351", "0.80697733", "0.8008723", "0.7839936", "0.7751281", "0.7658799", "0.7505113", "0.74100506", "0.7406461", "0.7343743", "0.7333825", "0.7277276", "0.72587514", "0.72124624", "0.71864015", "0.7143445", "0.7091009", "0.7067895", "0.7057005", "0.70113045", "0.69977295...
0.0
-1
Create a temporary directory and return the path. The path is stored in an array for later cleanup.
def make_tempdir(parent=None): tmpdir = tempfile.mkdtemp(prefix='rbtools.', dir=parent) tempdirs.append(tmpdir) return tmpdir
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tempdir():\n\n # Create a directory and return the path\n return tempfile.mkdtemp()", "def generate_temp_dir(path):\n exist = True\n while exist:\n # Keep trying random directory names if they already exist\n directory = str(hex(getrandbits(32)))[2:]\n full_path = os.path.joi...
[ "0.795508", "0.7894034", "0.7702712", "0.73150307", "0.7290462", "0.7250218", "0.7247284", "0.72069544", "0.71871734", "0.7164619", "0.71405846", "0.7138456", "0.7084093", "0.7042956", "0.7030745", "0.70285845", "0.7028008", "0.7018893", "0.6997867", "0.6979826", "0.69734335"...
0.66818
38
Creates each file in the given list and any intermediate directories.
def make_empty_files(files): for f in files: path = os.path.dirname(f) if path and not os.path.exists(path): try: os.makedirs(path) except OSError as e: logging.error('Unable to create directory %s: %s', path, e) continue ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_file_list(input_root, output_root, file_list):\n for backup_id, backup_file in file_list.items():\n # logging.debug(f\"{backup_id}: {backup_file.relative_path}\")\n if backup_file.is_dir:\n create_directory(backup_file, output_root)\n else:\n create_file(ba...
[ "0.76396525", "0.7381815", "0.72893167", "0.6653557", "0.66071504", "0.6594979", "0.6542781", "0.65182227", "0.6502467", "0.64640665", "0.64201957", "0.6419212", "0.6346715", "0.6258187", "0.62574536", "0.624943", "0.62128466", "0.6181926", "0.6181589", "0.6138358", "0.613155...
0.6131817
20
Walks up the tree to the root directory.
def walk_parents(path): while os.path.splitdrive(path)[1] != os.sep: yield path path = os.path.dirname(path)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _walk_to_root(path):\n if not os.path.exists(path):\n raise IOError('Starting path not found')\n\n if os.path.isfile(path):\n path = os.path.dirname(path)\n\n last_dir = None\n current_dir = os.path.abspath(path)\n while last_dir != current_dir:\n yield current_dir\n ...
[ "0.76668566", "0.705932", "0.68489826", "0.6406879", "0.63818604", "0.6371921", "0.6364334", "0.62827146", "0.6266948", "0.6261812", "0.6254145", "0.62435883", "0.62391335", "0.6222218", "0.6207792", "0.61975753", "0.6172311", "0.61026555", "0.61026555", "0.60895956", "0.6046...
0.5684149
40
Parse a .reviewboardrc file. Returns a dictionary containing the configuration from the file. The ``filename`` argument should contain a full path to a .reviewboardrc file.
def parse_config_file(filename): config = { 'TREES': {}, 'ALIASES': {}, } try: config = _load_python_file(filename, config) except SyntaxError as e: raise Exception('Syntax error in config file: %s\n' 'Line %i offset %i\n' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_config_from_file(self, filename):\n\n with open(filename, 'r') as f:\n config = load(f)\n return config", "def _read_config(filename):\n\n c = {}\n with open(filename, \"r\") as f:\n for line in f:\n key, val = line.split(\"=\")\n key = key.str...
[ "0.65097946", "0.6509468", "0.6360168", "0.6206505", "0.62046117", "0.61265814", "0.6115713", "0.60425186", "0.59130377", "0.58775854", "0.5857379", "0.58498156", "0.5840303", "0.5804756", "0.5792347", "0.57693106", "0.5754693", "0.5729053", "0.571904", "0.57116205", "0.57046...
0.5777592
15
Load configuration from .reviewboardrc files. This will read all of the .reviewboardrc files influencing the cwd and return a dictionary containing the configuration.
def load_config(): nested_config = { 'ALIASES': {}, 'COLOR': { 'INFO': None, 'DEBUG': None, 'WARNING': 'yellow', 'ERROR': 'red', 'CRITICAL': 'red' }, 'TREES': {}, } config = {} for filename in reversed(get_confi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse():\n rcParams = configparser.ConfigParser(defaults=defaults())\n rcParams.read([os.path.join(os.getcwd(), 'watershed_workflowrc'),\n os.path.join(os.getcwd(), '.watershed_workflowrc'),\n os.path.join(home(), '.watershed_workflowrc')])\n return rcParams", "de...
[ "0.68835634", "0.65985775", "0.6577922", "0.65607095", "0.65473485", "0.64618313", "0.6343824", "0.6307074", "0.6282571", "0.6252696", "0.6212181", "0.6181693", "0.6154754", "0.6142431", "0.613517", "0.6108535", "0.6093759", "0.6060292", "0.6015555", "0.59988767", "0.5988006"...
0.5764751
38
No. 1 tests collection for SearchParameter.
def test_searchparameter_1(base_settings): filename = ( base_settings["unittest_data_dir"] / "valueset-extensions-ValueSet-workflow.json" ) inst = searchparameter.SearchParameter.parse_file( filename, content_type="application/json", encoding="utf-8" ) assert "SearchParameter...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_search(self):\n pass", "def test_search(self):\n pass", "def test_search(self):\n pass", "def test_search(self):\n d = self._search()\n self._response([2, 5, 10])\n self.assertEqual(self.successResultOf(d), [2, 5, 10])", "def test_test_query_parameter_coll...
[ "0.73362684", "0.73362684", "0.73362684", "0.7120844", "0.6838435", "0.65840405", "0.64942724", "0.64885795", "0.6453885", "0.6444171", "0.6440209", "0.6410346", "0.63999104", "0.6381548", "0.63668084", "0.6353568", "0.63125026", "0.6264422", "0.6255069", "0.62412", "0.623305...
0.65049756
6
No. 2 tests collection for SearchParameter.
def test_searchparameter_2(base_settings): filename = ( base_settings["unittest_data_dir"] / "codesystem-extensions-CodeSystem-author.json" ) inst = searchparameter.SearchParameter.parse_file( filename, content_type="application/json", encoding="utf-8" ) assert "SearchParamet...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_search(self):\n pass", "def test_search(self):\n pass", "def test_search(self):\n pass", "def test_search(self):\n d = self._search()\n self._response([2, 5, 10])\n self.assertEqual(self.successResultOf(d), [2, 5, 10])", "def test_test_query_parameter_coll...
[ "0.7379565", "0.7379565", "0.7379565", "0.7081231", "0.6773972", "0.6721623", "0.6602005", "0.6570807", "0.6561566", "0.6547614", "0.6517315", "0.65085924", "0.6498378", "0.6469518", "0.6435221", "0.6390614", "0.6355592", "0.6340346", "0.63397413", "0.63151586", "0.6313986", ...
0.6485245
13
No. 3 tests collection for SearchParameter.
def test_searchparameter_3(base_settings): filename = ( base_settings["unittest_data_dir"] / "searchparameter-example-extension.json" ) inst = searchparameter.SearchParameter.parse_file( filename, content_type="application/json", encoding="utf-8" ) assert "SearchParameter" == inst.re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_search(self):\n pass", "def test_search(self):\n pass", "def test_search(self):\n pass", "def test_search(self):\n d = self._search()\n self._response([2, 5, 10])\n self.assertEqual(self.successResultOf(d), [2, 5, 10])", "def test_test_query_parameter_coll...
[ "0.7524382", "0.7524382", "0.7524382", "0.719911", "0.67714614", "0.6694623", "0.6682351", "0.66683775", "0.66621274", "0.6661969", "0.6632521", "0.660418", "0.65989137", "0.65837914", "0.6565122", "0.6474108", "0.64660376", "0.64638436", "0.64622825", "0.64236736", "0.642147...
0.64911914
15
No. 4 tests collection for SearchParameter.
def test_searchparameter_4(base_settings): filename = ( base_settings["unittest_data_dir"] / "condition-extensions-Condition-part-of.json" ) inst = searchparameter.SearchParameter.parse_file( filename, content_type="application/json", encoding="utf-8" ) assert "SearchParamete...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_search(self):\n pass", "def test_search(self):\n pass", "def test_search(self):\n pass", "def test_search(self):\n d = self._search()\n self._response([2, 5, 10])\n self.assertEqual(self.successResultOf(d), [2, 5, 10])", "def test_test_query_parameter_coll...
[ "0.7278206", "0.7278206", "0.7278206", "0.70863503", "0.7014391", "0.65407383", "0.6516599", "0.6503514", "0.64953935", "0.6431318", "0.63968146", "0.6389044", "0.6366322", "0.63650423", "0.63497394", "0.634315", "0.63367665", "0.632791", "0.6318682", "0.63042", "0.6281064", ...
0.6249166
22
No. 5 tests collection for SearchParameter.
def test_searchparameter_5(base_settings): filename = ( base_settings["unittest_data_dir"] / "condition-extensions-Condition-definition.json" ) inst = searchparameter.SearchParameter.parse_file( filename, content_type="application/json", encoding="utf-8" ) assert "SearchParam...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_search(self):\n pass", "def test_search(self):\n pass", "def test_search(self):\n pass", "def test_search(self):\n d = self._search()\n self._response([2, 5, 10])\n self.assertEqual(self.successResultOf(d), [2, 5, 10])", "def test_test_query_parameter_coll...
[ "0.7406091", "0.7406091", "0.7406091", "0.70825505", "0.70355684", "0.66207635", "0.66000885", "0.6587109", "0.6542095", "0.64500356", "0.64420635", "0.6425836", "0.6411012", "0.64074194", "0.63909847", "0.63876253", "0.6368644", "0.636557", "0.6347726", "0.6344155", "0.63333...
0.63986474
14
No. 6 tests collection for SearchParameter.
def test_searchparameter_6(base_settings): filename = ( base_settings["unittest_data_dir"] / "searchparameter-example-reference.json" ) inst = searchparameter.SearchParameter.parse_file( filename, content_type="application/json", encoding="utf-8" ) assert "SearchParameter" == inst.re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_search(self):\n pass", "def test_search(self):\n pass", "def test_search(self):\n pass", "def test_search(self):\n d = self._search()\n self._response([2, 5, 10])\n self.assertEqual(self.successResultOf(d), [2, 5, 10])", "def test_test_query_parameter_coll...
[ "0.73060715", "0.73060715", "0.73060715", "0.70509", "0.70273435", "0.65535307", "0.6528675", "0.6520882", "0.64785254", "0.6414514", "0.6398901", "0.6385834", "0.63663197", "0.6365136", "0.63604003", "0.63545066", "0.6353233", "0.63502675", "0.63352436", "0.6309115", "0.6308...
0.664943
5
No. 7 tests collection for SearchParameter.
def test_searchparameter_7(base_settings): filename = ( base_settings["unittest_data_dir"] / "organization-extensions-Organization-alias.json" ) inst = searchparameter.SearchParameter.parse_file( filename, content_type="application/json", encoding="utf-8" ) assert "SearchPara...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_search(self):\n pass", "def test_search(self):\n pass", "def test_search(self):\n pass", "def test_search(self):\n d = self._search()\n self._response([2, 5, 10])\n self.assertEqual(self.successResultOf(d), [2, 5, 10])", "def test_test_query_parameter_coll...
[ "0.74034846", "0.74034846", "0.74034846", "0.7099519", "0.69699824", "0.67721945", "0.6723432", "0.6605236", "0.6589783", "0.650057", "0.649886", "0.648161", "0.6435487", "0.6420251", "0.64112496", "0.64027804", "0.63955367", "0.6391908", "0.6389356", "0.6387581", "0.6380137"...
0.6726757
6
No. 8 tests collection for SearchParameter.
def test_searchparameter_8(base_settings): filename = ( base_settings["unittest_data_dir"] / "elementdefinition-11179-DataElement-objectClass.json" ) inst = searchparameter.SearchParameter.parse_file( filename, content_type="application/json", encoding="utf-8" ) assert "Searc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_search(self):\n pass", "def test_search(self):\n pass", "def test_search(self):\n pass", "def test_test_query_parameter_collection_format(self):\n pass", "def test_search(self):\n d = self._search()\n self._response([2, 5, 10])\n self.assertEqual(se...
[ "0.72196627", "0.72196627", "0.72196627", "0.7032631", "0.69970065", "0.65187585", "0.65080386", "0.64842105", "0.64330566", "0.6411865", "0.6391008", "0.6362771", "0.63559705", "0.63431054", "0.62747276", "0.62722075", "0.6263313", "0.62574136", "0.6255801", "0.62479085", "0...
0.64599174
8
No. 9 tests collection for SearchParameter.
def test_searchparameter_9(base_settings): filename = ( base_settings["unittest_data_dir"] / "diagnosticreport-genetic-DiagnosticReport-assessed-condition.json" ) inst = searchparameter.SearchParameter.parse_file( filename, content_type="application/json", encoding="utf-8" ) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_search(self):\n pass", "def test_search(self):\n pass", "def test_search(self):\n pass", "def test_search(self):\n d = self._search()\n self._response([2, 5, 10])\n self.assertEqual(self.successResultOf(d), [2, 5, 10])", "def test_test_query_parameter_coll...
[ "0.72682685", "0.72682685", "0.72682685", "0.70575094", "0.69838136", "0.65619326", "0.6549076", "0.64863217", "0.64846194", "0.6443793", "0.64140815", "0.6411601", "0.639414", "0.6372566", "0.6358288", "0.63527036", "0.6343903", "0.6340767", "0.6285486", "0.6282209", "0.6281...
0.6362744
14
No. 10 tests collection for SearchParameter.
def test_searchparameter_10(base_settings): filename = base_settings["unittest_data_dir"] / "device-extensions-Device-din.json" inst = searchparameter.SearchParameter.parse_file( filename, content_type="application/json", encoding="utf-8" ) assert "SearchParameter" == inst.resource_type imp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_search(self):\n pass", "def test_search(self):\n pass", "def test_search(self):\n pass", "def test_search(self):\n d = self._search()\n self._response([2, 5, 10])\n self.assertEqual(self.successResultOf(d), [2, 5, 10])", "def test_test_query_parameter_coll...
[ "0.75179785", "0.75179785", "0.75179785", "0.723605", "0.6821399", "0.66570586", "0.6633374", "0.66132206", "0.65546477", "0.6520058", "0.6465841", "0.6465592", "0.6459875", "0.64372003", "0.6420038", "0.6419864", "0.64135313", "0.64052737", "0.6402042", "0.6386993", "0.63865...
0.65330493
9
Initialize class for asynchronous working with network devices
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self._ansi_escape_codes = True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def init(self) -> None:", "async def init(self) -> None:", "def __init__(self, address):\r\n self.loop = asyncio.new_event_loop()\r\n self.device_address = address\r\n\r\n self.__api_address = \"http://\" + address if not address.startswith('http://') else address\r\n _LOGGER....
[ "0.71344113", "0.71344113", "0.7081007", "0.7080689", "0.7050641", "0.70482785", "0.69154876", "0.69042337", "0.68543035", "0.6787077", "0.67327476", "0.6718989", "0.6709036", "0.6658528", "0.65632737", "0.6546651", "0.6515222", "0.6489728", "0.6489728", "0.64302796", "0.6408...
0.0
-1
Create a display all the losses and accuracies.
def print_losses(epoch_gen_adv_loss, epoch_gen_l1_loss, epoch_disc_real_loss, epoch_disc_fake_loss, epoch_disc_real_acc, epoch_disc_fake_acc, data_loader_len, l1_weight): print(' Generator: adversarial loss = {:.4f}, L1 loss = {:.4f}, full loss = {:.4f}'.format( epoch_gen_adv_loss / data_l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_all(self):\n self.explained_variance_score()\n self.max_error()\n self.mean_absolute_error()\n self.mean_squared_error()\n self.median_absolute_error()\n self.r2_score()\n self.mean_poisson_deviance()\n self.mean_gamma_deviance()\n self.featur...
[ "0.69125676", "0.6476937", "0.6424762", "0.624658", "0.6141795", "0.60919976", "0.6082685", "0.60254973", "0.5969228", "0.59657204", "0.59546447", "0.59546447", "0.5937181", "0.58896863", "0.5880483", "0.5826841", "0.5761452", "0.5744232", "0.5732084", "0.5714477", "0.5702603...
0.60792524
7
Create a grid of ground truth, grayscale and colorized images and save + display it to the user.
def save_sample(real_imgs_lab, fake_imgs_lab, save_path, plot_size=20, scale=2.2, show=False): batch_size = real_imgs_lab.size()[0] plot_size = min(plot_size, batch_size) # create white canvas canvas = np.ones((3*32 + 4*6, plot_size*32 + (plot_size+1)*6, 3), dtype=np.uint8)*255 real_imgs_lab = rea...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_image(self, save=False):\n\n # image_grid = np.full((self.size_x, self.size_y), '#888888', dtype=str)\n image_grid = np.full((self.size_x, self.size_y, 3), 0, dtype=np.uint8)\n\n # self.grid = np.flip(self.grid, 1)\n\n # self.grid = np.swapaxes(self.grid, 0, 0)\n \"\"\"\...
[ "0.710361", "0.67344755", "0.6693876", "0.6684266", "0.6636619", "0.6611564", "0.65500575", "0.65496665", "0.6531255", "0.6520105", "0.64875895", "0.6470281", "0.6466169", "0.6457369", "0.6448441", "0.63789225", "0.63589984", "0.6353417", "0.6329826", "0.63067925", "0.6293998...
0.0
-1
Create a grid of ground truth, grayscale and 2 colorized images (from different sources) and save + display it to the user.
def save_test_sample(real_imgs_lab, fake_imgs_lab1, fake_imgs_lab2, save_path, plot_size=14, scale=1.6, show=False): batch_size = real_imgs_lab.size()[0] plot_size = min(plot_size, batch_size) # create white canvas canvas = np.ones((plot_size*32 + (plot_size+1)*6, 4*32 + 5*8, 3), dtype=np.uint8)*255 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_image(self, save=False):\n\n # image_grid = np.full((self.size_x, self.size_y), '#888888', dtype=str)\n image_grid = np.full((self.size_x, self.size_y, 3), 0, dtype=np.uint8)\n\n # self.grid = np.flip(self.grid, 1)\n\n # self.grid = np.swapaxes(self.grid, 0, 0)\n \"\"\"\...
[ "0.699197", "0.6795464", "0.6558072", "0.6518849", "0.6515237", "0.6494493", "0.646866", "0.64258856", "0.64251566", "0.6380761", "0.6350199", "0.6348576", "0.63359296", "0.6326003", "0.6315788", "0.6314708", "0.6312695", "0.6305785", "0.6304858", "0.62946075", "0.62831163", ...
0.5979978
47
Adjust the learning rate of the params of an optimizer.
def adjust_learning_rate(optimizer, global_step, base_lr, lr_decay_rate=0.1, lr_decay_steps=6e4): lr = base_lr * (lr_decay_rate ** (global_step/lr_decay_steps)) if lr < 1e-6: lr = 1e-6 for param_group in optimizer.param_groups: param_group['lr'] = lr
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def adjust_learning_rate(self, optimizer, epoch, args):\n lr = args.learning_rate * (0.1 ** (epoch // 30))\n # print(lr)\n for param_group in optimizer.param_groups:\n param_group['lr'] = lr", "def adjust_learning_rate(args, optimizer, epoch):\n if (epoch*3==args.epochs) or (ep...
[ "0.84753436", "0.84628916", "0.8429673", "0.83984476", "0.83933645", "0.8341199", "0.8315756", "0.82856673", "0.8283146", "0.8277514", "0.8277514", "0.8277514", "0.82710576", "0.8265629", "0.8265629", "0.8265629", "0.8256059", "0.8221603", "0.8218627", "0.821692", "0.82004076...
0.0
-1
True, as all users are active.
def is_active(self): return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_active(self):\n return self.status == ACTIVE_USER", "def users_active(self):\n return self.users(\"inactive == NO\")", "def is_active(self):\n return self.user.is_active", "def check_active(self, user):\r\n if not self.require_active:\r\n # Ignore & move on.\r\n ...
[ "0.7647194", "0.7586095", "0.7392544", "0.7232017", "0.71640766", "0.71496123", "0.71493125", "0.7106868", "0.7079819", "0.7037626", "0.7011906", "0.7006486", "0.69768447", "0.6959976", "0.6950634", "0.68555677", "0.68256825", "0.67990226", "0.6742825", "0.67392254", "0.67171...
0.71025443
23
Return the email address to satisfy FlaskLogin's requirements.
def get_id(self): return self.email
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def email(self) -> Optional[str]:\n return pulumi.get(self, \"email\")", "def email(self) -> Optional[str]:\n return pulumi.get(self, \"email\")", "def email(self) -> Optional[str]:\n return pulumi.get(self, \"email\")", "def email(self) -> Optional[str]:\n return pulumi.get(self,...
[ "0.74636996", "0.74636996", "0.74636996", "0.74636996", "0.744493", "0.744493", "0.744493", "0.7439936", "0.7439936", "0.7439936", "0.7439936", "0.7439936", "0.7439936", "0.7439936", "0.7421634", "0.72910833", "0.7233626", "0.7228416", "0.72064245", "0.7176058", "0.71472573",...
0.0
-1
Return True if the user is authenticated.
def is_authenticated(self): return self.authenticated
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_authenticated(self):\n return self.user is not None and self.state == AuthenticationOptions.authenticated", "def is_authenticated(self):\n return bool(get_auth_token())", "def is_authenticated(self):\n return True", "def is_authenticated(self):\n return True", "def is_aut...
[ "0.8739372", "0.87086535", "0.86574197", "0.86574197", "0.86574197", "0.86574197", "0.86574197", "0.86574197", "0.86574197", "0.8613915", "0.8609252", "0.8578436", "0.83723366", "0.83587176", "0.8258534", "0.82273275", "0.8209421", "0.8200795", "0.8174884", "0.81280386", "0.8...
0.8580474
23
False, as anonymous users aren't supported.
def is_anonymous(self): return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_anonymous():\n return False", "def is_anonymous(self):\r\n return False", "def is_anonymous(self):\n return False", "def is_anonymous_access_allowed(self):\n return self._is_anonymous_access_allowed", "def is_authenticated(self):\n return False", "def _is_anonymous_u...
[ "0.8561902", "0.8379807", "0.8245341", "0.78152746", "0.7576769", "0.72893053", "0.72617674", "0.72353363", "0.72353363", "0.72353363", "0.72353363", "0.72353363", "0.72353363", "0.72353363", "0.72341543", "0.7159127", "0.710755", "0.70946115", "0.70573515", "0.7021494", "0.7...
0.8359887
18
Returns the distance between the two nodes.
def distance_callback(from_index, to_index): # Convert from routing variable Index to distance matrix NodeIndex. from_node = manager.IndexToNode(from_index) to_node = manager.IndexToNode(to_index) return data['distance_matrix'][from_node][to_node]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def node_distance(self, node1, node2):\n if node1 == node2:\n return 0.0\n for i, (n1, n2) in enumerate(zip(self.paths[node1], self.paths[node2])):\n if n1 != n2:\n break\n else:\n i = min(len(self.paths[node1]), len(self.paths[node2]))\n ...
[ "0.8304981", "0.8066109", "0.7991222", "0.79538476", "0.7773345", "0.77432054", "0.7391862", "0.73628265", "0.7361803", "0.7282327", "0.7280071", "0.7243736", "0.7236627", "0.7235989", "0.7224905", "0.71656454", "0.71509564", "0.7144462", "0.7141938", "0.71175206", "0.7103671...
0.0
-1
Render the comments on a match.
def view_for_match(match_id): match = _get_match_or_404(match_id) party_id = request.args.get('party_id') comments = match_comment_service.get_comments( match.id, party_id=party_id, include_hidden=False ) return { 'comments': comments, }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def view_for_match_as_json(match_id):\n match = _get_match_or_404(match_id)\n\n party_id = request.args.get('party_id')\n\n comments = match_comment_service.get_comments(\n match.id, party_id=party_id, include_hidden=True\n )\n\n comment_dtos = list(map(_comment_to_json, comments))\n\n ret...
[ "0.69025636", "0.6517017", "0.64587337", "0.6375415", "0.5832153", "0.57927454", "0.56803596", "0.5635831", "0.5615115", "0.5613555", "0.55577534", "0.5545727", "0.536719", "0.5287216", "0.51774096", "0.5171562", "0.5137133", "0.5116178", "0.5093417", "0.5071616", "0.5009722"...
0.77387655
0
Render the comments on a match as JSON.
def view_for_match_as_json(match_id): match = _get_match_or_404(match_id) party_id = request.args.get('party_id') comments = match_comment_service.get_comments( match.id, party_id=party_id, include_hidden=True ) comment_dtos = list(map(_comment_to_json, comments)) return jsonify({ ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def view_for_match(match_id):\n match = _get_match_or_404(match_id)\n\n party_id = request.args.get('party_id')\n\n comments = match_comment_service.get_comments(\n match.id, party_id=party_id, include_hidden=False\n )\n\n return {\n 'comments': comments,\n }", "def render(self, d...
[ "0.74470305", "0.64242184", "0.6096649", "0.60887337", "0.59857726", "0.58441186", "0.5687088", "0.5570564", "0.5343562", "0.5233029", "0.52269316", "0.52158976", "0.5182298", "0.51769084", "0.51769084", "0.51769084", "0.5169123", "0.51422024", "0.5129795", "0.5127157", "0.51...
0.8169989
0
Create a comment on a match.
def create(): schema = CreateMatchCommentRequest() try: req = schema.load(request.get_json()) except ValidationError as e: abort(400, str(e.normalized_messages())) match = match_service.find_match(req['match_id']) if not match: abort(400, 'Unknown match ID') creator = u...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_comment(\n match_id: MatchID, creator_id: UserID, body: str\n) -> DbMatchComment:\n comment = DbMatchComment(match_id, creator_id, body)\n\n db.session.add(comment)\n db.session.commit()\n\n return comment", "def make_comment(self, offset, comment):\n #self.ret = idc.MakeComm(off...
[ "0.76624846", "0.6174262", "0.5974365", "0.5959866", "0.59292716", "0.58998793", "0.58507085", "0.5784041", "0.5759629", "0.5698574", "0.56976587", "0.5687063", "0.5665218", "0.5641729", "0.5636225", "0.56260973", "0.5558051", "0.55462354", "0.5516858", "0.5492579", "0.546112...
0.7506518
1
Hide the match comment.
def hide(comment_id): schema = ModerateMatchCommentRequest() try: req = schema.load(request.get_json()) except ValidationError as e: abort(400, str(e.normalized_messages())) initiator = user_service.find_active_user(req['initiator_id']) if not initiator: abort(400, 'Initiato...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hide_comment(comment_id: MatchCommentID, initiator_id: UserID) -> None:\n comment = DbMatchComment.query.get(comment_id)\n if comment is None:\n raise ValueError('Unknown match comment ID')\n\n comment.hidden = True\n comment.hidden_at = datetime.utcnow()\n comment.hidden_by_id = initiato...
[ "0.6956386", "0.67960644", "0.6645516", "0.64213216", "0.6122187", "0.6085422", "0.6044063", "0.589062", "0.58788264", "0.587854", "0.57618713", "0.5756605", "0.5739403", "0.5698349", "0.5673908", "0.5667086", "0.56274337", "0.5554921", "0.5545091", "0.553894", "0.5529545", ...
0.7107491
0
Unhide the match comment.
def unhide(comment_id): schema = ModerateMatchCommentRequest() try: req = schema.load(request.get_json()) except ValidationError as e: abort(400, str(e.normalized_messages())) initiator = user_service.find_active_user(req['initiator_id']) if not initiator: abort(400, 'Initia...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unhide_comment(comment_id: MatchCommentID, initiator_id: UserID) -> None:\n comment = DbMatchComment.query.get(comment_id)\n if comment is None:\n raise ValueError('Unknown match comment ID')\n\n comment.hidden = False\n comment.hidden_at = None\n comment.hidden_by_id = None\n\n db.ses...
[ "0.70979667", "0.65529567", "0.6209326", "0.61320955", "0.60730875", "0.6047574", "0.6014774", "0.5923895", "0.5921565", "0.5790912", "0.57796824", "0.57351196", "0.56272805", "0.5621866", "0.5553992", "0.5522723", "0.54890823", "0.54295117", "0.5421029", "0.5381388", "0.5304...
0.7044827
1
Generates a random token of length 50 100, consisting of letters and numbers.
def generateToken(): token_length = random.randint(MIN_TOKEN_LEN, MAX_TOKEN_LEN) token = ''.join(random.choice(POSS_TOKEN_CHARS) for _ in range(token_length)) return token
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_token(length=30, chars=UNICODE_ASCII_CHARACTER_SET):\n rand = random.SystemRandom()\n return ''.join(rand.choice(chars) for x in range(length))", "def generate_token(length=30, chars=UNICODE_ASCII_CHARACTER_SET):\n rand = random.SystemRandom()\n return ''.join(rand.choice(chars) for x in...
[ "0.7993329", "0.7993329", "0.7920154", "0.78736335", "0.7871774", "0.77672803", "0.7656302", "0.73956025", "0.7290423", "0.7186431", "0.6872293", "0.68314445", "0.6819142", "0.6745215", "0.6715566", "0.6651408", "0.6571149", "0.65467554", "0.65405196", "0.6539193", "0.6511962...
0.8124889
0
Checks if the given password matches the stored password in the database for the given user name.
def correct_password(name, password): if not User.created(name): return False user = User.get_user(name) return user.info['password'] == password
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verify_password(self, username, password):\n\n try:\n self.c.execute('SELECT password FROM profiles WHERE name=(?)', (username,))\n\n db_pw = self.c.fetchone()[0]\n print(password)\n\n return db_pw == password\n\n except TypeError:\n return F...
[ "0.81212944", "0.8041874", "0.7520548", "0.74664444", "0.74535733", "0.74509126", "0.7448705", "0.7347964", "0.731099", "0.72927326", "0.72677416", "0.7239683", "0.7214253", "0.71979207", "0.71949124", "0.71595156", "0.7130568", "0.71266335", "0.7122605", "0.71045524", "0.702...
0.82322747
0
Checks if the given token matches the stored token in the database for the given user name.
def correct_token(name, token): if not User.created(name): return False user = User.get_user(name) return user.info['token'] == token
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isValid(self, username, token):\n env = {\n \"__username__\": username,\n \"__token__\": token\n }\n sql = \"\"\"\n SELECT md5([token]||strftime('%Y-%m-%d','now'))='{__token__}' \n FROM [users] \n WHERE hex([mail])=hex('{__username__}') \n ...
[ "0.71866256", "0.70793885", "0.6864088", "0.68539584", "0.66948694", "0.66763306", "0.66446084", "0.66169566", "0.6515855", "0.65100497", "0.648291", "0.64040583", "0.6359269", "0.63475573", "0.6327279", "0.63075227", "0.6297307", "0.6269785", "0.6257916", "0.62532854", "0.62...
0.8024435
0
Load a string in JSON format.
def load_json(content): from ujson import loads return loads(content)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_string(string):\n # in order to complete this lab we are going to use the python lib json in which we have the function json.loads\n # which will automatically load a json from a string\n return json.loads(string)", "def json_loads(self, string: str) -> object:\n return json....
[ "0.81258994", "0.8102917", "0.8039925", "0.7971666", "0.7918651", "0.78931725", "0.788109", "0.78176296", "0.78175443", "0.77984375", "0.7708689", "0.7708689", "0.7708689", "0.7664318", "0.7664318", "0.75843203", "0.75612456", "0.7469309", "0.737815", "0.725463", "0.72236663"...
0.71843857
25
Load a string in TOML format.
def load_toml(content): from toml import loads return loads(content)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_toml(self, toml_str): # type: (str) -> None\n self._toml = tomlkit.loads(toml_str)\n self._load_dict(self._toml.value)", "def from_content(cls, content: str) -> Any:\n cls._check_toml()\n return toml.loads(content)", "def readString(self, st):\n if not isinstance(st...
[ "0.7420956", "0.64042324", "0.6400318", "0.62130696", "0.6175536", "0.6037555", "0.5923447", "0.57195985", "0.5696763", "0.56276166", "0.5561361", "0.55125827", "0.5508243", "0.54697067", "0.5423769", "0.5421016", "0.5386182", "0.53803873", "0.5350524", "0.5347358", "0.531767...
0.72137314
1
Load a string in YAML format.
def load_yaml(content): from yaml import load, FullLoader return load(content, Loader=FullLoader)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_yaml_string(cls, string):\n return cls(_yaml_load(string))", "def _yaml_load(src):\n if not isinstance(src, str):\n try:\n src_name = src.name\n except AttributeError:\n src_name = '<yaml stringio>'\n # Force-load file streams as that allows the parse...
[ "0.7954442", "0.756084", "0.72663134", "0.72186196", "0.72009647", "0.71363896", "0.7074121", "0.7060779", "0.7014209", "0.69570035", "0.69149274", "0.6834525", "0.6805121", "0.6780684", "0.6779875", "0.6770773", "0.6749694", "0.672829", "0.67155385", "0.66844296", "0.6665231...
0.72355795
3
Load content in any supported file format.
def load_content(content, frmt): return SUPPORTED_FORMATS[frmt](content)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_file(path):\n frmt = path.suffix.replace('.', '', 1)\n if frmt not in SUPPORTED_FORMATS:\n raise RuntimeError(\n 'Unknown file format \"{}\" for file {}. '\n 'Supported formats are: {}.'.format(\n frmt, path,\n ', '.join(sorted(SUPPORTED_FOR...
[ "0.7207738", "0.70164794", "0.6437012", "0.6411795", "0.6376947", "0.6340488", "0.6296562", "0.6296562", "0.62914515", "0.6207789", "0.61893505", "0.61533445", "0.61208546", "0.60733736", "0.6056215", "0.60356605", "0.6033112", "0.60127926", "0.60027075", "0.5998614", "0.5989...
0.67882615
2
Load any supported file format.
def load_file(path): frmt = path.suffix.replace('.', '', 1) if frmt not in SUPPORTED_FORMATS: raise RuntimeError( 'Unknown file format "{}" for file {}. ' 'Supported formats are: {}.'.format( frmt, path, ', '.join(sorted(SUPPORTED_FORMATS.keys())),...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load(cls,filename,format=None,**kwargs):\n\n\t\tif format is None:\n\t\t\t\n\t\t\textension = filename.split(\".\")[-1]\n\t\t\tif extension in [\"fit\",\"fits\"]:\n\t\t\t\tformat=\"fits\"\n\t\t\telif extension in [\"npy\",\"npz\"]:\n\t\t\t\tformat=\"npz\"\n\t\t\telse:\n\t\t\t\traise IOError(\"File format not r...
[ "0.69348323", "0.6929965", "0.6624913", "0.6415834", "0.6369522", "0.63240075", "0.63224477", "0.62250555", "0.6213421", "0.6213398", "0.6210426", "0.61854166", "0.61691505", "0.6166694", "0.615161", "0.6147973", "0.61472505", "0.61351836", "0.6133587", "0.61215055", "0.61036...
0.6562057
3
Recursively load a list of paths and merge their content left to right. That is, last to load will override last.
def load_files(paths): bundle = {} # Load files # The returned dict of a parsed file cannot be guaranteed consistently # ordered, so sadly here we loose sequentially of declaration in files. for file in paths: log.info( 'Loading file {} ...'.format(file) ) con...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_full(self):\n\t\tfor filename in self.FILENAMES:\n\t\t\tself.load(filename)\n\t\tself.reverse_dicts()", "def _load(name, paths):\n for base_path in paths:\n parts = name.split('.')\n number_of_parts = len(parts)\n\n for folder_parts in range(number_of_parts):\n folder ...
[ "0.57152873", "0.56620735", "0.55487216", "0.55046284", "0.5459949", "0.5413269", "0.5405028", "0.53849477", "0.5367127", "0.53445715", "0.52973175", "0.5290876", "0.5290413", "0.5282406", "0.52707595", "0.52488333", "0.52382416", "0.5212468", "0.5205933", "0.52001184", "0.51...
0.5794004
0
loads all items defined in the config, received by _readconfig
def loadmodule( conf ): try: #conf = routes[ route ] # try to load the module module_name = conf['module']['name'] module_path = conf['module']['path'] mod_name, file_ext = os.path.splitext( os.path.split( module_path )[ -1] ) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_config(self):\n pass", "def loadConfigs(self):\n self.onLoadConfig(urlopen(self.inipath))", "def x_list():\n\t_loadconfig()", "def load ( self ):\n files = config.get_or_fail ( 'REPO.config_files' )\n for f in files:\n self.load_file ( f )", "def load_from_config(self, ...
[ "0.72290933", "0.7139063", "0.6844109", "0.6838094", "0.67836076", "0.66517085", "0.6637448", "0.6622025", "0.6617569", "0.6571889", "0.65608364", "0.6550983", "0.65428025", "0.6530315", "0.65190256", "0.6510584", "0.64977884", "0.6484388", "0.6474819", "0.64706755", "0.64681...
0.0
-1
Return ``QuerySet`` with related content preloaded.
def base_queryset(self): return self.get_query_set().select_related( 'product_class', ).prefetch_related( 'variants', 'product_options', 'product_class__options', 'stockrecords', 'images', ).all()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_eager_loading(cls, queryset):\n queryset = queryset.prefetch_related('keywords_str')\n queryset = queryset.prefetch_related('tags_str')\n # queryset = queryset.prefetch_related('keywords')\n # queryset = queryset.prefetch_related('tags')\n return queryset", "def get_p...
[ "0.679683", "0.6397021", "0.6240532", "0.60717916", "0.60220003", "0.5965624", "0.5962794", "0.58966774", "0.58433366", "0.5831678", "0.5744291", "0.572757", "0.56999606", "0.56916636", "0.5684065", "0.56319755", "0.5624948", "0.5520748", "0.5506694", "0.54910636", "0.5474627...
0.5304603
29
Tests that Train can be run without any specific backends.
def test_run(ray_start_2_cpus): num_workers = 2 key = "value" value = 1 config = TestConfig() def train_func(): checkpoint = train.load_checkpoint() train.report(**checkpoint) train.save_checkpoint(**checkpoint) return checkpoint[key] checkpoint = {key: value} ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_training():\n assert init_engine('train', [\"config=first_run_test/default.yaml\"]).run() is None", "def test_training(self):\n\t\tpass", "def ignore_test_train_with_empty_data(self):\n test_config = \"tests/data/test_config/test_config.json\"\n config = AnnotatorConfig(test_config)\n...
[ "0.68236053", "0.6713482", "0.6552605", "0.6439689", "0.6396073", "0.62762856", "0.62713516", "0.6243473", "0.61967087", "0.6161339", "0.608782", "0.6055071", "0.596316", "0.59406424", "0.5931859", "0.5925877", "0.5892437", "0.58763576", "0.5829315", "0.5827417", "0.5798366",...
0.0
-1
Tests that backend frameworks and noncritical libraries are not imported.
def test_failure(): with pytest.raises(ModuleNotFoundError): import torch # noqa: F401 with pytest.raises(ModuleNotFoundError): import tensorflow # noqa: F401 with pytest.raises(ModuleNotFoundError): import horovod # noqa: F401 with pytest.raises(ModuleNotFoundError): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def importlib_only(fxn):\n return unittest.skipIf(using___import__, \"importlib-specific test\")(fxn)", "def test_imports():\n assert False", "def test_absent_imports():\n module, HABEMUS_MODULE = optional_import(\"not_real_module\")\n\n assert not HABEMUS_MODULE\n assert module.__name__ == \"no...
[ "0.68966895", "0.6590146", "0.6410541", "0.640875", "0.63725764", "0.63153327", "0.6310005", "0.62650174", "0.61983067", "0.6145739", "0.6111093", "0.6097245", "0.6043151", "0.6024104", "0.60225976", "0.60222936", "0.5995633", "0.5948781", "0.59451693", "0.59420294", "0.59381...
0.6604788
1
chose an appropriate pygments lexer based on filename an contents
def pick_lexer(filename, contents): if filename in ["LICENSE", "COPYING", "README"]: return lexers.TextLexer() try: return lexers.guess_lexer_for_filename(filename, contents) except pygments.util.ClassNotFound: try: return lexers.guess_lexer(contents) except pygme...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def FindLexer(self, set_ext=u''):\n if set_ext != u'':\n ext = set_ext.lower()\n else:\n ext = self.file.GetExtension().lower()\n\n if ext == u'':\n fname = self.GetFileName()\n ext = ebmlib.GetFileName(fname).lower()\n\n self.ClearDocumentSty...
[ "0.63497233", "0.62798244", "0.6272315", "0.62466085", "0.5932153", "0.5927871", "0.5925492", "0.58749396", "0.5871015", "0.5857189", "0.5839256", "0.58244497", "0.5809686", "0.57122916", "0.5699207", "0.565513", "0.56470096", "0.56289476", "0.5628755", "0.5622783", "0.561491...
0.7685585
0
syntax highlighting using pygments
def highlight(contents, lexer): formatter = formatters.HtmlFormatter( linenos="table", lineanchors="loc", anchorlinenos=True ) return pygments.highlight(contents, lexer, formatter)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def highlight_code(code, lexer=None):\n# See this page for help with colouring: http://pygments.org/docs/tokens/\n#\n#from pygments.styles.default import DefaultStyle\n#from pygments.style import Style\n#from pygments.styles import get_style_by_name\n#from pygments.token import Comment, Keyword, Name, String, Oper...
[ "0.81851125", "0.79235816", "0.7887074", "0.74662143", "0.73098564", "0.71171296", "0.7070015", "0.70246243", "0.6972884", "0.6948946", "0.69234425", "0.68475306", "0.6819237", "0.67960787", "0.67088455", "0.66868114", "0.6614263", "0.65962946", "0.64780027", "0.64410335", "0...
0.7082435
6
get the filetype of a file mode
def get_filetype(filemode): mode_funcs = [ (stat.S_ISREG, "-"), (stat.S_ISBLK, "b"), (stat.S_ISCHR, "c"), (stat.S_ISDIR, "d"), (stat.S_ISFIFO, "p"), (stat.S_ISLNK, "l"), (stat.S_ISSOCK, "s"), ] for pred, val in mode_funcs: if pred(filemode): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def file_type(self):\n return FileType(self.unpack_dword(0x1C))", "def separate_mode_type(mode):\n m = stat.S_IMODE(mode)\n t = stat.S_IFMT(mode)\n return m, mode_to_unix(t)", "def file_type(self):\n return self.__file_type", "def get_file_type(filename):\n return filename[filename....
[ "0.7450004", "0.7423909", "0.72859955", "0.7259538", "0.72056085", "0.7116693", "0.7092354", "0.70837855", "0.6979861", "0.6899653", "0.68610466", "0.6858636", "0.6858636", "0.6849705", "0.6824208", "0.68010753", "0.6798186", "0.67940944", "0.67481923", "0.6725726", "0.671833...
0.86426646
0
get the permissions string
def get_perms(filemode): perm_vals = [ (stat.S_IRUSR, "r"), (stat.S_IWUSR, "w"), (stat.S_IXUSR, "x"), (stat.S_IRGRP, "r"), (stat.S_IWGRP, "w"), (stat.S_IXGRP, "x"), (stat.S_IROTH, "r"), (stat.S_IWOTH, "w"), (stat.S_IXOTH, "x"), ] perms ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def permissions(self) -> str:\n return pulumi.get(self, \"permissions\")", "def permissions(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"permissions\")", "def permissions(self) -> pulumi.Output[Optional[Sequence[str]]]:\n return pulumi.get(self, \"permissions\")", "...
[ "0.8105288", "0.7524519", "0.7369395", "0.73154134", "0.71759546", "0.711283", "0.711283", "0.71059763", "0.70587695", "0.6965376", "0.6887311", "0.6887311", "0.67905277", "0.6765287", "0.6731112", "0.67119324", "0.6593036", "0.6585412", "0.65600985", "0.65442973", "0.6531081...
0.5950448
31
add info related to the set UID bit, the set GID bit and the sticky bit
def add_bits_info(perms, filemode): bit_vals = [ (stat.S_ISUID, 2, "s", "s"), (stat.S_ISGID, 5, "s", "s"), (stat.S_ISVTX, 8, "t", "T"), ] for bit, i, xval, yval in bit_vals: if filemode & bit: if perms[i] == "x": perms[i] = xval else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initMetadata(self):\n\n if not 'flags' in self.metadata:\n\n self.metadata['flags'] = {}\n\n if not 'uidvalidity' in self.metadata:\n\n\n self.metadata['uidvalidity'] = random.randint(1000000, 9999999)\n\n if not 'uids' in self.metadata:\n\n self.metadata['...
[ "0.5581358", "0.53236526", "0.52267784", "0.51815194", "0.5159865", "0.51437914", "0.51163894", "0.51121086", "0.51067626", "0.5056954", "0.5051719", "0.4944715", "0.49100944", "0.4897046", "0.4880741", "0.4864748", "0.48488283", "0.4804211", "0.47231904", "0.47075477", "0.47...
0.569763
0
format a filemode int into a a nice string
def format_filemode(filemode): filetype = get_filetype(filemode) permissions = add_bits_info(get_perms(filemode), filemode) return filetype + permissions
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def file_mode(filename: str) -> str:\n return '{0:04o}'.format(stat.S_IMODE(os.stat(filename).st_mode))", "def filemode(mode):\n perm = []\n for table in _filemode_table:\n for bit, char in table:\n if mode & bit == bit:\n perm.append(char)\n break\n ...
[ "0.7865812", "0.6887833", "0.6831519", "0.66854316", "0.6539661", "0.62018806", "0.6169183", "0.60933334", "0.5975011", "0.5926117", "0.5923357", "0.5851956", "0.57330686", "0.57321155", "0.56938946", "0.5651825", "0.5632885", "0.55774564", "0.55690205", "0.5546659", "0.55377...
0.7804943
1
write html displaying a blob
def write_blob(blob, header_data, path, levels): if path is None: path = "" mkdir(os.path.join("file", path)) mkdir(os.path.join("raw", path)) if blob.is_binary: content = None highlighted = None rendered = None nlines = 0 else: content = blob.data.d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def outputHtml(s):\n htmlFile.write(s + \"\\n\")", "def write_html(self, content):\n self.write(content)", "def output_to_html(string_data):\n raise NotImplementedError(\"This function is not yet Implemented!\")", "def static_html(self, obj, fmt=None, template=None):\n html_bytes = String...
[ "0.6580048", "0.6531536", "0.6415666", "0.6363096", "0.6268991", "0.6207812", "0.6203876", "0.6122517", "0.606148", "0.60258734", "0.5992513", "0.5992321", "0.59695345", "0.59223884", "0.5919993", "0.5919779", "0.5883791", "0.5882668", "0.58557886", "0.584473", "0.5841449", ...
0.6675383
0
recursevily read the files in a tree
def write_file_tree(node, header_data, path=None, levels=0): if path is not None: name = os.path.join(path, node.name) else: name = node.name if isinstance(node, pygit2.Blob): return [write_blob(node, header_data, path=path, levels=levels)] if isinstance(node, pygit2.Tree): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def traverse_tree(file, tree):\n\n\tfor node in tree.get_children():\n\t\tpass", "def iter_tree(root):\n\tfor file_rel in _iter_tree_next(os.path.abspath(root), '', {}):\n\t\tyield file_rel", "def traverse_tree(tree, thisFolder, path, submission):\n\n # Get files directly underneath this folder.\n blobs ...
[ "0.77140933", "0.7299978", "0.6981091", "0.69146436", "0.6842688", "0.6823738", "0.68015987", "0.67952013", "0.67203087", "0.6660634", "0.6614352", "0.6609399", "0.6605242", "0.6594933", "0.64825356", "0.6469555", "0.64619434", "0.6456739", "0.6454041", "0.6447591", "0.644327...
0.0
-1
Utility function to get pixel value for coordinate vectors x and y from a 4D tensor image. Input
def get_pixel_value(img, x, y): shape = tf.shape(x) batch_size = shape[0] height = shape[1] width = shape[2] batch_idx = tf.range(0, batch_size) batch_idx = tf.reshape(batch_idx, (batch_size, 1, 1)) b = tf.tile(batch_idx, (1, height, width)) indices = tf.stack([b, y, x], 3) return...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vecteur_image(T,x,y):\n a,b,c,d = T[0][0],T[0][1],T[1][0],T[1][1]\n xx = a*x + b*y\n yy = c*x + d*y\n return xx,yy", "def getPixel (self, x, y):\r\n return self.image [y][x]", "def get_pixel(image, x, y):\n x = in_bound(image[\"height\"], x)\n y = in_bound(image[\"width\"], y)\n ...
[ "0.72120667", "0.7111711", "0.6763613", "0.67106384", "0.66041225", "0.6509605", "0.64627975", "0.6440617", "0.6410553", "0.6342924", "0.63029987", "0.6291874", "0.6291588", "0.62779397", "0.626543", "0.6245165", "0.62448704", "0.6238417", "0.6173571", "0.6162264", "0.6160496...
0.80248594
1
Returns an argparse instance
def cmdline_parser(): # http://docs.python.org/dev/howto/argparse.html parser = argparse.ArgumentParser(description=__doc__) parser.add_argument("--verbose", action="store_true", help="Be verbose") parser.add_argument("--debug", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_parser():\n p = argparse.ArgumentParser(description='such a good program')\n p.add_argument('infile')\n p.add_argument('outfile')\n return p", "def get_parser():\n\n parser = parser.ArgumentParser()\n return parser", "def arg_parser():\n import argparse\n return argparse...
[ "0.7767424", "0.77440184", "0.7693054", "0.75894576", "0.75894576", "0.74071556", "0.7322823", "0.73185104", "0.7240093", "0.7232856", "0.72174203", "0.72085565", "0.72033024", "0.71685386", "0.71665", "0.7139135", "0.7130057", "0.7107946", "0.71069175", "0.7100661", "0.70824...
0.0
-1
yields variants listed in vcf file as 'Variant'
def simple_vcf_reader(fh): for line in fh: if line.startswith('#'): continue ls = line.rstrip().split('\t') # 8 fixed fields per record assert len(ls)>=8, ( "Number of retrieved fields in vcf file too small") # ignoring the rest (chrom, pos, i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_variants_from_vcf( vcf_file ):\n\t\n\tsnps_per_chr = {}\n\tindels_per_chr = {}\n\t\n\ttri_counter = 0\n\t\n\twith open( vcf_file, \"r\" ) as f:\n\t\tline = f.readline()\n\t\twhile line:\n\t\t\tif line[0] != '#':\n\t\t\t\tparts = line.strip().split('\\t')\n\t\t\t\tif not \",\" in parts[4]:\t#only biallelic...
[ "0.7201303", "0.6650941", "0.65448", "0.64423966", "0.63880545", "0.6301285", "0.62869686", "0.6278264", "0.626897", "0.6137558", "0.61200696", "0.61076975", "0.61054826", "0.59219545", "0.5920386", "0.59201425", "0.5894", "0.5866502", "0.5800668", "0.57959044", "0.5764796", ...
0.6716026
1
Decorator to validate the arguments passed to a function, returning self
def chainable(fn: Callable): # @validate_arguments @functools.wraps(fn) def setter_wrapper(self, *args: Any, **kwargs: Any) -> Any: fn(self, *args, **kwargs) return self return setter_wrapper
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_inputs(function: Callable) -> Callable:\n spec = inspect.getfullargspec(function)\n # (According to the Python FAQ, the proper name for \"argument name\" is\n # \"parameter\").\n arg_names = spec.args\n default_values = spec.defaults\n # Iterate over parameters in reverse: only the l...
[ "0.70715654", "0.70159316", "0.68496096", "0.68467736", "0.67173135", "0.66869897", "0.6630109", "0.6566176", "0.65501183", "0.6538953", "0.65237904", "0.6466164", "0.6448595", "0.642977", "0.6393917", "0.6387735", "0.63781583", "0.6346085", "0.6345894", "0.630728", "0.628611...
0.0
-1
Get the path to the backing schema this Metadata object users
def get_schema(cls): return cls.schema()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_bundled_schema_path():\n return str(data.load_resource(\"schema\"))", "def GetSchemaPath(cls, for_help=False):\n return export_util.GetSchemaPath(\n 'compute', cls.GetApiVersion(), 'BackendService', for_help=for_help)", "def metadata_path(self):\n profile_path, _ = metadata.get_path...
[ "0.6968205", "0.6887847", "0.6758166", "0.6755622", "0.6704998", "0.66873103", "0.6487636", "0.6468528", "0.64356565", "0.641601", "0.64103717", "0.6376613", "0.6352844", "0.6328807", "0.63263994", "0.63089687", "0.6211711", "0.6146068", "0.6146039", "0.6124243", "0.6087005",...
0.6189976
17
Run all field validations on existing model
def check_consistency(self) -> 'Schema': errors = [] fields = self.__fields__ for k, v in fields.items(): _, err = v.validate(getattr(self, k), fields, loc=k) if err: errors.append(err) if errors: raise ValidationError(errors, self.__cl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate(self):\n for field in self.fields:\n if field.validate():\n self.model.set(field.name, field.model_value)\n else:\n self.errors.append(field.error())\n return len(self.errors) == 0", "def validate(self):\n for name, field in se...
[ "0.71468586", "0.7097198", "0.69188654", "0.6817554", "0.6651476", "0.66058755", "0.65919423", "0.6582063", "0.6570577", "0.6559913", "0.65362847", "0.6432778", "0.6428596", "0.6403749", "0.6364333", "0.6302278", "0.6302278", "0.6302278", "0.6302278", "0.6302278", "0.6302278"...
0.0
-1
Compare two Cozy values, returning LT, EQ, or GT.
def compare_values(t : Type, v1, v2, deep : bool = False) -> int: # For performance, this function uses a work-stack algorithm rather than # recursive calls to itself. The stack holds (type, value1, value2, deep) # tuples to compare. If the values on the head of the stack differ, then # this function...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _cmp(x, y):\n if x[1].count > y[1].count:\n return CmpRelation.GREATER\n if x[1].count < y[1].count:\n return CmpRelation.LESS\n if x[1].ptn_length < y[1].ptn_length:\n return CmpRelation.GREATER\n if x[1].ptn_length > y[1...
[ "0.7025091", "0.6896343", "0.68076324", "0.6747456", "0.67306834", "0.6729285", "0.6720791", "0.67181224", "0.67062", "0.6697252", "0.6630908", "0.6624101", "0.66043633", "0.6552949", "0.6538281", "0.652217", "0.6515116", "0.6509953", "0.6508626", "0.6502572", "0.6500163", ...
0.0
-1
Shorthand for `compare_values(t, v1, v2) == EQ`.
def values_equal(t : Type, v1, v2) -> bool: return compare_values(t, v1, v2) == EQ
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def values_eq(self, a, b):\r\n return a == b", "def are_equal(value1, value2):\n if value1 == None or value2 == None:\n return True\n if value1 == None or value2 == None:\n return False\n return value1 == value2", "def compare(self, values):\n raise NotI...
[ "0.7225015", "0.66483396", "0.63902336", "0.62941045", "0.59793293", "0.5886414", "0.58498853", "0.5848486", "0.5826007", "0.5760525", "0.57133996", "0.5677296", "0.5624517", "0.5551929", "0.55439883", "0.55428416", "0.55212235", "0.5506666", "0.5491236", "0.54909456", "0.548...
0.8292787
0
Returns a queryset of events with attendance_event that a user has access to
def get_group_restricted_events(user, all_events=False): types_allowed = get_types_allowed(user) if all_events: return Event.objects.filter(event_type__in=types_allowed) else: return Event.objects.filter(attendance_event__isnull=False, event_type__in=types_allowed)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_queryset(self):\n return Event.objects.all().filter(user_id=self.request.user)", "def myevents(self, request, pk=None):\n user = request.auth.user\n myevents = user.events\n serializer = EventSerializer(\n myevents, many=True, context={'request': request})\n ...
[ "0.6964939", "0.6351143", "0.62036747", "0.6021155", "0.59197706", "0.58528394", "0.58394927", "0.58226365", "0.5759699", "0.57324386", "0.5666887", "0.55813336", "0.5572948", "0.55628294", "0.5537274", "0.5526723", "0.5497164", "0.54951507", "0.54903823", "0.5483845", "0.547...
0.6573138
1
Return icalendar as text
def output(self): return self.cal.to_ical()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n return str(self.GetCalendarString())", "def __str__(self):\n return str(self.GetCalendarString())", "def ical_string(self) -> str:\n tz = ''\n if self.timezone != '':\n tz = ';TZID=' + self.timezone\n result = ['BEGIN:VCALENDAR',\n ...
[ "0.7129085", "0.7129085", "0.7119772", "0.6839943", "0.6720884", "0.66290593", "0.66290593", "0.65572196", "0.62213963", "0.614671", "0.6109207", "0.61022824", "0.6086428", "0.6086428", "0.6067368", "0.5991712", "0.59777147", "0.593754", "0.59345764", "0.59312594", "0.5862119...
0.6756817
5
Returns a response object
def response(self): response = HttpResponse(self.cal.to_ical(), content_type='text/calendar') response['Content-Type'] = 'text/calendar; charset=utf-8' response['Content-Disposition'] = 'attachment; filename=' + self.filename + '.ics' return response
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(self):\n resp = Response()\n return resp", "def get_response(self):\r\n response = self.response\r\n return response", "def get_response(self):\n return self.__response", "def get_response(self):\n\n return self.response", "def get(self, *args, **kwargs):\n...
[ "0.82338905", "0.7885493", "0.7587166", "0.7460398", "0.7287168", "0.7274704", "0.72658044", "0.72658044", "0.7150664", "0.71441334", "0.70517844", "0.697786", "0.6948767", "0.68960065", "0.6883576", "0.6832751", "0.6806244", "0.67846364", "0.6782759", "0.6754708", "0.6747059...
0.0
-1
Personalized calendar This calendar is publicly available, but the url is not guessable so data should not be leaked to everyone
def user(self, user): signer = Signer() try: username = signer.unsign(user) user = User.objects.get(username=username) except (BadSignature, User.DoesNotExist): user = None if user: # Getting all events that the user has/is participating in...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, email, password, title, location, calendar):\n self.title = title\n self.location = location\n self.calendar_title = calendar\n self.calendar_link = \"/calendar/feeds/default/private/full\"\n self.calendar_service = gdata.calendar.service.CalendarService()\n ...
[ "0.64824843", "0.63210833", "0.6275899", "0.62199634", "0.61886364", "0.59637237", "0.59538734", "0.592292", "0.5897547", "0.58153486", "0.5805204", "0.5783033", "0.57610255", "0.5760272", "0.571628", "0.5711207", "0.5711207", "0.56876516", "0.567872", "0.5677546", "0.5668688...
0.0
-1
All events that haven't ended yet
def events(self): self.add_events(Event.objects.filter(event_end__gt=timezone.now()).order_by('event_start')) self.filename = 'events'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def slurp_events(self):\n while self.has_event():\n self.get_event()", "def fetch_events(self):\n while 1:\n try:\n self.events_local.append(self._q.get(False))\n except queue.Empty:\n break", "async def events(self) -> Iterable[Event...
[ "0.70517313", "0.68124783", "0.6811235", "0.6757995", "0.6718218", "0.66285515", "0.656825", "0.64827085", "0.6464121", "0.6379542", "0.6357838", "0.6301193", "0.62811595", "0.6232039", "0.6228214", "0.6218898", "0.61879677", "0.6155984", "0.61404085", "0.6138689", "0.6138351...
0.57665646
58
return the scan data dimention from pndcom
def getScanDataShape(device): reloadConfig() return simuConfig["N.TEL"]+simuConfig["N.SCI.WIN"]+simuConfig["N.DARK.WIN"], simuConfig["N.OPL"]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_dcmgnd(self):\n return self.dcmgnd", "def device_get_information_about(pnd, buf):\n return _nfc.device_get_information_about(pnd, buf)", "def getPointerDisplacementDataType(program: ghidra.program.model.listing.Program) -> ghidra.program.model.data.DataType:\n ...", "def extract_dn(d...
[ "0.63539934", "0.62629724", "0.59691465", "0.5848797", "0.5798491", "0.57720125", "0.57382995", "0.57165813", "0.5702169", "0.56683207", "0.5654882", "0.56413543", "0.55074435", "0.5485375", "0.5480787", "0.54541403", "0.54378676", "0.5430126", "0.54298115", "0.53656685", "0....
0.5320437
21
return the current OBC configuration
def getObcType(): return simuConfig["OBC"]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def config(self):\r\n return self._config", "def get_config(self):\n if self.allow_reco():\n return self.chs_config()\n else:\n return self.get_config_j(self.id)", "def config(self):\n return self._config", "def get_config(self):\n return self.config", "def ...
[ "0.76223904", "0.758794", "0.7562929", "0.7540094", "0.7497914", "0.74324155", "0.74324155", "0.74324155", "0.74324155", "0.74324155", "0.74324155", "0.74324155", "0.74324155", "0.74324155", "0.74324155", "0.74324155", "0.74324155", "0.74324155", "0.74324155", "0.74324155", "...
0.0
-1
from a obc name find a IOB mapping array The list of IOB should be defined in config.mapLoockUp
def findMap(obc, nWin): try: return config.mapLoockUp[(obc,nWin)] except KeyError: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _load_obcfile(casename=None): \n\n data={}\n\n if casename==None:\n print('_load_obcfile requires a filename to load.')\n return\n try:\n fp=open(casename+'_obc.dat','r')\n except IOError:\n print('_load_obcfile: invalid case name.')\n return data\n\n obc_st...
[ "0.53534824", "0.5345637", "0.531654", "0.53130233", "0.5284127", "0.52317035", "0.5207828", "0.51392853", "0.50721306", "0.50523263", "0.5050292", "0.5049232", "0.5045717", "0.50451595", "0.5042849", "0.5037867", "0.5027547", "0.50163406", "0.5013733", "0.50073826", "0.50031...
0.58121645
0
read inside the data base and return string result
def dbRead(dbPoint): raise NotImplementedError('dbRead in simu mode')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read():\n # TODO", "def read_data() -> str:\n with open('input.txt') as input_file:\n return input_file.read()", "def read(self):", "def _read_data(self, txtfile):\n data_string = open(txtfile,'r').read()\n return data_string", "def _read_data(self):", "def read(self, unique_id...
[ "0.68854916", "0.6681691", "0.66781354", "0.6588823", "0.65474457", "0.64176416", "0.6263209", "0.62257844", "0.6215985", "0.6132139", "0.6130376", "0.60853267", "0.60312265", "0.5974957", "0.5969577", "0.5947669", "0.59194213", "0.590746", "0.59032995", "0.58987325", "0.5893...
0.54466337
77
write inside the data base
def dbWrite(dbPoint, formatedValue): raise NotImplementedError('dbWrite in simu mode')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_data():", "def _write(self, data):\n self.db.append(data)\n\n with open(self.DB_FILE, 'w') as outfile:\n json.dump(self.db, outfile)", "def write(self):", "def write(self):", "def write(data):", "def write( data ):", "def write(self, content):\n ...", "def wr...
[ "0.8018094", "0.73796594", "0.7357922", "0.7357922", "0.7322724", "0.7262804", "0.7089671", "0.7067174", "0.7067174", "0.7030766", "0.7024154", "0.6942223", "0.6925384", "0.6904935", "0.68816346", "0.682891", "0.67433035", "0.6743237", "0.6729241", "0.67112666", "0.6644303", ...
0.63664347
47