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
Defines compactly a complete lsystem
def fromGenomeRepresentation(self,genome): self.clear() #print(genome) tokens = genome.split("||") self.setAxiomFromString(tokens[0]) self.setIterations(int(tokens[1])) for i in range(2,len(tokens)): self.addProductionFromGenomeRepresentation(tokens[i])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def createLsystemFromFile( filename ):\n\tfp = open(filename, \"r\")\n\tlines = fp.readlines()\n\tfp.close()\n\tlsys = init()\n\tfor line in lines:\n\t\twords = line.split()\n\t\tif words[0] == 'base':\n\t\t\tsetBase(lsys, words[1])\n\t\telif words[0] == 'rule':\n\t\t\taddRule(lsys, words[1:])\n\treturn lsys", "...
[ "0.6005125", "0.57788986", "0.57766825", "0.574704", "0.57327974", "0.55598825", "0.5504319", "0.54979235", "0.53936106", "0.53858566", "0.53837013", "0.5377843", "0.5371647", "0.53696257", "0.5365755", "0.5361104", "0.53594065", "0.5354975", "0.5329676", "0.53259987", "0.529...
0.0
-1
Returns the pString that results from iterating this lsystem. Computes it, if needed.
def getResultPString(self): # TODO: WARNING!!! Make sure the resultPstring is emptied if we do some modification to the lsystem!! OR THIS WILL BEHAVE INCORRECTLY! if self.resultPString == None: self.resultPString = self.iterate() return self.resultPString
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def buildString( lsys, iter ):\n\tnstring = getBase(lsys)\n\trule = getRule(lsys, 0)\n\tsymbol = rule[0]\n\treplacement = rule[1]\n\tfor i in range(iter):\n\t\tnstring = nstring.replace( symbol, replacement )\n\treturn nstring", "def get_string(self):\n return (self.loop_level+1) * ' ' + ','.join(map(str,...
[ "0.6028617", "0.59457964", "0.58593225", "0.57503265", "0.57239276", "0.5717773", "0.5690348", "0.56889313", "0.56804085", "0.56782484", "0.5660313", "0.5655957", "0.56339836", "0.5624231", "0.5619703", "0.56152797", "0.56096286", "0.5604201", "0.5588711", "0.5579955", "0.553...
0.7823306
0
Creates a fancy decorator for adding checks.
def fancy_test_decorator( lister, arguments=lambda x: x, attributes=lambda x: {"id": str(x)}, naming=lambda x: str(x), debug=False ): def for_all_stuff(check): for x in lister(): if debug: logger.info("add test %s / %s " % (check, x)) add_checker_f(check, x, argu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_check_function(check_function: Callable):\n\n def decorator(func: Callable):\n @wraps(func)\n def wrapper(*args, **kwargs):\n check_function(*args, *kwargs.values())\n return func(*args, **kwargs)\n\n return wrapper\n\n name = getattr(check_function, '__name...
[ "0.7273434", "0.6325305", "0.6310445", "0.6059395", "0.59788996", "0.59650195", "0.58667994", "0.5828741", "0.5791087", "0.5753213", "0.57451487", "0.573942", "0.5720317", "0.57140326", "0.5673965", "0.56716275", "0.5637673", "0.5629896", "0.56294024", "0.5589285", "0.5578370...
0.68729776
1
Parses body of page with results
def redirect_search(self, response): hxs = HtmlXPathSelector(response) yield Request( url=search_url, dont_filter=True, headers=self.headers, callback=self.parse_search )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse(self, response):\n yield{\n 'url': response.url,\n 'title': response.css(\"h1.article-main-title::text\").get(),\n 'sub_title': response.css(\"h2.article-sub-title::text\").get(),\n 'article_image': (response.css(\"div.article-image img::attr(src)\").get...
[ "0.64853513", "0.6482158", "0.6456431", "0.6455991", "0.64094716", "0.6360284", "0.6351245", "0.6322419", "0.6322419", "0.6287243", "0.62466747", "0.62429255", "0.62403435", "0.6224466", "0.6218099", "0.62085515", "0.6199304", "0.6150161", "0.61090165", "0.61054695", "0.60829...
0.0
-1
What is a prime by any other name?
def is_prime(self): prime = [True for i in range(self.count_cities + 1)] ## taken from https://www.geeksforgeeks.org/sieve-of-eratosthenes ## modified to fit this program. p = 2 while (p * p <= self.count_cities): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_prime(self):\n pass", "def return_prime(x):\n \n for m in range(x+1):\n if m!=0 and x%m==0 and m!=1 and x!=m:\n return 'not prime'\n return 'prime'", "def getPrime(bits):\n\twhile(True) :\n\t\t# on continue a tirer des nombres tant que l'on n'a pas trouve de nombre prem...
[ "0.6933746", "0.68087786", "0.67593974", "0.6696474", "0.669573", "0.66482574", "0.6638508", "0.6630151", "0.6607786", "0.6583643", "0.6467024", "0.64517045", "0.64022636", "0.6400168", "0.6374949", "0.63715667", "0.632655", "0.63087493", "0.62899244", "0.62851256", "0.628077...
0.0
-1
Here we apply the penalty if the reindeer haven't hit a city with a prime number after 10 stops.
def apply_penalty(self, distance): self.cities_hit += 1 # Adds to the counter of cities without visiting a prime. if self.cities_hit > 10: # If Santa has visted more than 10 cities ... penalty_distance = ( distance * 0.1) + distance # ...Applies the penalt...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def problem077():\n\n cond = lambda n: num_prime_sum_ways(n) > 5000\n ans = next(filter(cond, itertools.count(2)))\n return ans", "def optimize_on_n_cops(self):\n self.optimize_on_target_profiles()\n max_revenue = -INF\n while self.get_revenue_per_hour() >= max_revenue:\n ...
[ "0.56442875", "0.55455905", "0.54904443", "0.5464032", "0.5369751", "0.53377616", "0.53199047", "0.53149813", "0.5300897", "0.5283969", "0.527871", "0.5255954", "0.52017784", "0.52017784", "0.52017784", "0.5185166", "0.51775", "0.5160633", "0.5146357", "0.5146357", "0.5138448...
0.6755605
0
A view to show all plans, including search queries
def all_plans(request): plans = Plan.objects.all() context = { 'plans': plans, } return render(request, 'plans/plans.html', context)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plans(self):\n title = self.context.Title()\n return self.portal_catalog(portal_type='Plan', Subject=title)", "def plans(self):\r\n return pl.Plans(self)", "def plans():\n results = []\n if 'qry' in request.args:\n look_for = request.args['qry']\n if look_for[0] ==...
[ "0.7310067", "0.7198465", "0.7083822", "0.6990251", "0.68972915", "0.68796146", "0.6816322", "0.67738247", "0.66978693", "0.66711676", "0.6489017", "0.63918585", "0.6355578", "0.6252215", "0.613207", "0.59970254", "0.5911662", "0.58731335", "0.5862313", "0.582986", "0.5799526...
0.7688979
0
A view to show individual plan details
def plan_detail(request, plan_id): plan = get_object_or_404(Plan, pk=plan_id) context = { 'plan': plan, } return render(request, 'plans/plan_detail.html', context)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show(self):\n self.parser.add_argument('plan_uuid',\n help=\"Plan uuid or name\")\n args = self.parser.parse_args()\n response = self.client.plans.find(name_or_id=args.plan_uuid)\n fields = ['uuid', 'name', 'description', 'uri']\n data = dict([...
[ "0.73478836", "0.73370415", "0.72034496", "0.7157708", "0.7024649", "0.7023542", "0.6954958", "0.68937033", "0.6892831", "0.6678772", "0.6660882", "0.6554114", "0.64640635", "0.6410193", "0.6300984", "0.62471807", "0.6220166", "0.6216608", "0.62138957", "0.61967915", "0.61773...
0.8303781
0
Generates a list of biases with changes in trend as given by "break_pt_list"
def make_bias_list_switch(lm, input_bias, break_point_list): num_actions = lm.get_num_actions() # bias() is a list: [ [action 1 losses], [actn 2 losses] ...] bias = list() # Create a list of lists trend = [[], [] ...] # trend[i] holds biases for the entire time period for action i trend = list(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_stochastic_losses(lm, break_point_list, option):\n\n num_rounds = lm.get_num_rounds()\n num_actions = lm.get_num_actions()\n input_bias = list()\n\n if option == 0:\n mu_base = 0.450\n # input_bias indicate the range of variation of bias for the particular action\n inp...
[ "0.55167365", "0.5464309", "0.53766716", "0.5337338", "0.52728546", "0.5107063", "0.50852406", "0.50195694", "0.50195694", "0.50195694", "0.50195694", "0.5011635", "0.5011635", "0.49982467", "0.4990661", "0.49348637", "0.49161673", "0.49007043", "0.48979306", "0.48661646", "0...
0.70775414
0
Generates actual loss vector on which (any) algorithm runs.
def generate_stochastic_losses(lm, break_point_list, option): num_rounds = lm.get_num_rounds() num_actions = lm.get_num_actions() input_bias = list() if option == 0: mu_base = 0.450 # input_bias indicate the range of variation of bias for the particular action input_bias.append...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_loss(self):", "def compute_loss(self, obs, returns):", "def compute_loss(self):\n self.prototypes = self.compute_prototypes()\n self.test_logits = self.compute_logits()\n loss = tf.nn.sparse_softmax_cross_entropy_with_logits(\n labels=self.episode.test_labels, logits=self.test_logit...
[ "0.73324686", "0.69774777", "0.6881946", "0.67719156", "0.67131245", "0.6662713", "0.6615021", "0.65667623", "0.65462005", "0.65456057", "0.6513204", "0.6513204", "0.6513204", "0.6513204", "0.6474533", "0.645884", "0.6450064", "0.64219075", "0.6405554", "0.6405144", "0.639776...
0.0
-1
this function is executed every subscription.
def subscribe_callback(self, scan: LaserScan): pub_msg = Range() pub_msg.range = self.calc_distance_to_wall(scan) print("min_distance front: ", pub_msg.range) # Here I am publishing min_distance_front self.control_publisher.publish(pub_msg)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subscribe(observer):", "def subscribe(observer):", "def test_process_subscriptions(self):\n pass", "def subscribe(receiver):", "def subscribe(receiver):", "def subscribe(receiver):", "def run(self):\n\t\tfor item in self.pubSub.listen():\n\t\t\tself.processItem(item)", "def notify(self) ->...
[ "0.7396868", "0.7396868", "0.7225957", "0.7034127", "0.7034127", "0.7034127", "0.6860445", "0.6794288", "0.67500645", "0.6742202", "0.6735108", "0.67132324", "0.67115766", "0.66025513", "0.6517039", "0.64258933", "0.6377078", "0.6316633", "0.6258438", "0.6250808", "0.62267375...
0.0
-1
Recall metric. Only computes a batchwise average of recall. Computes the recall, a metric for multilabel classification of how many relevant items are selected.
def recall(y_true, y_pred): true_positives = K.sum(K.round(K.clip(y_true * y_pred, 0, 1))) possible_positives = K.sum(K.round(K.clip(y_true, 0, 1))) recall = true_positives / (possible_positives + K.epsilon()) return recall
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recall(y_true, y_pred, average, labels):\n\n y_true, y_pred = check_metric_args(y_true, y_pred, average, labels)\n\n result = None\n\n m = len(y_true)\n n = len(labels)\n\n confusion_matrix = get_confusion_matrix(y_true, y_pred, labels).T\n\n if average == \"micro\":\n numerator = np.t...
[ "0.76044506", "0.74481285", "0.74049824", "0.7280345", "0.7208418", "0.71655464", "0.7157273", "0.7144908", "0.7144908", "0.7144908", "0.7144908", "0.7144908", "0.7144908", "0.7131389", "0.710048", "0.7065451", "0.7064196", "0.70623666", "0.70623666", "0.70623666", "0.7062366...
0.70967406
31
Precision metric. Only computes a batchwise average of precision. Computes the precision, a metric for multilabel classification of how many selected items are relevant.
def precision(y_true, y_pred): true_positives = K.sum(K.round(K.clip(y_true * y_pred, 0, 1))) predicted_positives = K.sum(K.round(K.clip(y_pred, 0, 1))) precision = true_positives / (predicted_positives + K.epsilon()) return precision
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def precision(self):\n self.overall_precision = precision_score(\n self.y_true, self.y_pred, average = self.average_type).round(self.digits_count_fp)\n self.classes_precision = precision_score(\n self.y_true, self.y_pred, average = None).round(self.digits_count_fp)", "def comp...
[ "0.74888414", "0.7288112", "0.71588355", "0.7152657", "0.70652217", "0.69849795", "0.6964874", "0.69532984", "0.69120836", "0.6833932", "0.681686", "0.6808751", "0.68043625", "0.68043625", "0.68043625", "0.68043625", "0.68043625", "0.68043625", "0.6785024", "0.6756936", "0.67...
0.67543876
45
Sample from expert's demonstrations
def sample_exp( self, batch_size: int ) -> Tuple[torch.Tensor, torch.Tensor, torch.Tensor, torch.Tensor, torch.Tensor]: # Samples from expert's demonstrations. all_states_exp, all_actions_exp, _, all_dones_exp, all_next_states_exp = \ self.buffer_exp.get() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sample(self):", "def sample(self):\n # This method is set in __init__.\n pass", "def sample(self):\r\n raise NotImplementedError", "def sample(self, *args, **kwargs):", "def sample(self):\n raise NotImplementedError(\"Override me!\")", "def sample(self):\n raise NotImpl...
[ "0.801074", "0.7336341", "0.726373", "0.7109755", "0.7036162", "0.69276094", "0.69276094", "0.6732838", "0.67123544", "0.6475089", "0.6475089", "0.6475089", "0.6475089", "0.64721847", "0.6412025", "0.6410103", "0.638004", "0.63401127", "0.63341457", "0.62087774", "0.61651415"...
0.0
-1
Generates elements of data in random order
def in_random_order(theta): indexes = [i for i,_ in enumerate(data)] # creates a list of indices random.shuffle(indexes) # shuffles them for i in indexes: yield data[i] # return data in that order
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def in_random_order(data):\n idx = [i for i, _ in enumerate(data)]\n random.shuffle(idx)\n for i in idx:\n yield data[i]", "def in_random_order(data):\n indexes = [i for i, _ in enumerate(data)] # create a list of indexes\n random.shuffle(indexes) # shuffle them\n f...
[ "0.7262608", "0.7254635", "0.7237436", "0.7121677", "0.6964875", "0.69248337", "0.68586147", "0.6843434", "0.6768304", "0.6749781", "0.6682726", "0.6605506", "0.6604064", "0.65523404", "0.65341103", "0.6526108", "0.6483904", "0.6438686", "0.64077073", "0.6377881", "0.6364842"...
0.6722621
10
return a function that for any input x returns f(x)
def negate(f): return lambda *args, **kwargs: -f(*args, **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def f(x):\n return x**2", "def one():\n return lambda f: lambda x: f(x)", "def make_func_repeater(f, x):\n\n def repeat(i, x=x):\n if i == 0:\n return x\n else:\n return repeat(i-1, f(x))\n return repeat", "def g(f, x: float):\n return lambda x: f(x + f(x)) ...
[ "0.7142296", "0.71152514", "0.70200515", "0.6926727", "0.68230706", "0.67764896", "0.6700583", "0.66723657", "0.66669524", "0.66024786", "0.6597746", "0.6529977", "0.6485928", "0.64814407", "0.6480471", "0.64629745", "0.64629745", "0.64629745", "0.64629745", "0.6453006", "0.6...
0.0
-1
the same when f returns a list of numbers
def negate_all(f): return lambda *args, **kwargs: [-y for y in f(*args,**kwargs)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eval_f(f, xs):\n res_list = []\n for num in xs:\n #int_num = int(num)\n fun_num = f(num)\n res_list.append(fun_num)\n\n return res_list", "def eval_f(f, xs):\n l = []\n for x in xs:\n l.append(f(x))\n return l", "def sequence(f, lst: list) -> list:\n ret = [...
[ "0.7165293", "0.7018054", "0.6783615", "0.6652443", "0.6626969", "0.638973", "0.62692827", "0.6085412", "0.60691726", "0.6050465", "0.6025006", "0.6017229", "0.59980124", "0.5991823", "0.5990009", "0.59607744", "0.5948411", "0.591182", "0.5898125", "0.58947545", "0.5875967", ...
0.0
-1
Check a property of a STIX Object against this casefold filter, but with a casefold operator.
def _check_property(self, stix_obj_property): # Had to keep the following code so that # If filtering on a timestamp property and the filter value is a string, # try to convert the filter value to a datetime instance. if isinstance(stix_obj_property, datetime) and isinstance(self.value, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter_func(fieldname):\n if fieldname.startswith('_'):\n return False\n value = getattr(class_, fieldname)\n \n return isinstance(value, type)", "def subtest_Case_estLibre():\n _out =''\n a = tp.Case(42)\n _out = check_property(a.estLibre)\n a = tp.Case(23,...
[ "0.53179395", "0.52419406", "0.50970495", "0.49938634", "0.49797964", "0.4970947", "0.48606667", "0.47654226", "0.4718314", "0.46296453", "0.4607768", "0.45705086", "0.45391482", "0.4537164", "0.45287728", "0.45066768", "0.45066455", "0.44971266", "0.4487424", "0.44674322", "...
0.682188
0
calculates the maximization step in the EM algorithm for a GMM
def maximization(X, g): if not verify(X, g): return None, None, None n, d = X.shape k, _ = g.shape m = np.zeros((k, d)) S = np.empty((k, d, d)) pi = np.zeros((k, )) for i in range(k): Nk = np.sum(g[i]) pi[i] = Nk / n gi = g[i].reshape(1, n) m[i] = np.s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def em_mog(X, k, max_iter=20):\n\n # Initialize variables\n mu = None\n sigma = [np.eye(X.shape[1]) for i in range(k)]\n phi = np.ones([k,])/k\n ll_prev = float('inf')\n start = time.time()\n\n #######################################################################\n # TODO: ...
[ "0.62958145", "0.612357", "0.61165535", "0.5972927", "0.59422433", "0.5917642", "0.59169376", "0.58822757", "0.5831473", "0.5787356", "0.5751428", "0.57348675", "0.57332474", "0.5717566", "0.56960833", "0.5687598", "0.56711745", "0.56593215", "0.5650866", "0.5630811", "0.5629...
0.6266878
1
Return the ID of the matching item. A regexp is used. If the regexp is not found, return None
def extract_item_id(url): m = re.search('/([0-9]+)\.htm', url) if m is not None: return m.group(1) else: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_id(href):\n ID = idRE.search(href)\n if ID:\n return ID.group(1)", "def get_id_from_name(item_name):\n try:\n return next(item for item in mapping if item[\"name\"].lower() == item_name.lower())[\"id\"]\n except StopIteration:\n return None", "def get_id(self, item):\n...
[ "0.6506368", "0.6427352", "0.6353122", "0.63430667", "0.632683", "0.6239559", "0.6149368", "0.61301756", "0.6050991", "0.6000301", "0.59869", "0.5912312", "0.59105664", "0.5822848", "0.5814121", "0.57743317", "0.5769344", "0.57639855", "0.5721476", "0.5716667", "0.568763", ...
0.65152615
0
Get the item list and the entire items details by using several threads to speed up processing. First the list of items are retrieved by using multi threading. Then the list is processed ; a thread is processing a fixed number of items (5 by default).
def get_item_list_with_full_details_fast(self, stop_item=None, max_page=25): item_list = self.get_item_list(stop_item, max_page) q = Queue.Queue() item_per_thread = 5 logging.info("Running threads ...") x = 1 thread_list = [] for _ in item_list[::item_per_thread]...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getAllListPage():\n firstPage = city + '/line1'\n data = urlopen(firstPage).read().decode('gbk')\n urlList = getLineTypeList(data)\n urlList.append(firstPage)\n num = len(urlList)\n i = 0\n p = Pool(processes=4)\n pageData = p.map(readData, urlList)\n# manager = Manager()\n# pageDat...
[ "0.66107327", "0.6286475", "0.6218568", "0.62020344", "0.5968334", "0.5835191", "0.5825054", "0.57762015", "0.5757452", "0.57314986", "0.5681635", "0.5675728", "0.5591356", "0.5585768", "0.5572358", "0.5556921", "0.55254465", "0.5524028", "0.55230993", "0.5522514", "0.5517528...
0.7719556
0
test that inheritance works for the first level
def test_level1_recursion(self): recursed = recurse_files('filename', self.files['filename'], self.files) self.assertEqual(recursed, ["file7", "file2", "file3"])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test(self):\n class MissingAncestor1(Ancestor):\n \"\"\" no op \"\"\"\n return MissingAncestor1", "def test_inheritance(self):\n self.write_load_config()\n self.check_cmd([\n 'File \"{root}foo.php\", line 3, characters 7-9: Foo',\n\n ' inherited...
[ "0.7124934", "0.7077564", "0.70426524", "0.70383346", "0.699506", "0.69672513", "0.69421875", "0.68661386", "0.6854943", "0.6838767", "0.6786299", "0.676167", "0.6732592", "0.6731977", "0.67163223", "0.6715989", "0.6709305", "0.6689052", "0.66835797", "0.66330886", "0.6622685...
0.0
-1
test that inheritance works for the second level
def test_level2_recursion(self): recursed = recurse_files('filename2', self.files['filename2'], self.files) self.assertEqual(recursed, ["file7", "file2", "file3", "file6"])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_inheritance(self):\n self.assertTrue(issubclass(Rectangle, Base))", "def test_inheritance(self):\n self.assertTrue(issubclass(type(self.user_1), BaseModel))", "def test_inherit(self):\n\n new_jawn = Amenity()\n self.assertIsInstance(new_jawn, BaseModel)", "def test_inheri...
[ "0.7252218", "0.7145017", "0.7070318", "0.70148265", "0.6996266", "0.6962417", "0.69262314", "0.6919598", "0.6890036", "0.6845428", "0.6826213", "0.6785706", "0.6779433", "0.67737323", "0.6739828", "0.67118394", "0.67048097", "0.66224116", "0.6613517", "0.65859616", "0.658281...
0.0
-1
test that inheritance works for the third level
def test_level3_recursion(self): recursed = recurse_files('filename3', self.files['filename3'], self.files) self.assertEqual(recursed, ["file7", "file2", "file3", "file6", "file5"])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_inherit(self):\n\n new_jawn = Amenity()\n self.assertIsInstance(new_jawn, BaseModel)", "def test_inheritence(self):\n self.assertTrue(issubclass(City, BaseModel))", "def test_inheritance(self):\n self.assertTrue(issubclass(Rectangle, Base))", "def test_inheritance(self):\...
[ "0.6992817", "0.69796383", "0.6967074", "0.69405305", "0.6846577", "0.68217635", "0.67915785", "0.6788711", "0.6766193", "0.67629385", "0.6694426", "0.6625266", "0.6607014", "0.6606425", "0.6605018", "0.65722626", "0.65275764", "0.6505733", "0.649356", "0.6493218", "0.6439650...
0.0
-1
The major helpful clue is that the password is 3 lowercase ASCII characters This gives us 263 = 17576 possible passwords, quite easy to brute force.
def solve(): cipher_bytes = get_cipher_bytes() best_so_far = 0 message = None for password in get_passwords_iterator(): possible_message = decrypt_cipher(cipher_bytes, password) if possible_message: num_spaces = len(filter(lambda x: x == ' ', possible_message)) if...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_password():\n selection = string.ascii_letters + string.digits\n\n while True:\n password = \"\".join(secrets.choice(selection) for i in range(16))\n\n if (\n any(c.isupper() for c in password)\n and any(c.islower() for c in password)\n and any(c.is...
[ "0.72692347", "0.7052376", "0.6990031", "0.6944426", "0.68689084", "0.68246585", "0.67636114", "0.67191935", "0.666207", "0.6655312", "0.663373", "0.6632437", "0.66086996", "0.6606339", "0.6605197", "0.660217", "0.659407", "0.65937746", "0.65908", "0.6555751", "0.6553656", ...
0.63099164
43
Have we matched the first 'level' tiles with the answer grid
def match_level(g, level): for i in range(len(g)): for j in range(len(g[i])): level -= 1 if g[i][j] != finished_grid[i][j]: return False # Special case - when doing the last row we must put 2 tiles in place each time elif i == len(g) - 2 and g[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_room_has_tiles(self):\n self.assertEqual(self.room.tile_set.count(), self.room.grid_size ** 2)", "def tile_is_set(index, level_map):\n return level_map[index] != -1", "def new_tile(self):\r\n # replace with your code\r\n # complete search ....\r\n non_zero_count = 0;\r\n...
[ "0.6392905", "0.63439393", "0.6242026", "0.623573", "0.6123131", "0.60925686", "0.6058311", "0.60546285", "0.6011433", "0.5972334", "0.5947247", "0.58905536", "0.5882922", "0.58619165", "0.5842605", "0.5842342", "0.5827736", "0.5819716", "0.5808958", "0.57964456", "0.57834065...
0.7060842
0
When a tile is in place dont F with it
def get_banned_moves(g, level): result = [] size = len(g) for i in range(len(g)): for j in range(len(g[i])): if level == 0: break result.append((i, j)) level -= 1 # If we have to move the last element of the row in place then dont ban the mov...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new_tile(self):\n # replace with your code\n pass", "def recall(self):\n for t in self.placed_tiles:\n row = self.placed_tiles[t][1][0]\n col = self.placed_tiles[t][1][1]\n # remove tiles from board\n self.board.board[row][col].letter = None\n ...
[ "0.69121015", "0.6871692", "0.6867049", "0.6711384", "0.66536576", "0.6647385", "0.66331536", "0.6613727", "0.65811276", "0.6574255", "0.6570792", "0.6547585", "0.64998657", "0.6475304", "0.64131564", "0.63572073", "0.63561857", "0.6346861", "0.6333354", "0.6319166", "0.63151...
0.0
-1
Use bf_search or df_search not both
def bf_search(grid, level): states_we_have_seen_before = Set(grid) current_states = [grid] result = None counter = 0 while result is None: next_states = Set() for g in current_states: for gg in legal_moves(g): if gg not in states_we_have_seen_before: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def full_search(pw, *arg, **kw):\n return pw.search(*arg, **kw)", "def search():\n pass", "def _search(self, *args, **kwargs): # should return Formulas obj\n # Find all Matches\n if kwargs:\n col = list(kwargs)[0]\n args = kwargs[col]\n if isinstance(args, st...
[ "0.64128804", "0.63269526", "0.6272328", "0.62001276", "0.60793567", "0.59846294", "0.5974868", "0.5963416", "0.5956343", "0.5940417", "0.5804509", "0.57607305", "0.5748222", "0.5582162", "0.5566634", "0.5557225", "0.5554862", "0.55547976", "0.5539439", "0.5526554", "0.549519...
0.0
-1
Use bf_search or df_search not both
def df_search(grid, level): states_we_have_seen_before = Set(grid) def recur(inner_grid, itter, level): counter = 0 next_states = Set() for gg in legal_moves(inner_grid): if gg not in states_we_have_seen_before: states_we_have_seen_before.add(gg) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def full_search(pw, *arg, **kw):\n return pw.search(*arg, **kw)", "def search():\n pass", "def _search(self, *args, **kwargs): # should return Formulas obj\n # Find all Matches\n if kwargs:\n col = list(kwargs)[0]\n args = kwargs[col]\n if isinstance(args, st...
[ "0.6413596", "0.63259625", "0.6270906", "0.619966", "0.6078687", "0.5985881", "0.5974419", "0.59645563", "0.5953544", "0.593985", "0.5803611", "0.57594156", "0.5747455", "0.5580669", "0.55657405", "0.5556216", "0.5555104", "0.5553256", "0.55388397", "0.5527058", "0.54937047",...
0.0
-1
Dynamically inherits from either StokesGrad or StokesDiv.
def set_arg_types( self ): if self.mode == 'grad': self.function = terms.dw_grad use_method_with_name( self, self.get_fargs_grad, 'get_fargs' ) elif self.mode == 'div': self.function = terms.dw_div use_method_with_name( self, self.get_fargs_div, 'get_fargs...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n super().__init__()\n self.type = 'NDCartesianSpline'", "def setup_class(self):\n\n class SubFLRW(FLRW):\n def w(self, z):\n return super().w(z)\n\n self.cls = SubFLRW\n # H0, Om0, Ode0\n self.cls_args = (70 * u.km / u.s / u.Mpc, 0....
[ "0.5651647", "0.5141371", "0.49801058", "0.49185097", "0.48806036", "0.48587885", "0.4843918", "0.4840421", "0.4827489", "0.48104107", "0.4752142", "0.47276998", "0.47276998", "0.4716857", "0.47075373", "0.4705083", "0.4705065", "0.4689408", "0.4676182", "0.46729988", "0.4664...
0.0
-1
Init an instance of Movie.
def __init__(self, title, image, movie_tagline="", trailer_url=""): self.title = title self.poster_image_url = image self.trailer_youtube_url = trailer_url self.storyline = movie_tagline
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, movie_title, poster_image, trailer_youtube, movie_release_data, genre):\n # initialize instance of class Movie\n self.title = movie_title\n self.poster_image_url = poster_image\n self.trailer_youtube_url = trailer_youtube\n self.movie_release = movie_release_da...
[ "0.7427198", "0.72977936", "0.7203118", "0.69395375", "0.6887995", "0.6821545", "0.67963916", "0.6785846", "0.6779613", "0.67588", "0.67477024", "0.673185", "0.67124087", "0.6708494", "0.67072725", "0.66912884", "0.66809094", "0.6625668", "0.66171354", "0.65737313", "0.656318...
0.6374452
25
Open the movie's trailer in a new browser.
def show_trailer(self): webbrowser.open(self.trailer_youtube_url)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_trailer(self):\r\n webbrowser.open(self.trailer_youtube_url)", "def show_trailer():\n webbrowser.open(self.trailer_url)", "def show_trailer(self):\r\n\r\n webbrowser.open(self.trailer_youtube_url)", "def show_trailer(self):\n webbrowser.open(self.trailer_youtube_url) # Open ...
[ "0.82354426", "0.81834763", "0.81493247", "0.8140178", "0.8126791", "0.8126791", "0.8126791", "0.81221545", "0.81221545", "0.81221545", "0.80919135", "0.8090726", "0.80319715", "0.8019958", "0.80156064", "0.8013932", "0.68470794", "0.6688031", "0.65670836", "0.646949", "0.621...
0.8063596
25
Print to the console the instance's attributes. Used to conveniently check the values of each attribute. Include title, storyline, poster_image_url and trailer_youtube_url.
def debug_print(self): print self.title print self.storyline print self.poster_image_url print self.trailer_youtube_url print "------"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _print_attribute(self):\n print(vars(self))", "def print_attrs(self):\n for attribute in self.__dict__.keys():\n print(attribute)", "def print_attr(self):\n return \"name : {0}\\nprice : {1}\\ndescription : {2}\".format(\n self.name, self.price, self.description\n...
[ "0.7770835", "0.71061724", "0.6830483", "0.6676465", "0.6646499", "0.66010046", "0.65855104", "0.6482456", "0.64637995", "0.64564973", "0.64564973", "0.6446431", "0.637585", "0.6349447", "0.6332035", "0.6307484", "0.63065374", "0.62938637", "0.625839", "0.6251546", "0.6231006...
0.7889193
0
Function to generate a 1D Gaussian signal centered at mu and wid wide (FWHM).
def gaussian(mu, wid, x): return np.exp(-((x - mu) / (0.6005612 * wid))**2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def makeGaussian(size, fwhm, center=None):\n\n x = sp.arange(0, size, 1, float)\n y = x[:,sp.newaxis]\n\n if center is None:\n x0 = y0 = size // 2\n else:\n x0 = center[0]\n y0 = center[1]\n\n return sp.exp(-4*sp.log(2) * ((x-x0)**2 + (y-y0)**2) / fwhm**2)", "def makeGaussian(...
[ "0.71223104", "0.711397", "0.69865227", "0.69807374", "0.69807374", "0.6943345", "0.67490226", "0.66589683", "0.665439", "0.66379637", "0.66137505", "0.6592439", "0.6572652", "0.6561467", "0.65301096", "0.65105855", "0.64582235", "0.6392432", "0.63875985", "0.63683474", "0.63...
0.7511534
0
Function to generate a 1D BiGaussian signal centered at mu, wid wide (FWHM) and parameter m. Symmetrical BiGaussian is generated is m = 0.5
def bigaussian(mu, wid, x, m = 0.5): lx = x.shape[0] ix = np.where(x == mu)[0][0] y = np.ones(lx) y[0:ix] = gaussian(mu, wid * m, x[0:ix]) y[ix+1:lx] = gaussian(mu, wid * (1 - m), x[ix+1:lx]) return y
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gauss_kernel(n_fwhm,sigma):\n\n x_length = int(n_fwhm * sigma + 0.5) #Add 0.5 to approximate to nearest integer\n y_length = x_length\n \n \n x, y = mgrid[-x_length:x_length+1, -y_length:y_length+1]\n g = numpy.exp(-(x**2/(2*(float(sigma)**2))+y**2/(2*(float(sigma)**2))))\n return g...
[ "0.6898881", "0.6818787", "0.67554414", "0.6599363", "0.6599363", "0.65387416", "0.64224786", "0.6395345", "0.63268816", "0.6326088", "0.62345266", "0.61686397", "0.61607105", "0.61607105", "0.6159384", "0.61421514", "0.61411417", "0.61372757", "0.61231935", "0.61114275", "0....
0.6849023
1
Function to generate a 1D Gaussian peak broadened by exponential signal. The signal is centered at mu, is wid wide (FWHM) and timeconstant t.
def expgaussian(mu, wid, timeconstant, x): # Gaussian signal broadened by an exponetial signal g = gaussian(mu, wid, x) hly = np.round( len(g) / 2.0 ) ey = np.r_[np.zeros(hly),g,np.zeros(hly)] fy = np.fft.fft(ey) a = np.exp(-(np.arange(len(fy))) / timeconstant ) fa = np.fft.fft(a) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gaussian(amp, fwhm, mean, x):\n return amp * np.exp(-4. * np.log(2) * (x-mean)**2 / fwhm**2)", "def gaussian(amp, fwhm, mean):\n return lambda x: amp * np.exp(-4. * np.log(2) * (x-mean)**2 / fwhm**2)", "def generate_gaussian():\n amp = 10 * numpy.random.chisquare(3)\n width = numpy.random.chisq...
[ "0.68232644", "0.6766749", "0.67023665", "0.66635114", "0.66003823", "0.647763", "0.63649267", "0.6330254", "0.6263207", "0.62517333", "0.6239082", "0.6226317", "0.62098634", "0.61496973", "0.6118846", "0.61174375", "0.60935134", "0.60935134", "0.6064958", "0.60388005", "0.60...
0.7727515
0
Function to generate a 1D Lorentzian peak. The peak is centered at mu and is wid wide (FWHM).
def lorentzian(mu, wid, x): return np.ones(len(x) ) / (1 + ( (x - mu) / (0.5 * wid) )**2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lorentz(self, X, xm, amp, w):\n return amp / (1 + ((X - xm) / (w / 2)) ** 2)", "def narrowIncandPeakInfoLG(self):\r\n\t\tself.narrowIncandBaseline_LG = (np.mean(self.lowGainNarrowBandIncandData[0:10]))\r\n\t\t\t\t\r\n\t\traw_narrowIncand_max_LG = np.amax(self.lowGainNarrowBandIncandData)\r\n\t\tnarrow...
[ "0.5856068", "0.57200897", "0.56143546", "0.5612396", "0.55637854", "0.5529816", "0.5487402", "0.5477099", "0.5475023", "0.5467301", "0.54670376", "0.54655933", "0.54424506", "0.5441767", "0.5420336", "0.54146683", "0.5394928", "0.5380085", "0.5374374", "0.5354449", "0.534702...
0.59923255
0
Function to generate a 1D BiLorentzian peak. The peak is centered at mu, is wid wide (FWHM) and m symmetric.
def bilorentzian(mu, wid, x, m = 0.5): lx = x.shape[0] ix = np.where(x == mu)[0][0] y = np.ones(lx) y[0:ix] = lorentzian( mu, wid * m, x[0:ix] ) y[ix+1:lx] = lorentzian( mu, wid * (1 - m), x[ix+1:lx] ) return y
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gen_peak_def_high():\n\n high_cf_opts = np.arange(50, 90, 1)\n\n # Generate peak definitions\n while True:\n\n cur_cen = np.random.choice(high_cf_opts)\n cur_pw = np.random.choice(PW_OPTS, p=PW_PROBS)\n cur_bw = np.random.choice(BW_OPTS, p=BW_PROBS)\n\n peak = [cur_cen, cur...
[ "0.5574448", "0.5479021", "0.547757", "0.54067004", "0.5383462", "0.535629", "0.53522104", "0.5343756", "0.52861816", "0.5247609", "0.51883906", "0.51769835", "0.51520514", "0.5127397", "0.5112868", "0.5105794", "0.5073474", "0.5068874", "0.5054378", "0.5052403", "0.5043015",...
0.6107654
0
Function to generate a 1D exponential broadened BiLorentzian peak. The peak is centered at mu, is wid wide (FWHM) and exponential function time constant t.
def explorentzian(mu, wid, timeconstant, x): g = lorentzian( mu, wid, x ) hly = np.round( len(g) / 2.0 ) ey = np.r_[np.zeros(hly),g,np.zeros(hly)] fy = np.fft.fft(ey) a = np.exp(-(np.arange(len(fy))) / timeconstant ) fa = np.fft.fft(a) fy1 = fy * fa ybz = np.real(np.fft.i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Boltzmann(En,T):\n ev = 1.60218e-19\n kb = 1.380e-23\n return np.exp(-En/(kb*T/ev))", "def expgaussian(mu, wid, timeconstant, x): \n # Gaussian signal broadened by an exponetial signal\n g = gaussian(mu, wid, x)\n \n hly = np.round( len(g) / 2.0 )\n ey = np.r_[np.zeros(hly),g,np.ze...
[ "0.63273394", "0.6285095", "0.6260649", "0.62249565", "0.603619", "0.6001973", "0.583102", "0.5788435", "0.5672957", "0.56534797", "0.56413347", "0.56182504", "0.56090707", "0.5609032", "0.559953", "0.5572931", "0.5571136", "0.55703306", "0.5569565", "0.5568544", "0.55333847"...
0.6298706
1
Function to generate a 1D GaussianLorentzian peak. The peak is centered at pos, is wid wide (FWHM) and with blending parameter m.
def GL(mu, wid, x, m = 0.5): return m * gaussian(mu, wid, x) + (1 - m) * lorentzian(mu, wid, x)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def leoGaussFit(self,zeroX_to_LEO_limit,calib_zeroX_to_peak,calib_gauss_width,evap_threshold):\r\n\r\n\r\n\t\t#run the scatteringPeakInfo method to retrieve various peak attributes \r\n\t\tself.scatteringPeakInfo()\r\n\t\t\r\n\t\t#get the baseline\r\n\t\tbaseline = self.scatteringBaseline\r\n\t\t\r\n\t\t#get the z...
[ "0.5664541", "0.565363", "0.5612759", "0.556034", "0.5553017", "0.5499083", "0.54807323", "0.54807323", "0.5448343", "0.54122156", "0.54015404", "0.53757596", "0.53722227", "0.5356703", "0.5345538", "0.5318612", "0.53144", "0.53105307", "0.5274922", "0.52537906", "0.52407515"...
0.51140475
35
Function to generate a logistic peak, centered at mu with half width half maximum hw.
def logistic(mu, hw, x): n = np.exp(- ((x-mu)/(.477*hw))**2) return (2. * n)/( 1 + n)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def logpeak(x, p=default()):\n model = p[0] - p[1]*(x**2)\n return model", "def log_prior(theta, peakrange, blurred):\n peak, center_x, center_y, radius, focus, width_x, width_y = theta\n if blurred:\n if 4. < center_x < 28. and 4. < center_y < 28. and 0.22 < width_x < 0.55 and 0.22 < width_y ...
[ "0.6236223", "0.6116088", "0.6110991", "0.6015719", "0.6012657", "0.58456266", "0.5818886", "0.57897973", "0.5669427", "0.5664322", "0.5583012", "0.5581381", "0.55758697", "0.5564898", "0.5564072", "0.5562496", "0.5552109", "0.5546169", "0.5496125", "0.54905564", "0.548567", ...
0.60826784
3
Function to generate a lognormal peak, centered at mu with half width half maximum hw.
def lognormal(mu, hw, x): return np.exp(-( np.log(x/mu) / (0.01*hw) )**2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loglam_minmax(self):\n return np.log10(8000.0), np.log10(25700)", "def NLL(sample, params):\n mu = params[:,:,0]\n logsigma = params[:,:,1]\n \n c = normalization.to(mu.device)\n inv_sigma = torch.exp(-logsigma)\n tmp = (sample - mu) * inv_sigma\n return torch.mean(0.5 * (tmp ...
[ "0.62176317", "0.6204198", "0.6148861", "0.61259323", "0.6089201", "0.6013187", "0.59450024", "0.59383446", "0.5914955", "0.5895413", "0.5884146", "0.58821017", "0.5845826", "0.5828772", "0.581202", "0.5810054", "0.57919997", "0.57919997", "0.5774185", "0.57400894", "0.573895...
0.7159443
0
Function to generate a lognormal peak, centered at pos with Voigt width gD.
def voigt(pos, gD, xx, alpha = 0.5): gL = alpha * gD gV = 0.5346 * gL + np.sqrt(0.2166 * gL**2 + gD**2) x = gL/gV y = np.abs(xx-pos) / gV g = 1/(2*gV*(1.065 + 0.447*x + 0.058*x**2))*((1-x)*np.exp(-0.693*y**2) + (x/(1+y**2)) + 0.016*(1-x)*x*(np.exp(-0.0841*y**2.25)-1./(1 + 0.021*y**2.25))); ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_marginal_likelihood_normal_pdf(self):\n noise_variance=self.params['noise_variance']['value']\n Kxx = self.C@self._Kernel(self.X, self.X, self.params)@self.C.T + (noise_variance+self.jitter) * np.eye(self.Y.shape[0])\n try:\n mu = np.linalg.solve(Kxx, self.Y)\n (s...
[ "0.6262099", "0.6223538", "0.6210626", "0.6174314", "0.60818064", "0.60313404", "0.595962", "0.5828224", "0.5796206", "0.5779242", "0.5766271", "0.5758238", "0.5748885", "0.5738757", "0.5737634", "0.57308507", "0.5727297", "0.5712227", "0.57101417", "0.5708703", "0.5705397", ...
0.55107003
43
Function to generate a Pearson peak, centered at pos with width wid and shape number m.
def pearson(pos, wid, x, m = 1): return np.ones(len(x)) / (1+(( x-pos) / ((0.5**(2/m)) * 4.62 * wid ))**2)**m
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def peakMask(shape, parameters, margin):\n peak_mask = numpy.ones(shape)\n\n # Check for circular AOI.\n if parameters.hasAttr(\"x_center\"):\n assert parameters.hasAttr(\"y_center\"), \"Y center must be specified.\"\n assert parameters.hasAttr(\"aoi_radius\"), \"AOI radius must be specified...
[ "0.555559", "0.544054", "0.5413793", "0.52438694", "0.5089177", "0.50843877", "0.49853846", "0.49212518", "0.49210066", "0.4911675", "0.4910305", "0.489397", "0.48864043", "0.48736084", "0.48613608", "0.48468658", "0.48138317", "0.48133323", "0.48061478", "0.48027074", "0.479...
0.6833717
0
Make an order of a NUMBER of Flan.
def flan(number, flavor): num = fooutil.make_it_an_int(number) flan_flavor = check_flan_flavor(flavor) order_some_flan(num, flan_flavor)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_order():", "def _generate_order_number(self):\n self.order_number = ''.join((random.choice(string.ascii_lowercase + string.digits) for _ in xrange(30)))", "def create_phone_number(n):", "def Order(self) -> int:", "def getNumber():", "def numerize():\n pass", "def pointorder(sel...
[ "0.60349905", "0.599928", "0.5529731", "0.54469997", "0.53199065", "0.52824", "0.52041674", "0.51772404", "0.51703626", "0.5150046", "0.5149647", "0.5136723", "0.51287293", "0.51287293", "0.51287293", "0.5096725", "0.5081682", "0.5076551", "0.50506306", "0.504155", "0.5034067...
0.6333936
0
Determine what kind of flavor we want for our Flan.
def check_flan_flavor(flavor): if not flavor: flan_flavor = "plain old boring" else: flan_flavor = flavor return (flan_flavor + " flavored flan")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flavor(self):\n return self._flavor", "def GetFlavor(params):\n flavors = {\n 'cygwin': 'win',\n 'win32': 'win',\n 'darwin': 'mac',\n }\n if 'flavor' in params:\n return params['flavor']\n if sys.platform in flavors:\n return flavors[sys.platform]\n if sys.platform.startswith('suno...
[ "0.7198069", "0.70691574", "0.70600504", "0.7038061", "0.6974424", "0.6974424", "0.6780557", "0.67735255", "0.66562754", "0.6603192", "0.6585234", "0.6561961", "0.6531786", "0.63524115", "0.6305831", "0.6278412", "0.6211117", "0.61978173", "0.6141366", "0.6072828", "0.6059918...
0.7246331
0
Train the model and return the losses over epochs
def train_model(model, train_input, train_target, validation_input, validation_target, nb_epochs, mini_batch_size, learning_rate, momentum = 0, sched_ = None, opt = 'SGD', loss = 'MSE'): if opt == 'SGD' : optimizer = SGD(model.param(), learning_rate, momentum) elif opt == 'Adadelta': optimizer =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train_model(self,model):\r\n \r\n train_state = {'stop_early': False,\r\n 'early_stopping_step': 0,\r\n 'early_stopping_best_val': 1e8,\r\n 'learning_rate': self.lr,\r\n 'epoch_index': 0,\r\n 'train_loss': [],\r\n ...
[ "0.7629719", "0.7614731", "0.76110846", "0.7607726", "0.75139326", "0.7506831", "0.74468327", "0.7414044", "0.7409308", "0.73946095", "0.7386752", "0.7382504", "0.7374693", "0.73742706", "0.7362462", "0.736129", "0.7337015", "0.73282", "0.7318951", "0.72233063", "0.72028977",...
0.0
-1
Compute the number of errors
def compute_nb_errors(model, data_input, data_target, mini_batch_size): nb_data_errors = 0 misclassifications = torch.zeros(data_input.size(0),1) for b in range(0, data_input.size(0), mini_batch_size): output = model.forward(data_input.narrow(0, b, mini_batch_size)) for k in range(mini_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def error_count(self):\n return len(self.errors)", "def get_error_count(self):\n return sum(1 for outcome in (r.outcome for r in self.values()) if outcome == Result.ERROR)", "def _error_count(cls, samples: Samples) -> int:\n return cls.__sample_count(samples, \"false\")", "def error_coun...
[ "0.7887773", "0.7688767", "0.76094353", "0.7446989", "0.7229912", "0.70899045", "0.7016196", "0.69604325", "0.6898181", "0.6848194", "0.6846915", "0.68002003", "0.6798965", "0.6795212", "0.67521125", "0.67066556", "0.6704142", "0.6662205", "0.66546935", "0.66060305", "0.65880...
0.64422214
27
Initializes the Machine object.
def __init__(self): self._symbols = set() self._blank_symbol = None self._states = set() self._start_state = None self._end_states = set() self._transitions = {} self._current_state = None self._tape = None self._head = None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup(self):\n self.machine = Machine(['a', 'b', 'c', '_'])", "def __init__(self, machine):\n self.machine = machine\n self.features = {}\n self.log = None\n self.debug = False\n\n # Set default platform features. Each platform interface can change\n # these t...
[ "0.7426832", "0.71339655", "0.7100026", "0.7063775", "0.70539427", "0.70313317", "0.6975625", "0.6975625", "0.6939676", "0.6649868", "0.6570789", "0.6564931", "0.65368205", "0.65332156", "0.65314966", "0.6514519", "0.65126127", "0.65126127", "0.65126127", "0.65126127", "0.651...
0.0
-1
Adds a symbol to the set of symbols of the Machine. Sets the blank symbol only if it is not already set.
def _set_symbol(self, symbol, blank=False): self._symbols.add(symbol) try: assert self._blank_symbol == None or not blank if blank: self._blank_symbol = symbol except: raise Exception( f"Machine got blank symbol '{symbol}' whic...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add(self, symbol, value):\n if symbol in self.symbol_map:\n raise ValueError(f\"symbol {symbol} already exists in map.\")\n self.symbol_map[symbol] = value", "def add_symbol(self, symbol):\n self.symbols_list.append(symbol)\n self.symbols_list.sort()", "def addSymbol(...
[ "0.737178", "0.71844953", "0.6879582", "0.6751897", "0.6693627", "0.66602457", "0.66042966", "0.65442795", "0.6537731", "0.6475653", "0.6472118", "0.6463029", "0.63761586", "0.63514227", "0.6310761", "0.6297593", "0.62926525", "0.62787044", "0.622642", "0.62097865", "0.619931...
0.8360916
0
Adds a state to the set of states of the Machine. Sets the start state only if it is not already set.
def _set_state(self, state, start=False, end=False): self._states.add(state) if end: self._end_states.add(state) try: assert self._start_state == None or not start if start: self._start_state = state except: raise Exception...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_state(self, state):\n self.states.add(state)", "def add_state(self, state):\n self._validate_state(state)\n self._state.add(state)", "def set(self, state):\r\n self.append(state)", "def add_state(self, state):\n try:\n return self.state(state)\n ex...
[ "0.8140393", "0.7894456", "0.72185045", "0.7092537", "0.70284075", "0.66859454", "0.66859454", "0.6674869", "0.63787305", "0.6377714", "0.6327687", "0.63166374", "0.63145447", "0.62984765", "0.62984574", "0.62984574", "0.6265835", "0.6242698", "0.61614704", "0.61505604", "0.6...
0.78574103
2
Adds a transition to the set of transitions of the Machine.
def _set_transition( self, current_state, current_symbol, next_symbol, direction, next_state ): self._set_symbol(current_symbol) self._set_symbol(next_symbol) self._set_state(current_state) self._set_state(next_state) if self._transitions.get(current_state) is None: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_transition(self, **kwargs):\n transition = {k: [v] for k, v in kwargs.items()}\n self.add_transitions(**transition)", "def addTransition(self,fromState, toState, testFunc):\n if not self.currentState:\n raise ValueError(\"StateMachine already Started - cannot add new trans...
[ "0.7282933", "0.7242774", "0.7242774", "0.69885457", "0.6903377", "0.68745124", "0.6802694", "0.67786336", "0.6741184", "0.6670267", "0.65890056", "0.65890056", "0.64939916", "0.6307099", "0.6150025", "0.6098735", "0.60669607", "0.60570806", "0.60542333", "0.6012345", "0.5991...
0.49933103
69
Parses a definition for a Machine object.
def parse(self, definition): comment_re = re.compile(r"(#.*)") state_re = re.compile(r"^([a-zA-Z_][a-zA-Z0-9_]*)([.*])?$") transition_re = re.compile( r"^'(.)'\s+'(.)'\s+([<>])\s+([a-zA-Z_][a-zA-Z0-9_]*)$" ) lines = list( filter( lambda x:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _parse_single_definition(unparsedDefinition):\r\n parsed = {'definition': unparsedDefinition['difino']}\r\n parsed['subdefinitions'] = [\r\n _parse_subdefinitions(subdefinition)\r\n for subdefinition in unparsedDefinition['pludifinoj']\r\n ]\r\n \r\n parsed['examples'] = [\r\n ...
[ "0.56363386", "0.55514866", "0.5501883", "0.54004073", "0.535413", "0.53299636", "0.53040886", "0.52859396", "0.5224299", "0.5166532", "0.51594836", "0.5115619", "0.51043546", "0.5061594", "0.50540215", "0.50540215", "0.5051268", "0.5033262", "0.50239384", "0.5016015", "0.499...
0.58957094
0
Resets the tape, head and state of the Machine.
def reset(self, tape): self._current_state = self._start_state self._tape = list(tape) self._head = 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset(self):\n self.index = self.start_index\n self.state = self.initial_state\n self.tape = Tape(empty_value=self.empty_value)", "def reset (self):\n\n self.currentState = self.initialState\n self.inputSymbol = None", "def reset(self):\n Simulation.reset(self)", ...
[ "0.7429243", "0.69576144", "0.69318694", "0.685927", "0.6827475", "0.6825976", "0.67982167", "0.6747884", "0.6735652", "0.672856", "0.672856", "0.672856", "0.67073536", "0.6703694", "0.6701576", "0.6701576", "0.6701576", "0.6701576", "0.6701576", "0.6701576", "0.6701576", "...
0.8252242
0
Performs one Machine step.
def step(self): try: current_symbol = self._tape[self._head] next_symbol, direction, self._current_state = self._transitions.get( self._current_state ).get(current_symbol) except: return True self._tape[self._head] = next_symbol ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_one_step(self):\n pass", "def do_step(self) -> None:", "def perform_step(self) -> None:\n pass", "def take_one_step(self):\n\t\tfor i in range(len(self.agents)):\n\t\t\tself.agents[i].action(0)", "def step(self):\n self.function()", "def step(self):\n\n pass", "def s...
[ "0.72797555", "0.70480156", "0.6937339", "0.6654862", "0.6623409", "0.6611855", "0.65473723", "0.6477645", "0.6465413", "0.6461562", "0.64069915", "0.6329293", "0.63285255", "0.6295325", "0.6295325", "0.6291", "0.6287055", "0.6237789", "0.62062514", "0.62054944", "0.6196224",...
0.0
-1
Performs a computation by the Machine on a tape
def run(self, tape, max_steps=200, animate=False, **kwargs): self.reset(tape) halt = False if animate: try: assert kwargs.get("filename") is not None except: raise Exception("Specify a filename to save the animation") images = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_classical_processing_single_tape(self, execute_kwargs):\n a = jax.numpy.array(0.1)\n b = jax.numpy.array(0.2)\n c = jax.numpy.array(0.3)\n\n def cost(a, b, c, device):\n with qml.queuing.AnnotatedQueue() as q:\n qml.RY(a * c, wires=0)\n ...
[ "0.6349937", "0.61850125", "0.6126917", "0.60142744", "0.58041316", "0.579127", "0.5779092", "0.5714605", "0.5702609", "0.5644706", "0.5627367", "0.5615143", "0.56113523", "0.5607846", "0.5587174", "0.5586851", "0.556687", "0.54959184", "0.54613596", "0.54577625", "0.5438673"...
0.0
-1
Returns a graph object
def graph(self, context=None, **kwargs): graph = Dot(graph_type="digraph", rankdir=("LR" if context is None else "TB")) machine_graph = Subgraph( graph_name="cluster_machine", graph_type="digraph", label="MACHINE" ) for current_state in sorted(self._states): node...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getGraph(self):\n\t\treturn self.graph", "def graph(self):\n return self.__graph", "def _construct_graph(self):\n raise NotImplementedError", "def get_graph(self):\n return self._graph", "def get_graph(self):\n return copy.deepcopy(self.graph)", "def graph(self):\n retu...
[ "0.7613128", "0.7589741", "0.75011766", "0.74803877", "0.7471403", "0.7382264", "0.7382264", "0.73113227", "0.7271371", "0.72405905", "0.71944875", "0.7192069", "0.71794736", "0.71738875", "0.7162929", "0.71580875", "0.7152584", "0.71347123", "0.7099386", "0.7077915", "0.7074...
0.0
-1
Initialize the ring buffer. Keyword arguments
def __init__(self, **kwargs): directory = kwargs.get('directory', '.') filename = kwargs.get('filename', 'rbuffer.h5') recording = kwargs.get('recording', True) N = int(kwargs.get('N', 100)) roi = kwargs.get('roi', [10, 100, 10, 100]) assert isinstance(directory, str) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _initialize_buffers(self) -> None:", "def init_buffer(self):\n \n self.shape.buf = [pi3d.Buffer(self.shape, self.verts, self.texcoords, self.inds, self.norms)]\n self.shape.set_draw_details(self.shader, [self.spritesheet.img])", "def __init__(self):\n self.buffer = bytearray()",...
[ "0.7579113", "0.6758113", "0.66458374", "0.6536974", "0.65139705", "0.65139705", "0.6435655", "0.6434097", "0.6365389", "0.6296929", "0.62875783", "0.6259578", "0.62412685", "0.6239364", "0.6237563", "0.62159604", "0.6205206", "0.6195717", "0.6195717", "0.6195717", "0.6195717...
0.0
-1
Return the number of items actually stored in the ring buffer.
def __len__(self): return len(self.db.list_nodes('/images'))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def items_num(self):\n\t\treturn len(self.items)", "def items_num(self):\n\t\treturn len(self.items)", "def size(self):\n\t\treturn self._count", "def items_num(self):\n return len(self.items)", "def get_num_items(self):\r\n return self.num_items", "def items_count(self):\n return le...
[ "0.7611105", "0.7611105", "0.75940126", "0.7531309", "0.75204605", "0.7494793", "0.74913055", "0.747113", "0.7457616", "0.7421252", "0.7414746", "0.73948175", "0.73948175", "0.7347941", "0.73001474", "0.72723544", "0.727034", "0.72629976", "0.72542554", "0.7241447", "0.723164...
0.0
-1
Explicitly set the recording state to state.
def set_recording_state(self, state): assert isinstance(state, (bool, int)) self.recording = state
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_recording(self, recording):\n self.record_states = recording", "def set_recording(self, recording):\r\n self.recording = recording", "def enable_recording(self, new_state=True):\n self._is_recording = new_state", "def __setstate__(self, state):\n\n self.set(DER = state)", ...
[ "0.8397688", "0.71942544", "0.70696265", "0.7002531", "0.6923284", "0.69138104", "0.6876642", "0.682559", "0.682559", "0.682559", "0.682559", "0.682559", "0.682559", "0.682559", "0.682559", "0.682559", "0.682559", "0.682559", "0.682559", "0.682559", "0.6818264", "0.68059945...
0.8421561
0
Toggle the recording state.
def toggle(self): if self.recording: logger.debug('Pausing ring buffer recording') else: logger.debug('Resuming ring buffer recording') self.recording = not self.recording
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_recording_state(self, state):\n assert isinstance(state, (bool, int))\n self.recording = state", "def enable_recording(self, new_state=True):\n self._is_recording = new_state", "def update(self):\n enabled = True if self._camera[\"recording_mode\"] != \"never\" else False\n ...
[ "0.7379402", "0.7345225", "0.6897455", "0.68279135", "0.67939514", "0.6779239", "0.6746105", "0.6724644", "0.6659277", "0.6649085", "0.66368675", "0.6609908", "0.65981084", "0.65981084", "0.658571", "0.6556684", "0.64841735", "0.6432129", "0.6410469", "0.63564646", "0.6327811...
0.82393235
0
Add the data to the queue to be written to disk.
def write(self, data, roi=None): if not self.recording: return roi = roi or self.roi name = 'img{:04d}'.format(self._index) try: self.db.get_node('/images/' + name).remove() except tables.NoSuchNodeError: pass finally: # T...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add(self, data):\n wasquiet = True if (self.tail == self.curr) else False\n\n # Assert the queue is clean\n qtail = self.base + \".\" + str(self.tail)\n print \"creating %s\" % qtail\n assert not os.path.exists(qtail)\n qt = open(qtail, \"w\")\n qt.write(data)\n...
[ "0.7960137", "0.77648485", "0.767388", "0.74361455", "0.74212503", "0.72933763", "0.72772205", "0.7201101", "0.70225316", "0.70217663", "0.6964032", "0.6930849", "0.6914776", "0.6913866", "0.69130784", "0.6895173", "0.6882361", "0.6882361", "0.68305576", "0.68266684", "0.6814...
0.0
-1
Return data from the ring buffer file.
def read(self, index): assert type(index) is int img = self.db.get_node('/images/img{:04d}'.format(index)) return np.array(img)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def file_data(self):\n return self.read(self.file)", "def get_file_data(filename):", "def __readNext(self, f) -> bytes:\n try:\n fBuffer = f.read(Rudp.Packet.payloadMax)\n except Exception as e:\n print(\"Exception when reading file \", f, \". Because:\", format(e))\n...
[ "0.67880464", "0.6516399", "0.64596367", "0.6410002", "0.6347294", "0.63242334", "0.63183033", "0.6306611", "0.6276562", "0.6245824", "0.62450755", "0.62404746", "0.62309414", "0.6176375", "0.61630434", "0.61610234", "0.6118276", "0.609051", "0.6053758", "0.60435826", "0.6015...
0.0
-1
Return the timestamp associated with the specified image index.
def get_timestamp(self, index): return self.db.get_node( '/images/img{:04d}'.format(index)).attrs.timestamp
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetTimestamp(self, entry_index):\n return self._timestamps[entry_index]", "def _getTimeStamp(self, index):\n\n if self._n_cset:\n if index is None:\n return self._timestamps[self._acsi]\n else:\n return self._timestamps[index]\n else:\n ...
[ "0.67218184", "0.63522774", "0.625728", "0.6161379", "0.6146714", "0.6110099", "0.6103994", "0.60976535", "0.6072466", "0.60624766", "0.59977585", "0.5965456", "0.59633976", "0.59579647", "0.5909631", "0.5895183", "0.5875945", "0.58575124", "0.5834482", "0.58286786", "0.58139...
0.8940892
0
Return the recorded ROI for the given index.
def get_roi(self, index): return self.db.get_node('/images/img{:04d}'.format(index)).attrs.roi
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_roi_rect_by_index(self, index):\n return int(self.rect_list[index][\"x1\"]), int(self.rect_list[index][\"y1\"]), \\\n int(self.rect_list[index][\"x2\"]), int(self.rect_list[index][\"y2\"])", "def get_roi_line_by_index(self, index):\n return int(self.line_list[index][\"x1\"]), ...
[ "0.6685425", "0.6491489", "0.63368607", "0.62810946", "0.62326044", "0.62326044", "0.5919045", "0.5829573", "0.58119226", "0.5724068", "0.5634868", "0.5595355", "0.5586868", "0.5559789", "0.554171", "0.550977", "0.5471687", "0.54615474", "0.5421114", "0.53905815", "0.5389214"...
0.7410617
0
Save the ring buffer to file filename. The output format will depend on the extension of filename.
def save_as(self, filename): raise NotImplementedError( "Saving ring buffers to other formats is not yet implemented.") if filename[-3:] == 'zip': pass # TODO elif filename[-2:] == 'h5': pass # TODO elif filename[-4:] == 'fits': pass # ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save(self, fname, snver=None):\n self._io.save(fname)", "def to_file(self, filename):\n self.header['n'] = self.n\n save_gyre(filename, self.header, self.data)", "def save_as(self, filename):\n # Join together the buffer contents so it can be written to a file\n contents = \"\"\n...
[ "0.66321325", "0.6604608", "0.6562731", "0.64335483", "0.64077777", "0.63998353", "0.6398885", "0.6397939", "0.6369856", "0.6354021", "0.6286657", "0.62851137", "0.6244096", "0.6244096", "0.6230271", "0.61896867", "0.61477333", "0.611484", "0.61135226", "0.6100261", "0.602092...
0.8182043
0
Save the ring buffer to an HDF5 file using the PyTables library. This requires PyTables to be installed with either
def save_as_hdf5(self, filename):
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_hdf5(self, filename):\n filename += '.h5'\n try:\n hf = h5py.File(filename, 'w')\n hf.create_dataset('Array', data=self.flat_array)\n hf.close()\n except TypeError as err:\n if isinstance(self.mess_inst, MessagesGUI):\n self.m...
[ "0.6295007", "0.61233366", "0.61118317", "0.6024696", "0.59897345", "0.5931716", "0.5925943", "0.59007144", "0.58521616", "0.5777547", "0.57388747", "0.5730122", "0.56849515", "0.5677608", "0.5652777", "0.5609461", "0.5578832", "0.55645543", "0.55201614", "0.54989177", "0.549...
0.68898726
0
Save the ring buffer to a FITS file using the Astropy library. This requires Astropy to be installed with either
def save_as_fits(self, filename):
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_fits(self, name=None, output_path=None):\n pass", "def saveFits(self, filename):\n \n if isinstance(self.res, type(None)):\n raise Exception('Result is not yet aviable.')\n \n header = fits.Header()\n header['NAXIS1'] = self.naxis\n header['NA...
[ "0.6351375", "0.6321986", "0.63159454", "0.6159946", "0.59933627", "0.595426", "0.58952725", "0.5888947", "0.58830416", "0.58048767", "0.57406783", "0.5735594", "0.56605303", "0.5650868", "0.56002384", "0.55981505", "0.5546471", "0.5463205", "0.54400367", "0.5366371", "0.5353...
0.6828635
0
Save the ring buffer to Numpy's native npz format. If
def save_as_numpy(self, filename, compressed=False): logger.warn( 'Saving in npz format loses timestamp and ROI information.') logger.warn('Consider saving in FITS or HDF5 formats instead.') save_func = np.savez_compressed if compressed else np.savez save_func(filename, *self...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_as(self, filename):\n raise NotImplementedError(\n \"Saving ring buffers to other formats is not yet implemented.\")\n\n if filename[-3:] == 'zip':\n pass # TODO\n elif filename[-2:] == 'h5':\n pass # TODO\n elif filename[-4:] == 'fits':\n ...
[ "0.71860105", "0.6833188", "0.6742446", "0.6735762", "0.67158043", "0.6705623", "0.6704055", "0.6699208", "0.66952246", "0.66750234", "0.66198", "0.66197395", "0.65919346", "0.65755296", "0.65595406", "0.65580493", "0.654517", "0.6542975", "0.6524669", "0.65196514", "0.650768...
0.6354673
36
Will setup just once for all tests
def setUp(self): if os.path.isdir('/tmp/remote_pacha'): shutil.rmtree('/tmp/remote_pacha') if os.path.isdir('/tmp/localhost'): shutil.rmtree('/tmp/localhost') if os.path.isdir('/tmp/test_pacha'): shutil.rmtree('/tmp/test_pacha') if os.path.isdir('/tmp/...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setUp(self):\n test_env_setup()", "def setUp(self):\n MainTests.setUp(self)", "def setUp(self):\r\n # nothing to do, all tests use different things\r\n pass", "def setUp(self):\n logging.debug('setting up')", "def setUp(self):\n logging.debug('setting up')", ...
[ "0.83815914", "0.82712924", "0.82630223", "0.81374806", "0.81374806", "0.8100604", "0.80742764", "0.8048388", "0.8023459", "0.8015108", "0.80086696", "0.80086696", "0.79994905", "0.79994905", "0.79930747", "0.79855764", "0.79841876", "0.7975942", "0.7975942", "0.7975942", "0....
0.0
-1
Will run last at the end of all tests
def tearDown(self): if os.path.isdir('/tmp/remote_pacha'): shutil.rmtree('/tmp/remote_pacha') if os.path.isdir('/tmp/localhost'): shutil.rmtree('/tmp/localhost') if os.path.isdir('/tmp/test_pacha'): shutil.rmtree('/tmp/test_pacha') if os.path.isdir('/t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_run_ended(self):", "def on_test_end(self, logs=None):", "def after_test(self, test_results):\n pass", "def tearDown(self):\n\t\tprint(\"end test\")\n\t\tpass", "def after_all(self) -> None:", "def finished_tests(self):\n self.testing = 0", "def on_test_end(self):\n for cal...
[ "0.79268986", "0.7884995", "0.7703589", "0.7630603", "0.7571386", "0.7367542", "0.73137903", "0.724941", "0.724941", "0.7227065", "0.7169988", "0.7169988", "0.7169988", "0.71688277", "0.7149913", "0.71480596", "0.71015364", "0.71015364", "0.71015364", "0.70724744", "0.7042876...
0.0
-1
Gets a single directory from a remote host
def test_retrieve_files_single(self): os.makedirs('/tmp/remote_pacha/localhost/another_dir') os.makedirs('/tmp/remote_pacha/localhost/single_dir') remote_file = open('/tmp/remote_pacha/localhost/single_dir/remote.txt', 'w') remote_file.write("remote file") remote_file.close() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_directory(self, remote_path, local_path, storage_id=None):\n return self.get(remote_path, local_path, directory=True, storage_id=storage_id)", "def _host_dir(self, path):\n return self._host._dir(path)", "def _remote_path(self):\n return self._remote_dir", "def getDirectory( self...
[ "0.71816313", "0.6808492", "0.65466416", "0.6494472", "0.63945407", "0.6141707", "0.5870109", "0.5802468", "0.57827306", "0.57689875", "0.5733646", "0.56572115", "0.564335", "0.564198", "0.56064063", "0.5576286", "0.5575904", "0.5539315", "0.55343604", "0.55277354", "0.55178"...
0.54527444
28
Gets all files from a remote host
def test_retrieve_files_all(self): os.makedirs('/tmp/remote_pacha/localhost/etc') os.mkdir('/tmp/remote_pacha/localhost/home') remote_file = open('/tmp/remote_pacha/localhost/etc/etc.conf', 'w') remote_file.write("remote second file") remote_file.close() remote_file = ope...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_remote_files(remote_path, type, ssh):\n (ssh_in, ssh_out, ssh_err) = ssh.exec_command(\"find %s -name \\\"*\\\" -type %s\" % (remote_path, type))\n files = []\n for file in ssh_out.readlines():\n files.append(file.rstrip())\n return files", "def remote(self, requests, file, remoteHost...
[ "0.70346135", "0.68883044", "0.6588765", "0.6572632", "0.638519", "0.63409555", "0.6323735", "0.6217724", "0.62072116", "0.6185865", "0.6181787", "0.61501384", "0.61262274", "0.6120584", "0.60990316", "0.60282105", "0.6013964", "0.60094684", "0.59635437", "0.5957358", "0.5937...
0.66672397
2
If you can't retrieve files let me know
def test_retrieve_files_error_message(self): os.makedirs('/tmp/remote_pacha/localhost/etc') os.mkdir('/tmp/remote_pacha/localhost/home') remote_file = open('/tmp/remote_pacha/localhost/etc/etc.conf', 'w') remote_file.write("remote second file") remote_file.close() remote_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download_files(self):", "def test_get_files_list(self):\n files = self.download.get_files_list()\n self.assertTrue(len(files) > 0)", "def test_get_file_content(self):\n pass", "def get_files(self):\n # self.folder= +str(int(time.time()))\n if not os.path.exists(self.fol...
[ "0.74783885", "0.67740464", "0.65581155", "0.64995986", "0.64471006", "0.6439264", "0.6407973", "0.64034575", "0.6319614", "0.62836075", "0.62790054", "0.62737674", "0.62569165", "0.624199", "0.62397265", "0.6236453", "0.62254405", "0.62137246", "0.62114537", "0.62094253", "0...
0.0
-1
if there is an exisiting file when retrieving move it
def test_retrieve_files_move_existing_file(self): os.makedirs('/tmp/remote_pacha/localhost/etc') os.mkdir('/tmp/remote_pacha/localhost/home') remote_file = open('/tmp/remote_pacha/localhost/etc/etc.conf', 'w') remote_file.write("remote second file") remote_file.close() re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_file(self, ctx):\n pass", "def _move_temporary(self, url: str) -> bool:\n if self._file_path.exists():\n info('File already exists')\n return True\n # If download complete, make file permanent\n move(self._temp_path, self._file_path)\n info(\"DOWN...
[ "0.6994751", "0.6619303", "0.66191614", "0.6607701", "0.65548354", "0.65404713", "0.6534627", "0.65266013", "0.63730323", "0.6253934", "0.62085515", "0.6208203", "0.6169796", "0.61596227", "0.60212094", "0.60064256", "0.599767", "0.59887314", "0.5972293", "0.5971119", "0.5950...
0.58999497
25
Execute pre hook script
def test_pre_hooks(self): os.makedirs('/tmp/localhost/pacha_pre') touch_script = open('/tmp/localhost/pacha_pre/foo.sh', 'w') touch_script.write('''touch /tmp/localhost/pre_got_executed.txt''') touch_script.close() run = rebuild.Rebuild(hostname='localhost') run.pre_hook...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_pre_post_hooks(self):\n os.makedirs('/tmp/localhost/pacha_pre')\n os.makedirs('/tmp/localhost/pacha_post')\n pre_script = open('/tmp/localhost/pacha_pre/foo.sh', 'w')\n pre_script.write('''touch /tmp/localhost/pre_got_executed.txt''')\n pre_script.close()\n post_s...
[ "0.759358", "0.73621875", "0.72918934", "0.72264814", "0.70526624", "0.70117944", "0.69909036", "0.69263935", "0.69135416", "0.67982525", "0.6788915", "0.67710733", "0.6768303", "0.67355055", "0.67089957", "0.6687215", "0.6654927", "0.6652886", "0.65357006", "0.6516884", "0.6...
0.77686775
0
Execute post hook script
def test_post_hooks(self): os.makedirs('/tmp/localhost/pacha_post') touch_script = open('/tmp/localhost/pacha_post/bar.sh', 'w') touch_script.write('''touch /tmp/localhost/post_got_executed.txt''') touch_script.close() run = rebuild.Rebuild(hostname='localhost') run.post...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _post_hooks(self):", "def post_hook(config, final=False):\n if config.post_hook:\n if final or config.verb != \"renew\":\n logger.info(\"Running post-hook command: %s\", config.post_hook)\n _run_hook(config.post_hook)", "def _post_run_hook(self, runtime):\n pass", "...
[ "0.7953319", "0.74168485", "0.7200324", "0.7078464", "0.6912018", "0.6878299", "0.6751543", "0.67330295", "0.6723188", "0.6596426", "0.6564574", "0.6519976", "0.64974236", "0.6496264", "0.6394765", "0.6374311", "0.6309746", "0.63095397", "0.62873095", "0.628285", "0.627087", ...
0.732868
2
Execute both pre and post hooks
def test_pre_post_hooks(self): os.makedirs('/tmp/localhost/pacha_pre') os.makedirs('/tmp/localhost/pacha_post') pre_script = open('/tmp/localhost/pacha_pre/foo.sh', 'w') pre_script.write('''touch /tmp/localhost/pre_got_executed.txt''') pre_script.close() post_script = ope...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _post_hooks(self):", "def setup_hooks(self):\n pass", "def pre_execute(self):", "def postRun(self):\n pass", "def _post_run_hook(self, runtime):\n pass", "def on_hook(self) -> None:", "def pre_build_hook(self):", "def on_before_execution(self):\n pass", "def post_pro...
[ "0.80948967", "0.70629466", "0.7053906", "0.6904916", "0.6878891", "0.67881465", "0.662801", "0.6619334", "0.6613622", "0.6613622", "0.6613622", "0.6613622", "0.6613622", "0.6590337", "0.6590337", "0.6590337", "0.6590337", "0.6545335", "0.6488723", "0.6484735", "0.64458454", ...
0.7164809
1
Retrieve files and execute the pre_hook if found
def test_retrieve_files_with_pre_hook(self): os.makedirs('/tmp/remote_pacha/localhost/etc') os.mkdir('/tmp/remote_pacha/localhost/home') remote_file = open('/tmp/remote_pacha/localhost/etc/etc.conf', 'w') remote_file.write("remote second file") remote_file.close() remote_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_before(self):\n\n for path in self.hooks.get('before', []):\n self.run_module(path)", "def test_pre_hooks(self):\n os.makedirs('/tmp/localhost/pacha_pre')\n touch_script = open('/tmp/localhost/pacha_pre/foo.sh', 'w')\n touch_script.write('''touch /tmp/localhost/pre_...
[ "0.73509175", "0.6805542", "0.67745686", "0.6534818", "0.6484406", "0.64018464", "0.62568307", "0.61468", "0.61281395", "0.6122728", "0.610112", "0.6091286", "0.60416675", "0.60370576", "0.5959401", "0.59323233", "0.58979607", "0.5886881", "0.5885049", "0.58704245", "0.582433...
0.6623049
3
Run a full rebuild and fail because no db was found
def test_rebuild_no_db(self): os.makedirs('/tmp/remote_pacha/localhost/etc') os.mkdir('/tmp/remote_pacha/localhost/home') remote_file = open('/tmp/remote_pacha/localhost/etc/etc.conf', 'w') remote_file.write("remote second file") remote_file.close() remote_file = open('/t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rebuild_db():\n delete_db()\n create_db()\n insert_db()", "def validate_db():\n if not os.path.exists(app.config['DATABASE']):\n print(\"Init database!\")\n init()", "def test_database():\n sanity_tester = sanity.DatabaseSanity(Base, engine)\n sanity_tester.test()\n if sa...
[ "0.7292154", "0.6359214", "0.6348415", "0.6336012", "0.6334465", "0.6322623", "0.62703866", "0.62209284", "0.62134", "0.6208199", "0.61339605", "0.6126262", "0.6058358", "0.6006172", "0.60014945", "0.5991569", "0.5980901", "0.59504825", "0.5948537", "0.586677", "0.5865437", ...
0.64247996
1
Test a simple rebuild with some files in the pacha.db
def test_rebuild(self): pacha.DB_DIR = '/tmp/pacha_test/db' pacha.DB_FILE ='/tmp/pacha_test/db/pacha_test.db' pacha.permissions.DB_FILE ='/tmp/pacha_test/db/pacha_test.db' pacha.sync.DB_FILE ='/tmp/pacha_test/db/pacha_test.db' pacha.hg.DB_FILE ='/tmp/pacha_test/db/pacha_test.d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_rebuild_no_db(self):\n os.makedirs('/tmp/remote_pacha/localhost/etc')\n os.mkdir('/tmp/remote_pacha/localhost/home')\n remote_file = open('/tmp/remote_pacha/localhost/etc/etc.conf', 'w')\n remote_file.write(\"remote second file\")\n remote_file.close()\n remote_fi...
[ "0.72980964", "0.6863426", "0.65527713", "0.63870674", "0.6255685", "0.6245181", "0.6117568", "0.6076369", "0.60150194", "0.59235954", "0.5922191", "0.5913737", "0.5906409", "0.5903624", "0.5890652", "0.5864806", "0.5862683", "0.58509976", "0.5833254", "0.58128977", "0.581065...
0.8171218
0
Renders basic application layout
def index(request): params = get_user_profile_params(request) competition = Competition.get_active() params['top_competition_id'] = competition.id params['minify_js'] = settings.MINIFY_JS params['first_page_text'] = '' config = Config.objects.all() if config.count() > 0: params['fi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n\n return render_template(\"index.html\", title=\"Home\", heading=\"Dublin Bus\")", "def main():\n return render_template(\"main.html\")", "def main():\n return render_template(\"main.html\")", "def main_page():\n return render_template(\"index.html\")", "def index():\n return r...
[ "0.7066787", "0.6931911", "0.6931911", "0.6863343", "0.68569344", "0.6825769", "0.67722845", "0.6768591", "0.67603266", "0.6751819", "0.6751819", "0.6748155", "0.6736636", "0.67295665", "0.6681644", "0.6681644", "0.66804475", "0.66610783", "0.6634673", "0.6634673", "0.6634673...
0.0
-1
resize user image with PIL
def resize_image(image_path): image = Image.open(image_path) imagefit = ImageOps.fit(image, (612, 612), Image.ANTIALIAS) imagefit.save(image_path, 'JPEG', quality=100)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resize(img):\n size = (500, 500)\n img.thumbnail(size)\n return img", "def process_image(image):\n image = resize(image)\n return image", "def resize_img(self,scale=1):\n reduced = self.image.reduce((scale,scale))\n reduced.save(\"../edited/{}\".format(self.image.filename))\n\n...
[ "0.79386026", "0.75627327", "0.73551965", "0.7285514", "0.7223892", "0.7223892", "0.7217032", "0.7197306", "0.7177484", "0.7141788", "0.71341205", "0.71090263", "0.7093459", "0.7086832", "0.7072992", "0.6995217", "0.69547194", "0.6922918", "0.69134164", "0.6910244", "0.690310...
0.69681334
16
Receive and save user photo from crop tool on front end Photo has 612612 size
def upload_photo_from_src(request): if not request.user.is_authenticated(): return HttpResponseBadRequest('Auth needed') if 'imgsrc' not in request.POST: return HttpResponseBadRequest('No photo') data = request.POST['imgsrc'].split(',')[1].decode('base64') # or self.files['image'] in your ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def photo(update: Update, context: CallbackContext) -> int:\n user = update.message.from_user\n photo_file = update.message.photo[-1].get_file()\n x = \".jpg\"\n z = user.first_name + x\n photo_file.download(z)\n logger.info(\"Photo of %s: %s\", user.first_name, 'user_photo.jpg')\n update.mess...
[ "0.63226664", "0.6277487", "0.61969674", "0.61117494", "0.60872054", "0.6061417", "0.6032607", "0.596742", "0.5964295", "0.59565604", "0.5894247", "0.58474433", "0.5830311", "0.57978463", "0.5784759", "0.5756846", "0.5739104", "0.5708432", "0.5697767", "0.5693011", "0.5683093...
0.5401084
64
Return the current projects.
def get_projects(self): projects = [] for project in self.server.projects: projects.append({'id': utils.slugify(project), 'name': project}) response.content_type = 'application/json' return json.dumps(projects)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_projects(self):\n return conf.projects", "def projects(self):\r\n return p.Projects(self)", "def getProjects(self):\n\n return self.__projects", "def get_projects(self):\n return self.http_call(\"get\", url=f\"{self.base_url}/projects\").json()", "def get_projects(self):...
[ "0.8724896", "0.83391625", "0.8327239", "0.8324768", "0.8268606", "0.80907303", "0.80517626", "0.7972364", "0.7922078", "0.7869921", "0.7847794", "0.78318465", "0.7809198", "0.77894056", "0.7730232", "0.7721734", "0.76871973", "0.766436", "0.7609134", "0.7579387", "0.7574908"...
0.7339555
31
Return the active plugins of `project_id`.
def get_plugins(self, project_id): response.content_type = 'application/json' project_plugins = self.server.projects[project_id].plugins plugins = [] for plugin in project_plugins.keys(): plugins.append({'id': plugin}) return json.dumps(plugins)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def active_projects(self):\n return self.projects.filter(active=True)", "def get_projects(self):\n return conf.projects", "def get_enabled_plugins(self):\n return self._enabled_plugins", "def get_plugins(self):\n return []", "def get_plugins(group, project=None):\n return _ge...
[ "0.6666622", "0.62207335", "0.61864966", "0.61825234", "0.606817", "0.60661215", "0.60538733", "0.6007684", "0.59860665", "0.5953358", "0.5933789", "0.589718", "0.58709055", "0.58422714", "0.5795465", "0.57738656", "0.57128495", "0.5710045", "0.5668924", "0.5614691", "0.56042...
0.73636353
0
Return the `main` plugin source of this plugin for the given language.
def plugin_source(self, project_id, plugin_id, language): try: project = self.server.projects[project_id] plugin = project.plugins[plugin_id] fullpath = plugin.client_plugin_source(language) except (KeyError, ValueError): raise HTTPError(404) else:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def client_plugin_source(self, language):\n\n static = self.static\n if static is None:\n return None\n\n filename = os.path.join(static, \"main.\" + language)\n realfilename = os.path.realpath(filename)\n\n if not realfilename.startswith(self.static + '/'): # pragma:...
[ "0.7541241", "0.688626", "0.5591561", "0.54446316", "0.5422065", "0.53816205", "0.5327444", "0.53084797", "0.52598286", "0.5217657", "0.5198788", "0.5177965", "0.5143488", "0.5103181", "0.50855315", "0.507945", "0.5029944", "0.50189203", "0.49991527", "0.4993731", "0.49323747...
0.69887185
1
Return a view of the requested states.
def get_states(self): from geoffrey.data import datakey criteria = datakey(**request.query) response.content_type = 'application/json' return utils.jsonencoder.encode( [s.serializable() for s in self.server.hub.get_states(criteria)])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_states():\n return render_template('7-states_list.html',\n storage=storage.all(\"State\").values())", "def states():\n states = storage.all(State).values()\n return render_template('9-states.html', states=states)", "def states():\n all_states = storage.all(State)\...
[ "0.74572664", "0.742965", "0.7274897", "0.719027", "0.7156958", "0.71197766", "0.7011792", "0.700369", "0.69347006", "0.685962", "0.68006754", "0.6758228", "0.6734672", "0.6718815", "0.65212655", "0.64980835", "0.64723116", "0.6458556", "0.64242727", "0.63466716", "0.634263",...
0.6312003
23
Return the list of states of this plugin.
def plugin_state(self, project_id, plugin_id): from geoffrey.data import datakey criteria = datakey(project=project_id, plugin=plugin_id) response.content_type = 'application/json' return utils.jsonencoder.encode( [s.serializable() for s in self.server.hub.get_st...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_list_of_states(self):\n return self.states", "def States(self) -> List[Callable]:\r\n\t\treturn self.__STATES__", "def getstate(self):\n return [elem.getstate() for elem in self]", "def get_all_states(self):\n return self._states", "def state_list(self) -> Sequence[TState]:\n ...
[ "0.82501197", "0.77690196", "0.76578045", "0.7560449", "0.75386643", "0.75329566", "0.75040877", "0.74932325", "0.735629", "0.71534085", "0.704421", "0.70064116", "0.6995536", "0.69708186", "0.69600093", "0.6959018", "0.69525653", "0.69230497", "0.6873112", "0.6865247", "0.68...
0.6934388
17
Change the subscription criteria of this consumer.
def subscribe(self, consumer_id): try: consumer = self.server.consumers[consumer_id] except KeyError: raise HTTPError(404, 'Consumer not registered.') try: jsonschema.validate(request.json, schema.subscription) except jsonschema.ValidationError as err...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_subscription(self, value):\n self.pub_socket.setsockopt(zmq.SUBSCRIBE, value)", "def subscription(self, subscription):\n\n self._subscription = subscription", "def set_qos(self, on_ok):\n self._channel.basic_qos(\n prefetch_count=self._prefetch_count, callback=on_ok)", ...
[ "0.62269795", "0.5823506", "0.55463105", "0.55077237", "0.55019516", "0.5392663", "0.5332092", "0.528257", "0.5259546", "0.52463406", "0.5246165", "0.52217674", "0.51562726", "0.5155586", "0.5073033", "0.50714934", "0.506789", "0.5029318", "0.50248665", "0.50248665", "0.50248...
0.5498764
5
Serve index.html redered with jinja2.
def index(self): return {'projects': [p for p in self.server.projects.values()]}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index(path):\n return render_template(\"main.jinja2.html\")", "def index():\n return app.send_static_file(\"index.html\")", "def index():\n return app.send_static_file('index.html')", "def index():\n return render_template('index.html'), 200", "def index():\n\n return render_template(\"i...
[ "0.84246004", "0.8272775", "0.82501537", "0.8228777", "0.81703055", "0.81307155", "0.8094319", "0.80637187", "0.80637187", "0.80637187", "0.80637187", "0.80637187", "0.80637187", "0.80637187", "0.80637187", "0.80637187", "0.80637187", "0.80637187", "0.80637187", "0.80637187", ...
0.0
-1
Serve project.html redered with jinja2.
def project(self, project_id): try: return {'project': self.server.projects[project_id]} except KeyError: raise HTTPError(404, "Unknown project")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index():\n return render_template('project.html')", "def index(path):\n return render_template(\"main.jinja2.html\")", "def index():\n return render_template('home.jinja2')", "def main():\n return render_template('index.html')", "def main():\n return render_template('index.html')", "de...
[ "0.76853174", "0.75702834", "0.7240784", "0.6982168", "0.6982168", "0.6910416", "0.6821985", "0.6790587", "0.67658055", "0.67555386", "0.6735233", "0.6735233", "0.67199844", "0.67199844", "0.6713254", "0.66706204", "0.6651341", "0.6625179", "0.65809524", "0.65652275", "0.6559...
0.0
-1
Serve static files under web/assets at /assets.
def server_static(self, filepath): root = os.path.join(self.webbase, 'assets') return static_file(filepath, root=root)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def files_serve(path):\n return flask.send_from_directory(\"static/js\", path)", "def serve_static_files(request, path, insecure=False, **kwargs):\n\n if not settings.DEBUG and not insecure:\n raise Http404\n normalized_path = posixpath.normpath(unquote(path)).lstrip('/')\n absolute_path = fin...
[ "0.69144833", "0.67893183", "0.67141455", "0.6705759", "0.6669034", "0.66611695", "0.66611695", "0.66611695", "0.66611695", "0.6539572", "0.6536954", "0.6501155", "0.6495804", "0.64598477", "0.63987106", "0.6387039", "0.6364836", "0.6289411", "0.6248533", "0.6242702", "0.6177...
0.71087754
0
Serve static files under pluginname/assets.
def server_plugin_static(self, filepath): try: pluginname, filename = filepath.split('/', 1) plugin = [p for p in get_all_plugins(self.config, project=None) if p.name==pluginname and plugin.assets is not None][0] except (ValueError, IndexError): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def server_static(self, filepath):\n root = os.path.join(self.webbase, 'assets')\n return static_file(filepath, root=root)", "def files_serve(path):\n return flask.send_from_directory(\"static/js\", path)", "def serve_static_files(request, path, insecure=False, **kwargs):\n\n if not setting...
[ "0.66425836", "0.650275", "0.6494702", "0.63426834", "0.6313165", "0.6253335", "0.62064654", "0.61046124", "0.60932267", "0.6077982", "0.6062902", "0.60482115", "0.602354", "0.600255", "0.5975606", "0.5932071", "0.5927599", "0.5903414", "0.5891787", "0.5891787", "0.5891787", ...
0.73649305
0
Get web API definitions.
def get_api(self): from geoffrey.utils import get_api return get_api(self.app.routes, prefix='/api')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def api_list(self):\n return self._get('apis')", "def list_all_apis():\n app.logger.info('Request for api list')\n func_list = []\n for rule in app.url_map.iter_rules():\n if rule.endpoint != 'static':\n methods = ','.join(rule.methods)\n func_list.append(\n ...
[ "0.67170715", "0.6385792", "0.62804663", "0.6170367", "0.61486185", "0.6076361", "0.60462284", "0.59231466", "0.57675594", "0.5740952", "0.57011944", "0.5667798", "0.56621456", "0.5656959", "0.56463724", "0.56237555", "0.56000674", "0.56000674", "0.56000674", "0.557157", "0.5...
0.55181885
25
Run the internal webserver.
def start(self): run(self.app, host=self.host, port=self.port, server=AsyncServer, quiet=True, debug=False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_webserver():\n\tglobal hostname, portnum\n\t#bottle.debug(True)\t# While in development, we want the data\n\tbottle.run(host=hostname, port=portnum) \n\tlogging.info(\"Exiting server.\")", "def webserver_start():\n run(_webserver_command())", "async def serve_web(self):\n interface = \"0.0.0....
[ "0.79317755", "0.7850701", "0.77923936", "0.77375144", "0.7684496", "0.75978947", "0.74984926", "0.7433606", "0.7433108", "0.74034625", "0.736822", "0.73658055", "0.72712004", "0.72553146", "0.7231856", "0.72288", "0.71963876", "0.71963876", "0.7180804", "0.7158431", "0.71516...
0.65137756
95
Create a nicely formatted HTML representation of a singular or list of substitutions.
def format_substitutions(subs: Union[SubstituteTerm, List[SubstituteTerm]]): text = "" if isinstance(subs, SubstituteTerm): term_str = str(subs) for line in term_str.split('\n'): text += Markup.escape(line) + Markup('<br />') text += Markup('<br />') return text f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n t = Template(\n \"\"\"\n <h4>$title</h4>\n $imgs\n $footnotes\n <hr/>\"\"\")\n # Return result.\n return t.substitute({\n \"title\": self.title,\n \"imgs\": self.render_images(),\n \"fo...
[ "0.581361", "0.5800976", "0.57761186", "0.5666923", "0.5624687", "0.5621324", "0.5601476", "0.5572784", "0.5540061", "0.5529508", "0.5505106", "0.5487089", "0.5471752", "0.5471752", "0.5471752", "0.5471752", "0.54387504", "0.54198366", "0.53992283", "0.5394507", "0.53875756",...
0.7432605
0
Responds true if the unification algorithm chosen and the mode of operation chosen are compatible.
def valid_moo_unif_pair(moo_string: str, unif_choice) -> bool: if unif_choice != p_unif and unif_choice != XOR_rooted_security: return True if unif_choice == p_unif: supported_chaining = ['cipher_block_chaining', 'propogating_cbc', 'hash_cbc'] else: # XOR_rooted_security supported_ch...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_compatible_with(self, data):\n return True", "def test_compatibility(cipher, mode):\n\n chiper_obj = cipher_params(cipher, os.urandom(length_by_cipher[cipher]))[0] #need to be object, not interface, to validate_for_algorithm work\n if chiper_obj.name == \"ChaCha20\":\n return True\n ...
[ "0.6053097", "0.59758437", "0.58974004", "0.57908773", "0.5716292", "0.5692241", "0.56851655", "0.56801456", "0.5670041", "0.563753", "0.55710834", "0.55652994", "0.553747", "0.5530433", "0.5527546", "0.5460544", "0.5431406", "0.5387513", "0.5376746", "0.5365288", "0.5354722"...
0.5007131
72
Tests whether the nicv is calculated correctly
def test_solve_nicv(self): traces = np.array([[1, 2, 3], [4, 5, 6], [7, 0.4, 9], [2, 3, 12]]) plain = np.array([[1], [2], [1], [2]]) keys = plain resulting_nicvs = np.array([0.23045267, 0.24016342, 0.49382716]) calculated_nicvs = NICV.calculate_nicv_array(plain, traces, 0, keys...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_run_nicv(self):\n\n traces, keys, plain = FileLoader.main(CONST_DEFAULT_TRACES_FILE,\n CONST_DEFAULT_KEYS_FILE,\n CONST_DEFAULT_PLAIN_FILE)\n\n result = NICV.run(traces, keys, plain)\n\n self.ass...
[ "0.6684239", "0.60306436", "0.59655744", "0.5958371", "0.59267014", "0.58634454", "0.5859812", "0.58524597", "0.58106333", "0.5790867", "0.5771807", "0.57673794", "0.57341224", "0.5684923", "0.5670353", "0.5643081", "0.5637038", "0.5635449", "0.56344414", "0.56036335", "0.560...
0.6432046
1
This tests if the most probable point is contained in the result set
def test_run_nicv(self): traces, keys, plain = FileLoader.main(CONST_DEFAULT_TRACES_FILE, CONST_DEFAULT_KEYS_FILE, CONST_DEFAULT_PLAIN_FILE) result = NICV.run(traces, keys, plain) self.assertTrue(1398 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ok(self, point):\n [x1, x2, x3, x4, x5, x6] = point.decisions\n if x1 + x2 -2 < 0:\n return False\n if 6 - x1 - x2 < 0:\n return False\n if 2 - x2 + x1 < 0:\n return False\n if 2 - x1 + 3*x2 < 0:\n return False\n if 4 - (x3 - 3)**2 - x4 < 0:\n return False\n if (x5...
[ "0.62022245", "0.6142302", "0.6080909", "0.6052912", "0.60189813", "0.60144424", "0.5968332", "0.5959424", "0.595265", "0.5902871", "0.58955073", "0.5891899", "0.58760667", "0.5827749", "0.5806527", "0.5780695", "0.5774272", "0.576317", "0.57527685", "0.574575", "0.57178843",...
0.0
-1