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
in this view the teacher can view other or their own posts information and its content with comments
def teacher_forum_read(request, post_id): # Deleting admin-typed user session # Deleting programmer-typed-user session # Get the current users current_basic_user = get_current_user(request, User, ObjectDoesNotExist) current_basic_user_profile = get_current_user_profile( request, Us...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post(self):\n subject = self.request.get('subject')\n content = self.request.get('post_content')\n post_id = self.request.get('post_id')\n post = Posts.get_by_id(int(post_id))\n user = self.get_active_user()\n user_id = int(user.key().id())\n\n if post and user ...
[ "0.70892215", "0.7027051", "0.6993676", "0.6992631", "0.69625515", "0.67901164", "0.6782363", "0.6731911", "0.6589651", "0.6572402", "0.6564665", "0.6538776", "0.65338194", "0.63951313", "0.6388007", "0.6384502", "0.635212", "0.6340285", "0.63027096", "0.62704444", "0.6267225...
0.62222695
27
in this view the teacher can update their own posts
def teacher_forum_update(request, post_id): # Deleting admin-typed user session # Deleting programmer-typed-user session # Get the current users current_basic_user = get_current_user(request, User, ObjectDoesNotExist) current_basic_user_profile = get_current_user_profile( request, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post_update():\n\n\n user_id = session['user_id']\n post = request.form.get('post')\n\n Update.add_update(user_id, post)\n\n return \"Updated Post\"", "def post(self):\n subject = self.request.get('subject')\n content = self.request.get('post_content')\n post_id = self.reques...
[ "0.719283", "0.71187025", "0.6917328", "0.69051486", "0.6806218", "0.6707744", "0.65740657", "0.6540123", "0.64509684", "0.6392218", "0.63798857", "0.63631964", "0.636004", "0.6351142", "0.6350981", "0.63290304", "0.63229775", "0.6306676", "0.6287355", "0.6259736", "0.6248741...
0.7201709
0
Called after every training iter to evaluate the results.
def after_train_iter(self, trainer: CLIPTrainer): unwrapped_model = getattr(trainer.model, 'module', trainer.model) logit_scale = unwrapped_model.clip_model.logit_scale logit_scale.data = torch.clamp(logit_scale.data, 0, 4.6052)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _evaluate_during_fit(self, test_loader, epoch):", "def evaluate(self):\n self.training = False", "def on_train_end(self):", "def after_train_iter(self, runner):\n if not self.enabled or (runner.iter % self.interval != 0):\n return\n\n # EMA\n self._ema_model()", "...
[ "0.7540861", "0.74407065", "0.7307486", "0.71198803", "0.7046394", "0.7030449", "0.6988127", "0.6908733", "0.68926156", "0.68738407", "0.685959", "0.68251514", "0.68121606", "0.67596513", "0.6704245", "0.6695779", "0.66937315", "0.66708964", "0.6656686", "0.6656203", "0.66471...
0.0
-1
This function returns the expected return of a policy.
def compute_expected_return_(domain, N, policy, p_init, s_init): pos = p_init speed = s_init expected_return = 0 for i in range(N): if domain.terminalState(pos, speed): break action = policy((pos, speed)) if isinstance(action,str): action = doma...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def policy(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"policy\")", "def policy(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"policy\")", "def policy(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"policy\")", "def get_policy(self):\n return self.ag...
[ "0.69697285", "0.69697285", "0.69697285", "0.6905277", "0.68301946", "0.68301946", "0.6812905", "0.6812905", "0.6812905", "0.6795406", "0.66836554", "0.6634797", "0.66274107", "0.66274107", "0.65744597", "0.6567626", "0.6544161", "0.65080476", "0.6495071", "0.64834815", "0.64...
0.6447522
22
Verify that an empty Project instance can be created
def test_empty(self): p = Project() assert isinstance(p, "Project") assert len(p.samples) == 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_empty_project_create(self):\n\n responses.add(\n responses.POST,\n self.host + \"/manager\",\n json={'message': \"Project name cannot be empty.\", 'status':\"error\"},\n status=200\n )\n\n with self.assertRaises(CreateError):\n se...
[ "0.7565686", "0.7472565", "0.7472565", "0.7472565", "0.7403371", "0.718804", "0.71662986", "0.7149225", "0.71124834", "0.7100387", "0.7081178", "0.7073791", "0.7022151", "0.70001334", "0.6987323", "0.69563067", "0.69153684", "0.688426", "0.68389845", "0.6823242", "0.68211466"...
0.7878026
0
A Capsule Network for Text Similarity.
def __init__(self, logger, p, h, save_folder, folder_name, word_embedding_weights, filters=[3,4,5,6,7], n_filter_out=30, capsule_num=5, capsule_dim=6, routings=3, lr=None, dr_rate=0.2, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def CapsNet(input_shape, n_class, routings):\n x = layers.Input(shape=input_shape)\n\n # Layer 1: Just a conventional Conv2D layer\n conv1 = layers.Conv2D(filters=256, kernel_size=7, strides=1, padding='valid', kernel_initializer='he_normal', activation='relu', name='conv1')(x)\n # conv1 = layers.Batch...
[ "0.60780746", "0.5440451", "0.5418689", "0.54040563", "0.5176601", "0.5173884", "0.5169176", "0.5153165", "0.5043501", "0.50323147", "0.49938765", "0.4992409", "0.49833193", "0.49833193", "0.4961386", "0.4961299", "0.4948286", "0.4947138", "0.49295563", "0.4928063", "0.490538...
0.0
-1
Get rss data from url, print single entry to show latest news, else give index number
def get_rss(limit): rss_data = feedparser.parse(URL) if limit == 1: title = rss_data.entries[0].title link = rss_data.entries[0].link rss_print(title, link) else: for i in range(0, limit): title = rss_data.entries[i].title link = rss_data.entries[i].li...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_news(url):\r\n \r\n # parse RSS feed into list of dictionaries\r\n feed = feedparser.parse(url)\r\n\r\n # no RSS feed articles for url\r\n if len(feed['entries']) == 0:\r\n return []\r\n \r\n # get first ten articles from the RSS feed\r\n news = []\r\n i = 0\r\n while T...
[ "0.75352377", "0.6732173", "0.66765153", "0.665058", "0.65504193", "0.6381726", "0.6367431", "0.63618726", "0.63228035", "0.6274171", "0.6259605", "0.6249335", "0.6235714", "0.623111", "0.62301534", "0.6225683", "0.6224893", "0.6210909", "0.6184807", "0.6138288", "0.61182076"...
0.69751287
1
item cf base contribution score by user
def base_contribute_score(): return 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def score(self):", "def scoring(self):\n pass", "def get_contribution_score(self):\n self._extract()\n for key in BitBucketEnum.USER_CONTRIBUTION_MAPPING:\n if key.high >= self.total_no_of_repos >= key.low:\n return BitBucketEnum.USER_CONTRIBUTION_MAPPING[key]\n ...
[ "0.620806", "0.61869097", "0.6163936", "0.61014056", "0.60496336", "0.5992737", "0.5977021", "0.59710246", "0.5925449", "0.59224397", "0.5915847", "0.5837098", "0.58159584", "0.5804917", "0.5716641", "0.5706325", "0.5704022", "0.569648", "0.5693049", "0.5656052", "0.5626995",...
0.66897124
0
item cf update sim contribution score by user
def upgrad_one_contribute_score(user_total_click_num): return 1/math.log(1 + user_total_click_num)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_score():\n pass", "async def changescore(self, ctx, num: int, *, user: discord.Member):\n self.data[ctx.guild.id]['score'][user.id] += num\n return await ctx.send(f\"{user}'s score has been changed to {self.data[ctx.guild.id]['score'][user.id]}.\")", "def update_score(self):\n ...
[ "0.6815297", "0.63673705", "0.6107736", "0.5988937", "0.578196", "0.57493675", "0.57471263", "0.57374215", "0.57188326", "0.5709215", "0.56854475", "0.5675903", "0.5665249", "0.5660525", "0.5657919", "0.5650883", "0.5641297", "0.5637313", "0.56192154", "0.56125504", "0.560394...
0.51820666
99
item cf update two sim contribution score by user
def upgrad_two_contribute_score(click_time_one, click_time_two): delata_time = abs(click_time_two - click_time_one) # 基于秒,在秒的维度,score差别不大 total_sec = 24 * 60 * 60 delata_time = delata_time / total_sec return 1 / (delata_time + 1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_score():\n pass", "def test_update_score_multiple(self):\r\n self.update_score_multiple()\r\n score = self.openendedmodule.latest_score()\r\n self.assertEquals(score, 1)", "def update_user_user_sim(self, user_A_info, user_B_info, item_popularity):\n user_A_id, user...
[ "0.663773", "0.61361444", "0.60892826", "0.60406524", "0.59592223", "0.59180367", "0.58450896", "0.57660127", "0.5701052", "0.5667632", "0.56443375", "0.5642383", "0.56333405", "0.5611411", "0.5609061", "0.5608028", "0.56075853", "0.5588425", "0.558617", "0.5579193", "0.55763...
0.0
-1
main flow of itemcf
def main_flow(): user_click, user_click_time = reader.get_user_click("../data/rating.txt") # dict: key:user_id value:[item0,item1...] item_info = reader.get_item_info("../data/movies.txt") sim_info = cal_sim_info(user_click, user_click_time) debug_itemsim(item_info, sim_info) recom_result = cal_re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def items():", "def action(self,item):\r\n pass", "def item(self, item_name):\n\tself.log.info('Not implemented yet... Sorry!')\n\tpass", "def __init__(self, factions, items):\n self.factions = factions\n self.items = items", "def items(self):", "def items(self, course):\r\n p...
[ "0.6443082", "0.6387463", "0.63777965", "0.60275745", "0.6019542", "0.5994673", "0.59896845", "0.59896845", "0.58588225", "0.57363003", "0.5667128", "0.5661275", "0.5661275", "0.5661275", "0.56331366", "0.56323844", "0.5631494", "0.5607624", "0.5602413", "0.5579382", "0.55758...
0.5543466
23
function that normalizes an unactivated output of a neural network using batch normalization
def batch_norm(Z, gamma, beta, epsilon): m = np.mean(Z, axis=0) s = np.std(Z, axis=0) Z_norm = (Z - m) / np.sqrt(s**2 + epsilon) Z_ = gamma*Z_norm+beta return Z_
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def batch_normalization(input_var=None):\n\n # Hyperparameters\n hp = Hyperparameters()\n hp('batch_size', 30)\n hp('n_epochs', 1000)\n hp('learning_rate', 0.01)\n hp('l1_reg', 0.00)\n hp('l2_reg', 0.0001)\n hp('patience', 5000)\n\n # Create connected layers\n # Input layer\n l_in ...
[ "0.7328072", "0.7253965", "0.71714145", "0.7171106", "0.7072247", "0.68661773", "0.68411905", "0.6806717", "0.67806345", "0.6777476", "0.67409617", "0.6729022", "0.67117846", "0.6690852", "0.66811794", "0.6668156", "0.6655927", "0.6641299", "0.66372794", "0.66166836", "0.6616...
0.0
-1
Print a text passed as argument
def _verbose(self,text): if self.verbose: print(text)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Print(self, text):\n pass", "def _print(self, text):\n\t\tif self.verbose:\n\t\t\tprint text", "def print_text(self, text1, text2):", "def print_to_string(*args, text):\n print(*args)\n text.append(' '.join(args)+'\\n')", "def output_text(text):\n print(text)", "def emu_print(text):\n...
[ "0.8138202", "0.78461736", "0.7601609", "0.75549704", "0.7503951", "0.74257314", "0.7383068", "0.73288554", "0.72891396", "0.7249413", "0.7162841", "0.7094371", "0.7049727", "0.6959261", "0.6944948", "0.6926056", "0.69175637", "0.6871908", "0.68524003", "0.6846737", "0.684653...
0.61918527
81
Check if p < alpha
def _result(self, p, alpha): if p < alpha: self._verbose('reject H0') return False else: self._verbose('Fail to reject H0') return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pvalue_test(self, alpha=0.01):\n CL = int((1-alpha)*100) # confidence level\n \n if self.p_value < alpha:\n print(\"Null hypothesis rejected at {:d}%CL => distributions are different\".format(CL))\n else:\n print(\"Null hypothesis NOT rejected => distr...
[ "0.6903913", "0.65936184", "0.64266586", "0.6404423", "0.632386", "0.617827", "0.6169871", "0.6154222", "0.6103611", "0.60738355", "0.6071435", "0.60705245", "0.6026349", "0.6003107", "0.59858894", "0.5979116", "0.5966189", "0.5961026", "0.59589374", "0.59494054", "0.5945314"...
0.7522837
0
Check if samples follow a normal distribution, according to the Shapiro test. In case of two samples, check if both the samples follow a normal distribution.
def check_normality(self,alpha = 0.05): stat1, p = shapiro(self.x) if self.y is not None: stat2, p2 = shapiro(self.y) if p < alpha: if self.y is not None: if p2 < alpha: self._verbose('x and y do not look Gaussian...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_normality(df, features_to_analyse, p_value_threshold=0.05):\n \n is_normal_threshold = 1 - p_value_threshold\n\n normality_results = pd.DataFrame(data=None, index=['stat','pval'], columns=features_to_analyse)\n for f, feature in enumerate(features_to_analyse):\n try:\n stat,...
[ "0.6643706", "0.6607907", "0.65663075", "0.656181", "0.64410543", "0.64410543", "0.64410543", "0.6429082", "0.6350439", "0.6350439", "0.6350439", "0.6209372", "0.60482424", "0.6045995", "0.60372585", "0.58879375", "0.5857885", "0.5827552", "0.5822744", "0.57681113", "0.572109...
0.7163608
0
Check if samples are correlated. If samples follow a normal distribution, the Pearson Correlation Coefficient is used, otherwise the Spearman Rank Correlation is used. This is a simple test, which does not return the statistics. Correlation is calculated only on the basis of pvalue.
def check_correlation(self, alpha = 0.05): if self.y is None: return None if len(self.x) != len(self.y): return None if self.is_normal: stat, p = pearsonr(self.x, self.y) else: stat, p = spearmanr(self.x, self.y) return s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_correlation_test_perfect_correlation(self):\r\n # These results were verified with R.\r\n obs = correlation_test([1, 2, 3, 4], [1, 2, 3, 4])\r\n self.assertFloatEqual(obs[:2],\r\n (0.99999999999999978, 2.2204460492503131e-16))\r\n self.assertEqual(l...
[ "0.74774", "0.7184711", "0.7119329", "0.70897657", "0.6877289", "0.6834545", "0.67533475", "0.67221105", "0.66276866", "0.6546544", "0.65236306", "0.6508728", "0.6496093", "0.6476523", "0.6470434", "0.6450455", "0.64336354", "0.6405079", "0.6379323", "0.6374457", "0.63576996"...
0.66762716
8
Check if the sample has been generated in a random way.
def check_randomness(self, alpha = 0.05, cutoff='mean'): stat, p = runstest_1samp(self.x, cutoff=cutoff) return self._result(p,alpha)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def confused(self, rand):\n return rand > 0", "def should_sample(self):\n sampling_probability = 1.0 / self._trans_sample_rate\n log.debug(\"should_sample (sampling prob: %f)\", sampling_probability)\n\n return random() <= sampling_probability", "def _sample_using_random(\n s...
[ "0.790469", "0.7621618", "0.72218984", "0.72212857", "0.71029085", "0.71029085", "0.71029085", "0.71029085", "0.70999885", "0.7068966", "0.7065843", "0.7065843", "0.683941", "0.6784703", "0.6736935", "0.672948", "0.6573652", "0.6567017", "0.647614", "0.646925", "0.646925", ...
0.64064646
29
Compare the sample mean to a theoretical value, or compare samples means. If samples follow a normal distribution, the ttest is used if the number of samples is less than n. The ztest, otherwise. If the samples are not normal, the Wilcoxon test is used.
def compare_means(self, value = None, alpha = 0.05, n = 50): p = None if self.y is None: # one sample test if self.is_normal: if len(self.x) <= n: stat, p = ttest_1samp(self.x, value) else: stat, p = ztest(s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ztest_mean(self, value=0, alternative=\"two-sided\"):\n tstat = (self.mean - value) / self.std_mean\n # TODO: use outsourced\n if alternative == \"two-sided\":\n pvalue = stats.norm.sf(np.abs(tstat)) * 2\n elif alternative == \"larger\":\n pvalue = stats.norm.s...
[ "0.7094629", "0.6431837", "0.6431837", "0.6431837", "0.63993895", "0.6372074", "0.6372074", "0.6372074", "0.6092988", "0.59103686", "0.5790642", "0.57710034", "0.57710034", "0.57670575", "0.57560855", "0.5721325", "0.56856143", "0.56267905", "0.56255215", "0.56172353", "0.557...
0.7326671
0
Compare the sample distribution to a given cdf (cumulative distribution function), if one sample is provided. The KolmogorovSmirnov Test is used. Compare the samples distribution, if two samples are provided. In this case, the Chi Square test is used.
def compare_distributions(self, alpha = 0.05, cdf = None, args=(), freq = False): if freq: if self.y is not None: stat, p = chisquare(self.x, f_exp = self.y) else: return None else: if cdf is not None: stat, p = kstest(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def f_test(chi1,df1,chi2,df2,red_chi = True):\n\n# if chi1/df1 > chi2/df2:\n#\tprob = 2. * f.cdf(chi1/df1, chi2/df2, df1, df2)\n# else:\n#\tprob = 2. * f.cdf(chi2/df2, chi1/df1, df2, df1)\n if red_chi:\n\tfval = (chi1/df1) / (chi2/df2)\n else:\n\tfval = chi1 / chi2\n prob = 2. * f.cdf((chi1/df1) / (...
[ "0.7114142", "0.62854636", "0.61177313", "0.61136746", "0.5970565", "0.5863553", "0.585731", "0.5784674", "0.5686073", "0.55763865", "0.55630934", "0.5556157", "0.5546654", "0.55157024", "0.55142057", "0.5466505", "0.54631937", "0.5452893", "0.54494053", "0.54422474", "0.5438...
0.7335901
0
Default / route, in case someone decides to navigate to the tracker root.
def index(): return 'There is nothing here.'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def home_page():\n return redirect(url_for(_DEFAULT_ROUTE, _external=True))", "def root_redirect():\r\n return redirect(url_for(\"display_top\"))", "def setDefaultRoute( self, intf ):\n self.cmd( 'ip route flush root 0/0' )\n return self.cmd( 'route add default ' + intf )", "def homepage(...
[ "0.6797867", "0.62675285", "0.60095525", "0.5990974", "0.58593035", "0.58282346", "0.5826653", "0.57567704", "0.57441", "0.5743467", "0.5726533", "0.5726533", "0.5726533", "0.57250667", "0.5719507", "0.5640453", "0.56262094", "0.55911887", "0.5589991", "0.5589991", "0.5560961...
0.0
-1
Handle announces. This is the main, most important pieces, of Telescope.
def announce(user): time_now = datetime.datetime.now() q = request.query update_torrent_in_db = False # do we track this torrent? torrent = STORAGE.lookup_torrent(q['info_hash']) if not torrent: # we don't util.fail(REASON_UNREGISTERED_TORRENT) # we do! # is leeching o...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def onBounce(self):\n pass", "def arp_announce(self):\n pass", "def announceGenerate(self):", "async def announce(self, ctx, *, msg):\n if self._announce_msg is not None:\n await self.bot.say(\"Already announcing, wait until complete to\"\n \" iss...
[ "0.59229904", "0.5829532", "0.5780667", "0.5646563", "0.5597837", "0.54603344", "0.5343028", "0.53424466", "0.53347164", "0.5284047", "0.5257975", "0.52425146", "0.5188517", "0.5169333", "0.5155788", "0.5147466", "0.51322675", "0.5091058", "0.505806", "0.5054131", "0.5022248"...
0.0
-1
This function selects num peers from the torrent. If select_seeders is True, then we only select seeders otherwise, we only select leechers. By default we use random.sample, but feel free to implement your own selection system.
def select_people(torrent, select_seeders=True, num=50): selector = torrent.seeders if select_seeders else torrent.leechers resp = random.sample(selector, min(num, len(selector))) return resp
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def accept_seeders(self, accept_seeds):\n if accept_seeds:\n call = \"d.accepting_seeders.enable\"\n else:\n call = \"d.accepting_seeders.disable\"\n\n m = rtorrent9.rpc.Multicall(self)\n self.multicall_add(m, call)\n\n return m.call()[-1]", "def select_cl...
[ "0.6207165", "0.598683", "0.55595607", "0.55328155", "0.54304093", "0.5372144", "0.535326", "0.5268179", "0.5265857", "0.52191955", "0.5192883", "0.5186847", "0.5138152", "0.50706697", "0.50696266", "0.5061419", "0.505665", "0.50276333", "0.5012703", "0.5010171", "0.5006359",...
0.8250936
0
This function performs the compact announce peerlist building
def format_compact(peer, torrent, num): rawpeers = select_people(torrent, peer.left > 0, num) peers = [] peers_v6 = [] for rpeer in rawpeers: try: rpeer = util.conjure_peer(torrent.peers[rpeer]) except KeyError: print "Error trying to find %s in %s!" % (rpeer, tor...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _announceContainers(self):\n distance = float(self.config.container_manager.announce_distance)\n targetpeers = self.config.owner.getByDistance(self.session, distance)\n\n containers = self.announcequeue\n self.announcequeue = []\n msg = 'announcing %d %ss to %d peers'\n ...
[ "0.59987557", "0.5810986", "0.5473048", "0.537243", "0.5337154", "0.53327066", "0.52817154", "0.5222992", "0.5212361", "0.5167724", "0.514673", "0.5068437", "0.506451", "0.5046118", "0.4968012", "0.48542842", "0.48511732", "0.4842829", "0.48255283", "0.48201734", "0.47549656"...
0.49166185
15
This function performs the 'standard' announce peerlist building
def format_normal(peer, torrent, num, no_peer_id=False): rawpeers = select_people(torrent, peer.left > 0, num) peers = [] for rpeer in rawpeers: rpeer = util.conjure_peer(torrent.peers[rpeer]) peers.append("d2:ip%d:%s4:port%d:%s" % (len(rpeer.ip), rpeer.ip, len(rpeer.port), rpeer.port)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def announceGenerate(self):", "def _announceContainers(self):\n distance = float(self.config.container_manager.announce_distance)\n targetpeers = self.config.owner.getByDistance(self.session, distance)\n\n containers = self.announcequeue\n self.announcequeue = []\n msg = 'annou...
[ "0.6372707", "0.63178474", "0.6009953", "0.59099126", "0.5766325", "0.5695178", "0.566982", "0.5651715", "0.5625587", "0.5520921", "0.5513589", "0.5486276", "0.5473989", "0.54553825", "0.5452486", "0.5325521", "0.53041273", "0.52763605", "0.52356195", "0.52241623", "0.5223752...
0.0
-1
Create some tasks by default to show off the site
def create_dummy_content(user_id): task = TodoItem( user=user_id, task=u'Find a shrubbery', tags=[u'quest', u'ni', u'knight'], due_date=datetime.utcnow() + timedelta(days=60), ) DBSession.add(task) task = TodoItem( user=user_id, task=u'Search for the holy ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tasks():", "def create_task():", "def generate_tasks(self, task):", "def create_tasks(self):\n self.create_passport_task()\n\n self.create_visa_task()\n\n self.create_vaccines_task()\n self.create_malaria_task()\n\n self.create_weather_task()\n self.create_flight...
[ "0.7419465", "0.7254781", "0.7205577", "0.71818626", "0.6948934", "0.6753616", "0.65834916", "0.65572876", "0.64935565", "0.64540464", "0.64521545", "0.64098644", "0.6391006", "0.63651496", "0.6327748", "0.63197774", "0.63186055", "0.6314866", "0.63021183", "0.6296633", "0.62...
0.0
-1
The FNN enc and FNN dec of the Denoiser.
def __init__(self, input_dim): super(ps_FNNDenoiser, self).__init__() self._input_dim = input_dim self.fnn_enc = Linear(self._input_dim, int(self._input_dim / 2)) self.fnn_dec = Linear(int(self._input_dim / 2), self._input_dim) self.initialize_module()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _encode(self):\n with tf.variable_scope('encoding'):\n self.sep_p_encodes, _ = bilstm_layer(self.p_emb, self.p_length, self.hidden_size)\n tf.get_variable_scope().reuse_variables()\n self.sep_q_encodes, _ = bilstm_layer(self.q_emb, self.q_length, self.hidden_size)\n ...
[ "0.55594534", "0.5484632", "0.5475248", "0.5433192", "0.53741807", "0.5338545", "0.53328925", "0.5324473", "0.5303475", "0.52772224", "0.5273364", "0.5268513", "0.5253051", "0.5249744", "0.52083373", "0.5200783", "0.51895785", "0.5175783", "0.51673234", "0.5162198", "0.513767...
0.64204884
0
Creates a new user with a unique email address.
def create_user(): try: payload = _validatePayload(request) timestamp = int(time.time() * 1000) user = { 'name': payload.get('name'), 'email': payload.get('email'), 'password': _encodePassword(payload.get('password')), 'createdAt': timestamp, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_user(email, password):\n try:\n User(email=email, password=password)\n except IntegrityError:\n print('Error: Duplicate email address')", "def create_user(email='user@example.com', password='testpass123'):\n return get_user_model().objects.create_user(email=email...
[ "0.82201904", "0.8129927", "0.8125364", "0.8110234", "0.8090691", "0.8072226", "0.80139476", "0.80017096", "0.7963306", "0.7933557", "0.7929344", "0.79290503", "0.79205734", "0.7909613", "0.79067945", "0.79038435", "0.78828025", "0.78814787", "0.7878793", "0.7878176", "0.7877...
0.7804401
42
Check that all expected fields are in payload and have valid values.
def _validatePayload(request): return { 'name': _validateField(request, 'name'), 'email': _validateField(request, 'email'), 'password': _validateField(request, 'password'), }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_fields(self, content: JsonDict) -> None:\n self.assertIn(\"id\", content)\n self.assertIn(\"received_ts\", content)\n self.assertIn(\"room_id\", content)\n self.assertIn(\"event_id\", content)\n self.assertIn(\"user_id\", content)\n self.assertIn(\"sender\", con...
[ "0.70033276", "0.6977844", "0.6937503", "0.6816091", "0.66672194", "0.66445965", "0.64546615", "0.63872355", "0.63409096", "0.6291471", "0.6289986", "0.62696654", "0.62582856", "0.6215967", "0.6204885", "0.6201266", "0.61564136", "0.61518383", "0.6137182", "0.6115781", "0.611...
0.65139276
6
Check that all field is a string with one or more characters.
def _validateField(request, field): val = request.json.get(field, '') if type(val) is not str or len(val) < 1: raise Exception('Invalid {}'.format(field)) elif field == 'password': return _validatePassword(val) else: return val
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_empty_string(self):\n self.assertTrue(all_unique_chars(\"\"))", "def test_empty_string(self):\n self.assertTrue(all_unique_chars_no_set(\"\"))", "def check_input(input_string):\n if len(input_string) > 50: # check if length of name is less than 50 ir not\n return False\n el...
[ "0.6745913", "0.6696813", "0.6637041", "0.66326654", "0.6543104", "0.6416302", "0.63635653", "0.63391274", "0.632886", "0.6321404", "0.62952805", "0.6273974", "0.6257625", "0.623946", "0.6231969", "0.6192615", "0.61773145", "0.61684555", "0.6159218", "0.6149323", "0.61417013"...
0.0
-1
Checks that password is longer than 8 characters and that it contains upper and lowercase letters and at least one number.
def _validatePassword(password): uppercaseChars = re.search('[A-Z]', password) lowercaseChars = re.search('[a-z]', password) if len(password) < 8: raise Exception("Password must be at lest 8 letters") elif re.search('[0-9]', password) is None: raise Exception("Password must contain atl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_password(password):\n return isinstance(password, str) and len(password) >= 8 and \\\n re.search(r'[A-Z]', password) and re.search(r'[0-9]', password)", "def validate_password(self, password_field):\n if len(password_field.data) < 8:\n raise ValidationError('Y...
[ "0.8766334", "0.81289023", "0.81200564", "0.80847394", "0.8010414", "0.7993104", "0.78297937", "0.7824315", "0.78155774", "0.7803249", "0.7767423", "0.77415377", "0.7721763", "0.76823556", "0.7681701", "0.7652257", "0.76191694", "0.7600995", "0.75715125", "0.7533356", "0.7520...
0.84100276
1
This route is here to make testing user creatation easier. Since, it's a demo project we assume every user is an admin.
def list(): try: data = table.scan() users = data.get('Items', None) if users is None: return jsonify({'error': 'Error fetching users'}), 400 resp = { 'count': len(users), 'users': users } return jsonify(resp) except BaseExcept...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_09_admin_users_as_admin(self):\r\n self.register()\r\n res = self.app.get('/admin/users', follow_redirects=True)\r\n assert \"Manage Admin Users\" in res.data, res.data", "def test_admin_create_user(self):\n resp = self.admin_register()\n reply = self.admin_login()\n ...
[ "0.76988465", "0.7372535", "0.73059255", "0.73059255", "0.73059255", "0.7280059", "0.7163433", "0.71625036", "0.7158194", "0.71431285", "0.71431285", "0.7040476", "0.70340353", "0.7007233", "0.69826454", "0.69826454", "0.69826454", "0.69826454", "0.6981487", "0.69673336", "0....
0.0
-1
Chooses a random word from this list of ridiculous English words and returns it
def get_computer_play(): return random.choice(['Ailurophile', 'Assemblage', 'Becoming', 'Beleaguer', 'Brood', 'Bucolic', 'Bungalow', 'Chatoyant', 'Comely', 'Conflate', 'Cynosure', 'Dalliance', 'Demesne', 'Demure', 'Denouement', 'De...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def return_word():\n wordlist = load_words()\n word = random.choice(wordlist)\n return word", "def random_word(wordlist):\n return random.choice(wordlist)", "def choose_word(word_list):\n word = random.choice(word_list)\n word = word.lower()\n return word", "def randomWord(wordList):\n ...
[ "0.8440277", "0.8287809", "0.8253476", "0.81828856", "0.81828856", "0.81828856", "0.8174142", "0.8137592", "0.8044216", "0.7982263", "0.7900026", "0.7900026", "0.7900026", "0.7837851", "0.7800308", "0.77765477", "0.7773012", "0.7644745", "0.7625416", "0.76155937", "0.75968814...
0.0
-1
Runs the word game, user vs computer, using your functions. Will not work until you have them implemented correctly!
def play_game(): cutoff = 30 # CHANGE THIS IF YOU WANT A LONGER GAME! user_total = 0 comp_total = 0 print "First to", cutoff, "points wins!" print while user_total < cutoff and comp_total < cutoff: # get the user and computer words, convert to lower case user_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n ans = random_word()\n run_game(ans, N_TURNS)", "def main():\n secret_word = get_word()\n play_game(secret_word)", "def main():\r\n # Initialize words from specific file\r\n words_list = hangman_helper.load_words()\r\n # Run single game with given word list to choose from\r\n ...
[ "0.7434662", "0.73721844", "0.70454", "0.6908657", "0.68199605", "0.6661747", "0.6661747", "0.6566236", "0.65410364", "0.6530803", "0.65254414", "0.6475175", "0.63247544", "0.6285411", "0.62551254", "0.6210292", "0.6180333", "0.61633396", "0.6153147", "0.61445504", "0.6130061...
0.6605025
7
Make sure that bzr is available when running in CI.
def test_ensure_bzr_available(): assert is_bzr_installed()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prepare_deploy():\n from fabdeploy.django import test as django_test\n django_test()\n git.add_commit_pull()\n git.push()", "def _get_bzr_version():\n try:\n value, output, _ = run_shell_command('bzr --version',\n shell=True,\n ...
[ "0.6085656", "0.5957647", "0.57713366", "0.57140285", "0.56965965", "0.564991", "0.5644301", "0.55707353", "0.5557706", "0.5546851", "0.55418056", "0.5531211", "0.5515171", "0.5443203", "0.54164296", "0.53966993", "0.5394848", "0.5389168", "0.5381132", "0.5380146", "0.5363527...
0.7557124
0
Gets valid user credentials from storage. If nothing has been stored, or if the stored credentials are invalid, the OAuth2 flow is completed to obtain the new credentials.
def get_credentials(commandline_flags=None): home_dir = os.path.expanduser('~') credential_dir = os.path.join(home_dir, '.credentials') if not os.path.exists(credential_dir): os.makedirs(credential_dir) credential_path = os.path.join(credential_dir, 'drive-pyth...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _load_user_credentials(self, storage):\n # Set up a Flow object to be used if we need to authenticate.\n flow = client.flow_from_clientsecrets(\n self.client_secrets,\n scope=self.api_scopes,\n message=tools.message_if_missing(self.client_secrets))\n\n # Re...
[ "0.7571535", "0.7355913", "0.71540344", "0.7120326", "0.70709026", "0.7026004", "0.6991126", "0.69621813", "0.6947445", "0.69403243", "0.69352114", "0.69063586", "0.68998873", "0.6899442", "0.6857314", "0.6828924", "0.679187", "0.6784848", "0.677493", "0.677493", "0.677493", ...
0.6167278
90
Evaluate a policy given an environment and a full description of the environment's dynamics.
def policy_eval(policy, env, discount_factor=1.0, theta=0.00001): # Start with a random (all 0) value function V = np.zeros(env.nS) while True: #any(Vdiff > theta): delta_V = 0 for i in range(env.nS): # need to calculate the value of taking each of ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def policy_eval(env, policy, V, discount_factor):\n policy_value = np.zeros(env.nS)\n for state, action in enumerate(policy):\n for probablity, next_state, reward, info in env.P[state][action]:\n policy_value[state] += probablity * (reward + (discount_factor * V[next_state]))\n\n return ...
[ "0.68249816", "0.64548814", "0.642272", "0.6244586", "0.6161337", "0.6145352", "0.60711825", "0.6059267", "0.6047221", "0.5992679", "0.5959183", "0.5959183", "0.5846315", "0.5827876", "0.5783816", "0.5746275", "0.57402617", "0.5729169", "0.5669494", "0.5669214", "0.56520754",...
0.60442084
9
If memory uses threads.
def is_async(self) -> bool: return self.__is_async
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def manage_threads(_) -> int:\n return 1 << 33", "def manage_threads(_) -> int:\n return 1 << 33", "def parallel_safe(self):\n return True", "def use_public_threads(_) -> int:\n return 1 << 34", "def use_public_threads(_) -> int:\n return 1 << 34", "def getThreads():\r\...
[ "0.6849884", "0.6849884", "0.6510201", "0.64524364", "0.64524364", "0.639639", "0.63069963", "0.63069963", "0.6204849", "0.6157713", "0.6146597", "0.5962862", "0.5948838", "0.5911457", "0.59005356", "0.5876403", "0.5805998", "0.5766067", "0.5755047", "0.5743835", "0.5706686",...
0.0
-1
Fixture responsible for searching a folder with the same name of tests module and, if available, moving all contents to a temporary directory so tests can use them freely.
def datadir(tmpdir, request): filename = request.module.__file__ test_dir, _ = os.path.splitext(filename) if os.path.isdir(test_dir): dir_util.copy_tree(test_dir, str(tmpdir)) return tmpdir
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_from_temp_directory(self):", "def fixture_project_dir(tmpdir_factory) -> Path:\n my_tmpdir = Path(tmpdir_factory.mktemp(\"data\"))\n yield my_tmpdir\n shutil.rmtree(str(my_tmpdir))", "def setUp(self):\n tempDir.safe_mkdir(parents=True)\n os.chdir(tempDir.as_posix())", "def testing_fil...
[ "0.70360804", "0.69717216", "0.67078876", "0.6637878", "0.66373396", "0.6632224", "0.6616858", "0.66160154", "0.6607836", "0.65883696", "0.65883696", "0.6542226", "0.6530276", "0.6501414", "0.64873177", "0.6470115", "0.6458611", "0.64384073", "0.6433042", "0.6402625", "0.6392...
0.0
-1
Calculates the accuracy of the NaiveBayes algorithm
def calculateResults(predictions, answers): t = 0 f = 0 for i in range(len(answers)): if predictions[i] == answers[i]: t += 1 else: f += 1 print("The Percent of Correct Predictions is {t}%".format(t=round((t * 100 / len(answers)), 1))) print("The Pe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def naiveBayes(self):\n acc = 0\n #for each example in the test-set\n for d in self.dev:\n pred_good = self.prob_True\n pred_bad = self.prob_False\n #calc the probability for yes and no\n for index in range(len(d[0])):\n pred_good *= s...
[ "0.74899286", "0.7438116", "0.72386056", "0.7164012", "0.71495265", "0.71005416", "0.7094217", "0.7050752", "0.70441353", "0.7004448", "0.69885844", "0.69650227", "0.6953509", "0.6929957", "0.69283235", "0.6926801", "0.6924115", "0.69222695", "0.6908321", "0.68867135", "0.687...
0.0
-1
Removes the api version from the href.
def remove_trailing_version_from_href(href): parsed_url = urlparse.urlsplit(href) url_parts = parsed_url.path.rsplit('/', 1) # NOTE: this should match vX.X or vX expression = re.compile(r'^v([0-9]+|[0-9]+\.[0-9]+)(/.*|$)') if not expression.match(url_parts.pop()): LOG.debug('href %s does no...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_link():", "def _strip_version(endpoint):\n if endpoint.endswith('/'):\n endpoint = endpoint[:-1]\n url_bits = endpoint.split('/')\n if re.match(r'v\\d+\\.?\\d*', url_bits[-1]):\n endpoint = '/'.join(url_bits[:-1])\n return endpoint", "def remove_study_version_dbgap_link(app...
[ "0.6193792", "0.60921365", "0.6078247", "0.5901628", "0.58109987", "0.5665509", "0.5512722", "0.5504835", "0.54142016", "0.54117763", "0.54097027", "0.529149", "0.5282961", "0.5278921", "0.5244824", "0.5241325", "0.5213375", "0.52127796", "0.5143578", "0.51431906", "0.5127807...
0.6932704
0
Convenience method for joining parts of a URL Any leading and trailing '/' characters are removed, and the parts joined together with '/' as a separator. If last element of 'parts' is an empty string, the returned URL will have a trailing slash.
def url_join(*parts): parts = parts or [""] clean_parts = [part.strip("/") for part in parts if part] if not parts[-1]: # Empty last element should add a trailing slash clean_parts.append("") return "/".join(clean_parts)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _url_join(self, *parts):\n return \"/\".join(map(lambda fragment: fragment.rstrip('/'), parts))", "def urljoin(*parts):\n def _gen(parts):\n prev = None\n for part in parts:\n if not part:\n continue\n if not prev:\n prev = part\n ...
[ "0.84102356", "0.82989657", "0.81839633", "0.8064334", "0.79943556", "0.7882533", "0.786418", "0.7630931", "0.7371415", "0.6973159", "0.6902921", "0.68932605", "0.68614244", "0.68232083", "0.68219864", "0.67865187", "0.6781647", "0.677915", "0.6769976", "0.66617376", "0.66453...
0.8668859
0
Get project id from request url if present or empty string otherwise
def _get_project_id(self, request): project_id = request.environ["masakari.context"].project_id if project_id in request.url: return project_id return ''
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_project_id():\n return os.environ.get('project')", "def __get_project_id(self):\n request = urllib2.Request(self.host_api+\"projects?owner=\"+urllib2.quote(self.owner)+\"&display_name=\"+urllib2.quote(self.project_name))\n # request = urllib2.Request(self.host_api+\"projects?owner=\"+sel...
[ "0.7154755", "0.70934504", "0.6984654", "0.6971364", "0.6971364", "0.6971364", "0.6971364", "0.6971364", "0.6708459", "0.66086614", "0.6594982", "0.6558914", "0.6558914", "0.6518638", "0.64804995", "0.64804995", "0.64804995", "0.64804995", "0.6430157", "0.63776463", "0.635488...
0.8752246
0
Return href string with proper limit and marker params.
def _get_next_link(self, request, identifier, collection_name): params = request.params.copy() params["marker"] = identifier prefix = self._update_masakari_link_prefix(request.application_url) url = url_join(prefix, self._get_project_id(request), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _insert_links(self, limit, offset):\n if limit is None:\n limit = 0\n if offset is None:\n offset = 0\n\n import ckan.plugins.toolkit as toolkit\n import urllib\n import urllib2\n import urlparse\n '''Adds link to the next/prev part (same l...
[ "0.6050559", "0.58291566", "0.58065987", "0.5738649", "0.57187855", "0.5685541", "0.5682918", "0.56696624", "0.5668175", "0.56174916", "0.5611827", "0.556549", "0.55634326", "0.55570424", "0.5539954", "0.5521814", "0.55146676", "0.54406375", "0.5396114", "0.5370539", "0.53625...
0.6111639
0
Return an href string pointing to this object.
def _get_href_link(self, request, identifier, collection_name): prefix = self._update_masakari_link_prefix(request.application_url) return url_join(prefix, self._get_project_id(request), collection_name, str(identifier))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def href(self) -> str:\n result = self.get_href()\n if result is None:\n raise ValueError(f\"{self} does not have an HREF set.\")\n return result", "def href(self):\n return self._href", "def href(self):\n return self._href", "def get_anchor_tag(self):\n r...
[ "0.85301834", "0.8274691", "0.8274691", "0.74851286", "0.74171", "0.7406751", "0.7405322", "0.73963124", "0.7284488", "0.7258416", "0.7235905", "0.7235905", "0.7235905", "0.71688205", "0.71688205", "0.7152213", "0.7152213", "0.7152213", "0.7152213", "0.7152213", "0.7152213", ...
0.65351176
55
Create a URL that refers to a specific resource.
def _get_bookmark_link(self, request, identifier, collection_name): base_url = remove_trailing_version_from_href(request.application_url) base_url = self._update_masakari_link_prefix(base_url) return url_join(base_url, self._get_project_id(request), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def anchor_to_resource(resource, post_create_func=None, title=None):\n href = resource.get('href')\n resource = {\n \"description\": title or resource.text_content().encode('utf8'),\n \"name\": href.split('/')[-1],\n \"url\": href,\n \"format\": href[href.rfind(\".\")+1:].upper()...
[ "0.6941272", "0.68629503", "0.67490333", "0.67356056", "0.67045265", "0.6702004", "0.6671467", "0.66025174", "0.657523", "0.6491968", "0.64915454", "0.6396327", "0.63947356", "0.6392973", "0.6361397", "0.6360611", "0.63332766", "0.6327195", "0.6323129", "0.62874043", "0.62748...
0.0
-1
Extract integer param from request or fail.
def _get_int_param(request, param): try: int_param = utils.validate_integer(request.GET[param], param, min_value=0) except exception.InvalidInput as e: raise webob.exc.HTTPBadRequest(explanation=e.format_message()) return int_param
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _parse_positive_int_param(request, query_params, param_name):\n param = query_params.get(param_name)\n if not param:\n return None\n try:\n param = int(param)\n if param <= 0:\n raise ValueError()\n return param\n except ValueError:\n request.respond('query parameter \"%s\" must be inte...
[ "0.737176", "0.6762896", "0.65760314", "0.654616", "0.64901876", "0.64549387", "0.64112216", "0.6378887", "0.62955576", "0.6280391", "0.6223324", "0.6150399", "0.61250275", "0.6049242", "0.60073894", "0.60064703", "0.597818", "0.5947589", "0.594178", "0.5940132", "0.5923045",...
0.7985158
0
Extract marker id from request or fail.
def _get_marker_param(request): return request.GET['marker']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_marker(self, req):\n try:\n marker = int(req.str_params.get('marker', None))\n except ValueError:\n raise exc.HTTPBadRequest(\"marker param must be an integer\")\n return marker", "def _get_marker(self, req):\n marker = req.params.get('marker', None)\n\n...
[ "0.7499812", "0.7286604", "0.6193086", "0.6187371", "0.6064134", "0.5921961", "0.5867724", "0.5837601", "0.5775515", "0.5747198", "0.56819403", "0.55907786", "0.55435884", "0.5493284", "0.53950775", "0.53246915", "0.53200275", "0.52863353", "0.5239298", "0.5203371", "0.519169...
0.61523575
4
Return marker, limit tuple from request.
def get_pagination_params(request): params = {} if 'limit' in request.GET: params['limit'] = _get_int_param(request, 'limit') if 'page_size' in request.GET: params['page_size'] = _get_int_param(request, 'page_size') if 'marker' in request.GET: params['marker'] = _get_marker_param...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_limit_and_marker(request, max_limit=CONF.osapi_max_limit):\n params = get_pagination_params(request)\n limit = params.get('limit', max_limit)\n limit = min(max_limit, limit)\n marker = params.get('marker')\n\n return limit, marker", "def _offset_request(self, limit: int, offset: int) -> Di...
[ "0.8131", "0.65567756", "0.6452999", "0.6240873", "0.5774155", "0.5759827", "0.56829715", "0.5569735", "0.5445113", "0.5394796", "0.53077626", "0.5298797", "0.5257216", "0.5257216", "0.52530754", "0.5225444", "0.5222232", "0.52028453", "0.519762", "0.51738304", "0.51058054", ...
0.58075047
4
get limited parameter from request.
def get_limit_and_marker(request, max_limit=CONF.osapi_max_limit): params = get_pagination_params(request) limit = params.get('limit', max_limit) limit = min(max_limit, limit) marker = params.get('marker') return limit, marker
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_limit(self, req):\n try:\n limit = int(req.str_params.get('limit', MAX_ITEM_LIMIT))\n except ValueError:\n raise exc.HTTPBadRequest(\"limit param must be an integer\")\n\n if limit < 0:\n raise exc.HTTPBadRequest(\"limit param must be positive\")\n\n ...
[ "0.71339375", "0.6901796", "0.66054535", "0.65772295", "0.6466222", "0.63059694", "0.6286302", "0.62795705", "0.62795705", "0.62707806", "0.61873186", "0.6120285", "0.60292095", "0.6021805", "0.6021805", "0.59807783", "0.59795976", "0.5977163", "0.58563024", "0.57849246", "0....
0.66025305
3
Retrieves sort keys/directions parameters. Processes the parameters to create a list of sort keys and sort directions that correspond to the 'sort_key' and 'sort_dir' parameter values. These sorting parameters can be specified multiple times in order to generate the list of sort keys and directions. The input parameter...
def get_sort_params(input_params, default_key='created_at', default_dir='desc'): params = input_params.copy() sort_keys = [] sort_dirs = [] while 'sort_key' in params: sort_keys.append(params.pop('sort_key').strip()) while 'sort_dir' in params: sort_dirs.append(p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_sort_params(sort_keys, sort_dirs, default_keys=None,\n default_dir='asc'):\n if default_keys is None:\n default_keys = ['created_at']\n\n # Determine direction to use for when adding default keys\n if sort_dirs and len(sort_dirs):\n default_dir_value = sort...
[ "0.72372377", "0.61290574", "0.58718145", "0.5770037", "0.5766348", "0.5757473", "0.57474947", "0.5730805", "0.5716173", "0.566162", "0.566162", "0.55787706", "0.55084854", "0.54334277", "0.5427028", "0.5402491", "0.53888994", "0.5301868", "0.5285601", "0.52648246", "0.524790...
0.75024617
0
Calculates angular separation in degrees between two objects. ra1, dec1, ra2, dec2 are the coordinates of the two targets in decimal
def ang_sep(ra1,ra2,dec1,dec2): #print('target_coords: ',ra1,dec1,ra2,dec2) dra = abs(ra1-ra2) if dra > 180: dra = 360 - dra #convert relevant angles to radians dec1_rad = np.radians(dec1) dec2_rad = np.radians(dec2) ra1_rad = np.radians(ra1) ra2_rad = np.radians(ra2) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def angular_separation(r1: np.ndarray, r2: np.ndarray) -> float:\n # First compute the rotation that maps r1 to r2.\n dr = r2 @ r1.transpose()\n # Then extract the angle.\n _, angle = transforms3d.axangles.mat2axangle(dr)\n # Normalise the angle.\n if angle > np.pi:\n angle = 2 * np.pi - a...
[ "0.75287974", "0.7102566", "0.7089916", "0.70077497", "0.64021134", "0.6401823", "0.63344175", "0.6267705", "0.62399036", "0.6158805", "0.5949738", "0.5878258", "0.5862246", "0.5824026", "0.5824026", "0.5782027", "0.5755602", "0.5734374", "0.5721164", "0.56958395", "0.5695083...
0.7627773
0
Generate and import Neo4j nodes and edges tables.
def main(load: bool, load_only: bool, force: bool, with_sudo: bool): paths = [] na = NodeAssembler() for processor_cls in processor_resolver: if not processor_cls.importable: continue click.secho(f"Checking {processor_cls.name}", fg="green", bold=True) if not load_only: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_all_tables(self):\n pass", "def writeImports2File(self, file, indent = \" \"):\r\n # import each entity and its associated graphical file\r\n for obj in self.listNodes.keys():\r\n file.write(indent+\"from \"+obj+\" import \"+obj+\"\\n\")\r\n if not obj[0:4] == \"ASG...
[ "0.58826673", "0.5827632", "0.5805161", "0.5751973", "0.5716268", "0.5685903", "0.5562104", "0.54953635", "0.5493187", "0.5487213", "0.547548", "0.54685795", "0.5467668", "0.54589504", "0.54585034", "0.54548496", "0.54250515", "0.5400322", "0.5389987", "0.5389987", "0.538599"...
0.5555874
7
>>> data = ' CHANG CHUB SEM CHOG RIN PO CHE' >>> normalizeVerseBreak(data) 'CHANG CHUB SEM CHOG RIN PO CHE' >>> data = 'CHANG CHUB SEM CHOG RIN PO CHE /' >>> normalizeVerseBreak(data) 'CHANG CHUB SEM CHOG RIN PO CHE / ' >>> data = 'CHANG CHUB SEM CHOG RIN PO CHE/' >>> normalizeVerseBreak(data) 'CHANG CHUB SEM CHOG RIN ...
def normalizeVerseBreak(string): string = string.strip() string = re.sub('\s+/\s?', '/', string) string = string.replace('/', ' / ') return string
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize_data(data):\n return ' '.join(data.upper().split())", "def whitespace_sorter(sentence):\r\n sentence_copy = str(sentence)\r\n sentence_copy = sentence_copy.strip() #Remove leading and trailing whitespace (/s)\r\n sentence_copy = re.sub(\" +\", \" \", sentence_copy) #Coerces all multiple...
[ "0.5627176", "0.5514943", "0.5392916", "0.5288041", "0.5284384", "0.52544844", "0.5122039", "0.5120344", "0.5118473", "0.5098055", "0.50781465", "0.5062507", "0.50251794", "0.5006783", "0.49919733", "0.49425045", "0.4937896", "0.49310207", "0.49207133", "0.48972574", "0.48935...
0.7600039
0
string that repersents the boundary condition imposed to the energy space wavefunctions
def case(self) -> str: return self._case
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _boundary_value(self) -> str:\n ...", "def __str__(self):\n\t\tself.__normalize()\n\t\tmyStr ='# min = %lf\\n'%(float(self._min))\n\t\tmyStr+='# max = %lf\\n'%(float(self._max))\n\t\tmyStr+='# dx = %lf\\n'%(float(self._dx))\n\t\tmyStr+='# av = %lf (sErr = %lf)\\n'%(self.av,self.sErr)\n\t\tmyStr+...
[ "0.6199592", "0.5976905", "0.5922983", "0.5851359", "0.5840542", "0.57978845", "0.565", "0.5632981", "0.56277174", "0.56101704", "0.55923355", "0.5581757", "0.5577677", "0.54971206", "0.54722154", "0.5458786", "0.5429907", "0.54255545", "0.5425042", "0.54207623", "0.5415468",...
0.0
-1
object of type 'New_Style_Boundary' containing all the funcionality that specifically depends on the choice of the boundary condition'
def boundary_lib(self) -> New_Style_Boundary: return self._boundary_lib
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def boundary(self): # -> BaseGeometry:\n ...", "def boundary_conditions(self):\n pass", "def boundary_conditions(particle_outer_radius, boundary_temp):\n\n boundary_condition = [particle_outer_radius, boundary_temp]\n\n return boundary_condition", "def apply_boundary_conditions(self):\n ...
[ "0.65627015", "0.6453875", "0.62970746", "0.6121181", "0.60591966", "0.60413367", "0.5958082", "0.5926671", "0.59197557", "0.5884173", "0.58623636", "0.581189", "0.58097094", "0.5777472", "0.57357526", "0.5722252", "0.5700501", "0.5657504", "0.56291044", "0.5623114", "0.56054...
0.6487195
1
parameter to specify the Robin boundary conditions under the
def gamma(self) -> float: return self._gamma
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def boundary_conditions(self):\n pass", "def boundary_conditions(particle_outer_radius, boundary_temp):\n\n boundary_condition = [particle_outer_radius, boundary_temp]\n\n return boundary_condition", "def boundary_conditions(self):\n ce = 2 * self.dy * self.g * self.mu * self.m_u / self.kb\...
[ "0.7321438", "0.62348247", "0.60754645", "0.5894727", "0.58483815", "0.5836908", "0.5830072", "0.5813218", "0.58012766", "0.571765", "0.565312", "0.5634793", "0.56021154", "0.55712533", "0.5564351", "0.5494645", "0.5490693", "0.5476504", "0.54438883", "0.542073", "0.54016256"...
0.0
-1
the length of the interval (box)
def L(self) -> float: return self._L
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def length(self):\n return pyvista.Box(self.bounds).length", "def intervalLen(self):\n return self.end-self.start+1", "def box_size(self) -> np.ndarray:\n return self.upper - self.lower + 1", "def box_size(self) -> np.ndarray:\n return self.upper - self.lower + 1", "def len_squa...
[ "0.76909757", "0.7267467", "0.6992213", "0.6992213", "0.6758656", "0.6718922", "0.66236997", "0.65887195", "0.6577734", "0.65670806", "0.6564583", "0.6464234", "0.64607036", "0.642546", "0.64243233", "0.6397626", "0.6390193", "0.6366058", "0.6351269", "0.62648505", "0.6231517...
0.0
-1
the number of energy states the 'particle in a box'state is projected onto
def num_energy_states(self) -> int: return self._num_energy_states
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __len__(self):\n return self.nparticles", "def n_pos(self):\n running_total = 0\n for i in range(self.prob.num):\n if self.alphas[i] > 1e-5 > self.prob.C - self.deltas[i] and self.prob.Y[i] == 1:\n running_total += 1\n return running_total if running_tota...
[ "0.6625179", "0.6520586", "0.6520586", "0.64324784", "0.6431588", "0.6414873", "0.63809717", "0.63734233", "0.6323586", "0.6288493", "0.62755984", "0.62718546", "0.6233775", "0.6207782", "0.6170476", "0.6145455", "0.6141519", "0.61399394", "0.6132359", "0.61210644", "0.610804...
0.6643349
0
unorderd list containing the quantum numbers 'l' of the energy states onto which the 'particle in a box'state is projected
def energy_states(self) -> List[int]: return self._energy_states
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def xyz(self: Qs) -> List:\n\n new_states = []\n\n for ket in self.qs:\n new_states.append([ket.x, ket.y, ket.z])\n\n return new_states", "def get_boxes(self):\r\n\r\n boxes = [(\" \", self.worldbox.tl, self.worldbox.br)]\r\n# boxes = []\r\n boxes += [(\".\", ...
[ "0.60017014", "0.59401447", "0.5881057", "0.57378083", "0.57150584", "0.55337393", "0.5454964", "0.54214126", "0.5416198", "0.5387321", "0.5382153", "0.5329017", "0.5294709", "0.5290597", "0.52467066", "0.5244865", "0.52356905", "0.5235567", "0.52125275", "0.520428", "0.52018...
0.0
-1
list of the same order as 'energy_states' containing the k_l values that correspond to the quantum numbers 'l' found in 'energy_states'
def k_kappa_l(self) -> List[complex]: return self._k_kappa_l_array
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def energy_states(self) -> List[int]:\n return self._energy_states", "def ising_energies(states,L):\r\n J=np.zeros((L,L),)\r\n for i in range(L):\r\n J[i,(i+1)%L]-=1.0\r\n # compute energies\r\n E = np.einsum('...i,ij,...j->...',states,J,states)\r\n return E, J", "def ising_energie...
[ "0.61947995", "0.59555596", "0.5916479", "0.58130866", "0.5792258", "0.5747695", "0.56861466", "0.5649747", "0.56434804", "0.561509", "0.555946", "0.5533187", "0.55266356", "0.55232155", "0.5479074", "0.54776806", "0.54776806", "0.5466385", "0.5432786", "0.5414882", "0.538297...
0.57441205
6
see documentation of 'l_to_kl_mapper'
def l_kl_map(self) -> l_to_kl_mapper: return self._l_kl_map
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def KL2kL(NL, KL, BL):\n # cycle through BL, finding matching inds in NL and thus KL\n # for row in BL, get KL value in row BL[i,0] and col where(NL[BL[i,0],:]==BL[i,1])[0]\n if (BL < 0).any():\n aBL = np.abs(BL)\n kL = np.array([KL[aBL[i, 0], np.where(NL[aBL[i, 0], :] == aBL[i, 1])[0]][0] f...
[ "0.56921595", "0.5569048", "0.5549203", "0.54740924", "0.54145914", "0.5406118", "0.53970444", "0.53854877", "0.53566736", "0.5277632", "0.52508193", "0.52366", "0.5219296", "0.5178262", "0.5145818", "0.51157826", "0.5106366", "0.5102655", "0.5078339", "0.5077449", "0.5038405...
0.8680803
0
Get input for the application. Use Config to determine the source of the data.
def get_input(self): if self._config.use_stdin(): return stdin.read() else: try: with open(self._config.values['input'], 'r') as f: return f.read() except: raise InputFileException('Error opening and reading the inpu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def input(self):\n return self[\"input\"]", "def input(self):\n return self[\"input\"]", "def _get_input(self):\n return self.__input", "def _get_input(self):\n return self.__input", "def _get_input(self):\n return self.__input", "def _get_input(self):\n return self.__input", ...
[ "0.70721096", "0.70721096", "0.7016102", "0.7016102", "0.7016102", "0.7016102", "0.7016102", "0.7016102", "0.7016102", "0.6866804", "0.682956", "0.6824514", "0.6662567", "0.6662567", "0.6662567", "0.65906376", "0.65392363", "0.6490492", "0.6468117", "0.6466041", "0.64284444",...
0.6876856
9
Get the content of the formatting file
def get_format_table(self): try: with open(self._config.values['format'], 'r') as f: return f.read() except: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_content(self):\n return self.file.read()", "def get_file_content(self):\n return \"\\n\".join(self._vim.current.buffer)", "def get_file_content(self):\n after = self.file.revisions.filter(\n revision_number__gt=self.revision_number)\n content = self.file.content\...
[ "0.6722635", "0.6655623", "0.66384435", "0.64865637", "0.64729464", "0.64545316", "0.6389236", "0.63692665", "0.6315058", "0.6314024", "0.6297957", "0.62597746", "0.62527674", "0.62383825", "0.6225904", "0.62182045", "0.61744064", "0.61735946", "0.61523366", "0.6151303", "0.6...
0.62714297
11
Print the output to the console or to a file
def present_output(self, output: str): if self._config.use_stdout(): print(output, flush=True, end='') else: try: # print("OUTPUT FILE IS THERE!!!!", self._config.values['output']) with open(self._config.values['output'], mode='w', newline='') as ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def output(*args):\n print(*args, end='', file=file)", "def print_out():\n pass", "def printOutput(self):\n pass", "def print_out(self, *lst):\n self.print2file(self.stdout, True, True, *lst)", "def main(args):\n # Results: print to console and also write to output file...
[ "0.76134956", "0.76095504", "0.73696345", "0.7185569", "0.7096256", "0.70948833", "0.70309347", "0.701113", "0.6972133", "0.69573224", "0.6937068", "0.68955594", "0.68706226", "0.6834418", "0.68031895", "0.66229516", "0.6622299", "0.6573759", "0.65713024", "0.656254", "0.6561...
0.65202826
22
2 T 5 N 1 2 3 4 5 N numeros 3 3 5 6
def leer_entrada_1(): A, B = map(int,str.split(entrada.readline())) test = '' recicledpairsfound = 0 for i in range(A,B+1): test = str(i) if (len(test) > 1): swapped = 0 for j in range(1,len(test)): swapped = int(test[-j:] + test[:len(test...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mots_Nlettre(L:list, n)->list:\n lst= []\n mot = 0\n for i in range(len(L)):\n mot = L[i] \n cpt = 0\n for e in mot:\n cpt += 1\n if cpt == n:\n lst.append(mot)\n return lst", "def numerize():\n pass", "def nits(self):", "def I (self, ...
[ "0.6185058", "0.61487234", "0.6011286", "0.5962796", "0.5959609", "0.595229", "0.58828706", "0.5801601", "0.58003134", "0.57770985", "0.57568866", "0.5727559", "0.56404084", "0.56246775", "0.55655366", "0.55538875", "0.55318946", "0.5530798", "0.5525625", "0.5506544", "0.5500...
0.0
-1
Input 4 1 9 10 40 100 500 1111 2222 Output
def leer_entrada_2(): var1 = int(entrada.readline()) var2 = int(entrada.readline()) lista = [] for i in xrange(1,var2): lista = lista + [map(int,str.split(entrada.readline()))] return correr_tarea(var1,var2,lista)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def processed(N:int)->tuple:\n l1= str(N)\n a,b = '',''\n for i in range(len(l1)):\n if l1[i] == '4':\n a+='2'\n b+='2'\n else:\n a+=str(l1[i])\n b+='0'\n return int(a), int(b)", "def main():\n next_val_string = '1'\n\n for counter in ra...
[ "0.6020323", "0.60092735", "0.591648", "0.5801599", "0.5785172", "0.5785172", "0.5785", "0.56829536", "0.56707966", "0.5650203", "0.5626738", "0.5598183", "0.5597939", "0.55951333", "0.55717784", "0.5565832", "0.5565102", "0.5556577", "0.55332583", "0.55315197", "0.55264056",...
0.0
-1
Pad a singlenested list or a sequence of nd array (torch.tensor or np.ndarray) into a (n+1)d array, only allow the first dim has variable lengths.
def pad_sequences_1d(sequences, dtype=torch.long, device=torch.device("cpu"), fixed_length=None): if isinstance(sequences[0], list): if "torch" in str(dtype): sequences = [torch.tensor(s, dtype=dtype, device=device) for s in sequences] else: sequences = [np.asarray(s, dtype=d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pad_list(xs: torch.Tensor, pad_value: int):\n n_batch = len(xs)\n max_len = max(x.size(0) for x in xs)\n pad = xs[0].new(n_batch, max_len, *xs[0].size()[1:]).fill_(pad_value)\n\n for i in range(n_batch):\n pad[i, : xs[i].size(0)] = xs[i]\n\n return pad", "def list_to_padded_array(x_list...
[ "0.7142818", "0.6955065", "0.69292176", "0.69206595", "0.67178845", "0.6659169", "0.66363806", "0.66253", "0.66230506", "0.6605494", "0.65888196", "0.6520145", "0.65112054", "0.6511188", "0.65110904", "0.6510516", "0.64411896", "0.63961047", "0.6319004", "0.6310096", "0.63074...
0.638518
18
Pad a doublenested list or a sequence of nd torch tensor into a (n+1)d tensor, only allow the first two dims has variable lengths
def pad_sequences_2d(sequences, dtype=torch.long): bsz = len(sequences) para_lengths = [len(seq) for seq in sequences] max_para_len = max(para_lengths) sen_lengths = [[len(word_seq) for word_seq in seq] for seq in sequences] max_sen_len = max([max(e) for e in sen_lengths]) if isinstance(sequenc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pad_lists(lists, pad_int, pad_len=None, dtype=torch.float, device=device):\n\n if pad_len is None:\n pad_len = max([len(lst) for lst in lists])\n new_list = []\n for lst in lists:\n if len(lst) < pad_len:\n new_list.append(lst + [pad_int] * (pad_len - len(lst)))\n else:...
[ "0.7546675", "0.7244427", "0.709511", "0.70657486", "0.696946", "0.6854676", "0.6830674", "0.67936957", "0.6771958", "0.67284626", "0.6721991", "0.6693022", "0.667271", "0.6560058", "0.65521586", "0.64398044", "0.6357635", "0.6346128", "0.6315901", "0.62978333", "0.6295265", ...
0.57962435
82
Find a list of (k1, k2) where k1 < k2 with the maximum values of st_prob[k1] ed_prob[k2]
def find_max_triples(st_prob, ed_prob, top_n=5, prob_thd=None, tensor_type="torch"): if tensor_type == "torch": st_prob, ed_prob = st_prob.data.numpy(), ed_prob.data.numpy() product = np.einsum("bm,bn->bmn", st_prob, ed_prob) # (N, L, L) the lower part becomes zeros, start_idx < ed_idx upper_pro...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_greatest_probability(self):\n greatest = -1\n for i in range(self.dim):\n for j in range(self.dim):\n if self.kb[i][j] > greatest:\n greatest = self.kb[i][j]\n\n return greatest", "def find_max_triples(p1, p2, topN=5, prob_thd=None):\n ...
[ "0.6394993", "0.6110282", "0.6072714", "0.60599595", "0.6017126", "0.6015208", "0.5910312", "0.58973885", "0.58359766", "0.582623", "0.58196145", "0.5813802", "0.5803053", "0.58028036", "0.57886326", "0.57541484", "0.5689953", "0.56894594", "0.5671669", "0.5668233", "0.566437...
0.64712745
0
Find a list of (k1, k2) where k1 < k2 with the maximum values of p1[k1] p2[k2]
def find_max_triples_from_upper_triangle_product(upper_product, top_n=5, prob_thd=None): batched_sorted_triple = [] for idx, e in enumerate(upper_product): sorted_triple = top_n_array_2d(e, top_n=top_n) if prob_thd is not None: sorted_triple = sorted_triple[sorted_triple[2] >= prob_t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def findHighestPkPair(x, pkp): #{\n vrbMsg(5, 'findHighestPkPair() x = [...], pkp = ' + str(pkp))\n mi = [0,0]\n mv = x[pkp[0]]\n for i in range(1, len(pkp)): #{\n nv = x[pkp[i]]\n if(nv > mv): #{\n mi[0] = i\n mv = nv\n #}\n #}\n mv = None\n for i in range(0, len(pkp)): #{\n if(i != m...
[ "0.6645103", "0.6619337", "0.64487", "0.6393022", "0.63164264", "0.61364424", "0.60545003", "0.6047857", "0.60373175", "0.59977555", "0.59454757", "0.5940216", "0.5936271", "0.59169334", "0.59063673", "0.5887921", "0.58286756", "0.5818385", "0.57923603", "0.57911456", "0.5770...
0.0
-1
Get topN indices and values of a 2d array, return a tuple of indices and their values, ranked by the value
def top_n_array_2d(array_2d, top_n): row_indices, column_indices = np.unravel_index(np.argsort(array_2d, axis=None), array_2d.shape) row_indices = row_indices[::-1][:top_n] column_indices = column_indices[::-1][:top_n] sorted_values = array_2d[row_indices, column_indices] return np.stack([row_indice...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def topN_array_2d(array_2d, topN=None):\n row_indices, column_indices = np.unravel_index(np.argsort(array_2d, axis=None), array_2d.shape)\n row_indices = row_indices[::-1][:topN]\n column_indices = column_indices[::-1][:topN]\n sorted_values = array_2d[row_indices, column_indices]\n sorted_triples =...
[ "0.74073654", "0.7327787", "0.71032065", "0.6694238", "0.6656095", "0.6633193", "0.6503937", "0.6362402", "0.63310814", "0.62197495", "0.6209443", "0.6191257", "0.6189325", "0.61888635", "0.6164573", "0.61391664", "0.6070247", "0.60639524", "0.598961", "0.5986245", "0.5982238...
0.7583843
0
Create application for the tests.
def app(): _app = create_app("flaskapp.settings.testing") _app.logger.setLevel(logging.CRITICAL) ctx = _app.test_request_context() ctx.push() yield _app ctx.pop()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def application():\n yield create_test_application()", "def create_and_run():\n\n app = App()\n app.run()", "def create_app(self):\n\n app = create_app()\n app.config.from_object('project.config.TestingConfig')\n return app", "def app():\n print('creating app with test vars')...
[ "0.78650266", "0.78183943", "0.779372", "0.7706425", "0.7696785", "0.76925087", "0.76771784", "0.76373273", "0.7630568", "0.76160675", "0.7544439", "0.7523237", "0.75079054", "0.7506175", "0.74288905", "0.74103117", "0.73966044", "0.737695", "0.73750865", "0.7362577", "0.7358...
0.0
-1
return signal quality in dbm. wlanSignalQuality is percentage value that represents the signal quality of the network. WLAN_SIGNAL_QUALITY is of type ULONG. This member contains a value between 0 and 100. A value of 0 implies an actual RSSI signal strength of 100 dbm. A value of 100 implies an actual RSSI signal streng...
def getSignalQualityInDBM(self): return (float(self.wlanSignalQuality) / 2.0) - 100.0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_signal_percent(self):\n # RSSI or this signal value is measured in decibels from 0 (zero) to\n # -120 (minus 120). The closer the value to 0 (zero), the stronger the\n # signal will be.\n if self.rssi < -80:\n return 20\n elif self.rssi < -70:\n retu...
[ "0.6074094", "0.60217094", "0.5889179", "0.57901305", "0.57396984", "0.5680173", "0.56357545", "0.5527894", "0.5477314", "0.54561406", "0.5389357", "0.5375582", "0.5350388", "0.5338676", "0.52917403", "0.5262764", "0.5253507", "0.52252936", "0.52248573", "0.5217617", "0.52172...
0.83052623
0
return the reason code string
def getWlanReasonCodeString(reasonCode): rcStr = '' try: buf = create_unicode_buffer(256) bufSize = DWORD(256) ret = WlanReasonCodeToString( reasonCode, bufSize, buf, None) if ret != ERROR_SUCCESS: raise WinError(ret) rcStr = buf.value except Exception,err...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getReason():", "def reason(self) -> str:\n return pulumi.get(self, \"reason\")", "def reason(self) -> str:\n return self._reason", "def _get_exc_reason(cls, exc: Exception) -> str:\n reason = str(exc)\n for reason_re in cls.REASON_RES:\n if reason_re.search(reason):...
[ "0.7898791", "0.7654689", "0.7463807", "0.74114925", "0.7312814", "0.70631933", "0.700501", "0.6937393", "0.69278306", "0.69059575", "0.67653686", "0.67569005", "0.66947216", "0.6684652", "0.6585945", "0.64782953", "0.6468771", "0.6448249", "0.6415473", "0.6304019", "0.621460...
0.74249285
3
return an interface using miniDesc name
def getInterface(self, miniDesc): for iface in self.ifaces: if iface.miniDesc() == miniDesc: return iface else: raise Exception('Interface with miniDesc "%s" not found' % miniDesc)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_interface(name=''):\n global interfaces\n return interfaces[name]", "def _get_interface_name(self):\n return self.__interface_name", "def _extract_interface(interface_name):\n return re.match(r'e(th?)?((?P<fex>\\d+)/)?(?P<mod>\\d+)/(?P<int>\\d+)', interface_name).groupdict()", "def interf...
[ "0.681402", "0.66090214", "0.6328007", "0.6283059", "0.6162838", "0.6135661", "0.6117199", "0.5963388", "0.5935286", "0.5923882", "0.5910261", "0.5909605", "0.5899179", "0.58971596", "0.5891223", "0.58635175", "0.58635175", "0.58635175", "0.58635175", "0.58635175", "0.5863517...
0.78897786
0
return network with profile name
def getProfile(self, profile): for network in self.networks: if network.getProfileName() == profile: return network else: raise Exception('Network with profile name "%s" not found' % profile)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_network_profile(arn=None):\n pass", "def network_profile(self) -> Optional[pulumi.Input['NetworkProfileArgs']]:\n return pulumi.get(self, \"network_profile\")", "def network_profile(self) -> Optional[pulumi.Input['NetworkProfileArgs']]:\n return pulumi.get(self, \"network_profile\")", ...
[ "0.8034974", "0.7666455", "0.7666455", "0.7470822", "0.7312471", "0.7185045", "0.678201", "0.6757629", "0.6633127", "0.65804386", "0.65450716", "0.6517732", "0.64937603", "0.64295596", "0.6365375", "0.6311133", "0.6305287", "0.62889874", "0.628199", "0.6279119", "0.6276328", ...
0.82880425
0
return network using ssid
def getSSID(self, ssid): for network in self.networks: if network.getSSID() == ssid: return network else: raise Exception('Network with SSID "%s" not found' % profile)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getnetwork(ipaddr):\n return '192.168.1.0/24'", "def get_network(self):\n return self.get_ip_network()[-1]", "def joinwifi():\n station = network.WLAN(network.STA_IF) # initiate a station mode\n\n if not station.isconnected():\n print('connecting to network:', ssid())\n ...
[ "0.7319217", "0.66508794", "0.651576", "0.6394354", "0.6324551", "0.6259074", "0.6236336", "0.6175038", "0.6138658", "0.61321485", "0.60615045", "0.6059806", "0.6049224", "0.6032489", "0.60294557", "0.60238683", "0.5988079", "0.5976195", "0.59709895", "0.5966414", "0.59601575...
0.75938874
0
open handle to Wlan
def openHandle(self): NegotiatedVersion = DWORD() self._handle = HANDLE() log.debug('WlanOpenHandle()') ret = WlanOpenHandle(1, None, byref(NegotiatedVersion), byref(self._handle)) if ret != ERROR_SUCCESS: raise WinError(ret) if self._useCallback: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def open(self, handle):\n raise NotImplementedError", "def open(self) -> None:", "def open(self) -> None:", "def open(self) -> None:", "def open(self):\n pn_link_open(self._impl)", "def openSensel():\n handle = None\n (error, device_list) = sensel.getDeviceList()\n if device_list.n...
[ "0.63797355", "0.6268434", "0.6268434", "0.6268434", "0.62281483", "0.62180805", "0.60923684", "0.6082648", "0.6039862", "0.6021626", "0.6021626", "0.59682363", "0.59587044", "0.5914516", "0.5914516", "0.5914516", "0.5914516", "0.5914516", "0.5914516", "0.5914516", "0.5894515...
0.6322617
1
update the description string
def updateDesc(self, wlanIfData=None): if wlanIfData: self._lstIfaces = [str(iface) for iface in wlanIfData.ifaces] else: with self.enumInterfaces() as wlanIfData: self._lstIfaces = [str(iface) for iface in wlanIfData.ifaces]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def description(self, new_description):\r\n self.set({\"description\": new_description})", "def description(self, newDescription=None):\n pass", "def request_description_update():\n global should_update_description\n should_update_description = True", "def update_description_debounced(sel...
[ "0.7761274", "0.7686069", "0.7643725", "0.74393356", "0.7404592", "0.74001515", "0.73334724", "0.7328683", "0.7264786", "0.72593653", "0.7226315", "0.7226315", "0.7226315", "0.7226315", "0.71891356", "0.7162867", "0.71464103", "0.714478", "0.71401286", "0.71049523", "0.710237...
0.0
-1
connect a wlan interface using a profile
def wlanConnect(self, iface, profile): log.debug('WlanInterface wlanConnect() - iface:%s profile:"%s"' % (iface.miniDesc(), profile)) wcp = WLAN_CONNECTION_PARAMETERS() wcp.wlanConnectMode = wlan_connection_mode_profile wcp.strProfile = profile wcp.pDot11Ssid = None # byref(ssid)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connect_session(profile):\n os.system('ssh ' + profile)", "def connect():\n \n print(\"*****Starting connection*****\")\n \n ssid = id_key.network_id #hidden ssid\n key = id_key.network_key #hidden key\n \n station = network.WLAN(network.STA_IF)\n \n if station.isconnected() == True:\n print(\...
[ "0.68901867", "0.67133456", "0.6624861", "0.66222256", "0.6520829", "0.64085853", "0.638917", "0.6374321", "0.6367763", "0.6331932", "0.6144454", "0.6085704", "0.5949704", "0.59170735", "0.5864868", "0.5848089", "0.5840637", "0.5806825", "0.5786279", "0.5785304", "0.5770876",...
0.78789246
0
disconnect a wlan interface
def wlanDisconnect(self, iface): log.debug('WlanInterface wlanDisconnect() - iface:%s' % (iface.miniDesc())) ret = WlanDisconnect( self._handle, byref(iface.InterfaceGuid), None) if ret != ERROR_SUCCESS: raise WinError(ret...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _DisconnectAP(self):\n disconnect_command = 'iw dev {interface} disconnect'.format(\n interface=self.interface)\n # This call may fail if we are not connected to any network.\n self._device.Call(disconnect_command)", "def disconnect_port(self, iface):\n self.iface_config(iface, adminMo...
[ "0.72159076", "0.70738363", "0.67676616", "0.6624292", "0.66076785", "0.66066116", "0.6585626", "0.65664726", "0.6516199", "0.65145594", "0.64772666", "0.6396341", "0.63787943", "0.63662654", "0.6359681", "0.63501954", "0.6323497", "0.6318395", "0.62968045", "0.626833", "0.62...
0.7975275
0
return profile XML for a defined profile
def wlanGetProfile(self, iface, profile, saveToFile=None): log.debug('WlanInterface wlanGetProfile() - profile:"%s" saveToFile:%s' % (profile,saveToFile)) sProfile = c_wchar_p(profile) sProfileXML = c_wchar_p() # create_unicode_buffer(1024) flags = DWORD(0) grantedAccess = DWOR...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _make_wlan_profile_xml(ssid, auth_method, encrypt_method, key_type = \"\", key_material = \"\", key_index = \"\", use_onex = False):\n\n # Try to generate a temporary file for storing the XML profile\n fd, path = tempfile.mkstemp(\".xml\")\n\n # Fill the content\n os.write(fd, '<?xml version=\"1.0\...
[ "0.6350907", "0.63488406", "0.6266231", "0.6177022", "0.61312056", "0.6096144", "0.6061613", "0.605447", "0.60457754", "0.6005076", "0.5981148", "0.5963808", "0.59127927", "0.58966184", "0.5859962", "0.5842467", "0.58242536", "0.5814976", "0.57743406", "0.5754428", "0.5705603...
0.6570712
0
return profile XML for a defined profile
def wlanSetProfile(self, iface, profileXML, overwrite=True): log.debug('WlanInterface wlanSetProfile()') flags = DWORD(0) sProfileXML = c_wchar_p(profileXML) dwReasonCode = DWORD() bOverwrite = BOOL(overwrite) ret = WlanSetProfile( self._handle, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wlanGetProfile(self, iface, profile, saveToFile=None):\n log.debug('WlanInterface wlanGetProfile() - profile:\"%s\" saveToFile:%s' % (profile,saveToFile))\n sProfile = c_wchar_p(profile)\n sProfileXML = c_wchar_p() # create_unicode_buffer(1024)\n flags = DWORD(0)\n grantedA...
[ "0.6570087", "0.6350916", "0.63491035", "0.6265601", "0.61771524", "0.61315066", "0.6096711", "0.6060701", "0.60537815", "0.604565", "0.6003376", "0.598159", "0.59635496", "0.59146196", "0.58956265", "0.5859714", "0.5842899", "0.5824503", "0.58148515", "0.57747084", "0.575358...
0.0
-1
Create a new profile from an existing profile
def wlanCopyProfile(self, iface, profile, newProfile, ssid=None, pass_phrase=None, saveOrigProfile=None, saveNewProfile=None): sXML = self.wlanGetProfile(iface, profile, saveToFile=saveOrigProfile) #print sXML reProf = re.compile('<{0}>.*</{0}>'.format('name')) reProf2 = re.compile('<{0}...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def createProfile(self):\n if self.profile:\n return\n from soc.modules.gsoc.models.profile import GSoCProfile\n user = self.createUser()\n properties = {'link_id': user.link_id, 'student_info': None, 'user': user,\n 'parent': user, 'scope': self.program, 'status': 'active'}\n ...
[ "0.8025856", "0.74423146", "0.73864764", "0.73674834", "0.73625", "0.73201007", "0.7273355", "0.7258695", "0.72443515", "0.72335404", "0.7229877", "0.7214494", "0.7181721", "0.715497", "0.7084597", "0.7083544", "0.70644885", "0.706198", "0.7054918", "0.70378166", "0.7000497",...
0.0
-1
Requests that the native 802.11 Wireless LAN driver scan for available wireless networks.
def wlanScan(self, iface): log.debug('WlanInterface wlanScan()') ret = WlanScan( self._handle, byref(iface.InterfaceGuid), None,None,None) if ret != ERROR_SUCCESS: raise WinError(ret)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scan(self):\n if self.isconnected is False:\n return False\n nets = self._wlan.scan()\n nets_list = {}\n for net in nets:\n nets_list['SSID'] = str(net[0], 'utf8')\n # nets_list['bssid'] = str(net[1])\n nets_list['CHANNEL'] = str(net[2])\n...
[ "0.6717677", "0.66940945", "0.63552207", "0.63373786", "0.62656766", "0.61971956", "0.61675155", "0.61275834", "0.6100425", "0.60858244", "0.60420954", "0.5974406", "0.58970606", "0.5790645", "0.5784938", "0.5771123", "0.57069147", "0.5658612", "0.5653181", "0.56500864", "0.5...
0.50168884
66
list all interfaces available
def _ifList(self): bNetworks = False for cmd in self.lstCmd[1:]: if cmd == 'networks' or cmd == 'n': bNetworks = True print 'enum interfaces ...' with self.wlan.enumInterfaces() as wlanIfData: # find each available network for each interface ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list():\n\n\treturn netifaces.interfaces()", "def interfaces(self):\n if self._interfaces is None:\n self._interfaces = list(x[\"interface\"] for x in self._interfaces_detailed_list())\n\n return self._interfaces", "def _get_interfaces(self):\n return self.__interfaces", "def ...
[ "0.8556273", "0.7459789", "0.7315116", "0.7315116", "0.7315116", "0.72669274", "0.72245455", "0.721408", "0.7142727", "0.71341616", "0.7067674", "0.7016781", "0.69752765", "0.6932081", "0.6854325", "0.67948496", "0.6784868", "0.6717955", "0.6681753", "0.6681753", "0.6619683",...
0.7075943
10
Return an unstructured grid with the connectivity given by matplotlib Code borrowed from Chris Richardson
def mesh2triang(mesh: df.Mesh) -> tri.Triangulation: xy = mesh.coordinates() return tri.Triangulation(xy[:, 0], xy[:, 1], mesh.cells())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def buildGrid(self, plot=False):\r\n\r\n print(\"Constructing grid\")\r\n # print(\"Grid dims\", self.ne, self.nn, self.nz)\r\n # print(\"Num points\", 2*(self.ne+1)*(self.nn+1)*3, len(self.coords))\r\n\r\n # number of edges\r\n self.ndx = self.ne + 1\r\n self.ndy = self.n...
[ "0.6508896", "0.63165975", "0.6273557", "0.62416875", "0.61100554", "0.6023052", "0.5950282", "0.58708537", "0.587006", "0.5862989", "0.5830344", "0.58211243", "0.5815232", "0.57970977", "0.5794793", "0.57859427", "0.5774907", "0.57310355", "0.57252765", "0.5724067", "0.57131...
0.0
-1
Return a pseudocolor plot of an unstructured triangular grid.
def mplot_cellfunction(cell_function: df.MeshFunction) -> Tuple[plt.Figure, Any]: fig, ax = plt.subplots(1) tri = mesh2triang(cell_function.mesh()) ax.tripcolor(tri, facecolors=cell_function.array()) return fig, ax
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mpl_triangulation(self):\n tris=[] # [ (n1,n2,n3), ...]\n\n for c in self.valid_cell_iter():\n nodes=np.array(self.cell_to_nodes(c))\n\n # this only works for convex cells\n for i in range(1,len(nodes)-1):\n tris.append( nodes[ [0,i,i+1] ] )\n\n ...
[ "0.55358636", "0.54399073", "0.54330146", "0.5422613", "0.53930223", "0.5346241", "0.5303776", "0.52686137", "0.52419925", "0.5238832", "0.5218028", "0.5201694", "0.5186084", "0.51579493", "0.51142186", "0.5112351", "0.5108906", "0.50909567", "0.5072048", "0.5052789", "0.5038...
0.48508424
34
Plot the meh as an unstructured grid.
def mplot_mesh(meshtriang: df.Mesh) -> Tuple[plt.Figure, Any]: fig, ax = plt.subplots(1) ax.triplot(meshtriang, 'ko-', lw=1) return fig, ax
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plotgrid(data,d=10,shape=(30,30)):\n ion()\n gray()\n clf()\n for i in range(min(d*d,len(data))):\n subplot(d,d,i+1)\n row = data[i]\n if shape is not None: row = row.reshape(shape)\n imshow(row)\n ginput(1,timeout=0.1)", "def plot(self):\n\t\tself.plotOfHeatingCurr...
[ "0.6244365", "0.62126404", "0.62066466", "0.61587167", "0.60979223", "0.6090224", "0.59458405", "0.59377295", "0.5907159", "0.58908015", "0.5879286", "0.5874144", "0.5863606", "0.5861239", "0.5772227", "0.5736954", "0.5704334", "0.5672166", "0.5670842", "0.5664432", "0.564503...
0.52730376
94
Plot a function. The kind of plot depends on the function.
def mplot_function( function: df.Function, vmin=None, vmax=None, shading="gouraud", colourbar=False, colourbar_label=None ) -> Tuple[plt.Figure, Any]: mesh = function.function_space().mesh() if mesh.geometry().dim() != 2: raise AttributeError("Mesh must be 2D") fig, ax = plt...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot():\n pass", "def plot(\n self,\n function: Callable[[float], float],\n x_range: Sequence[float] | None = None,\n use_vectorized: bool = False,\n **kwargs,\n ):\n\n t_range = np.array(self.x_range, dtype=float)\n if x_range is not None:\n ...
[ "0.7440588", "0.7227534", "0.70364696", "0.67569745", "0.6756228", "0.6744774", "0.6693308", "0.66897386", "0.6668732", "0.6635225", "0.6518727", "0.6354156", "0.6338658", "0.63316536", "0.63066083", "0.6276415", "0.62636936", "0.6238976", "0.62312776", "0.62132955", "0.61974...
0.6611125
10
Parser used for script command with all its necessary parameters needed to be run on the cluster
def parse_options(): global parser parser.add_option("-r", "--regions", dest="input_brain_regions", help="Input file for brain region data", action="store", type='string') parser.add_option("-g", "--gray", dest="input_gray_levels", help="Inp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse():\n intro = \"\"\"\\\n Use this script to bootstrap, join nodes within a Galera Cluster\n ----------------------------------------------------------------\n Avoid joining more than one node at once!\n \"\"\"\n parser = argparse.ArgumentParser(\n formatter_c...
[ "0.6959925", "0.6677796", "0.66506535", "0.6597472", "0.64935666", "0.63764864", "0.6372577", "0.6371842", "0.6340508", "0.6328619", "0.63115484", "0.63084835", "0.6289498", "0.6243776", "0.6233198", "0.62203646", "0.62061137", "0.62059563", "0.62047905", "0.6189151", "0.6176...
0.0
-1
builds a library given required scripts to includes and other arguments
def build(request): def get(name): return request.GET.get(name) def get_arr(name): val = get(name) if val: return val.split(",") else: return [] require = get_arr("require") exclude = get_arr("exclude") excludeLibs = get_arr("excludeLibs") requireLibs = get_arr("requireLibs")...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build(working_directory=None, args=None):\n from .buildme import main\n if args is None:\n args = []\n return main(working_directory, args)", "def build(self):\n env = ConfigureEnvironment(self.deps_cpp_info, self.settings)\n\n set_path_command = \"\"\n # Download nasm as...
[ "0.60995007", "0.60779", "0.60349417", "0.59920174", "0.59571064", "0.5946177", "0.5943936", "0.5908569", "0.59018505", "0.5898167", "0.5886315", "0.58850145", "0.58688945", "0.58599895", "0.5858286", "0.5827634", "0.58227205", "0.5804258", "0.5778985", "0.5758587", "0.574068...
0.58530253
15
Get a single action label for the current state, ideally whatever the planner would have outputted if just called on `cstate` in isolation.
def single_action_label(self, cstate): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def action2label(action):\n if action[0] == 'shift':\n label = action[0]\n elif action[0] == 'reduce':\n label = '-'.join(list(action))\n else:\n raise ValueError(\"Unrecognized parsing action: {}\".format(action))\n return label", "def state_name(self):\n return self.stat...
[ "0.68593997", "0.6409792", "0.63704884", "0.6344228", "0.6292176", "0.616831", "0.61657256", "0.6163822", "0.6136787", "0.6057938", "0.605119", "0.605119", "0.6047956", "0.6044922", "0.6044922", "0.6044922", "0.6044414", "0.60374177", "0.6018807", "0.60048354", "0.60048354", ...
0.79932404
0
Produce an iterable of states visited by the teacher policy when initialised in the given state.
def extract_policy_envelope(self, cstate): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def iter_states(self):\n return iter(self._states_)", "def state_list(self) -> Sequence[TState]:\n pass", "def __iter__(self):\n return self.states()", "def get_list_of_states(self):\n return self.states", "def get_states(self):\n return product(*[phi.automaton().states f...
[ "0.6537469", "0.6507559", "0.6333943", "0.62946624", "0.6279952", "0.6270858", "0.62265533", "0.6213435", "0.6131452", "0.61095124", "0.6086804", "0.6057857", "0.60427266", "0.6012612", "0.59918135", "0.5902357", "0.5893258", "0.58824396", "0.58483016", "0.58471715", "0.58373...
0.0
-1
f"""Perform a single rollout under the expert policy & return the visited states. On probabilistic problems, this differs from extract_policy_envelope in
def expert_policy_rollout(self, cstate, *, len_bound=DEFAULT_MAX_LEN): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rollout(env, our_policy, expert_policy, num_rollouts, max_steps):\n returns = []\n observations = []\n actions = []\n for i in range(num_rollouts):\n # print('iter', i)\n obs = env.reset()\n done = False\n totalr = 0.\n steps = 0\n while not done:\n ...
[ "0.6982677", "0.64091736", "0.61041176", "0.5740429", "0.5698572", "0.56384194", "0.5564403", "0.53721863", "0.53550786", "0.53181446", "0.52759427", "0.52260995", "0.513249", "0.51045525", "0.50875306", "0.5063328", "0.5041458", "0.5035391", "0.499523", "0.49948314", "0.4992...
0.56915593
5
Cutoff value (float) for maximum length of a path to reach goal; no valid path returned by the planner has higher cost than this.
def dead_end_value(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getCutoffDistance(self):\n return self.cutoffDistance", "def cutoff_distance(self):\n return self._cutoff_distance", "def GetEpsilonBeer(Abs, conc, pathLength):\n return Abs / (conc * pathLength)", "def pathcost_cooler(k=5, lam=0.0003, limit=3000):\n return lambda t: (k * exp(-lam * t...
[ "0.66599065", "0.6464602", "0.59441173", "0.5824008", "0.5823617", "0.5738601", "0.5698907", "0.563141", "0.562286", "0.55233145", "0.5477712", "0.5420577", "0.53618807", "0.53434753", "0.53083557", "0.5302423", "0.52958834", "0.5275068", "0.5263953", "0.5245157", "0.5243079"...
0.0
-1
Wraps a method of this class in a SSiPP timeout, so that planning can't take too long. Maintains a blacklist of states that caused timeouts before, and prevents relevant methods from being called again on those states by simply raising another timeout.
def _blacklist_decorator(inner_func): @wraps(inner_func) def wrapper_func(self, cstate, *args, **kwargs): assert isinstance(cstate, CanonicalState), \ "func %s was expecting a cstate but got '%r'" \ % (inner_func, cstate) if cstate._ident_tup() in...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def timeout(time):\n\n def wrapper(f):\n @wraps(f)\n def wrapped_f(self, event, context):\n return f(self, event, context)\n\n wrapped_f.timeout = time\n return wrapped_f\n\n return wrapper", "def timeout(time_limit):\n\n class TimeoutException(Exception):\n ...
[ "0.62377894", "0.61471254", "0.6033199", "0.5992332", "0.59493905", "0.57512546", "0.5742238", "0.5699485", "0.5643137", "0.5635711", "0.56170464", "0.5599529", "0.5585652", "0.5580245", "0.55567193", "0.5546809", "0.55230653", "0.55142486", "0.55070794", "0.5488454", "0.5446...
0.6632625
0
Turn a unique action identifier string (i.e SSiPPformatted action string) into an index into the action list for this problem.
def _act_id(self, act_str): # FIXME: instead of doing this shit I should just fix the things in # state_reprs.py so that they can take action IDs (numeric ones) OR # action names OR BoundActions! Have a family of resolve_action_to_* # methods that let you convert from any one representa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_action_id(self, action_text: str) -> int:\n\n actions_tuple = tuple(action_text.split('+'))\n return self.action_tuples2ids[actions_tuple] # todo unhandled exception when not found", "def str_to_action(str):\n raise NotImplementedError", "def get_action_id(self, action_text: str) ...
[ "0.6287347", "0.62635666", "0.6073907", "0.604243", "0.5834542", "0.5821824", "0.5821046", "0.58161885", "0.5769511", "0.57691544", "0.56986296", "0.5698094", "0.5687889", "0.5677664", "0.5606154", "0.55739564", "0.5573762", "0.55202705", "0.5516037", "0.55082506", "0.5484332...
0.66609216
0
Dynamically call the function according 'oper'
def process_data(self, oper='SCAN'): func_name = oper.lower() return getattr(self, func_name)()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _execute(self, op, time):\n raise NotImplementedError", "def do_run(calc, a=int, b=int):\n of = calc.oper_func\n calc.log.msg(10, 'Calculating', operation=of, a=a, b=b)\n res = getattr(operator, of, calc.not_found)(a, b)\n calc.log.msg(20, 'Returning', result=res)\n ...
[ "0.61901075", "0.61292493", "0.61219674", "0.60508186", "0.60292137", "0.594123", "0.5882175", "0.5842769", "0.58308256", "0.5827575", "0.58041626", "0.57888895", "0.5762354", "0.5761433", "0.5750888", "0.5736811", "0.5736043", "0.5727928", "0.5691805", "0.56814253", "0.56723...
0.64394444
0
Implemnets the scan method in BasePlugin class. In this mac module, mac addesses were retrieved by snmpwalk python lib.
def scan(self): walk_result = utils.snmp_walk(self.host, self.credential, "BRIDGE-MIB::dot1dTpFdbPort") if not walk_result: return None mac_list = [] for result in walk_result: if not result or result['value'] == str(0): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Scan(self, plugin):\n raise 'Method not implemented'", "def scan(self):\n return", "def on_scanner_start(self, scanner):", "def _scan(self): # pragma: no cover\n raise NotImplementedError()", "def get_scan(self):\n pass", "def scan(self):\n for angle in range(self....
[ "0.664008", "0.5926287", "0.5923922", "0.59137505", "0.5759931", "0.55758125", "0.5553623", "0.55237395", "0.54862815", "0.54580957", "0.5450833", "0.5449223", "0.5423793", "0.54232156", "0.5345217", "0.53041476", "0.5296159", "0.52909553", "0.5288499", "0.5279574", "0.522754...
0.5530806
7