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
get_data_from_file returns data from a file, given a path.
def get_data_from_file(self, path): data = None if not path: raise RedisUpdateException("Failed to provide a path") try: with open(path, 'r') as _file: data = _file.read() print("Retrieved data from {}".format(path)) except Excepti...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_data_from_file(filepath):\n with open(filepath) as f:\n return f.read()", "def read_file(path):\n assert_is_string(path)\n f = open(path, \"r\")\n data = f.read()\n f.close()\n return data", "def load_data(filepath):\n with open(filepath, 'r') as f:\n data = f.read()\...
[ "0.8003186", "0.757911", "0.7487064", "0.7271406", "0.72710305", "0.7209962", "0.7185837", "0.716335", "0.71389616", "0.7106145", "0.7102851", "0.70604414", "0.7031526", "0.7019637", "0.69653034", "0.68595344", "0.6819222", "0.6815672", "0.68082505", "0.6782052", "0.67758113"...
0.7735694
1
This returns a DataFrame of the content of glob_or_list. IT MAY CONTAIN DUPLICATES
def bulk_gzipped_jsonline_files_to_dfs(glob_or_list, nproc=20): import multiprocessing as mp from tqdm import tqdm if isinstance(glob_or_list, str): from glob import glob glob_or_list = glob(glob_or_list) if len(glob_or_list) == 0: return [] pool = mp.Pool(min(nproc, len(g...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_filelist_into_dataframe(file_list, pref_name, junk=5, return_idex_version=False,postname_len=4,backjunk=0):\n pref_len = len(pref_name)\n\n q,sq = read_twocol_data(file_list[0],junk=junk,backjunk=backjunk,shh=True)\n df_all_sq = pd.DataFrame(index=q)\n for i in range(len(file_list)):\n ...
[ "0.62427217", "0.60388565", "0.58885", "0.588173", "0.58777386", "0.58511496", "0.5771708", "0.5754438", "0.5697812", "0.5615192", "0.5559894", "0.5550235", "0.54819506", "0.54814804", "0.54708", "0.54589564", "0.54551876", "0.5444385", "0.5415823", "0.54004604", "0.5378023",...
0.5354352
25
check the given soup for the given URL
def check_href(url, soup): # pdb.set_trace() ret_vals = [] href = soup.find_all("a") for link in href: if url in link.get("href"): ret_vals.append(link.get("href").split(url)[1]) return list(set(ret_vals))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_url(soup):\r\n \"\"\"criteria: any(s in a[\"title\"] for s in ('新增', '確診', '肺炎')\"\"\"\r\n url_list = []\r\n for a in soup.find_all('a', {\"href\": re.compile(\"typeid=9$\")}):\r\n if any(s in a[\"title\"] for s in ('新增', '確診', '肺炎')):\r\n url = \"https://www.cdc.gov.tw\" + a['hr...
[ "0.66171163", "0.6528606", "0.6515215", "0.65107447", "0.64629287", "0.6438142", "0.64015216", "0.63977945", "0.6395195", "0.6379726", "0.63796556", "0.63583046", "0.6352542", "0.6324256", "0.6231188", "0.6229653", "0.6197432", "0.6152754", "0.6152524", "0.6151828", "0.614191...
0.7073773
0
utility function for sampling from distributions, given noise
def sample(params, eps, dist='gauss'): if 'bin' in dist: logits = params[-1] params = params[:-1] if 'gauss' in dist: mean, cov = params s = mean + tf.sqrt(cov) * eps elif 'gm' in dist: means, covs, pi_logits = params choices = tf.multinomial(pi_logits, num_sa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sample_from(space):\n distrs = {\n 'choice': choice,\n 'randint': randint,\n 'uniform': uniform,\n 'normal': normal,\n }\n s = space[0]\n\n np.random.seed(int(time.time() + np.random.randint(0, 300)))\n\n log = s.startswith('log_')\n s = s[len('log_'):] if log else...
[ "0.6733525", "0.6709667", "0.66923374", "0.6601143", "0.6528409", "0.6528409", "0.65123415", "0.647184", "0.6471811", "0.64671725", "0.6463913", "0.6457344", "0.6455953", "0.6451384", "0.6442806", "0.6442806", "0.6442806", "0.6442806", "0.6442806", "0.64404196", "0.64396787",...
0.0
-1
builds inference model for one time step
def inference(in_pl, hid_pl, f_state, eps_z, fd): phi_x = fd['phi_x'](in_pl) mean_0, cov_0 = fd['phi_prior'](hid_pl) mean_z, cov_z = fd['phi_enc'](phi_x, hid_pl) z = sample((mean_z, cov_z), eps_z, 'gauss') phi_z = fd['phi_z'](z) params_out = fd['phi_dec'](phi_z, hid_pl) f_in = tf.concat([phi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inference(model, data, diagnostics, seed, extra_fitting_args):\n pass", "def finetuning_single(phase,token2id_dict,id2embedding_dict,inference,dataloaders,model,optimizer,device,weighted_sampling,criterion,classification,auxiliary_loss=False,attn_loss=False,epoch_count=None,new_task_epochs=None,trial=None...
[ "0.7219933", "0.6997029", "0.69138074", "0.6905621", "0.6757916", "0.67068917", "0.6679972", "0.6673408", "0.6594149", "0.658507", "0.65409905", "0.64915425", "0.6486508", "0.6433577", "0.64314353", "0.64195937", "0.64091146", "0.6342456", "0.63339645", "0.6313222", "0.631148...
0.0
-1
computes log probability of target in Gaussian with given parameters
def gaussian_log_p(params_out, x_target, dim): mean_x, cov_x = params_out x_diff = x_target - mean_x x_square = tf.reduce_sum((x_diff / cov_x) * x_diff, axis=[1]) log_x_exp = -0.5 * x_square log_cov_x_det = tf.reduce_sum(tf.log(cov_x), axis=[1]) log_x_norm = -0.5 * (dim * tf.log(2 * np.pi) + log...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_gaussian_likelihood(x, mu, log_std):\n log_gaussian_prob = -0.5 * (((x - mu) / (tf.exp(log_std) + EPS)) ** 2 - log_std - 0.5 * np.log(2 * np.pi))\n return tf.reduce_sum(log_gaussian_prob, axis=1)", "def log_prob(self):", "def log_prob(target_distribution, x0, xs, accepteds):\n return np.mean([...
[ "0.74791056", "0.7415539", "0.73810035", "0.737954", "0.71995723", "0.71843565", "0.7128425", "0.7069776", "0.7023565", "0.70144814", "0.7014303", "0.701235", "0.6959458", "0.6924743", "0.6915048", "0.68896127", "0.6878826", "0.68766814", "0.68624735", "0.6858382", "0.6854947...
0.78899825
0
computes log probability of target in Gaussian mixture with given parameters
def gm_log_p(params_out, x_target, dim): mean_x, cov_x, pi_x_logit = params_out pi_x = tf.nn.softmax(pi_x_logit) mean_x = tf.transpose(mean_x, perm=[1, 0, 2]) cov_x = tf.transpose(cov_x, perm=[1, 0, 2]) pi_x = tf.transpose(pi_x, perm=[1, 0]) x_diff = x_target - mean_x x_square = tf.reduce_s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gaussian_log_p(params_out, x_target, dim):\n mean_x, cov_x = params_out\n x_diff = x_target - mean_x\n x_square = tf.reduce_sum((x_diff / cov_x) * x_diff, axis=[1])\n log_x_exp = -0.5 * x_square\n log_cov_x_det = tf.reduce_sum(tf.log(cov_x), axis=[1])\n log_x_norm = -0.5 * (dim * tf.log(2 * n...
[ "0.7413691", "0.7035746", "0.6878685", "0.6865637", "0.68429726", "0.6838593", "0.6807696", "0.67913365", "0.6708026", "0.66946834", "0.6656199", "0.663148", "0.66271496", "0.6596391", "0.65957904", "0.6587668", "0.6581443", "0.6546727", "0.65407664", "0.64943653", "0.6489907...
0.6380243
31
computes KL divergences between two Gaussians with given parameters
def gaussian_kl_div(mean_0, cov_0, mean_1, cov_1, dim): mean_diff = mean_1 - mean_0 cov_1_inv = tf.reciprocal(cov_1) log_cov_1_det = tf.reduce_sum(tf.log(cov_1), axis=[1]) log_cov_0_det = tf.reduce_sum(tf.log(cov_0), axis=[1]) log_term = log_cov_1_det - log_cov_0_det trace_term = tf.reduce_sum(c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def KL_divergence(model_1, model_2, samples):\n posterior_1 = create_posterior_object(model_1, samples)\n posterior_2 = create_posterior_object(model_2, samples)\n return posterior_1.KL(posterior_2)", "def kl_gaussian_gaussian_analytic(mu_q, logvar_q, mu_p, logvar_p):\n # init\n batch_size = mu_q....
[ "0.72388107", "0.6910017", "0.6894922", "0.68472576", "0.6779738", "0.6659188", "0.66573954", "0.6615593", "0.65750533", "0.6552618", "0.6473315", "0.6462868", "0.6447152", "0.64378923", "0.6435891", "0.64307237", "0.64105403", "0.6390125", "0.6342134", "0.6315715", "0.629020...
0.6427663
16
computes binary cross entropy loss given logit estimate and target
def ce_loss(logits_out, bin_target): l = tf.nn.sigmoid_cross_entropy_with_logits(logits=logits_out, labels=bin_target, name='ce_loss') return tf.squeeze(l)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def classification_loss(self, logit, target):\n return F.cross_entropy(logit, target)", "def binary_crossentropy(output, target):\r\n return -(target * tensor.log(output) + (1.0 - target) * tensor.log(1.0 - output))", "def cross_entropy(input: Tensor, target: Tensor) -> Tensor:\n norm_log = log_so...
[ "0.7688538", "0.7384541", "0.7337872", "0.73106444", "0.7251753", "0.7251657", "0.71824944", "0.7172774", "0.7118522", "0.710551", "0.71031016", "0.70961285", "0.7076509", "0.70662785", "0.70476913", "0.70405006", "0.7031607", "0.70242167", "0.6990047", "0.69736594", "0.69541...
0.6802525
37
computes variational upper bound, depending on output distribution and optionally adds binary CE loss employs masking, if enabled. also returns partial losses in most setups (inaccurate with masking)
def loss(x_target, mean_0, cov_0, mean_z, cov_z, params_out, param_dict): maybe_ce = [] kl_div = gaussian_kl_div(mean_z, cov_z, mean_0, cov_0, param_dict['z_dim']) if param_dict['model'] == 'gauss_out': log_p, log_x_norm, log_x_exp, abs_diff = gaussian_log_p(params_out, x_target, param_dict['x_dim'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def CE():\n def CE_loss(input,target):\n return nn.CrossEntropyLoss()(input.squeeze(), target)\n\n return CE_loss", "def bce_loss(input, target):\r\n neg_abs = - input.abs()\r\n loss = input.clamp(min=0) - input * target + (1 + neg_abs.exp()).log()\r\n return loss.mean()", "def loss_tota...
[ "0.57762206", "0.5742245", "0.57354647", "0.5715962", "0.57150716", "0.56465185", "0.56056947", "0.5579924", "0.5569751", "0.553863", "0.5532758", "0.553238", "0.5495617", "0.54928374", "0.549099", "0.5471299", "0.5447897", "0.54031384", "0.53975034", "0.5375022", "0.5372996"...
0.5766483
1
creates train operation using ADAM and gradient clipping
def optimization(err_acc, learning_rate): optimizer = tf.train.AdamOptimizer(learning_rate=learning_rate) tvars = tf.trainable_variables() grads = tf.gradients(err_acc, tvars) tg_pairs = [(tf.clip_by_value(k[0], -100, 100), k[1]) for k in zip(grads, tvars) if k[0] is not None] train_op = optimizer.a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train(self):\n learning_rate = tf.train.exponential_decay(self.learning_rate, self.global_step, self.decay_steps,self.decay_rate, staircase=True)\n self.learning_rate_=learning_rate\n #noise_std_dev = tf.constant(0.3) / (tf.sqrt(tf.cast(tf.constant(1) + self.global_step, tf.float32))) #gra...
[ "0.70264864", "0.69798446", "0.6939323", "0.6836911", "0.683521", "0.6806715", "0.6806536", "0.67949176", "0.6763052", "0.67439944", "0.67263734", "0.6715664", "0.67050755", "0.66781133", "0.6576617", "0.6525466", "0.6515684", "0.6439034", "0.6349592", "0.63356787", "0.633342...
0.6183898
34
executes one timestep of inference and accumulates loss (and partial losses) passes results for next timestep
def train_loop(x_pl, f_theta, bound_acc, count, f_state, eps_z, param_dict, fun_dict, tracked_tensors): x_t = tf.squeeze(tf.slice(x_pl, [tf.to_int32(count), 0, 0], [1, -1, -1]), axis=[0]) eps_z_t = tf.squeeze(tf.slice(eps_z, [tf.to_int32(count), 0, 0], [1, -1, -1]), axis=[0]) mean_0, cov_0, mean_z, cov_z, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _train_or_inference(self, hparams, res):\n\t\tif self.mode == 'train':\n\t\t\tself.sample_id = res[1]\n\t\t\tself.loss = res[2]\n\t\t\tself.loss_per_token = res[3]\n\t\t\tself.kl_loss = res[4]\n\t\telif self.mode == 'eval':\n\t\t\tself.loss = res[2]\n\t\telif self.mode == 'infer':\n\t\t\tself.infer_logtis, sel...
[ "0.68273246", "0.68102425", "0.6779098", "0.6720618", "0.67177796", "0.6677193", "0.66431224", "0.66379356", "0.6615984", "0.66039443", "0.6597892", "0.6579163", "0.65593505", "0.65543324", "0.65461916", "0.65415984", "0.64743316", "0.6473563", "0.6446455", "0.64011544", "0.6...
0.6539289
16
function wrapper to assign the dicts. return value can be looped with tf.while_loop
def get_train_loop_fun(param_dict, fun_dict): def train_loop_fun(x_pl, hid_pl, err_acc, count, f_state, eps_z, debug_tensors): return train_loop(x_pl, hid_pl, err_acc, count, f_state, eps_z, param_dict, fun_dict, debug_tensors) return train_loop_fun
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _step(self) -> Dict[str, tf.Tensor]:\n\n # Pull out the data needed for updates/priorities.\n inputs = next(self._iterator)\n\n o_tm1, a_tm1, r_t, d_t, o_t = inputs.data\n keys, probs = inputs.info[:2]\n\n with tf.GradientTape() as tape:\n # Evaluate our networks.\n # `qv` means quanti...
[ "0.5671674", "0.5550421", "0.5465736", "0.54489744", "0.5430541", "0.5418484", "0.53735536", "0.53536373", "0.5325152", "0.53153545", "0.53073084", "0.526662", "0.52653", "0.52617794", "0.5245784", "0.52382976", "0.5237779", "0.52322906", "0.522094", "0.52148306", "0.5176101"...
0.5212006
20
sequence length counter needed for while loop
def get_train_stop_fun(num_iter): def train_stop_fun(*args): count = args[3] return tf.less(count, num_iter) return train_stop_fun
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count(seq):\n\treturn sum(1 for x in seq)", "def __len__(self):\n return self.get_num_sequence()", "def GetSequenceLength(num_nodes: int) -> int:\n return num_nodes * (3 + (num_nodes - 1) * 2)", "def _setup_next_sequence(cls):\n return 0", "def __len__(self):\n return len(self.seq...
[ "0.6761017", "0.67569274", "0.66916007", "0.6634269", "0.6609336", "0.6609336", "0.65568435", "0.64844733", "0.64844733", "0.6341952", "0.6317042", "0.6269344", "0.624352", "0.623329", "0.622913", "0.61457485", "0.61272085", "0.61186063", "0.6097058", "0.6026103", "0.60050267...
0.0
-1
builds generative model for one time step
def generation(hid_pl, f_state, eps_z, eps_x, pd, fd): params_prior = fd['phi_prior'](hid_pl) z = sample(params_prior, eps_z, 'gauss') phi_z = fd['phi_z'](z) params_out = fd['phi_dec'](phi_z, hid_pl) x = sample(params_out, eps_x, pd['model']) phi_x = fd['phi_x'](x) f_in = tf.concat([phi_x, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_model():", "def build_model_fn(self):", "def build_model(self):\n pass", "def build_model(self):\n pass", "def build_model(self):\n raise NotImplementedError", "def _build_model(self):\n raise NotImplementedError()", "def build_sys_rec_model():\n print(\"buildin...
[ "0.7986959", "0.71801484", "0.6979665", "0.6979665", "0.6917935", "0.68268156", "0.6736923", "0.6727681", "0.6707003", "0.66739935", "0.66584253", "0.6601041", "0.6587544", "0.6551139", "0.64963394", "0.64550954", "0.6439442", "0.64208007", "0.64159006", "0.63939077", "0.6364...
0.0
-1
executes one timestep of generation and accumulates results, writing to x_pl. passes results for next timestep
def gen_loop(x_pl, hid_pl, count, f_state, eps_z, eps_x, pd, fun_dict): eps_z_t = tf.squeeze(tf.slice(eps_z, [tf.to_int32(count), 0, 0], [1, -1, -1]), axis=[0]) eps_x_t = tf.squeeze(tf.slice(eps_x, [tf.to_int32(count), 0, 0], [1, -1, -1]), axis=[0]) x_t, f_out, f_state = generation(hid_pl, f_state, eps_z_t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def iterate(self):\n for i in range(self.generations):\n sorted_polulation = sorted(self.data, key=lambda item: - item.fitness_function(item))\n print(\n [item.to_string() for item in sorted_polulation[:8]],\n [round(item.fitness_function(item),2) ...
[ "0.6084154", "0.60200095", "0.5987702", "0.5944604", "0.5869606", "0.58060366", "0.5777766", "0.57663774", "0.57506156", "0.57447004", "0.5744184", "0.5738231", "0.5735162", "0.5731313", "0.57287484", "0.5708319", "0.5682771", "0.5663186", "0.5659958", "0.5632665", "0.5632278...
0.6012473
2
function wrapper to assign the dicts. return value can be looped with tf.while_loop
def get_gen_loop_fun(param_dict, fun_dict): def f(x_pl, hid_pl, count, f_state, eps_z, eps_x): return gen_loop(x_pl, hid_pl, count, f_state, eps_z, eps_x, param_dict, fun_dict) return f
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _step(self) -> Dict[str, tf.Tensor]:\n\n # Pull out the data needed for updates/priorities.\n inputs = next(self._iterator)\n\n o_tm1, a_tm1, r_t, d_t, o_t = inputs.data\n keys, probs = inputs.info[:2]\n\n with tf.GradientTape() as tape:\n # Evaluate our networks.\n # `qv` means quanti...
[ "0.5671674", "0.5550421", "0.5465736", "0.54489744", "0.5430541", "0.5418484", "0.53735536", "0.53536373", "0.5325152", "0.53153545", "0.53073084", "0.526662", "0.52653", "0.52617794", "0.5245784", "0.52382976", "0.5237779", "0.52322906", "0.522094", "0.52148306", "0.5212006"...
0.0
-1
sequence length counter needed for while loop
def get_gen_stop_fun(num_iter): def gen_stop_fun(*args): count = args[2] return tf.less(count, num_iter) return gen_stop_fun
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count(seq):\n\treturn sum(1 for x in seq)", "def __len__(self):\n return self.get_num_sequence()", "def GetSequenceLength(num_nodes: int) -> int:\n return num_nodes * (3 + (num_nodes - 1) * 2)", "def _setup_next_sequence(cls):\n return 0", "def __len__(self):\n return len(self.seq...
[ "0.6761017", "0.67569274", "0.66916007", "0.6634269", "0.6609336", "0.6609336", "0.65568435", "0.64844733", "0.64844733", "0.6341952", "0.6317042", "0.6269344", "0.624352", "0.623329", "0.622913", "0.61457485", "0.61272085", "0.61186063", "0.6097058", "0.6026103", "0.60050267...
0.0
-1
Retrieve the set of tenants and associated data that this service instance is serving requests for.
def get_tenants(): # these are the tenant_id strings configured for the service - tenants_strings = conf.tenants result = [] # the tenants service is a special case, as it must be a) configured to serve all tenants and b) actually maintains # the list of tenants in its own DB. in this case, we retur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tenants(self):\n # print \"tenant list is %s\" % self.auth.tenants.list()\n if not self._tenancy:\n self._tenancy = {}\n for tenant in self.auth.tenants.list():\n t = Tenant(tenant, self)\n self._tenancy[t[\"name\"]] = t\n return self._te...
[ "0.7666496", "0.7551507", "0.7327521", "0.7190773", "0.69795996", "0.6883774", "0.66170615", "0.65354675", "0.62560654", "0.62347025", "0.6183546", "0.6130637", "0.6121122", "0.61209637", "0.61066383", "0.59755176", "0.5924605", "0.5888566", "0.58852446", "0.58799565", "0.586...
0.77167916
0
Return the config for a specific tenant_id from the tenants config.
def get_tenant_config(tenant_id): for tenant in tenants: if tenant['tenant_id'] == tenant_id: return tenant raise errors.BaseTapisError("invalid tenant id.")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_tenant_id(self, tenant_name):\n _url = \"http://\" + self.host_ip + \":35357/v2.0/tenants\"\n _headers = {'x-auth-token': self.cloud_admin_info['token_project']}\n _body = None\n\n response = self.request(\"GET\", _url, _headers, _body)\n if response is None:\n ...
[ "0.65135497", "0.64297974", "0.6343317", "0.63199764", "0.614862", "0.6080383", "0.6076917", "0.602286", "0.5951957", "0.5922034", "0.5922034", "0.5922034", "0.5922034", "0.5922034", "0.5922034", "0.5922034", "0.5922034", "0.5922034", "0.5922034", "0.5848894", "0.5848894", ...
0.90069056
0
Allinone convenience function for implementing the basic Tapis authentication and authorization on a flask app. Pass authn_callback, a Python callable, to handle custom authentication mechanisms (such as nonce) when a JWT is not present. (Only called when JWT is not present; not called when JWT is invalid. Pass authz_c...
def authn_and_authz(authn_callback=None, authz_callback=None): authentication(authn_callback) authorization(authz_callback)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def basic_auth_required(realm=None, test_func=None, callback_func=None):\r\n if realm is None:\r\n realm = getattr(settings, 'HTTP_AUTHENTICATION_REALM', _('Restricted Access'))\r\n if test_func is None:\r\n test_func = lambda u: u.is_authenticated()\r\n\r\n def decorator(view_func):\r\n ...
[ "0.63016653", "0.6183594", "0.6033451", "0.58979934", "0.5873151", "0.5845127", "0.58035785", "0.58035785", "0.5727074", "0.57164025", "0.57164025", "0.57054675", "0.5703795", "0.56947964", "0.5664348", "0.56487954", "0.56346077", "0.56199163", "0.5616812", "0.56149024", "0.5...
0.70336246
0
Adds the standard Tapis headers to the flask thread local.
def add_headers(): # the actual access token - g.x_tapis_token = request.headers.get('X-Tapis-Token') # the tenant associated with the subject of the request; used, for instance, when the subject is different # from the subject in the actual access_token (for example, when the access_token represents a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_app_headers(self, app: Flask) -> Flask:\n app.after_request(self.add_report_to_headers)\n app.after_request(self.add_csp_headers)\n return app", "def setup_request_headers(self, uri: str = None) -> dict:\n\n uri = uri if uri is not None else self.host\n headers = {\n ...
[ "0.6606569", "0.5847463", "0.58139145", "0.5724754", "0.56415623", "0.5594848", "0.5594848", "0.54990697", "0.5450078", "0.54261225", "0.54148436", "0.5409216", "0.5407132", "0.5405232", "0.5381111", "0.5372568", "0.5370171", "0.5361144", "0.53344506", "0.5326481", "0.5326137...
0.66597694
0
Attempts to validate the Tapis access token in the request based on the public key and signature in the JWT. This function raises NoTokenError if no token is present in the request. AuthenticationError if validation is not successful.
def validate_request_token(): if not g.x_tapis_token: raise errors.NoTokenError("No access token found in the request.") claims = validate_token(g.x_tapis_token) g.token_claims = claims g.username = claims.get('username') g.tenant_id = claims.get('tenant_id') g.account_type = claims.get(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_token(token):\n # first, decode the token data to determine the tenant associated with the token. We are not able to\n # check the signature until we know which tenant, and thus, which public key, to use for validation.\n try:\n data = jwt.decode(token, verify=False)\n except Except...
[ "0.7679794", "0.6713847", "0.6641467", "0.63084567", "0.6300321", "0.62817377", "0.62767637", "0.6245932", "0.6244816", "0.6241664", "0.6165352", "0.6150704", "0.61449933", "0.61445177", "0.61367255", "0.6129596", "0.6111446", "0.61058015", "0.60760295", "0.60264575", "0.5998...
0.66064703
3
Standalone function to validate a Tapis token.
def validate_token(token): # first, decode the token data to determine the tenant associated with the token. We are not able to # check the signature until we know which tenant, and thus, which public key, to use for validation. try: data = jwt.decode(token, verify=False) except Exception as e: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def validate_token(self, token):", "def testIsValidToken(self):\n self.assertTrue(TokenResource.isValidToken('aValidToken'),\n msg='Expected isValidToken to accept a valid token.')\n self.assertTrue(TokenResource.isValidToken(TokenResource.VALID_TOKEN_CHARS),\n ...
[ "0.8108974", "0.72230214", "0.71571887", "0.7112058", "0.7027039", "0.70232147", "0.70062846", "0.6983515", "0.6958597", "0.6922451", "0.6837688", "0.6833468", "0.68074733", "0.6803482", "0.6784022", "0.6780159", "0.6730123", "0.6601923", "0.65926063", "0.6585264", "0.6554804...
0.6933009
9
Return the RSA public key object associated with the string `pub_key`.
def get_pub_rsa_key(pub_key): return RSA.importKey(pub_key)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_pub_key(priv_key: rsa.RSAPrivateKey) -> rsa.RSAPublicKey:\n return priv_key.public_key()", "def get_pub_key(self):\n return \"RSA {0}\".format(self._cert.get_pubkey().bits)", "def generate_rsa_public_key(private_key: RSAPrivateKeyWithSerialization) -> RSAPublicKey:\n return private_key.pub...
[ "0.8029845", "0.75208515", "0.7244733", "0.70427233", "0.6896109", "0.687922", "0.6870712", "0.687044", "0.67752415", "0.67175937", "0.66782856", "0.66284066", "0.6616188", "0.6558369", "0.65399873", "0.6535473", "0.6520587", "0.6505804", "0.65016174", "0.6483023", "0.6481328...
0.9062827
0
Get the method that would be run by 'cmd' if appliable. The convention is that a cmd command translates to a do_cmd method.
def _getCommand(self, cmd): try: cmd_str = cmd.decode('utf-8') return getattr(self, 'do_' + cmd_str, None) except: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_method_name(self) -> Optional[str]:\n current_mode = self.get_mode()\n # Check that 'Solvent' program is enabled.\n # Retreiving the remaining time without\n # this programm being selected first would trigger\n # a key error when unpacking the device reply.\n if cu...
[ "0.64923793", "0.6431936", "0.6302069", "0.62959874", "0.6212672", "0.6197978", "0.618102", "0.6149444", "0.6144598", "0.6138146", "0.61116034", "0.6111449", "0.6092141", "0.6064855", "0.5992648", "0.5975918", "0.5930302", "0.5929651", "0.5921336", "0.59118223", "0.59087247",...
0.722417
0
Initialise a new L{SSHSimpleRealm} with proto as a protocol class.
def __init__(self, proto): self.proto = proto
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, protocol):\n\n # TODO: add client dictionary\n self._name = protocol['name']\n self._mode = protocol['mode']\n\n try:\n from minicps import __file__\n index = __file__.rfind('minicps')\n self._minicps_path = __file__[:index+7] + '/'\n\...
[ "0.5714169", "0.5532706", "0.5513191", "0.5436813", "0.5364067", "0.53378403", "0.5280844", "0.52689683", "0.52358013", "0.5210464", "0.51737493", "0.5153141", "0.5150517", "0.51443684", "0.5113164", "0.5068551", "0.505757", "0.5046438", "0.50045574", "0.49984568", "0.4985887...
0.5785138
0
Return a L{SSHSimpleAvatar} that uses ``self.proto`` as protocol.
def requestAvatar(self, avatarId, mind, *interfaces): if conchinterfaces.IConchUser in interfaces: avatar = SSHSimpleAvatar(avatarId, self.proto) return interfaces[0], avatar, lambda: None else: raise Exception("No supported interfaces found.")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __call__(self):\n \n p = self.protocol()\n p.factory = self\n return p", "def ssh(self, new=False, waitUp=True):\n if new:\n return Ssh(self, \"\".join([self.username, '@', self.url]))\n\n if self._ssh:\n return self._ssh\n\n self._ssh = ...
[ "0.5337256", "0.5119516", "0.5052636", "0.4982192", "0.49626386", "0.4958354", "0.4958292", "0.49484098", "0.49389306", "0.49389306", "0.49389306", "0.49307394", "0.49133503", "0.48593906", "0.48505425", "0.48438805", "0.48305398", "0.480467", "0.478909", "0.4756514", "0.4752...
0.48853382
13
Initialises a new L{SSHKeyDirectory}.
def __init__(self, baseDir, parseKey=keys.Key.fromString): self.baseDir = baseDir self.parseKey = parseKey
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, type_encryption, directory_key_private, directory_key_public):\n\t\t# class variables\n\t\tself.type_encryption = type_encryption\n\t\tself.directory_key_private = directory_key_private\n\t\tself.directory_key_public = directory_key_public\n\n\t\t# check keys\n\t\tself._publicKey = ''\n\t\tself....
[ "0.60577464", "0.594606", "0.5861696", "0.5753003", "0.5698743", "0.56884545", "0.5672525", "0.55618393", "0.55471104", "0.5519805", "0.5516461", "0.5475223", "0.5460106", "0.54503596", "0.54401225", "0.54034656", "0.5368837", "0.53590226", "0.5354195", "0.53359336", "0.53329...
0.5662154
7
Return a L{SSHKeyDirectory} based SSH service with the given parameters. Authorized keys are read as per L{SSHKeyDirectory} with ``baseDir`` being ``keyDir/users``.
def conch_helper(endpoint, proto=None, namespace=dict(), keyDir=None, keySize=4096): if keyDir is None: from twisted.python._appdirs import getDataDirectory keyDir = getDataDirectory() keyDir = filepath.FilePath(keyDir) keyDir.child('server').makedirs(True) keyDir.child...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_directory(self, key):\n raise NotImplementedError", "def _getSshDir():\n return f'{Path.home()}/.ssh'", "def __parse_user_keyfiles(self):\n\n user_sshdir = os.path.expanduser('~/.ssh')\n if not os.path.isdir(user_sshdir):\n return\n\n paths = []\n fo...
[ "0.5406035", "0.53994006", "0.5377558", "0.5355839", "0.5331604", "0.52853525", "0.5199522", "0.5053196", "0.5026986", "0.50190806", "0.49215123", "0.4920138", "0.49054453", "0.48647752", "0.48550653", "0.48274633", "0.48263925", "0.47565874", "0.47353023", "0.47316363", "0.4...
0.5810333
0
Draws an xz plane on the draw object of an image.
def xzplane(draw, r, y, shift = np.array([1000, 1000, 0, 0]), scale = 300): extent = 2.8 pln = np.array( [ [-extent,y,0], [extent,y,0], [extent,y,extent*2], [-extent,y,extent*2] ] ) pln = np.dot(pln, np.transpose...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def xyplane(draw, r, x, shift = np.array([1000, 1000, 0, 0]), scale = 300):\n extent = 2.8\n pln = np.array(\n [\n [x,-extent,0],\n [x,extent,0],\n [x,extent,extent*2],\n [x,-extent,extent*2]\n ]\n )\n pln = np.dot(pl...
[ "0.63721764", "0.59499615", "0.5940975", "0.58033735", "0.57672477", "0.5749017", "0.5720184", "0.56682396", "0.5658899", "0.5638984", "0.56374484", "0.5617872", "0.5594936", "0.5588465", "0.55832714", "0.5539843", "0.5516542", "0.5481384", "0.5468149", "0.54351264", "0.53915...
0.7278522
0
Draws an xy plane on the draw object of an image.
def xyplane(draw, r, x, shift = np.array([1000, 1000, 0, 0]), scale = 300): extent = 2.8 pln = np.array( [ [x,-extent,0], [x,extent,0], [x,extent,extent*2], [x,-extent,extent*2] ] ) pln = np.dot(pln,np.transpose(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def xzplane(draw, r, y, shift = np.array([1000, 1000, 0, 0]), scale = 300):\n extent = 2.8\n pln = np.array(\n [\n [-extent,y,0],\n [extent,y,0],\n [extent,y,extent*2],\n [-extent,y,extent*2]\n ]\n )\n pln = np.dot(pl...
[ "0.6190558", "0.61875355", "0.6105799", "0.60978365", "0.60453653", "0.600665", "0.600636", "0.6005123", "0.5991991", "0.5984115", "0.58482707", "0.58322734", "0.58114034", "0.58027637", "0.580153", "0.5790779", "0.57654315", "0.57646567", "0.57402414", "0.5721477", "0.570749...
0.6882824
0
Creates a multisig wallet.
def create_multisig_wallet(cls, keystores: Sequence, multisig_type: str, gap_limit=None): store = storage.WalletStorage('if_this_exists_mocking_failed_648151893') for i, ks in enumerate(keystores): cosigner_index = i + 1 store.put('x%d/' % cosigner_index, ks.dump()) store...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_wallet(self, walletName):\n return", "def createwallet(wipe):\n stm = shared_morphene_instance()\n if mph.rpc is not None:\n mph.rpc.rpcconnect()\n if mph.wallet.created() and not wipe:\n wipe_answer = click.prompt(\"'Do you want to wipe your wallet? Are your sure? This i...
[ "0.6475591", "0.61685926", "0.58137155", "0.5811275", "0.57452744", "0.5626184", "0.5559449", "0.5492333", "0.5454424", "0.5401065", "0.5399363", "0.53674704", "0.53329164", "0.5268474", "0.5243381", "0.5242668", "0.52220947", "0.520208", "0.52008766", "0.5174029", "0.5087774...
0.7653589
0
Converts date string into UTC datetime object
def str_to_datetime(self, dt_string): return datetime.datetime.strptime(dt_string, "%Y-%m-%d").replace( tzinfo=timezone.utc) if dt_string is not None else datetime.datetime.utcnow()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_datetime(datestr):\r\n try:\r\n return dateutil.parser.parse(datestr).replace(tzinfo=utc)\r\n except ValueError:\r\n raise DashboardError(_(\"Unable to parse date: \") + datestr)", "def parse(date_string: str):\n # parse the date string\n date = dateutil.parser.parse(date_stri...
[ "0.7567312", "0.754763", "0.754763", "0.75145286", "0.73969394", "0.7324327", "0.7264657", "0.7232909", "0.7204877", "0.7177064", "0.71701044", "0.71201634", "0.7108171", "0.7096173", "0.7055034", "0.70515555", "0.70351195", "0.7005439", "0.6998112", "0.6957853", "0.6954065",...
0.72054285
8
Detect couriers for tracking number. Add any optional parameters as kwargs when calling the method. An overview can be found at
async def detect_couriers_for_tracking_number(self, tracking_number, **kwargs): headers = { 'aftership-api-key': self.api_key, 'Content-Type': 'application/json' } url = "{}/couriers/detect".format(URL) data = {} ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, routine, **kw):\n super().__init__(routine=routine, **kw)\n # FIXME: use general parameters from FindFrequency for now\n self.parameter_lookups = self.routine.parameter_lookups\n self.parameter_sublookups = self.routine.parameter_sublookups\n ...
[ "0.5049607", "0.49687684", "0.49674186", "0.4944877", "0.49375364", "0.4890782", "0.48639542", "0.47709024", "0.47329307", "0.46712676", "0.4589541", "0.4587399", "0.45867696", "0.45704305", "0.45490083", "0.45390007", "0.45230392", "0.45195344", "0.45174828", "0.4509526", "0...
0.64663106
0
Return the last meta response.
def meta(self): return self._meta
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_model_api_last_response(self):\n return self._last_response", "def meta(self):\r\n url = '{0}/{1}'.format(self.get_url(), 'meta')\r\n\r\n return http.Request('GET', url), parsers.parse_json", "def last(self):\n data = self._http_get(\"last\")\n return data.json()", ...
[ "0.66965777", "0.66848415", "0.63479745", "0.634627", "0.632676", "0.6163344", "0.6144499", "0.6102744", "0.5884768", "0.5876844", "0.58724266", "0.5859006", "0.58491874", "0.5838473", "0.5800524", "0.57896864", "0.57868093", "0.5754891", "0.57464105", "0.57243663", "0.570871...
0.6036977
10
This is the main receiver code
def process_message(msg): global fout print("received ") if len(msg)==200: #is header or end msg_in=msg.decode("utf-8","ignore") msg_in=msg_in.split(",,") if msg_in[0]=="header": #header filename=extract_file_data(msg_in[1]) file_out="copy-"+filename fout=open(file_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def receive(self):\n pass", "def receiver():\r\n global data\r\n DW1000.newReceive()\r\n DW1000.receivePermanently()\r\n DW1000.startReceive()", "def receive():\n pass", "def receive(self, message):", "def receiver(): \n global data\n DW1000.newReceive()\n DW1000.receivePe...
[ "0.76090187", "0.71404535", "0.7065118", "0.7059495", "0.70585096", "0.6973347", "0.6973347", "0.6973347", "0.69117665", "0.6830646", "0.6703256", "0.6566006", "0.6476829", "0.6430624", "0.6395208", "0.6376315", "0.6376315", "0.6376315", "0.6376315", "0.6376315", "0.6376315",...
0.0
-1
Converts a datetime instance to an HTTP date string.
def dt_to_http(dt): # Tue, 15 Nov 1994 12:45:26 GMT return dt.strftime('%a, %d %b %Y %H:%M:%S GMT')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def httpdate(date_obj):\n return date_obj.strftime(\"%a, %d %b %Y %H:%M:%S GMT\")", "def http_date(d=None):\n if not d:\n d = datetime.datetime.utcnow()\n return d.strftime(\"%a, %d %b %Y %H:%M:%S GMT\")", "def http_date(epoch_seconds=None):\n return formatdate(epoch_seconds, usegmt=True)", ...
[ "0.7712367", "0.73308283", "0.70412636", "0.69220614", "0.674512", "0.66672254", "0.6651549", "0.6576911", "0.6574302", "0.6549761", "0.6496985", "0.6476049", "0.6476049", "0.6464428", "0.6451866", "0.63511235", "0.63375556", "0.62699145", "0.62502176", "0.6221522", "0.622039...
0.7186173
3
Converts a dict of params to an actual query string.
def to_query_str(params): if not params: return '' # PERF: This is faster than a list comprehension and join, mainly # because it allows us to inline the value transform. query_str = '?' for k, v in params.items(): if v is True: v = 'true' elif v is False: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_query_string(params: Optional[Dict[str, Any]] = None) -> str:\n if params is None:\n return ''\n components = []\n for key, value in params.items():\n if isinstance(value, (list, tuple, set)):\n for v in value:\n c = '='.join([key, quote_plus(str(v))])\n ...
[ "0.78997064", "0.77389985", "0.7303582", "0.7127169", "0.70824003", "0.6948749", "0.6851403", "0.68277687", "0.68115485", "0.68115485", "0.67238486", "0.66717523", "0.6662173", "0.6593251", "0.6551027", "0.6503054", "0.6491908", "0.6478017", "0.6459579", "0.6337528", "0.63150...
0.8021034
0
Code from Stack Overflow's thread 2D gaussian mask should give the same result as MATLAB's fspecial('gaussian',[shape],[sigma])
def gauss_2d(shape=(3, 3), sigma=0.5): m, n = [(ss - 1.) / 2. for ss in shape] y, x = np.ogrid[-m:m + 1, -n:n + 1] h = np.exp(-(x * x + y * y) / (2. * sigma * sigma)) h[h < np.finfo(h.dtype).eps * h.max()] = 0 sumh = h.sum() if sumh != 0: h /= sumh return h
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fspecial_gaussian(shape=(3, 3), sigma=0.5):\n m, n = [(ss - 1.) / 2. for ss in shape]\n y, x = np.ogrid[-m:m + 1, -n:n + 1]\n h = np.exp(-(x * x + y * y) / (2. * sigma * sigma))\n h[h < np.finfo(h.dtype).eps * h.max()] = 0\n sumh = h.sum()\n if sumh != 0:\n h /= sumh\n return h", ...
[ "0.78761524", "0.7835241", "0.7257477", "0.7124766", "0.7013949", "0.6976483", "0.69737065", "0.6862989", "0.6862989", "0.68552184", "0.6814549", "0.67824596", "0.677597", "0.67612404", "0.6757782", "0.67248285", "0.6699591", "0.66922706", "0.66522694", "0.6613883", "0.661035...
0.6392105
37
This function is the entry point for making requests.
def _make_get_request(self,url,object_fh,params=None,return_type=None,extras=None): if params is None: params = {} if extras is None: extras = {} #Polite Pool Work #--------------------------------------- #Example ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _make_request(self):\n try:\n self.response = requests.request(\n method=self.method,\n url=self.url,\n params=self.params,\n data=self.data,\n )\n\n logger.debug(f\"Request URL: {self.response.url}\")\n\n ...
[ "0.6656559", "0.66180503", "0.6486032", "0.64114904", "0.63888973", "0.63717866", "0.63412136", "0.63108295", "0.6291359", "0.62690324", "0.62436515", "0.61723375", "0.6147059", "0.6139604", "0.61257833", "0.6107213", "0.6097222", "0.6091524", "0.60824835", "0.6058591", "0.60...
0.61050695
16
n_random not supported select not supported
def funders(self,filter=None,n_rows=None, offset=None,query=None,sort_by=None,order=None, facet=None,cursor=None,return_type=None): params = self._options_to_dict(filter=filter,n_rows=n_rows, n_random=None,offset=offset,query=query, so...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Chose_rand():\r\n total_list=list(range(1,467681))\r\n select=13788\r\n random_selected= random.sample(total_list,select)\r\n return (random_selected)", "def choose_random(N):\n db = pymongo.MongoClient('localhost',27020).chembldb\n # Get all CHEMBL IDs\n db.molecules.ensure_index('chemb...
[ "0.6967902", "0.69522023", "0.6594779", "0.6483721", "0.6418708", "0.64016896", "0.6392054", "0.6306159", "0.63005924", "0.6261867", "0.62477386", "0.622141", "0.622141", "0.6192581", "0.6178769", "0.6147042", "0.61248004", "0.61128944", "0.61124444", "0.6070057", "0.60632735...
0.0
-1
??? This seems to return all licenses Example Data .URL .workcount
def licenses(self,filter=None,n_rows=None,n_random=None, offset=None,query=None,sort_by=None,order=None, facet=None,cursor=None,select=None,return_type=None): params = self._options_to_dict(filter=filter,n_rows=n_rows, n_random=n_random,offset=offs...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_resource_license_resource_count_list(self):\n pass", "def example_data():\n return [\n {'id': 'cc-by', 'title': {'en': 'Creative Commons Attribution'},\n 'type': 'licenses'},\n {'id': 'cc0', 'title': {'en': 'Creative Commons Zero'},\n 'type': 'licenses'},\n ...
[ "0.632174", "0.6099382", "0.59777987", "0.58566386", "0.576463", "0.55406904", "0.54988503", "0.5466911", "0.54048777", "0.5387021", "0.53721786", "0.5370196", "0.5367013", "0.5332364", "0.5319262", "0.53074574", "0.52883095", "0.5281296", "0.5277077", "0.52634877", "0.522953...
0.0
-1
Examples from crossref.api import API api = API() doi = '10.1016/j.urology.2023.01.012' result = api.works_doi(doi)
def works_doi(self,doi,return_type=None): params = {} url = self.BASE_URL + f'works/{doi}/' return self._make_get_request(url,None,params,return_type)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def doi_info(self,doi):\n \n doi = _clean_doi(doi)\n \n url = self.BASE_URL + 'works/' + doi\n \n try:\n return self._make_get_request(url,models.work_single)\n except errors.RequestError:\n #TODO: Check for 404\n #last_response.stat...
[ "0.6810304", "0.6086377", "0.60213614", "0.5970753", "0.5929596", "0.59263915", "0.5889747", "0.5857135", "0.5758046", "0.5643174", "0.55543613", "0.5549364", "0.5461784", "0.54591", "0.5457254", "0.5441897", "0.5428848", "0.53719085", "0.5350076", "0.5324575", "0.53110355", ...
0.8207812
0
Returns crossref.models.Work If the DOI is not found the errors.InvalidDOI exception is raised. Example import crossref api = crossref.API() m = api.doi_info('10.1109/TNSRE.2011.2163145')
def doi_info(self,doi): doi = _clean_doi(doi) url = self.BASE_URL + 'works/' + doi try: return self._make_get_request(url,models.work_single) except errors.RequestError: #TODO: Check for 404 #last_response.status_code ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def works_doi(self,doi,return_type=None):\n \n params = {}\n \n url = self.BASE_URL + f'works/{doi}/'\n return self._make_get_request(url,None,params,return_type)", "def get_doi(self):\n\n return self._dois", "def doi(self):\n return LiteratureReader(self.record...
[ "0.6677814", "0.6116707", "0.6039603", "0.5952847", "0.58862245", "0.58078146", "0.57711214", "0.569314", "0.55778825", "0.5530802", "0.54897994", "0.54798776", "0.54640657", "0.5429963", "0.54216063", "0.5377707", "0.53602475", "0.53576905", "0.532476", "0.53072464", "0.5269...
0.7794295
0
Returns metadata for the DOI owner prefix Returns crossref.models.Prefix Implements /prefixes/{owner_prefix} Example Data
def prefix_info(self,prefix_id): url = self.BASE_URL + 'prefixes/' + prefix_id return self._make_get_request(url,models.prefix_single)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prefix(self):\n return self[\"prefix\"]", "def prefix(self):\n return self[\"prefix\"]", "def get_by_metadata_prefix(metadata_prefix):\n return OaiMetadataFormat.get_by_metadata_prefix(\n metadata_prefix=metadata_prefix\n )", "def prefix(self) -> typing.Optional[str]:\n ...
[ "0.64397043", "0.64397043", "0.622263", "0.59024286", "0.59024286", "0.59024286", "0.585944", "0.5855058", "0.58408695", "0.58408695", "0.58408695", "0.5816162", "0.57742304", "0.57204545", "0.57204545", "0.5717945", "0.5713031", "0.5652193", "0.5652193", "0.56421614", "0.550...
0.6969877
0
This doesn't seem to be all that useful, since it just returns the subset of work_types() Example api.work_type_info('journal')
def work_type_info(self,type_id): url = self.BASE_URL + 'types/' + type_id return self._make_get_request(url,models.pass_through)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_work_list_type_filter(self):\n # Login as simple user\n self.authenticate(self.user)\n\n # Get works list for type wt1\n # should return only work1 and work2\n response = self.client.get(self.url, {\"type\": \"wt1\"})\n self.assertEqual(response.status_code, s...
[ "0.6128776", "0.5625096", "0.55931836", "0.54858536", "0.5469247", "0.5398693", "0.5290816", "0.5184457", "0.5176279", "0.5157655", "0.51465964", "0.51203597", "0.51197135", "0.5115443", "0.5079298", "0.5057034", "0.50508094", "0.50491095", "0.5042974", "0.50390005", "0.50068...
0.667355
0
GIVEN a MultiChoiceQuestion with valid data WHEN this data has to be compared THEN assert it returns what is expected
def test_model_mc_question(mc_question_one_true): assert mc_question_one_true.answer1 == "a1" assert mc_question_one_true.answer1_correct == True assert mc_question_one_true.answer2 == "a2" assert mc_question_one_true.answer2_correct == False assert mc_question_one_true.answer3 == "a3" assert mc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_model_mc_question_all_true(mc_question_all_true):\n assert mc_question_all_true.answer1_correct == True\n assert mc_question_all_true.answer2_correct == True\n assert mc_question_all_true.answer3_correct == True", "def test_multi_choice_question_possibilities(self):\n my_step = WorkflowS...
[ "0.72464216", "0.6873948", "0.677739", "0.6737346", "0.6633856", "0.65543157", "0.6410493", "0.64002144", "0.638308", "0.63673925", "0.63080984", "0.6236714", "0.62363225", "0.622393", "0.6201957", "0.6161354", "0.61485213", "0.6138616", "0.61232615", "0.61002254", "0.6100149...
0.7110679
1
GIVEN a MultiChoiceQuestion where all questions are True WHEN this data has to be compared THEN assert it returns what is expected
def test_model_mc_question_all_true(mc_question_all_true): assert mc_question_all_true.answer1_correct == True assert mc_question_all_true.answer2_correct == True assert mc_question_all_true.answer3_correct == True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_model_mc_question(mc_question_one_true):\n assert mc_question_one_true.answer1 == \"a1\"\n assert mc_question_one_true.answer1_correct == True\n assert mc_question_one_true.answer2 == \"a2\"\n assert mc_question_one_true.answer2_correct == False\n assert mc_question_one_true.answer3 == \"a3...
[ "0.7324127", "0.67642087", "0.6470132", "0.64656526", "0.6461357", "0.64389974", "0.63520503", "0.63066167", "0.62987787", "0.6295936", "0.6269627", "0.6198932", "0.6155377", "0.60732865", "0.6065219", "0.6020827", "0.5968577", "0.5963992", "0.59543484", "0.59224224", "0.5921...
0.78412426
0
This is a decorator that lets us associate fixtures with one or more arbitrary types. We'll later use this type to determine what tests to run on the result
def typedfixture(*types, **kwargs): def fixture_wrapper(func): for t in types: registered_types.setdefault(t, []).append(func.__name__) return pytest.fixture(**kwargs)(func) return fixture_wrapper
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fixtures():", "def __fixture_decorator_factory(fixture_type):\n def fixture_method(func):\n MetaTestCase._fixture_accumulator[fixture_type].append(func)\n func._fixture_type = fixture_type\n return func\n return fixture_method", "def pytest_generate_tests(metafunc):\n if \"map...
[ "0.6420398", "0.63586724", "0.61313206", "0.58412457", "0.57845324", "0.56449497", "0.5609401", "0.5594321", "0.5594321", "0.54439896", "0.54254866", "0.54079115", "0.53840494", "0.5353019", "0.5349806", "0.53131664", "0.5305571", "0.5304818", "0.526498", "0.5259065", "0.5249...
0.7396351
0
Generates a btree node containing the given keys and children.
def __init__(self, keys, children): self.keys = keys self.children = children self.str_pos = None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_node_kml(self, d, children):\n return self.generate_leaf_kml(d, \"\\n\".join(children))", "def build_node(self,key):\n\t\tchildren = self.edges.loc[self.edges[self.parentkey]==key]\n\t\tparent = self.edges.loc[self.edges[self.childkey]==key]\n\t\tcontext = {'link':key}\n\t\tmixed_children = [self.b...
[ "0.6096955", "0.598687", "0.5864048", "0.5862965", "0.5818496", "0.58160436", "0.5708533", "0.56483185", "0.55681473", "0.55629885", "0.55351895", "0.55134845", "0.5472535", "0.547004", "0.5436146", "0.54358304", "0.54183835", "0.5415848", "0.53927886", "0.5363014", "0.534810...
0.57768047
6
Returns the number of key stored in self.
def num_keys(self): return len(self.keys)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getNumberOfKeys(self) -> int:\n ...", "def getKeyCount(self,\n key):\n if (self.hasKey(key) == 1):\n return self.__keyCount[key]\n else:\n return 0", "def getNoOfKeys(self):\n return len(self.__keyList)", "def size(self, key):\n ...
[ "0.8223332", "0.8059746", "0.772476", "0.7713106", "0.7676172", "0.7665692", "0.7628625", "0.76206857", "0.7604216", "0.7455673", "0.7455673", "0.74253446", "0.73838294", "0.7367744", "0.7305631", "0.73002994", "0.7284549", "0.7284549", "0.7281263", "0.72693294", "0.72623026"...
0.7749467
2
Returns the number of children in self.
def num_children(self): return len(self.children)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def child_count(self):\n\t\treturn len(self._children)", "def get_num_children(self):\n return len(self.children)", "def children_count(self):\n return len(self._children_ids)", "def n_children(self):\n ch = self.children\n return 0 if not ch else len(ch) + sum([c.n_children for c...
[ "0.9265085", "0.9214745", "0.90355635", "0.8766905", "0.8657029", "0.8415583", "0.8351195", "0.8347997", "0.830729", "0.82977325", "0.82969064", "0.8269557", "0.8222202", "0.819979", "0.8181198", "0.815542", "0.81494474", "0.81494474", "0.80688536", "0.8059617", "0.80556947",...
0.9027928
3
Checks whether self is a leaf.
def is_leaf(self): return self.num_children() == 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_leaf(self):\n return isinstance(self, Leaf)", "def is_leaf(self):\n if len(self.children) == 0: #If the Node has no children, it's a leaf\n return True\n else:\n return False", "def is_leaf(self):\n if len(self...
[ "0.8699565", "0.85564995", "0.85333204", "0.8457117", "0.845169", "0.84258795", "0.8417539", "0.84157974", "0.8409402", "0.8363046", "0.8351346", "0.83394974", "0.8338415", "0.83189255", "0.83147204", "0.82866836", "0.82800835", "0.82800835", "0.82800835", "0.82800835", "0.82...
0.8497543
3
Returns the index of the key preceding key in self. If all keys in self are smaller than key, then the returned index equals the number of keys in self.
def search(self, key): left = 0 right = self.num_keys() while right > left: mid = (left + right)//2 if self.keys[mid] >= key: right = mid else: left = mid + 1 return left
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def locate_predecessor(self, key):\r\n index = self.search(key)\r\n return index-1", "def locate_successor(self, key):\r\n index = 0\r\n while index < self.num_keys() and self.keys[index] <= key:\r\n index += 1\r\n return index", "def find_pos(self, _node, _key):\n...
[ "0.72809225", "0.6939995", "0.68590945", "0.68413186", "0.67561585", "0.66752625", "0.6412625", "0.63675463", "0.6203015", "0.6094198", "0.6082233", "0.6056718", "0.59587926", "0.593308", "0.5910885", "0.5910568", "0.5881031", "0.58729", "0.5737283", "0.5720458", "0.5712113",...
0.6353615
8
Returns the index of the key preceding key in self. If all keys in self are smaller than key, then the returned index equals the number of keys in self.
def linear_search(self, key): index = 0 while index < self.num_keys() and self.keys[index] < key: index += 1 return index
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def locate_predecessor(self, key):\r\n index = self.search(key)\r\n return index-1", "def locate_successor(self, key):\r\n index = 0\r\n while index < self.num_keys() and self.keys[index] <= key:\r\n index += 1\r\n return index", "def find_pos(self, _node, _key):\n...
[ "0.72809225", "0.6939995", "0.68590945", "0.68413186", "0.66752625", "0.6412625", "0.63675463", "0.6353615", "0.6203015", "0.6094198", "0.6082233", "0.6056718", "0.59587926", "0.593308", "0.5910885", "0.5910568", "0.5881031", "0.58729", "0.5737283", "0.5720458", "0.5712113", ...
0.67561585
4
Checks whether index is the index of key in self.
def contains_key_at(self, key, index): return index < self.num_keys() and self.keys[index] == key
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_key(self,index):\n\t\ttry:\n\t\t\tself.__get(index)\n\t\t\treturn True\n\t\texcept:\n\t\t\treturn False", "def __contains__(self, key):\n return (key in self.index)", "def __contains__(self, key):\n return key in self._index", "def is_index(self, key):\n if key not in self:\n ...
[ "0.80958515", "0.8080907", "0.7898593", "0.7691593", "0.76814926", "0.7461165", "0.7258421", "0.72347355", "0.72082126", "0.7156153", "0.71312", "0.70865715", "0.7085773", "0.70831966", "0.7078573", "0.7066213", "0.705248", "0.69911355", "0.69047403", "0.68976754", "0.6862757...
0.820087
0
Returns the smallest key in self's subtree.
def deep_min(self): node = self while not node.is_leaf(): node = node.children[0] return node.keys[0] if node.keys else None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_min(self):\n if self.root is None: # BC1\n return float('+inf')\n\n current = self.root\n while current.left is not None: # Traverse like a linked-list\n current = current.left\n\n return current.key", "def min(self):\n if not self.root:\n ...
[ "0.82188064", "0.8162049", "0.7955827", "0.77344906", "0.768402", "0.75149393", "0.7390059", "0.7334936", "0.7302149", "0.7246546", "0.7226745", "0.71841216", "0.7107352", "0.70095193", "0.69946045", "0.69824237", "0.696417", "0.6937441", "0.6906481", "0.69047743", "0.6857602...
0.76173735
5
Returns the largest key in self's subtree.
def deep_max(self): node = self while not node.is_leaf(): node = node.children[-1] return node.keys[-1] if node.keys else None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_max(self):\n if self.root is None: # BC1\n return float('-inf')\n\n current = self.root\n while current.right is not None: # Traverse like a linked-list\n current = current.right\n\n return current.key", "def max(self):\n if not self.root:\n ...
[ "0.81600595", "0.79450095", "0.74522495", "0.73599684", "0.7321719", "0.73032093", "0.7209396", "0.71139634", "0.7080734", "0.7050053", "0.69687974", "0.68866014", "0.6819253", "0.67932934", "0.6767476", "0.67378", "0.6650723", "0.66402555", "0.6632629", "0.66247076", "0.6565...
0.7431459
3
Returns the index of the key potentially preceding key in self. If no predecessor exists, then 1 is returned.
def locate_predecessor(self, key): index = self.search(key) return index-1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def predecessor(self, key):\r\n index = self.locate_predecessor(key)\r\n return self.keys[index] if index >= 0 else None", "def predecessor(self, key):\r\n node = self.root\r\n predecessor = None\r\n while node:\r\n index = node.locate_predecessor(key)\r\n ...
[ "0.7872401", "0.7589656", "0.6912195", "0.66506773", "0.63922715", "0.6348661", "0.63404214", "0.6321943", "0.6298526", "0.6276858", "0.6144792", "0.6108566", "0.6081407", "0.6023274", "0.59759766", "0.59638053", "0.5955006", "0.59512085", "0.5928223", "0.59244543", "0.592433...
0.8231871
0
Returns the key preceding key in self. If no predecessor exists, then None is returned.
def predecessor(self, key): index = self.locate_predecessor(key) return self.keys[index] if index >= 0 else None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def predecessor(self, key):\r\n node = self.root\r\n predecessor = None\r\n while node:\r\n index = node.locate_predecessor(key)\r\n if index >= 0:\r\n predecessor = node.keys[index]\r\n node = node.children[index+1] if not node.is_leaf() else No...
[ "0.81663084", "0.7901949", "0.7320799", "0.7194191", "0.7021487", "0.695712", "0.66491675", "0.65032935", "0.6382113", "0.63646156", "0.63179505", "0.62725496", "0.62594867", "0.62569416", "0.62057287", "0.6177524", "0.61598325", "0.61568946", "0.6125257", "0.6108996", "0.610...
0.86580616
0
Returns the key, in self's subtree, that precedes the indexth key in self.
def deep_predecessor(self, index): return self.children[index].deep_max()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_key_at_index(self, index):\n return self.chain_key.subkey(index)", "def locate_predecessor(self, key):\r\n index = self.search(key)\r\n return index-1", "def get_key(self, proxy_index):\n return self.treeItem(proxy_index)", "def __next__(self):\n\n nxt = next(self.t...
[ "0.7427632", "0.73217237", "0.68301684", "0.6672804", "0.6520573", "0.64545286", "0.64450806", "0.6401319", "0.63935626", "0.63909465", "0.6362552", "0.63624", "0.6286595", "0.62645453", "0.6250981", "0.6207541", "0.6196273", "0.61318624", "0.61301345", "0.6081644", "0.608085...
0.6196459
16
Returns the index of the key potentially succeeding key in self. If no successor exists, then the number of keys in self is returned.
def locate_successor(self, key): index = 0 while index < self.num_keys() and self.keys[index] <= key: index += 1 return index
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def successor(self, key):\r\n node = self.root\r\n successor = None\r\n while node:\r\n index = node.locate_successor(key)\r\n if index < node.num_keys():\r\n successor = node.keys[index]\r\n node = node.children[index] if not node.is_leaf() else...
[ "0.7063382", "0.70533043", "0.7016425", "0.6872748", "0.6482853", "0.6422271", "0.62887204", "0.6276225", "0.624498", "0.62333864", "0.6225246", "0.6175305", "0.6157319", "0.61103994", "0.61052746", "0.6092125", "0.6037587", "0.60236263", "0.597652", "0.59452987", "0.59405917...
0.7840635
0
Returns the key succeeding key in self. If no successor exists, then None is returned.
def successor(self, key): index = self.locate_successor(key) self.keys[index] if index < self.num_keys() else None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def successor(self, key):\r\n node = self.root\r\n successor = None\r\n while node:\r\n index = node.locate_successor(key)\r\n if index < node.num_keys():\r\n successor = node.keys[index]\r\n node = node.children[index] if not node.is_leaf() else...
[ "0.8028854", "0.73851246", "0.7282003", "0.7208794", "0.7198265", "0.6955634", "0.6844323", "0.6605388", "0.6567931", "0.64927167", "0.64615375", "0.64292336", "0.640851", "0.6341994", "0.6266964", "0.62656814", "0.6251835", "0.62339365", "0.62281877", "0.62220705", "0.621249...
0.80394524
0
Returns the key, in self's subtree, that succeeds the indexth key in self.
def deep_successor(self, index): return self.children[index+1].deep_min()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_key_at_index(self, index):\n return self.chain_key.subkey(index)", "def get_key(self, proxy_index):\n return self.treeItem(proxy_index)", "def __getitem__(self, item: int) -> int:\n return self.root[item].key", "def get_by_index_key(self, index, key=str):\n return str(self...
[ "0.7776442", "0.7432982", "0.7077935", "0.6845125", "0.68328536", "0.6783659", "0.6702943", "0.6666974", "0.6651412", "0.6620797", "0.6506993", "0.64967424", "0.64375025", "0.64341646", "0.64169234", "0.63980854", "0.6383009", "0.6362972", "0.63480264", "0.6338995", "0.633723...
0.0
-1
Inserts key in self.
def insert(self, key): index = self.search(key) self.keys.insert(index, key)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _insert(self, key):\n self.tree.insert(key)", "def insert(self, key, value):\n\t\tself.__insert(key, value, key[1:])", "def _insert_item(self, key: _KT, value: _VT) -> None:\n dict.__setitem__(self, key, value)", "def _insert(self, key, value):\n entry = self._lookup(key)\n if...
[ "0.8215291", "0.8130354", "0.7747777", "0.75291866", "0.7488285", "0.74673647", "0.7428965", "0.74166065", "0.7409694", "0.739464", "0.73516124", "0.73007077", "0.72898746", "0.7252617", "0.7230919", "0.7208782", "0.7203209", "0.7197184", "0.71301323", "0.71083945", "0.710483...
0.84677464
0
Deletes key from self.
def delete(self, key): index = self.search(key) if self.contains_key_at(key, index): del self.keys[index]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete(self, key):\n pass", "def delete(self, key):\n pass", "def delete(self, key):\n try: \n self.pop(key)\n \n except KeyError: \n raise KeyError", "def delete(self, key):", "def delete(self, key):\n raise NotImplementedError", "def d...
[ "0.86430204", "0.86430204", "0.8612833", "0.8520839", "0.8519579", "0.8519579", "0.85070837", "0.8474945", "0.8459517", "0.8453593", "0.8411753", "0.8394384", "0.83813727", "0.8342736", "0.83096606", "0.83096606", "0.816677", "0.8119352", "0.8118048", "0.8099478", "0.80872786...
0.8364644
13
Splits self's indexth child.
def split_child(self, index): child = self.children[index] median = (child.num_keys())//2 median_key = child.keys[median] left = Node(child.keys[:median], child.children[:median + 1]) right = Node(child.keys[median + 1:], child.children[median + 1:]) self.keys....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def child(self, index):\n self.__initChild()\n return self.__child[index]", "def left_child(self, index):\n return 2 * index", "def left_child(self, index):\n return 2 * index + 1", "def getChilds(self, index):\n return index, (2 * index) + 1, (2 * index) + 2", "def right...
[ "0.71440786", "0.71244633", "0.71180373", "0.70349526", "0.6969549", "0.68918955", "0.6713321", "0.65907323", "0.65504557", "0.6508575", "0.6449697", "0.64457214", "0.6435579", "0.63858145", "0.6366688", "0.634847", "0.6344875", "0.62523496", "0.6234957", "0.6202311", "0.6193...
0.7300562
0
Merges self's indexth keyi and its left and right children into a single node.
def merge_children(self, index): median_key = self.keys[index] left, right = self.children[index : index+2] left.keys.append(median_key) left.keys.extend(right.keys) if not right.is_leaf(): left.children.extend(right.children) del self.keys[index]...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transfer_key_counter_clockwise(self, index):\r\n left, right = self.children[index : index+2]\r\n left.keys.append(self.keys[index])\r\n\r\n if not right.is_leaf():\r\n left.children.append(right.children[0])\r\n del right.children[0]\r\n\r\n self.keys[index] =...
[ "0.63334984", "0.63204676", "0.62463367", "0.61867297", "0.61666614", "0.5982319", "0.59687746", "0.5849334", "0.57942855", "0.5774177", "0.57697964", "0.57500196", "0.57442075", "0.5695976", "0.5688016", "0.56424654", "0.56276697", "0.5625674", "0.5612786", "0.5512356", "0.5...
0.71881837
0
Returns self's indexth child after increasing its number of
def grow_child(self, index, min_num_keys): child = self.children[index] left_sibling = (index > 0) and self.children[index-1] right_sibling = (index < self.num_keys()) and self.children[index+1] if left_sibling and left_sibling.num_keys() > min_num_keys: self.transfer_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def right_child(self, index):\n return 2 * index + 1", "def get_parent_index(self, child):\n return (child-1)//2", "def parent(self, index):\n return index / 2", "def left_child(self, index):\n return 2 * index + 1", "def get_parent(self, index):\n return (index - 1) // (...
[ "0.7636268", "0.75757277", "0.7561977", "0.7540755", "0.74996656", "0.7438475", "0.7419933", "0.7398625", "0.73944867", "0.73817414", "0.73779047", "0.7339845", "0.7339434", "0.733684", "0.7296411", "0.7257258", "0.72059125", "0.7184709", "0.71317303", "0.7089428", "0.7061995...
0.6773244
32
Let child be self's indexth child and let sibling be child's left sibling. This method transfers the largest key of sibling to self, replacing its indexth key. Then the replaced key and the rightmost child of sibling are transferred to child.
def transfer_key_clockwise(self, index): left, right = self.children[index : index+2] right.keys.insert(0, self.keys[index]) if left.children: right.children.insert(0, left.children[-1]) del left.children[-1] self.keys[index] = left.keys[-1] del...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def grow_child(self, index, min_num_keys):\r\n child = self.children[index]\r\n left_sibling = (index > 0) and self.children[index-1]\r\n right_sibling = (index < self.num_keys()) and self.children[index+1]\r\n\r\n if left_sibling and left_sibling.num_keys() > min_num_keys:\r\n ...
[ "0.6706722", "0.66297823", "0.634008", "0.6338777", "0.6173428", "0.61367226", "0.6129858", "0.60990214", "0.60599846", "0.60426533", "0.59968555", "0.5979916", "0.5940587", "0.5929607", "0.5894123", "0.58354366", "0.5834681", "0.5830441", "0.5830441", "0.57984436", "0.579428...
0.6807251
0
Let child be self's indexth child and let sibling be the right sibling of child. This method transfers the smallest key of sibling to self, replacing its indexth key. Then the replaced key and the leftmost child of sibling are transferred to child.
def transfer_key_counter_clockwise(self, index): left, right = self.children[index : index+2] left.keys.append(self.keys[index]) if not right.is_leaf(): left.children.append(right.children[0]) del right.children[0] self.keys[index] = right.keys[0] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transfer_key_clockwise(self, index):\r\n left, right = self.children[index : index+2]\r\n right.keys.insert(0, self.keys[index])\r\n\r\n if left.children:\r\n right.children.insert(0, left.children[-1])\r\n del left.children[-1]\r\n\r\n self.keys[index] = left....
[ "0.68184465", "0.67039645", "0.6297882", "0.6214918", "0.60740006", "0.60549283", "0.6019058", "0.6003216", "0.5945567", "0.58862376", "0.5861213", "0.5845852", "0.5827546", "0.58161736", "0.57754976", "0.57537955", "0.5708677", "0.56796926", "0.56702685", "0.5666705", "0.566...
0.65648276
2
Returns a string representing self.
def __str__(self): T = Btree(2) T.root = Node(self.keys, [Node(child.keys, []) for child in self.children]) return str(T)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __repr__(self) -> str:\n return '{:s}({!r})'.format(self.__class__.__name__, self.getvalue())", "def __repr__(self) -> str:\n return '{:s}({!r})'.format(self.__class__.__name__, self.getvalue())", "def __repr__(self) -> str:\n return '{:s}({!r})'.format(self.__class__.__name__, self.ge...
[ "0.8629778", "0.8629778", "0.8629778", "0.86215127", "0.8617751", "0.859226", "0.859226", "0.859226", "0.859226", "0.85823804", "0.85522574", "0.8511063", "0.85021406", "0.8465271", "0.84598", "0.84598", "0.84598", "0.84598", "0.84598", "0.84598", "0.84598", "0.84598", "0...
0.0
-1
Returns an empty btree with the given degree.
def __init__(self, degree): self.root = Node([], []) self.min_num_keys = degree - 1 self.max_num_keys = 2*degree - 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def empty_trie():\n trie = Trie()\n return trie", "def create_empty_node():\n from linked_list import Node\n return Node()", "def generate_kdtree(self):\n if self.method==2:\n coordinates = self.unassigned_data[0:3,:]\n else:\n coordinates = self.unassigned_data[0:2,:]\n tree...
[ "0.54264593", "0.5319066", "0.5302084", "0.5298092", "0.5296648", "0.5273489", "0.5268416", "0.5260879", "0.52504086", "0.52388066", "0.52255917", "0.52025175", "0.5162751", "0.51332253", "0.51297206", "0.5105742", "0.51046455", "0.50928676", "0.50726986", "0.50614315", "0.50...
0.60590124
0
Searches for the given key in the btree. Returns a location pair (node, index), if the given key is found, and None otherwise.
def search(self, key): (node, index) = self.root, self.root.search(key) while not node.contains_key_at(key, index) and not node.is_leaf(): node = node.children[index] index = node.search(key) return (node, index) if node.contains_key_at(key, index) else None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search(self, key):\n if key in self.key_list:\n return (self.nodes)[key]\n return None", "def search(self, key):\n\n current = self.head\n\n while current:\n if current.data == key:\n return current\n else:\n current =...
[ "0.7536763", "0.7263329", "0.7258225", "0.7240818", "0.7216984", "0.7094803", "0.704646", "0.70330936", "0.7024418", "0.701099", "0.6984862", "0.6956169", "0.6842266", "0.68282413", "0.6815757", "0.67921466", "0.676543", "0.6735953", "0.6735286", "0.67308915", "0.67175317", ...
0.8333514
0
Returns the predecessor of key in the btree if a predecessor exists and None otherwise.
def predecessor(self, key): node = self.root predecessor = None while node: index = node.locate_predecessor(key) if index >= 0: predecessor = node.keys[index] node = node.children[index+1] if not node.is_leaf() else None return ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def predecessor(self, key):\r\n index = self.locate_predecessor(key)\r\n return self.keys[index] if index >= 0 else None", "def get_predecessor(self, key):\r\n parent_node, search_node = self.__compare(key, method='search')\r\n self.__check_node(search_node)\r\n\r\n # if the no...
[ "0.87234277", "0.81638896", "0.8081363", "0.79326314", "0.7544297", "0.70686626", "0.6950241", "0.66327226", "0.6330043", "0.6280026", "0.61215246", "0.59075844", "0.58937025", "0.58603984", "0.58209646", "0.57893604", "0.5765395", "0.57520866", "0.5751986", "0.5748757", "0.5...
0.86200005
1
Returns the successor of key in the btree if a successor exists and None otherwise.
def successor(self, key): node = self.root successor = None while node: index = node.locate_successor(key) if index < node.num_keys(): successor = node.keys[index] node = node.children[index] if not node.is_leaf() else None retu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def successor(self, key):\r\n index = self.locate_successor(key)\r\n self.keys[index] if index < self.num_keys() else None", "def successor(self, key: int) -> TreeNode:\n tree_node = self.search(key, possible_parent=True)\n if tree_node:\n if tree_node.right and tree_node.v...
[ "0.81975126", "0.7886115", "0.7700922", "0.71824485", "0.6839009", "0.67402244", "0.6659933", "0.65732276", "0.6505783", "0.6441283", "0.64137965", "0.63921624", "0.63333684", "0.6327468", "0.63146824", "0.6298344", "0.6289164", "0.6283962", "0.6269921", "0.6258933", "0.62448...
0.8570802
0
Inserts key in the btree.
def insert(self, key): if self.root.num_keys() == self.max_num_keys: self.root = Node([], [self.root]) self.root.split_child(0) node = self.root while not node.is_leaf(): index = node.search(key) child = node.children[index] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _insert(self, key):\n self.tree.insert(key)", "def insert(self, key):\r\n index = self.search(key)\r\n self.keys.insert(index, key)", "def insert(self, key):\n # Create new node\n n = TreeNode(key)\n if not self.node:\n self.node = n\n self.no...
[ "0.80723226", "0.7769577", "0.76046723", "0.7550876", "0.7482923", "0.7411101", "0.73503846", "0.73227596", "0.7145061", "0.713891", "0.7106708", "0.7089842", "0.7040802", "0.70233256", "0.69976085", "0.6994933", "0.69864684", "0.6960579", "0.69592124", "0.6953528", "0.693474...
0.7746731
2
Deletes key from the btree.
def delete(self, key): node = self.root while not node.is_leaf(): index = node.search(key) if node.contains_key_at(key, index): left, right = node.children[index : index+2] if left.num_keys() > self.min_num_keys: node...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete(self, key):\n self.tree.delete(key)", "def deleteKey(self, key):\n key.delete()", "def delete(self, key):\r\n index = self.search(key)\r\n if self.contains_key_at(key, index):\r\n del self.keys[index]", "def delete(self, key):", "def _delete_key(self):\n ...
[ "0.7991843", "0.79806525", "0.78956145", "0.789383", "0.7867929", "0.7845178", "0.7845178", "0.7822401", "0.77904487", "0.77550066", "0.77327126", "0.7691955", "0.76657486", "0.76657486", "0.7637523", "0.7621908", "0.7568555", "0.75683135", "0.7559642", "0.75456744", "0.75188...
0.76733583
12
Generates the keys of the btree in nondecreasing order.
def inorder(self): queue = [] node = self.root index = 0 while node: if node.is_leaf(): yield from node.keys if not queue: node = None else: node, index = queue.pop() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __gen_keys__(self):\n if self.seed == b'':\n self.seed = urandom(self.seed_size)\n\n n_prev = Node(hash=hash_factory(data=bytes(self.seed)).digest())\n self.keys.insert(0, n_prev)\n\n for i in range(1, self.l + 1):\n n = Node(hash=hash_factory(data=bytes(n_prev...
[ "0.7092828", "0.6634701", "0.60903746", "0.60409904", "0.59731305", "0.59087855", "0.58942914", "0.57111263", "0.57087433", "0.5708065", "0.56831133", "0.56762445", "0.5663076", "0.56439334", "0.5626762", "0.5597993", "0.55945045", "0.55350876", "0.55234456", "0.5508163", "0....
0.60486114
3
Generates the nodes of the btree in breathfirst order.
def breadth_first_search(self): queue = [self.root] while queue: node = queue.pop() yield node queue.extend(node.children)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _breadthfirst(self,root, action=lambda nodes: print(nodes)):\n nodes = []\n breadth = Queue()\n visited = []\n\n breadth.enqueue(root)\n visited.append(root)\n\n while breadth.front:\n front = breadth.dequeue()\n nodes.append(front.value)\n\n ...
[ "0.6592182", "0.6576818", "0.65263", "0.6493668", "0.64677995", "0.64018893", "0.6374469", "0.631121", "0.6179695", "0.61257946", "0.60737664", "0.6021041", "0.59558225", "0.5927343", "0.58865863", "0.58744186", "0.58461434", "0.5842087", "0.58408606", "0.583984", "0.58299184...
0.5814027
21
Generates the nodes of the btree in depthfirst order.
def depth_first_search(self): queue = [self.root] ordered = [] while queue: node = queue.pop() ordered.append(node) queue.extend(node.children) while ordered: yield ordered.pop()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gen_nodes(self):\n self.nodes = []\n for i in range(self.num_nodes):\n self.nodes.append(Node(self.fk))", "def bfs_nodes_generator(graph, source, reverse=...):\n ...", "def _forest_nodes(self):\n\n self.arbor._grow_tree(self)\n root = self.root\n for link in...
[ "0.6897027", "0.6522184", "0.643602", "0.63939285", "0.636438", "0.63289636", "0.6324205", "0.6229833", "0.6213625", "0.6175851", "0.6126817", "0.6121301", "0.60758805", "0.60136724", "0.5981834", "0.5974182", "0.5920892", "0.5901309", "0.5882063", "0.5875607", "0.5871025", ...
0.55194694
81
Returns a string representing the btree.
def __str__(self): levels = tuple(self.generate_levels()) self.compute_representation_positions() levels_to_strings = self.represent_tree_levels(levels) branches = self.represent_tree_branches(levels) return "".join("".join((level, "\n\n", branch)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\r\n T = Btree(2)\r\n T.root = Node(self.keys, [Node(child.keys, []) for child in self.children])\r\n return str(T)", "def __str__(self):\n tree_rows = [\n [\"Index\", str(self.index)],\n [\n \"Interval\",\n f\"{sel...
[ "0.7546317", "0.7204102", "0.7018558", "0.6907456", "0.6907456", "0.6722232", "0.6719562", "0.66999125", "0.66915786", "0.6672689", "0.66499346", "0.6554646", "0.6547603", "0.6458844", "0.6446414", "0.6432816", "0.6422437", "0.6398321", "0.63936335", "0.63900334", "0.63284117...
0.63268274
22
Generates the levels of the tree. Here, a level is a list containing the nodes of the corresponding level in the tree.
def generate_levels(self): level = (self.root,) while level: yield level level = tuple(child for node in level for child in node.children)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def represent_tree_levels(self, levels):\r\n prev_node_end = 0 \r\n level_string = []\r\n for level in levels:\r\n prev_node_end = 0 \r\n level_string = []\r\n for node in level: \r\n node_to_str = str(node.keys)\r\n space_between_...
[ "0.77440464", "0.70990723", "0.681317", "0.67359656", "0.6714505", "0.66331315", "0.6547001", "0.64071316", "0.638283", "0.6314174", "0.629522", "0.6271361", "0.6245086", "0.6224963", "0.62211055", "0.6192207", "0.6147419", "0.6091803", "0.60699326", "0.6028028", "0.6007356",...
0.8173879
0
Consider a node in the tree and define the label of a node be the string representation of its list of keys. This method computes the start position of the label of every node in the tree and stores the result in an attribute node.repr_pos
def compute_representation_positions(self): offset = 3 for node in self.depth_first_search(): if node.is_leaf(): node.str_pos = offset offset += len(str(node.keys)) + 2 else: first_child_mid = node.children[ 0].str_pos + ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _str(self):\n label = str(self.key)\n if self.left is None:\n left_lines, left_pos, left_width = [], 0, 0\n else:\n left_lines, left_pos, left_width = self.left._str()\n if self.right is None:\n right_lines, right_pos, right_width = [], 0, 0\n ...
[ "0.6528252", "0.650806", "0.61717063", "0.6095379", "0.5988239", "0.59429073", "0.591858", "0.5913944", "0.5873949", "0.58515847", "0.58018136", "0.5764564", "0.57590497", "0.5692352", "0.56786346", "0.5662169", "0.5628585", "0.56167775", "0.55897444", "0.55868715", "0.555483...
0.6413993
2
Generates the string representation of every level in the tree.
def represent_tree_levels(self, levels): prev_node_end = 0 level_string = [] for level in levels: prev_node_end = 0 level_string = [] for node in level: node_to_str = str(node.keys) space_between_nodes = node.str_pos ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n string = ''\n\n # gets the nodes at each level and puts the values into a string\n for i in range(self.get_height()+1):\n nodes = self.get_nodes_on_level(i)\n level = [str(node.value) if node else '-' for node in nodes]\n string += '{}\\n'....
[ "0.79816777", "0.7870697", "0.7510032", "0.7510032", "0.7411677", "0.7384896", "0.728976", "0.7282386", "0.72574866", "0.71412945", "0.7100166", "0.7081404", "0.70636654", "0.70597094", "0.70047724", "0.6962785", "0.6947879", "0.6914737", "0.69016016", "0.689865", "0.68854123...
0.78502977
2
Generates the string representation of the branches of every level in the tree.
def represent_tree_branches(self, levels): for level in levels[:-1]: branch = [] prev_child_mid = 0 for node in level: curr_child_mid = node.children[0].str_pos + len(str(node.children[0].keys))//2 space_between_children = curr_child_mid...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\r\n levels = tuple(self.generate_levels())\r\n self.compute_representation_positions()\r\n levels_to_strings = self.represent_tree_levels(levels)\r\n branches = self.represent_tree_branches(levels)\r\n\r\n return \"\".join(\"\".join((level, \"\\n\\n\", branch))...
[ "0.7995158", "0.71415323", "0.7092648", "0.6965924", "0.69347084", "0.69347084", "0.6869118", "0.67561233", "0.6710999", "0.6701027", "0.66574997", "0.6621628", "0.6544818", "0.6485891", "0.6470006", "0.6462897", "0.645523", "0.63816184", "0.63812333", "0.63696843", "0.635928...
0.79277086
1
Returns a code description of the given handshake
def code(action_sequence): # refuse any invalid action : if set(action_sequence) - set(CODE_MAP): # some action was not in the known ones. return '0' # per spec (test_unknown_action) mapdict = dict(zip(CODE_MAP, (1, 2, 4, 8))) da_code = [mapdict[action] for action in action_sequence] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handshake(code):\n # Get standardized binary string and reverse it to easily read left-ro-right\n scode = standardized_code(code)[::-1]\n if scode == _invalid_code: return _invalid_hshk\n # If input was valid, generate the list of actions that correspond to the\n # input 'code' by reading throug...
[ "0.7176368", "0.6627802", "0.60709524", "0.5658093", "0.5606787", "0.5603338", "0.55955744", "0.5593792", "0.5593628", "0.5551586", "0.55509025", "0.55008304", "0.545813", "0.5452217", "0.5406096", "0.5395542", "0.53359044", "0.52636343", "0.5240677", "0.5225355", "0.5209067"...
0.0
-1
Restore parameters to their default values
def restore_defaults(self): # Entry Widgets self.name.delete(0, tk.END) self.num_invest.delete(0, tk.END) self.num_flows.delete(0, tk.END) self.name.insert(0, self.ini_name) self.num_invest.insert(0, self.ini_num_invest) self.num_flows.insert(0, self.ini_num_flow...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def restore_parameters(self):\n for p in self.parameters:\n setattr(self, p, self.parameters[p].init_value)\n self.set_symmetry()", "def set_default_parameters(self):\n super().set_default_parameters()", "def _restore(self):\n self._logger = LOGGER\n self._param_st...
[ "0.746875", "0.7371194", "0.7262057", "0.7246145", "0.7239424", "0.7164283", "0.71043086", "0.7073957", "0.70345813", "0.70345813", "0.6979964", "0.6945354", "0.6928959", "0.69264185", "0.68758583", "0.6829242", "0.6829242", "0.6824344", "0.67598563", "0.6753171", "0.67494166...
0.0
-1
Empties all pending items in a queue and returns them in a list.
def dump_queue(queue): result = [] queue.put("STOP") for i in iter(queue.get, 'STOP'): result.append(i) # time.sleep(.1) return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pop_all(self):\n with self.lock:\n output = list(self.queue)\n self.queue.clear()\n\n return output", "def syncdequeue(self):\n #FIXME: Handle exceptions caused when some queue in the list might be empty\n temp=[]\n for itr, contextqueue in enumerate(s...
[ "0.7560036", "0.74379015", "0.73933333", "0.72794014", "0.7082574", "0.7025572", "0.69835323", "0.6933574", "0.6933574", "0.69274217", "0.6894741", "0.67466766", "0.6738973", "0.6546527", "0.6539666", "0.6518188", "0.64681697", "0.646041", "0.6407431", "0.6362687", "0.6346074...
0.61977243
27
Method to update config and set a default
def update_config(self, config): self.config = { "key": "", "display_name": "", "description": "", "required": 1, "type": "string" } self.config.update(config) self.API_KEY = self.config['github_api_key']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def conf_update(self):\n pass", "def _auto_update_configuration(self) -> None:\n self.config = rasa.utils.train_utils.update_confidence_type(self.config)\n rasa.utils.train_utils.validate_configuration_settings(self.config)\n self.config = rasa.utils.train_utils.update_similarity_type...
[ "0.7264598", "0.7069323", "0.6961064", "0.68372047", "0.6822155", "0.6778296", "0.67771703", "0.67771703", "0.6683653", "0.6655199", "0.66525483", "0.6628711", "0.66100997", "0.65775234", "0.6572172", "0.65567", "0.6530263", "0.6490007", "0.646487", "0.6441587", "0.6429744", ...
0.6605716
13
Property that is returned when the worker's current task is referenced
def task(self): return self._task
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_current_task():\r\n return current_task", "def _get_current_task():\r\n return current_task", "def task(self) -> base_model.BaseTask:\n return self._task", "def get_worker(self):\n return self.worker", "def worker(self):\n return self._worker", "def target(self):\n ...
[ "0.7258875", "0.7258875", "0.7125476", "0.7059717", "0.6981324", "0.6890757", "0.6786947", "0.6784656", "0.675614", "0.66428393", "0.66238403", "0.6599714", "0.65985817", "0.6598365", "0.6567491", "0.6450682", "0.64116323", "0.64116323", "0.641029", "0.6402253", "0.6399225", ...
0.7673366
4
entry point for the broker to add a task to the queue Adds this task to the queue, and calls method to process queue
def task(self, value): if value['job_type'] == "UPDATE" or value['job_type'] == "MAINTAIN": self._queue.put(value) if 'focused_task' in value: if value['focused_task'] == 1: logging.info("Focused task is ON\n") self.finishing_task = True ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_task(self, func, *args, **kwargs):\n self.queue.put((func, args, kwargs))", "def queue(self, *args, **kwargs):\n queue_args = self._pop_tq_add_args(kwargs)\n app = queue_args.pop('app', None) or flask.current_app\n\n with app.test_request_context():\n # flask.url_fo...
[ "0.7253905", "0.70889986", "0.70391834", "0.68631244", "0.67951286", "0.6636714", "0.6634228", "0.6612948", "0.6591344", "0.65668356", "0.65632844", "0.6521921", "0.64878726", "0.64713013", "0.6422268", "0.63997406", "0.6351592", "0.6346175", "0.63318634", "0.63318634", "0.63...
0.0
-1
Data collection and storage method Query the github api for contributors and issues (not yet implemented)
def badges_model(self, num): git_url = str(num) extension = "/en/projects/" + str(git_url) + ".json" url = self.config['endpoint'] + extension print("******************") print(url) logging.info("Hitting endpoint: " + url + " ...\n") r = requests.get(url=url) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_repo_data(gh, user, name, start, end):\n repo = gh.get_repo(name)\n\n commits = []\n issues = []\n\n all_commits = repo.get_commits(author=user, since=start, until=end)\n for commit in all_commits:\n # skip merge commits\n if len(commit.parents) == 1:\n commits.appen...
[ "0.6635733", "0.66275537", "0.65354526", "0.65154076", "0.64518225", "0.6380046", "0.63328266", "0.62949836", "0.6287409", "0.6218887", "0.61803705", "0.61606205", "0.61269826", "0.6107223", "0.6102897", "0.6024642", "0.60007703", "0.5956787", "0.595639", "0.5942637", "0.5914...
0.0
-1
Function to process each entry in the worker's task queue Determines what action to take based off the message type
def collect(self): while True: if not self._queue.empty(): message = self._queue.get() self.working_on = message['job_type'] else: break logging.info("Popped off message: {}\n".format(str(message))) if message['job_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _dispatch_messages(self):\n while True:\n select_obj = (yield)\n if select_obj == self._message_queue.selobj:\n msg = self._message_queue.get_nowait()\n if msg is not None:\n msg_type = msg.get('type', None)\n if m...
[ "0.65989715", "0.64549685", "0.63235414", "0.6317404", "0.62745744", "0.62171584", "0.6126182", "0.6099452", "0.6088659", "0.6075633", "0.6074768", "0.6067571", "0.6065684", "0.60568345", "0.601493", "0.6004395", "0.6", "0.598145", "0.5960497", "0.59493786", "0.5925146", "0...
0.6423937
2
Kicks off the processing of the queue if it is not already being processed Gets run whenever a new task is added
def run(self): logging.info("Running...\n") self._child = Process(target=self.collect, args=()) self._child.start()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def schdule(self):\n while self.queue:\n if self.processing >= self.maxProcessing:\n # We have reached the maximum number of parallel\n # tasks.\n break\n\n item, completeDeferred = self.queue.pop(0)\n\n self.processing += 1 ...
[ "0.69388866", "0.6733097", "0.67244655", "0.67082673", "0.66665846", "0.6658585", "0.6600161", "0.65939516", "0.65230006", "0.6475039", "0.6474375", "0.6474239", "0.6462289", "0.643574", "0.6401118", "0.6358066", "0.6355609", "0.6351405", "0.63341194", "0.63219726", "0.630714...
0.0
-1
Indicates if the group is discoverable for users to selfregister to it.
def discoverable(self): return sa.Column(sa.Boolean(), default=False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_registered(self) -> bool:\n from arkouda.util import is_registered\n\n if self.registered_name is None:\n return False\n return is_registered(self.registered_name)", "def can_group(self) -> bool:\n return (\n self.all_icon is not None and\n self...
[ "0.6570439", "0.6480385", "0.64103687", "0.63470215", "0.62850165", "0.62850165", "0.61633754", "0.6154956", "0.61019635", "0.607818", "0.60778564", "0.6061658", "0.60249096", "0.59742856", "0.5905762", "0.5863819", "0.58594495", "0.58562326", "0.5855537", "0.58496606", "0.58...
0.55592
65
Text containing the terms and conditions.
def terms(self): return sa.Column(sa.UnicodeText(), nullable=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def terms_and_conditions(request):\n\treturn render(request, 'tailored/terms_and_conditions.html', {})", "def __str__(self):\n value = []\n for term in self.terms:\n value += [term.termname]\n return '<formula: %s>' % ' + '.join(value)", "def __str__(self):\n value = []\n...
[ "0.7217661", "0.644716", "0.644716", "0.60568434", "0.59968853", "0.5941543", "0.59272987", "0.58720255", "0.58531255", "0.58456415", "0.58353406", "0.58314884", "0.57985574", "0.5666815", "0.5553111", "0.5552348", "0.5544842", "0.55418533", "0.5538942", "0.549686", "0.549234...
0.0
-1
Sorting priority weight of the group for resolving conflicting permissions.
def priority(self): # type: () -> GroupPriority if self._priority is not None: return self._priority if self.group_name == get_constant("MAGPIE_ANONYMOUS_GROUP"): self._priority = -1 # lowest of all for *special* public group elif self.group_name == get_constant(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _grokker_sort_key(args):\n grokker, name, obj = args\n return priority.bind().get(grokker)", "def getPriority(self):", "def priority(self):\n pass # pragma: no cover", "def priority(self):\n pass # pragma: no cover", "def _sort(self, groups):\n return sorted(groups, key=lam...
[ "0.6338274", "0.62321174", "0.61597615", "0.61597615", "0.61081684", "0.597041", "0.58988225", "0.587243", "0.5862533", "0.5848476", "0.58239365", "0.5780499", "0.5731992", "0.5679707", "0.5672135", "0.564723", "0.55861855", "0.55627245", "0.5561452", "0.5561452", "0.5561066"...
0.6633872
0
Returns all supported representation values that can be mapped to a valid status.
def allowed(cls): # type: () -> List[Str] names = cls.names() allowed = names allowed.extend([name.lower() for name in names]) return allowed
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid_statuses(self):\n return [\n \"dish_maintenance\",\n \"dish_ok\",\n \"RF_maintenance\",\n \"RF_ok\",\n \"digital_maintenance\",\n \"digital_ok\",\n \"calibration_maintenance\",\n \"calibration_ok\",\n ...
[ "0.70321226", "0.69514745", "0.6703547", "0.66662276", "0.66662276", "0.6600638", "0.60567725", "0.6023496", "0.6015762", "0.60128564", "0.58968663", "0.5772767", "0.5756744", "0.5754533", "0.5745289", "0.5745289", "0.5734405", "0.5720473", "0.569388", "0.5622869", "0.5609326...
0.0
-1