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
Test Get Method with Huge Artifact
async def test_get_huge_artifact(): writer = SimpleWriter() work_queue = asyncio.Queue() await work_queue.put(TestData.JOB_GET_PAYLOAD) worker = tower_api_worker.TowerApiWorker(TestData.config, writer, work_queue) headers = {"Content-Type": "application/json"} with aioresponses() as mocked: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_gettem_using_get(self):\n pass", "def test_get(self):\n pass", "def test_get1(self):\n pass", "def test_get2(self):\n pass", "def test_get(self):\n return self.doRequest(self.url, method=\"GET\", body=self.input)", "def test_listtem_using_get(self):\n pa...
[ "0.7655941", "0.760951", "0.7174276", "0.7135397", "0.6835586", "0.6827378", "0.6811686", "0.67530507", "0.66402256", "0.64859897", "0.6447968", "0.64439183", "0.64251465", "0.6409638", "0.6409638", "0.64047134", "0.6399988", "0.6341302", "0.63308346", "0.63177127", "0.630546...
0.6683982
8
Test Monitor Method 400
async def test_monitor_400(): writer = SimpleWriter() work_queue = asyncio.Queue() await work_queue.put(TestData.JOB_MONITOR_PAYLOAD) worker = tower_api_worker.TowerApiWorker( TestData.no_verify_config, writer, work_queue ) headers = {"Content-Type": "application/json"} with aiorespo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def monitor(self):", "def monitor(self, rms):\n pass", "def test(self):\n return test_throttle_method()", "def test_update_health_monitor(self):\r\n resource = 'health_monitor'\r\n cmd = healthmonitor.UpdateHealthMonitor(test_cli20.MyApp(sys.stdout),\r\n ...
[ "0.75364196", "0.6911458", "0.6635036", "0.6376784", "0.62131083", "0.60960746", "0.6014132", "0.60071146", "0.6003746", "0.5995701", "0.5986539", "0.59593236", "0.59593236", "0.59593236", "0.59508395", "0.5950133", "0.5930386", "0.5930386", "0.5903885", "0.5873679", "0.58604...
0.5556549
70
Generates link and filename strings to given day
def generatelinkandname(day_minus=None): global args if day_minus == None: day = date.today().strftime("%Y-%m-%d") else: day = (date.today() - timedelta(days = day_minus)).strftime("%Y-%m-%d") link = '{}{}{}.xlsx'.format(args.root_link, args.prefix, day) name = './{}{}.xls...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_zip_file_url_for_specific_date(date):\n date_format = date.strftime('%d%m%y')\n return __class__.href_pattern.format(date_format)", "def get_today_url():\n\n lines, numlst = get_items()\n if not lines:\n return ''\n month = time.localtime().tm_mon\n day = time.localtime()...
[ "0.65585816", "0.65574384", "0.61271703", "0.6113579", "0.60778224", "0.60665023", "0.6029519", "0.59859705", "0.59810865", "0.59277725", "0.58923703", "0.58849955", "0.5883099", "0.58484054", "0.58324665", "0.5776711", "0.57467675", "0.5738119", "0.57259405", "0.57066894", "...
0.7593797
0
Gets file from link and prints the status of the process
def getfile(link): global args file_data = None trying_count = 1 print('') while file_data == None and trying_count <= args.try_limit: try: print('\rTrying to get {}... ({}/{})' .format(link, trying_count, args.try_limit), end='') back_d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def t_getfile(self, link, filename, session):\n\n self.sema.acquire()\n\n filepath = os.path.join(os.getcwd() + '/Downloads/' + str(filename))\n os.makedirs(os.path.dirname(filepath), exist_ok=True)\n\n if not os.path.isfile(filepath):\n self.download_new_file(link, filepath,...
[ "0.65434134", "0.6188203", "0.6021775", "0.5991127", "0.5950387", "0.59072536", "0.5892946", "0.58916056", "0.58296704", "0.5745383", "0.5718854", "0.57025456", "0.56996423", "0.5674766", "0.5653579", "0.5642692", "0.5598064", "0.5593359", "0.5586392", "0.5573468", "0.5568049...
0.65308017
1
Returns version variable as a string
def getversion(): global VERSION if len(VERSION) == 3: return '{}.{}.{}'.format(VERSION[0], VERSION[1], VERSION[2]) else: return '{}.{}.{}-{}'.format(VERSION[0], VERSION[1], VERSION[2], VERSION[3])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getVersionString():\n return str(version_gen.major) + \".\" + str(version_gen.minor) + \".\" + str(version_gen.compilation)", "def get_version():\n return '.'.join(map(str, VERSION))", "def get_version():\n return '%d.%d.%d' % version_info", "def get_version():\n return \"0.0.1 (prerelease pr...
[ "0.81692374", "0.7711347", "0.7620297", "0.7548004", "0.7541828", "0.7541828", "0.75364894", "0.753284", "0.7518726", "0.74743867", "0.74742043", "0.74461126", "0.738015", "0.73392594", "0.7338098", "0.7330606", "0.72502506", "0.71888894", "0.7164977", "0.7146855", "0.7143757...
0.74415207
12
Prints summary and text
def printsummary(text): print('Summary:') print('--------') print(text)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def printSummary(self):\n pass", "def print_summary(self):\n #outcomes = self.get_outcomes()\n #passes = 'Passes: %i' % sum(1 for outcome in outcomes if outcome == Result.PASS)\n #untested = 'Untested: %i' % sum(1 for outcome in outcomes if outcome == Result.UNTESTED)\n #er...
[ "0.8318454", "0.7980596", "0.76172924", "0.756329", "0.7450223", "0.7426687", "0.74204826", "0.7371308", "0.73710257", "0.7349337", "0.7313019", "0.7286175", "0.7283446", "0.7251422", "0.71614695", "0.7157122", "0.71306276", "0.7098288", "0.7034655", "0.7009345", "0.69661987"...
0.84355104
0
r"""Calculates centers, (x, y), of box (N, 4)
def center(box): x_center = box[:, 0] + (box[:, 2] - box[:, 0]) // 2 y_center = box[:, 1] + (box[:, 3] - box[:, 1]) // 2 return torch.stack((x_center, y_center)).t().to(box.device)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def center_size(boxes):\n concat = P.Concat(1)\n return concat(((boxes[:, 2:] + boxes[:, :2])/2, # cx, cy\n boxes[:, 2:] - boxes[:, :2])) # w, h", "def to_center_form(boxes):\n x_min, y_min = boxes[:, 0], boxes[:, 1]\n x_max, y_max = boxes[:, 2], boxes[:, 3]\n center_x = (x_...
[ "0.7844434", "0.7580505", "0.75150996", "0.7374247", "0.71713126", "0.71421254", "0.7123263", "0.7022318", "0.69268924", "0.6919755", "0.6817232", "0.675503", "0.66800183", "0.6634561", "0.6622195", "0.6617297", "0.6592415", "0.6585464", "0.65702504", "0.65461254", "0.6537031...
0.7520257
2
r"""Returns a set of receptive fields (N, 4)
def receptive_fields(rfsz, jsz, feat_size): width = feat_size[2] height = feat_size[1] feat_ids = torch.tensor(list(range(width))).repeat(1, height).t().repeat(1, 2) feat_ids[:, 0] = torch.tensor(list(range(height))).unsqueeze(1).repeat(1, width).view(-1) box = torch.zeros(feat_ids.size()[0], 4) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_fields() :\n st=hp.synfast(cltt+nltt,nside,new=True,verbose=False,pol=True)\n ff0=nmt.NmtField(mask_lss,[st])\n return ff0", "def fields(self):", "def raw_fields(self):\n list_fields = ['BAROR', None, None] + self.x.tolist() + [self.offt]\n return list_fields", "def f(self):\r\...
[ "0.65688103", "0.60678416", "0.59396964", "0.59023494", "0.58226675", "0.5782203", "0.5777073", "0.5729337", "0.5726998", "0.57095695", "0.5701686", "0.56992126", "0.56943995", "0.5684656", "0.5650746", "0.5636341", "0.5568981", "0.55669224", "0.5556927", "0.5542809", "0.5537...
0.0
-1
r"""Remove receptive fields on the margin of the image
def prune_margin(receptive_box, imsize, threshold=0): im_width = imsize[1] im_height = imsize[0] xmin = util.where(receptive_box[:, 0] >= 0 - threshold) ymin = util.where(receptive_box[:, 1] >= 0 - threshold) xmax = util.where(receptive_box[:, 2] < im_width + threshold) ymax = util.where(recept...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _trim_margins(self, img):\n oldsize = (0, 0)\n while oldsize != img.shape: # while the size is changing\n oldsize = img.shape\n for i in range(4): # 4 times\n img = num.rot90(img) # rotate 90\n if num.std(img[0, :]) < self.trim_std: # if low...
[ "0.7126919", "0.6731677", "0.6630295", "0.6498372", "0.623735", "0.60546625", "0.60461175", "0.6004334", "0.59785616", "0.59781635", "0.5944686", "0.59423923", "0.58887416", "0.58805865", "0.58709306", "0.5778696", "0.57705253", "0.57490146", "0.5730342", "0.5727951", "0.5720...
0.6408792
4
r"""Remove receptive fields on the margin of the image
def prune_bbox(receptive_box, bbox, threshold=0): xmin = util.where(receptive_box[:, 0] >= bbox[0] - threshold) ymin = util.where(receptive_box[:, 1] >= bbox[1] - threshold) xmax = util.where(receptive_box[:, 2] < bbox[2] + threshold) ymax = util.where(receptive_box[:, 3] < bbox[3] + threshold) val...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _trim_margins(self, img):\n oldsize = (0, 0)\n while oldsize != img.shape: # while the size is changing\n oldsize = img.shape\n for i in range(4): # 4 times\n img = num.rot90(img) # rotate 90\n if num.std(img[0, :]) < self.trim_std: # if low...
[ "0.7127377", "0.67318827", "0.6631397", "0.6497906", "0.6409378", "0.62372595", "0.60567945", "0.60469633", "0.6005229", "0.597851", "0.5978465", "0.5945446", "0.59436196", "0.58900595", "0.58801115", "0.5870539", "0.577805", "0.57711315", "0.5749862", "0.5730678", "0.5728947...
0.0
-1
r"""Transfer keypoints by nearestneighbour assignment
def predict_kps(src_box, trg_box, src_kps, confidence_ts): # 1. Prepare geometries & argmax target indices _, trg_argmax_idx = torch.max(confidence_ts, dim=1) src_geomet = src_box[:, :2].unsqueeze(0).repeat(len(src_kps.t()), 1, 1) trg_geomet = trg_box[:, :2].unsqueeze(0).repeat(len(src_kps.t()), 1, 1) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_neighbour(self, dest, weight):\n self.points_to[dest] = weight", "def investigate(self, nearest_neighbors):\n pass", "def set_neighbours(self,knodes):\n self.neighbours = []\n for kn in knodes:\n # Make sure we don't have ourselves as a neighbour:\n if ...
[ "0.60067165", "0.5975986", "0.581192", "0.5608923", "0.5568041", "0.54894894", "0.5446244", "0.5445771", "0.5384765", "0.53826004", "0.53656256", "0.5352127", "0.53487545", "0.5341636", "0.53200513", "0.5317732", "0.53096175", "0.52956784", "0.52822363", "0.5280508", "0.52805...
0.0
-1
r"""Returns boxes in onehot format that covers given keypoints
def neighbours(box, kps): box_duplicate = box.unsqueeze(2).repeat(1, 1, len(kps.t())).transpose(0, 1) kps_duplicate = kps.unsqueeze(1).repeat(1, len(box), 1) xmin = kps_duplicate[0].ge(box_duplicate[0]) ymin = kps_duplicate[1].ge(box_duplicate[1]) xmax = kps_duplicate[0].le(box_duplicate[2]) ym...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _one_hot(x, k, dtype=np.float32):\n return np.array(x[:, None] == np.arange(k), dtype)", "def one_hot(x, k, dtype=np.float32):\n return np.array(x[:, None] == np.arange(k), dtype)", "def isolate_key_ponits(mask, keypoints):\n new_mask = np.zeros(mask.shape) * 255\n for y, x in keypoints[0].conver...
[ "0.6023954", "0.59734654", "0.5906592", "0.5894241", "0.5691551", "0.56882316", "0.56732035", "0.5670251", "0.5649142", "0.56303936", "0.5620511", "0.55627286", "0.5522864", "0.55192226", "0.551634", "0.5511373", "0.5501042", "0.54976946", "0.54897213", "0.5486914", "0.548356...
0.5936421
2
r"""Returns 2dimensional gaussian filter
def gaussian2d(side=7): dim = [side, side] siz = torch.LongTensor(dim) sig_sq = (siz.float()/2/2.354).pow(2) siz2 = (siz-1)/2 x_axis = torch.arange(-siz2[0], siz2[0] + 1).unsqueeze(0).expand(dim).float() y_axis = torch.arange(-siz2[1], siz2[1] + 1).unsqueeze(1).expand(dim).float() gaussia...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gaussian_filter(x):\n return _gaussian_filter(x, 3)", "def gaussian2d(filter_size=5, sig=1.0):\n ax = np.arange(-filter_size // 2 + 1., filter_size // 2 + 1.)\n xx, yy = np.meshgrid(ax, ax)\n kernel = np.exp(-0.5 * (np.square(xx) + np.square(yy)) / np.square(sig))\n return kernel / np.sum(kern...
[ "0.78346384", "0.75890946", "0.74313533", "0.7361506", "0.7078652", "0.6947377", "0.6904551", "0.68053776", "0.67282915", "0.67181545", "0.66538566", "0.6648306", "0.6619742", "0.6607492", "0.6605033", "0.66039956", "0.6599761", "0.6598037", "0.6585344", "0.654356", "0.650615...
0.6085549
66
Utility for network discovery and security auditing
def do_nmap__Auxilary(self, param): if self.which("nmap"): self.do_shell("nmap " + param)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_discovery_summary():\n pass", "def test_get_network(self):\n pass", "def test_get_networks(self):\n pass", "def test_get_host_access(self):\n pass", "def test_get_valid_networks_for_virtualization_realm(self):\n pass", "def check_network(config_name, urls = ''):\n\n...
[ "0.5997211", "0.5749957", "0.56549877", "0.5565761", "0.5504994", "0.55042785", "0.5495207", "0.54915965", "0.54690874", "0.54570913", "0.54346627", "0.54123163", "0.5411173", "0.53582054", "0.534926", "0.5308048", "0.52687246", "0.52683884", "0.52622414", "0.5199114", "0.519...
0.0
-1
Automatic SQL injection and database takeover tool
def do_sqlmap__Auxilary(self, param): if self.which("sqlmap"): self.do_shell("sqlmap " + param)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_sql_injection(self, info):\n if info == 'try hard sql':\n self.start_threaded_attack(self.sql_injection.run_tryhard)\n else:\n self.start_threaded_attack(self.sql_injection.run)", "def test_sql_injection(self):\n\n self.create_job('Tejas', 'tejas.s1996@gmail.com...
[ "0.72825456", "0.65079856", "0.6355967", "0.6350003", "0.62248284", "0.6112454", "0.5982863", "0.5971284", "0.590146", "0.5813608", "0.571605", "0.570741", "0.5680529", "0.5678373", "0.5673883", "0.5571462", "0.55611247", "0.55363864", "0.55357313", "0.5501094", "0.5498907", ...
0.0
-1
Is this google homepage? Check that page title = Google
def test_google_exists(self): self.driver.get("http://www.google.com") self.assertIn("Google", self.driver.title)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isTopHomePage(self):\n domain = self.getDomain()\n if self.url == \"http://\" + domain + \"/\":\n return True\n if self.url == \"http://www.\" + domain + \"/\":\n return True\n if self.url == \"http://\" + domain:\n return True\n if self.url =...
[ "0.71307063", "0.68313223", "0.6636375", "0.65844566", "0.6456925", "0.63692826", "0.628369", "0.61637586", "0.6119811", "0.6105285", "0.6097933", "0.606743", "0.6065098", "0.6015548", "0.6015097", "0.6003149", "0.59567595", "0.58298546", "0.5827458", "0.581945", "0.57669556"...
0.65529305
4
Do search results contain the search term? Check that the search term appears in the top 5 search results
def test_search_results(self): self.driver.get("http://www.google.com") searchbox = self.driver.find_element_by_name('q') searchbox.send_keys(self.searchTerm) searchbox.send_keys(Keys.RETURN) raw_input('\nenter to continue:') # Get a list of all search results searchResultsList = self.driver.find_elements...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_search_multiresults(self):\n self.assertEquals(len(self.t['Scrubs'].search('my first')) >= 3, True)", "def search(self, query, maxhits=100):", "def TopCheckins(results, search_term):\n top_five = Counter([row[1] for row in results]).most_common()[:5]\n if search_term == 'total':\n search_t...
[ "0.7319251", "0.7041021", "0.6803216", "0.6628914", "0.6618858", "0.63862985", "0.6233287", "0.62005186", "0.61860263", "0.6169277", "0.6145449", "0.61421907", "0.6096155", "0.6089804", "0.6075444", "0.6066592", "0.606288", "0.6060152", "0.6030858", "0.60286254", "0.60252815"...
0.6359782
6
Find and Return the first 10 search results which immediately follow the first instance of the search term appearing in the search results.
def getIndexOfFirstAppearance(self, searchResultsList): indexTermAppears = 0 #firstTen = [] lenResultsList = len(searchResultsList) for index in range(lenResultsList): link = searchResultsList[index] linkName = link.get_attribute('href') if type(linkName) == 'unicode': if self.searchTerm in linkN...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _search(q: str, n: int):\n return search_client.retrieve([q], n)[0]", "def search(self, query, maxhits=100):", "def _search(self, query_obj, num, after, reverse, count=0):\r\n builder = SearchBuilder(query_obj,\r\n after = after, num = num, reverse = reverse,\r\...
[ "0.64442", "0.6167913", "0.61250824", "0.59525365", "0.58917093", "0.58774316", "0.5857339", "0.5845053", "0.58335143", "0.583215", "0.58300304", "0.580874", "0.5773988", "0.5772055", "0.57602614", "0.5756416", "0.5739081", "0.5709645", "0.5688756", "0.5679288", "0.56704116",...
0.55050594
31
Generates a set of samples from the given generator and applies the given transformation. The outputs of the generator are centered and rescaled, if the corresponding statistics are available. Same for the transformation.
def get_samples( device, P, generator, generator_mean=None, teacher=None, transformation=None, transformation_mean=None, ): with torch.no_grad(): cs = torch.randn(P, generator.N_in).to(device) # propagate latent variables through the generator xs = generator.tran...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generator(samples, batch_size=32, is_training=True):\n num_samples = len(samples)\n\n #vertical, horizontal range for random translation\n x_translate_range = 100\n y_translate_range = 10\n\n while 1: # Loop forever so the generator never terminates\n #shuffle the samples once the whole d...
[ "0.60224885", "0.58547485", "0.58525455", "0.5796969", "0.5784097", "0.5770003", "0.5644783", "0.56155056", "0.55738884", "0.5562732", "0.5490929", "0.54908144", "0.547882", "0.54485327", "0.54390806", "0.54188913", "0.5395706", "0.53845555", "0.5383145", "0.53690684", "0.536...
0.63473403
0
Generates a set of samples from the generator and transformation with the given names. The outputs of the generator are centered and rescaled, if the corresponding statistics are available. Same for the transformation.
def get_inputs_by_name( device, P, generator_name, transformation_name, ): # Find the right generator for the given scenario generator = get_generator(generator_name, device) # transformation of the inputs transformation = get_transformation(transformation_name, generator, device) model_desc = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate(self):\n self.training_data.gen_x(self.x_func)\n self.training_data.gen_a(self.a_func)\n self.training_data.gen_y(self.y_func)\n \n self.testing_data.gen_x(self.x_func)\n self.testing_data.gen_ys(self.y_func)\n self.testing_data.gen_azero(self.ytotal_fu...
[ "0.5946869", "0.59112626", "0.58949316", "0.5753713", "0.5734045", "0.5722666", "0.56942326", "0.56448734", "0.5636334", "0.5636123", "0.55923116", "0.55923116", "0.5563399", "0.55401", "0.55366707", "0.55152845", "0.5511322", "0.55043995", "0.5497834", "0.54810655", "0.54726...
0.63186747
0
Returns a new instance of the generator with the given name.
def get_generator(name, device): if name == "dcgan_rand": generator = transformations.dcgan_cifar10(device, random=True) elif name == "dcgan_cifar10": generator = transformations.dcgan_cifar10(device) elif name == "dcgan_cifar100_grey": generator = transformations.dcgan_cifar100_grey...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate(self, name):\n raise NotImplementedError()", "def get_instance(self, name):\n klass = self.get_class(name)\n return klass()", "def new(name=None):", "def new_generator(self):\n return self.generator_function(*self.args, **self.kwargs)", "def make_rng(self, name: str...
[ "0.67438066", "0.66791904", "0.66047007", "0.64927286", "0.62310225", "0.6223543", "0.6199213", "0.61183614", "0.60630685", "0.6002545", "0.59170157", "0.5912291", "0.58919317", "0.58739626", "0.58009124", "0.58009124", "0.57575244", "0.57546234", "0.57410485", "0.5718856", "...
0.67784727
0
Returns a new instance of the transformation with the given name.
def get_transformation(name, generator, device): transformation = None if name is None: transformation = None elif name.startswith("rand_proj_gauss_sign"): temp = re.findall(r"\d+", name) [N_in, N_out] = list(map(int, temp)) # create the random transformation transfor...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_transform(self, name):\n return self._handlers_by_name[name].get_transform_instance()", "def with_transforms(self: TDataWTransform, group_name: str) -> TDataWTransform:\n datacopy = self._shallow_clone_dataset()\n datacopy._frozen_transform_groups.with_transform(group_name)\n ...
[ "0.72957146", "0.61331624", "0.6122498", "0.6105759", "0.6056436", "0.60378855", "0.58359975", "0.5805107", "0.5772465", "0.5734033", "0.5708399", "0.56826663", "0.5678532", "0.5658105", "0.5631155", "0.56002825", "0.5556288", "0.55493873", "0.5538025", "0.55364925", "0.55166...
0.66518956
1
Given a vector mean and covariance matrix of a distribution in N dimensions, returns the scalar mean and standard deviation of data drawn from that distribution.
def get_scalar_mean_std(mean, cov): N = cov.shape[0] mean_scalar = torch.mean(mean) var_scalar = torch.mean(cov[np.diag_indices(N)] + mean ** 2) - torch.mean(mean) ** 2 return mean_scalar, torch.sqrt(var_scalar)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def MeanAndStandardDeviation(data):\n n = len(data)\n if n == 0:\n return 0.0, 0.0\n mean = float(sum(data)) / n\n variance = sum([(element - mean)**2 for element in data]) / n\n return mean, math.sqrt(variance)", "def mean_cov(X):\n if not isinstance(X, np.ndarray) or len(X.shape) != 2:\n rais...
[ "0.69571626", "0.6857151", "0.6781143", "0.6749944", "0.6704417", "0.66870916", "0.66848916", "0.66563874", "0.66454536", "0.6589735", "0.6558502", "0.64964044", "0.6496252", "0.642613", "0.6410069", "0.6410069", "0.64019996", "0.6370109", "0.6355448", "0.635201", "0.6345564"...
0.7294634
0
Create pipeline string and launch it.
def setup_pipeline(self): pipeline = "rtspsrc protocols=tcp location={} name=src src. ! "\ "application/x-rtp, media=(string)audio"" !"\ "decodebin ! audioconvert ! pulsesink src. !"\ "application/x-rtp, media=(string)video"" !"\ "deco...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pipeline(args) :\n from pipeliner import create_pipeline\n create_pipeline(args)", "def _create_pipeline(self) -> codepipeline.Pipeline:\n source_output = codepipeline.Artifact()\n build_output = codepipeline.Artifact()\n return codepipeline.Pipeline(\n self,\n ...
[ "0.72488195", "0.63713664", "0.6367668", "0.6268433", "0.6179045", "0.617009", "0.60147107", "0.59962255", "0.59836966", "0.5975727", "0.592263", "0.59019846", "0.5894471", "0.5884143", "0.5866668", "0.58046997", "0.57974154", "0.57799566", "0.57761824", "0.5764525", "0.57518...
0.5425354
47
Sets handler to notify media information.
def set_info_event_handler(self, handler): self.info_handler = handler
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_handler(self, handler):\n self._handler = handler", "def setAlertNotificationHandler(self, handler):\n self.alertNotificationHandler = handler", "def register_handler(self, handler):\r\n self.handler = handler", "def __init__(self, handler: mediaHandler):\n\n self.handler ...
[ "0.69296384", "0.6656942", "0.6458559", "0.64305735", "0.6423851", "0.63559604", "0.62055033", "0.61443347", "0.6069962", "0.6003106", "0.5912256", "0.5867151", "0.57176775", "0.5670392", "0.56581545", "0.5640697", "0.5590167", "0.5568174", "0.55603975", "0.5541731", "0.54989...
0.6233584
6
This method calls when streaming started.
def on_watch_message(self, bus, msg): msg_struct = msg.get_structure() if msg_struct: if msg_struct.get_name() == 'GstMessageTag': codec_name = ((msg_struct["taglist"].nth_tag_name(0))) codec_value = msg_struct["taglist"].get_string(codec_name) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_stream(self):\n pass", "def start(self):\n\t\tself.stream.start_stream()", "def stream_created(self,stream):\n pass", "def stream_call(self):\n pass", "def start(self) -> None:\n self._stream.start()", "def on_connect(self):\n log.info(\"Stream connected\")", ...
[ "0.8575171", "0.80226105", "0.76048577", "0.73955184", "0.73001826", "0.7225473", "0.71093595", "0.71027416", "0.70751953", "0.6855948", "0.6837241", "0.679934", "0.67611635", "0.6707322", "0.6707322", "0.6707322", "0.6707322", "0.6707322", "0.6707322", "0.6707322", "0.670732...
0.0
-1
This method when sync message arrives and prepares the window handler for displaying properly on GUI.
def on_sync_message(self, _, msg): message_name = msg.get_structure().get_name() print(message_name) if message_name == "prepare-window-handle": win_id = self.window_id assert win_id imagesink = msg.src imagesink.set_window_handle(win_id)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def event_loop(self):\n if self.message_counter:\n if not self.msg:\n self.showdialog()\n else:\n self.msg.setText(\n \"COMET encounterd {} error(s)\".format(self.message_counter).ljust(\n 70\n )...
[ "0.65455043", "0.6346855", "0.6279635", "0.60636854", "0.60628414", "0.6017681", "0.59413826", "0.58798623", "0.577929", "0.57425565", "0.57300234", "0.5712851", "0.57022697", "0.5681794", "0.56317794", "0.5628675", "0.56248564", "0.56072944", "0.55959505", "0.5586139", "0.55...
0.7002181
0
Stops the player and destroys the player object.
def stop(self): self.set_state_null() self.player = None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stop(self):\n self.stopped = True\n # FIXME?: Why is this not doing anything? Shouldn't it be calling into the player API?", "def stop(self):\n if self.player and self.player.is_playing():\n self.player.pause()\n super().stop()", "def _control_stop(self):\n s...
[ "0.7495407", "0.72363794", "0.72135425", "0.70176417", "0.7017531", "0.6868679", "0.6810595", "0.67968863", "0.67196923", "0.66897637", "0.6644563", "0.6587246", "0.6582386", "0.64925516", "0.6466148", "0.64212495", "0.6382462", "0.6382462", "0.6350426", "0.63449967", "0.6334...
0.7740178
0
Used for getting media resolution using a sample from stream.
def get_resolution(self): ret_val = False width = 0 height = 0 try: sink = self.player.get_by_name('sink') sample = GstBase.BaseSink.get_last_sample(sink) caps = Gst.Sample.get_caps(sample) struct = Gst.Caps.get_structure(caps, 0) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_resolution(filename):\n cmd = ('ffprobe -v 0 -of flat=s=_ -select_streams v:0 -show_entries '\n 'stream=height,width ' + filename).split()\n pid = subprocess.run(cmd, stdout=subprocess.PIPE,\n universal_newlines=True)\n if pid.returncode != 0:\n return None...
[ "0.646399", "0.60087603", "0.5969253", "0.5954537", "0.590219", "0.56904954", "0.5665113", "0.5597763", "0.5594036", "0.55798703", "0.55705637", "0.55515945", "0.553239", "0.55043125", "0.54656255", "0.54384637", "0.54121894", "0.53890985", "0.5379376", "0.530331", "0.5300982...
0.6750637
0
Take snapshot from last sample.
def take_snapshot(self, path, file_name): pipelie_state = self.player.get_state(1) p_state = pipelie_state.state if p_state not in (Gst.State.PLAYING, Gst.State.PAUSED): print("Stream is not ready") else: try: sink = self.player.get_by_name('sink')...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_last_sample(self) -> InternalSample:", "def set_last_sample(self, sample: InternalSample):", "def take_snapshot(self):\r\n self.snapshot = self.gain, self.block, self.locked, self.bucket_num", "def take_snapshot(self):\r\n self.snapshot = self.max_gain, self.__dup_array(), copy.copy(sel...
[ "0.744688", "0.7266699", "0.70777684", "0.68082774", "0.65547365", "0.64320153", "0.6405451", "0.626976", "0.62492865", "0.6156588", "0.6042289", "0.6021475", "0.59454584", "0.5943764", "0.5943764", "0.5943764", "0.5910042", "0.5861286", "0.5859498", "0.5808587", "0.5724527",...
0.5878058
17
Set streaming source URL.
def set_url(self, source_url): if utils.validate_url(source_url, "rtsp"): self.url = source_url self.set_state_null() self.setup_pipeline() self.play() else: print("Invalid URL")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_source(self, source):\n self.data['source'] = source", "def set_stream_url(self, url, info=None):\n listitem = xbmcgui.ListItem(label='clip', path=url)\n xbmcplugin.setResolvedUrl(self.handle, True, listitem)", "def src(self, src):\n\n self._src = src", "def set_url(self, ...
[ "0.6712162", "0.6592298", "0.647681", "0.6407756", "0.6372209", "0.635762", "0.6356142", "0.6350102", "0.63494205", "0.62204987", "0.6213311", "0.6206013", "0.620283", "0.620283", "0.620283", "0.620283", "0.620283", "0.620283", "0.620283", "0.61903834", "0.6171611", "0.6141...
0.78246737
0
Read the instrumentlist and returns the list of available instruments
def __read_instrumentslist(self): available_instruments = [] with open("instrumentslist.txt", "r") as file: for line in file: splited = line.split(" ") name = "" for j in splited[1:]: name += j available_inst...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __get_instrument_items(self, i):\n all_instruments = self.__read_instrumentslist()\n return [x for x in all_instruments[i * 8:i * 8 + 8]]", "def instruments(self):\r\n return self.get_field('instrument')", "def instrument_list(request):\n breadcrumbs = Breadcrumbs(\"home\", None)\n ...
[ "0.72788113", "0.6994194", "0.6680399", "0.62496823", "0.6186994", "0.5795701", "0.5685171", "0.5648937", "0.5602791", "0.55970687", "0.55795294", "0.556428", "0.5521486", "0.55101776", "0.55014545", "0.54581416", "0.54535055", "0.5435083", "0.54243535", "0.5420092", "0.54146...
0.82584137
0
Gets mouse click position and if any instrument item is clicked then place a request to close and stores the instrument id in self.result
def handle_events(self, pos): x, y = pos if x > 20 and x < 20 + self.itype_width and y > 20 and y < 20 + self.itype_height: x = x - 20 y = y - 20 id = -1 selected_some = False for sprite in self.spritebox_itypes: if sprite.rect....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exit_on_click(self):\n self.get_mouse()\n self._close()", "def on_click(self, event):\n if self.click_job is not None:\n self.after_cancel(self.click_job)\n item = self.identify(\"item\", event.x, event.y)\n if item:\n self.click_job = self.after(200, ...
[ "0.67294705", "0.64975834", "0.6044", "0.5819678", "0.5760478", "0.56712794", "0.5587681", "0.5557171", "0.55097497", "0.5487866", "0.5468365", "0.5466923", "0.5465255", "0.5461246", "0.5447156", "0.5413082", "0.5412136", "0.5401142", "0.5387037", "0.5384846", "0.5322767", ...
0.51581424
37
returns items belonging particular instrument type
def __get_instrument_items(self, i): all_instruments = self.__read_instrumentslist() return [x for x in all_instruments[i * 8:i * 8 + 8]]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_items_of_type(self, item_type):\n return (item for item in self.items if item.get_type() == item_type)", "def getItemsOfType(typeId):\n return Gw2Spidy._request('all-items', str(typeId))['results']", "def get_items(self, dmi_type=None):\n if dmi_type is None:\n return [e...
[ "0.69635725", "0.68440086", "0.6805017", "0.6491815", "0.6378884", "0.6339532", "0.6326186", "0.6323095", "0.62107825", "0.5956291", "0.59456414", "0.5876843", "0.58207715", "0.5671607", "0.5645485", "0.5583342", "0.5539059", "0.55229145", "0.54867285", "0.54559404", "0.54378...
0.61834013
9
waits 7 seconds then check if lastline matches past iteration's lastline
def _check_completion(self): sleep(SONG_OVER_CHECK_TIME) ###Wait 10 seconds print("entering _check_completion") csv_lastline = self._read_lastline() print('system time = {}'.format(strftime("%H:%M:%S"))) print("csv_lastline = ", csv_lastline) print("self._last_line...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_recv_line(self):\n self.instance.sleep()\n for lans in self.file_lines:\n msg_flag, lres = self.instance.recv(timeout=self.timeout)\n assert(msg_flag)\n nt.assert_equal(lres, lans)\n msg_flag, lres = self.instance.recv()\n assert(not msg_flag)",...
[ "0.58198446", "0.580545", "0.5686041", "0.56266075", "0.5576705", "0.55692023", "0.5532898", "0.5488862", "0.54376894", "0.54367375", "0.5423209", "0.5357156", "0.5330643", "0.53153884", "0.52829564", "0.5281526", "0.5265003", "0.52394867", "0.5230492", "0.52259403", "0.52211...
0.700952
0
Call time_5_sec() 6 times, if the song ends return immediately, otherwise return once iterations are complete.
def _summarize_period(self): print("entering _summarize_period()") for i in range(TIME_BETWEEN_FEEDBACK // SONG_OVER_CHECK_TIME): ### Wait 30 seconds self._check_completion() if self._song_over is True: break self._set_last_30_sec() return
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bottle_song_while(num):\n pass", "def sleeper(self):\n for waittime in (.01, .02, .05, .1, .2, .5):\n yield waittime\n while True:\n waittime = min(waittime + .2, 5)\n yield waittime", "def alarm(n):\r\n for i in range(n):\r\n playsound(sound_file...
[ "0.5971425", "0.5715666", "0.562592", "0.5625318", "0.55573803", "0.5507816", "0.54147017", "0.53399533", "0.5328652", "0.53037155", "0.5302493", "0.525366", "0.5239045", "0.5213815", "0.5213523", "0.5209679", "0.52083516", "0.5202194", "0.5183815", "0.51826215", "0.5164267",...
0.0
-1
sets the grip list for the past 30 seconds of the song
def _set_last_30_sec(self): #print("entering set_last_30") grip_list = read_csv(CSV_functions.MUSICGLOVE, test=True) self._all_grips = parse_csv(grip_list) #print("grip_list = ", grip_list) if self._grip_count == 0: self._grip_count = len(grip_list) else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update():\n\tglobal songList\n\tglobal songs\n\tsongList=os.listdir(\"./music/\")\n\tsongs=['```']\n\tfor song in songList:\n\t\tif len(songs[-1])>1800:\n\t\t\tsongs[-1]+='```'\n\t\t\tsongs.append('```')\n\t\tif '.mp3' in song:\n\t\t\tsongs[-1]+=song.replace('.mp3','')\n\t\t\tsongs[-1]+='\\n'\n\tsongs[-1]+='``...
[ "0.54157674", "0.53405726", "0.5317972", "0.5257763", "0.5144258", "0.5139769", "0.51279414", "0.5094557", "0.5051587", "0.50215524", "0.501079", "0.499168", "0.49858606", "0.48963735", "0.48302227", "0.4828999", "0.48264942", "0.4816952", "0.48083523", "0.47975463", "0.47958...
0.7477254
0
Returns the last line of the csv containing the user's grip information
def _read_lastline(self): #print("entering _read_lastline()") #print(read_csv(CSV_functions.MUSICGLOVE)) try: last_line = parse_csv(read_csv(CSV_functions.MUSICGLOVE))[-1] except IndexError: return "Empty File" return last_line
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def last():\n users = get_data_from_csv('files/users.csv')\n return User(*last_row(users))", "def get_csv_line(self):\n return \"{},{},{},{},{},{},{}\\n\".format(self.employee_id, self.gender,\n self.sales, self.bmi,\n ...
[ "0.6391869", "0.60333467", "0.59943587", "0.59010094", "0.5854792", "0.5797717", "0.5770353", "0.5705069", "0.5595599", "0.5545027", "0.55202806", "0.54466856", "0.53091663", "0.5271451", "0.5203575", "0.5201268", "0.51674443", "0.5159241", "0.5132848", "0.5112787", "0.509268...
0.6832772
0
Chooses an appropriate response based upon user's performance. Returns a 2tuple where the first element is the string type of response and the second is that appropriate response string
def select_response(self): print("RIVA msg number: ", self._RIVA_message_num) overall_avg = self.user_stats.new_overall_avg() scale_points = self.user_stats.get_scale_points(abs_val_list(grip_times(self._all_grips))) #print("overall avg: {}\n scale point 1: {} scale point 2: {}".format(o...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_bot_response(response):\n\n # Response set 1 for Aang\n aang = [\n \"\\\"Harsh words won't solve problems, action will!\\\"\", # S1E11\n \"\\\"The past can be a great teacher.\\\"\", # S3E13\n \"\\\"It's easy to do nothing, but it's hard to forgive.\\\"\", # S3E16\n ]\n\n ...
[ "0.624096", "0.6176012", "0.59776336", "0.58650833", "0.585061", "0.5705987", "0.56702995", "0.56180567", "0.5612104", "0.55950737", "0.5505881", "0.5502962", "0.5489708", "0.546095", "0.54457444", "0.5445005", "0.5435877", "0.54341555", "0.5425992", "0.5423421", "0.53902596"...
0.6225671
1
Returns a welcome string for the user, including their name, giving the system a chance to analyze their skill
def response_welcome(self): self._last_response = "Welcome" self._last_worst_grip = 0 ### return "Alright " + self.user_name + ", are you ready to really get started!?" return "Welcome_str"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def welcome_user():\n print('Welcome to the Brain Games!')\n name = prompt.string('May I have your name? ')\n print('Hello, {0}!'.format(name)) # noqa: WPS421\n return name", "def welcome_user():\n welcome_string = 'Welcome to the brain Brain Games!\\n'\n print(welcome_string)\n name = prom...
[ "0.8003481", "0.7870617", "0.7427531", "0.72472423", "0.72441304", "0.72441304", "0.7233642", "0.72273666", "0.72234404", "0.7138254", "0.7120854", "0.7120854", "0.71084553", "0.7105011", "0.7073073", "0.70278895", "0.70234156", "0.6998494", "0.6991893", "0.6919859", "0.69195...
0.76510775
2
Analyzes the user's performance on a given grip, returns a string appropriate to their success/failure
def response_training_response(self): training_response = Mglove_str_gen.training_response( self.user_stats.get_followup(), self.user_stats.get_grip_avg(grip_number=self.user_stats.get_followup(), old=True), self.user_stats.get_grip_avg(grip_number=self.user_stats.get_followu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_performance_str(self, metrics=['avr_accuracy', 'avr_loss'], \n abbrev={'avr_accuracy':'acc','avr_loss':'loss'}):\n mystr = \"\"\n if self.mode == 'val':\n mystr += \"best_epoch={} best_acc={:.3f} \".format(\n self.current_best[se...
[ "0.5970947", "0.58715546", "0.5830527", "0.5648605", "0.5620245", "0.55949765", "0.55753756", "0.55521804", "0.5510973", "0.5479509", "0.54691756", "0.5455601", "0.5445883", "0.54453063", "0.5439494", "0.543092", "0.5397823", "0.539487", "0.5331677", "0.53299403", "0.53298986...
0.0
-1
Analyzes user's last 30 seconds, returns string prompt suggesting a grip to work on (the worst grip)
def response_training_prompt(self): self._last_response = "training_prompt" print("Training Prompt") self.user_stats.set_followup(self._last_worst_grip) return Mglove_str_gen.training_prompt(self.user_stats.get_followup())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def timeleft(var, wrapper, message):\n cli, nick, chan, rest = wrapper.client, wrapper.source.name, wrapper.target.name, message # FIXME: @cmd\n\n if (wrapper.public and var.LAST_TIME and\n var.LAST_TIME + timedelta(seconds=var.TIME_RATE_LIMIT) > datetime.now()):\n cli.notice(nick, messages...
[ "0.55555415", "0.5489019", "0.5465575", "0.5461834", "0.5434844", "0.5339962", "0.5314979", "0.53055173", "0.53049266", "0.52941054", "0.5291508", "0.52859485", "0.52676785", "0.5262727", "0.5251476", "0.5235185", "0.5218309", "0.51939255", "0.5193117", "0.518266", "0.5178915...
0.55030304
1
Returns a scaled string telling the user they need to improve their overall reaction time
def response_negative(self): print("Negative Response") self._last_response = "negative_response" #print("scale = ", self.user_stats.find_worst_grip_scale(grip_times(self._all_grips))) return Mglove_str_gen.negative_response(self.user_stats.find_worst_grip_scale(grip_times(self._all_grip...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def runtime_message(self, df):\n runtime = self.runtime(df.shape[0])\n\n if runtime is None:\n return \"Runtime estimate unavailable; model has no timing data.\"\n elif runtime >= 3600:\n return \"Estimated runtime: {0:3.4f} hr\".format(runtime / 3600)\n elif runti...
[ "0.6136557", "0.61044276", "0.5976954", "0.58637476", "0.5806269", "0.57733107", "0.5703799", "0.5656686", "0.56428784", "0.56355673", "0.5591753", "0.55359495", "0.5515496", "0.5512658", "0.547431", "0.5455899", "0.5454296", "0.5452885", "0.5405169", "0.5400682", "0.5392248"...
0.0
-1
Returns a scaled string telling the user that their overall reaction time is good/great
def response_positive(self): self._last_response = "positive_response" print("Positive Response") #print("scale =", self.user_stats.find_best_grip_scale(grip_times(self._all_grips))) return Mglove_str_gen.positive_response(self.user_stats.find_best_grip_scale(grip_times(self._all_grips))...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getStatusMessage():\n\n now = datetime.datetime.now()\n hour = now.hour\n mood = Sentience.getPrimaryMood()\n exp_mood = Sentience.getExposedPositivity()\n\n random.seed((time.time()//86400*86400))\n\n #sleeping\n if not (9 <= hour < 21) and (mood <= 0.5 or not ...
[ "0.6327088", "0.6078444", "0.60517025", "0.6004405", "0.60015446", "0.5977554", "0.5964122", "0.59580976", "0.5939013", "0.59376353", "0.5828104", "0.57946587", "0.5789976", "0.57783526", "0.5776032", "0.57751346", "0.5758608", "0.57351154", "0.57181746", "0.57181746", "0.569...
0.0
-1
Tests whether the a new song has been started
def test_for_restart(self): #print("entering test_for_restart()") self._compile_result("UserName: " + self.user_name) #if self.first_song == True: # msg = "Welcome_str" # self.first_song = False if self._feedback_plat == "RIVA": self._RIVA_message_num +=...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isstarted():", "async def async_is_playing_new_track(self):\n if self._playing_mediabrowser and self._media_source_uri is not None:\n # don't trigger new track flag for local mediabrowser files\n return False\n \n if self._icecast_name != None:\n import u...
[ "0.73210984", "0.72162753", "0.6994692", "0.69603556", "0.67442226", "0.6626962", "0.6558375", "0.6545721", "0.6513892", "0.65125555", "0.6507299", "0.64917034", "0.6405683", "0.6383405", "0.6313636", "0.6301264", "0.62817293", "0.62797385", "0.6261099", "0.62444067", "0.6208...
0.0
-1
organizes methods, and runs a song
def execute_song(self): print("entering execute_song()") while self._song_over is False: self._summarize_period() grip_info = gather_info(parse_csv(self._last_30_sec)) self.user_stats.set_grips(grip_info) best_grip = evaluate_best_grip(grip_info) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n first_notes_and_song()\n bad_singing()\n using_a_sensor_to_block()", "def main():\n\n for i in range(1, 4):\n print(\"\\nSAMPLE INPUT {}\".format(i))\n\n playlist = Playlist()\n\n filename = \"testinput{}.txt\".format(i)\n\n with open(filename, 'r') as testfi...
[ "0.6234297", "0.6199234", "0.6132509", "0.60286134", "0.60234034", "0.5998715", "0.598575", "0.5973735", "0.59055066", "0.58414876", "0.58328384", "0.58164155", "0.5807434", "0.5794493", "0.57728755", "0.57708794", "0.57288164", "0.57262206", "0.5685071", "0.56207126", "0.560...
0.5963326
8
This function returns the optimizer for Ground Truth and logits
def opti(gt, logits): logit = tf.reshape(logits,( -1, 4), name = "reshape_output") correct_label = tf.reshape(gt, (-1,4)) print(gt.shape) print(logits.shape) loss = tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logits(labels = correct_label, logits = logit)) G_opt=tf.train.AdamOptimizer(learning_rate=l_r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_optimizer(self):\n raise NotImplementedError", "def getOptimizer():\n if configuration['others']['verbose']:\n sys.stdout.write(reports.seperator + reports.tabs +\n 'Optimizer : Adagrad, learning rate = {0}'.format(configuration['mlp']['lr'])\n ...
[ "0.6997918", "0.66103566", "0.65770066", "0.650172", "0.6476816", "0.64556354", "0.64355063", "0.6356657", "0.63321614", "0.63260067", "0.6323449", "0.63195825", "0.62732476", "0.6248976", "0.619486", "0.61656713", "0.61635053", "0.6151245", "0.6119996", "0.60867846", "0.6079...
0.59677637
29
Return the total number of path components.
def __len__(self): i = -1 # TODO(user):pytype: type checker doesn't treat self as iterable. for i, _ in enumerate(self): # pytype: disable=wrong-arg-types pass return i + 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def numPaths(self):\n if self.numpaths > -1:\n return self.numpaths\n\n if self.jolt == 0:\n return 1\n\n paths = 0\n for parent in self.parents:\n paths += parent.numPaths()\n \n return paths", "def path_cost(path):\n return len(path)",...
[ "0.77656317", "0.7394348", "0.73258525", "0.72298014", "0.7206658", "0.7119876", "0.7062054", "0.7033186", "0.69190115", "0.6909168", "0.6908391", "0.68450224", "0.6813539", "0.6813539", "0.67647135", "0.67526245", "0.6737925", "0.67112666", "0.6666637", "0.66539496", "0.6653...
0.0
-1
Only iterate over all components from the current pointer.
def __iter__(self): element = self while element.HasField("pathtype"): yield element if element.HasField("nested_path"): element = element.nested_path else: break
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __iter__(self):\n for p in self.positions():\n yield p.element()", "def iterate(self):", "def iterate(self):\n raise NotImplementedError()", "def iter_components(self):\n return self.components.values()", "def __traverse_forward(self):\n work = copy(self.__compone...
[ "0.6270615", "0.6182444", "0.6109328", "0.60458565", "0.6037176", "0.601716", "0.5996668", "0.5888436", "0.586505", "0.5862997", "0.5862997", "0.5862997", "0.5862997", "0.58486027", "0.5843135", "0.5835315", "0.58177435", "0.5812949", "0.58017284", "0.5784526", "0.57607335", ...
0.0
-1
Insert a single component at index.
def Insert(self, index, rdfpathspec=None, **kwarg): if rdfpathspec is None: rdfpathspec = self.__class__(**kwarg) if index == 0: # Copy ourselves to a temp copy. nested_proto = self.__class__() nested_proto.SetRawData(self.GetRawData()) # Replace ourselves with the new object. ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insert(self, index, p_object): # real signature unknown; restored from __doc__\n pass", "def insert(self, item: T, index: int) -> None:\n pass", "def insert(self, index: int, item: Any) -> None:\n self.contents.insert(index, item)\n return", "def insert(self, index, item):\n ...
[ "0.75078076", "0.7310345", "0.7299112", "0.7242185", "0.724123", "0.71909964", "0.7151328", "0.7115667", "0.70852554", "0.7084879", "0.7059566", "0.7035718", "0.6994174", "0.695882", "0.6912395", "0.6813797", "0.6786568", "0.67380273", "0.6733274", "0.67274284", "0.6719816", ...
0.6344632
37
Append a new pathspec component to this pathspec.
def Append(self, component=None, **kwarg): if component is None: component = self.__class__(**kwarg) if self.HasField("pathtype"): self.last.nested_path = component else: for k, v in kwarg.items(): setattr(self, k, v) self.SetRawData(component.GetRawData()) return self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def path(self, new_path):\n if new_path == self.path:\n return\n\n self._path.append(new_path)", "def append(self, path):\n self.paths.append(path)\n self.time += path.time", "def extend_path(self, ext):\n ext = str(ext)\n self._path.append(e...
[ "0.6475366", "0.646892", "0.6289979", "0.620486", "0.614977", "0.603944", "0.5871561", "0.58572716", "0.581544", "0.58070743", "0.5806504", "0.58058983", "0.57017595", "0.5656207", "0.55844164", "0.55844164", "0.55248374", "0.5494463", "0.5440153", "0.54182255", "0.5415792", ...
0.6493598
0
Removes and returns the pathspec at the specified index.
def Pop(self, index=0): if index < 0: index += len(self) if index == 0: result = self.__class__() result.SetRawData(self.GetRawData()) self.SetRawData(self.nested_path.GetRawData()) else: # Get the raw protobufs for the previous member. previous = self[index - 1] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove(self, index):\n raise NotImplementedError()", "def remove(self, index):\n self.__validate_index(index)\n value = self.__list[index]\n self.__list = self.__list[:index] + self.__list[index + 1:]\n return value", "def removeChildAtIndex(self, index):\n self.__...
[ "0.6189841", "0.6019098", "0.5962646", "0.59440684", "0.58682954", "0.58682954", "0.58413357", "0.5764278", "0.57484084", "0.57312465", "0.5660876", "0.5655904", "0.5644953", "0.5636785", "0.55940664", "0.5589793", "0.55154896", "0.55135167", "0.5478066", "0.5414675", "0.5377...
0.5264401
32
Get a new copied object with only the directory path.
def Dirname(self): result = self.Copy() while 1: last_directory = posixpath.dirname(result.last.path) if last_directory != "/" or len(result) <= 1: result.last.path = last_directory # Make sure to clear the inode information. result.last.inode = None break re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copydir(self):\n pass", "def clone(self):\n joined_function = lambda: dot_joiner(self.path, self.path_type)\n return self.__class__(self.path, self.configuration, self.converters, self.ignore_converters, joined_function=joined_function)", "def deepcopy(self):\n return ModelFile(...
[ "0.6755348", "0.6664888", "0.6208972", "0.6114426", "0.60926545", "0.6081318", "0.60543275", "0.60534376", "0.605341", "0.6045518", "0.6033137", "0.60324025", "0.60239303", "0.5999266", "0.5997346", "0.59812343", "0.59212303", "0.5890578", "0.58496255", "0.58267903", "0.57969...
0.54735774
67
Returns the AFF4 URN this pathspec will be stored under.
def AFF4Path(self, client_urn): # If the first level is OS and the second level is TSK its probably a mount # point resolution. We map it into the tsk branch. For example if we get: # path: \\\\.\\Volume{1234}\\ # pathtype: OS # mount_point: /c:/ # nested_path { # path: /windows/ # ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def PathspecToURN(pathspec, client_urn):\n client_urn = rdfvalue.ClientURN(client_urn)\n\n if not isinstance(pathspec, rdfvalue.RDFValue):\n raise ValueError(\"Pathspec should be an rdfvalue.\")\n\n # If the first level is OS and the second level is TSK its probably a mount\n # point resolution. W...
[ "0.59959936", "0.57585794", "0.5757265", "0.55726695", "0.55363214", "0.5520384", "0.5514668", "0.54821783", "0.543625", "0.542376", "0.5363159", "0.5353192", "0.5350059", "0.5290205", "0.5246005", "0.52058023", "0.52011615", "0.5170195", "0.51669574", "0.5164558", "0.5114905...
0.680058
0
Returns a list of unique values in preserved order.
def _unique(iterable): return list(dict.fromkeys(iterable))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unique(x):\n\n return list(set(x))", "def create_unique_value_list(value):\n my_set = set(value)\n new_list = list(my_set)\n new_list.sort()\n return new_list", "def _unique(li):\n return list(set(li))", "def unique(seq):\n return list(set(seq))", "def distinct(x):\n return list...
[ "0.81129277", "0.7803977", "0.77864575", "0.76509386", "0.759385", "0.7525359", "0.738596", "0.7371861", "0.72834635", "0.7258286", "0.72512347", "0.71951", "0.7178567", "0.71587765", "0.7147433", "0.7127199", "0.7072416", "0.7035133", "0.7030887", "0.7026637", "0.70066077", ...
0.7027201
19
Interpolate inline globbing groups.
def InterpolateGrouping(self, pattern): components = [] offset = 0 for match in GROUPING_PATTERN.finditer(pattern): components.append([pattern[offset:match.start()]]) # Expand the attribute into the set of possibilities: alternatives = match.group(1).split(",") components.append(_un...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def glob_fmt(pattern: str, *templates: Strings) -> List[str]:\n results: List[str] = []\n for wildcards in glob_extract(pattern):\n for template in each_string(*templates):\n results.append(copy_annotations(template, template.format(**wildcards)))\n return results", "def to_globs(self,...
[ "0.599184", "0.54665947", "0.54016477", "0.5354282", "0.5243976", "0.5219615", "0.51785034", "0.5155968", "0.5107413", "0.508813", "0.5063504", "0.5054259", "0.5042185", "0.5013164", "0.49759755", "0.49616253", "0.49451718", "0.4893766", "0.4888701", "0.4883094", "0.48675454"...
0.60871595
0
Returns a list of GlobComponentExplanations with examples.
def ExplainComponents(self, example_count: int, knowledge_base) -> Sequence[GlobComponentExplanation]: parts = _COMPONENT_SPLIT_PATTERN.split(self._value) components = [] for glob_part in parts: if not glob_part: continue component = GlobComponentExplanation(glo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_examples():\n # Get the tjson test cases from a url.\n examples = urlopen(TJSON_EXAMPLES_URL).read()\n\n # Strip comments from the lines.\n examples = re.sub(r\"^#.*\\n?\", \"\", examples.decode(), flags=re.MULTILINE)\n\n # Split a group of examples.\n delimiter = re.escape(EXAMPLES_DELIM...
[ "0.67662424", "0.66115737", "0.6609532", "0.6507707", "0.64227337", "0.63136464", "0.62638426", "0.6231608", "0.6231608", "0.61889976", "0.61759686", "0.61759686", "0.6167018", "0.6167018", "0.6167018", "0.6167018", "0.6167018", "0.61635184", "0.6145044", "0.61187345", "0.610...
0.59416443
44
Return the current glob as a simple regex.
def AsRegEx(self): parts = _REGEX_SPLIT_PATTERN.split(self._value) result = u"".join(self._ReplaceRegExPart(p) for p in parts) return rdf_standard.RegularExpression(u"(?i)\\A%s\\Z" % result)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def glob_to_regex(glob):\n res = \"\"\n for c in glob:\n if c == \"*\":\n res = res + \".*\"\n elif c == \"?\":\n res = res + \".\"\n else:\n res = res + re.escape(c)\n\n # \\A anchors at start of string, \\Z at end of string\n return re.compile(r\"...
[ "0.7819873", "0.72080266", "0.6822879", "0.66485834", "0.6384914", "0.6339717", "0.62750065", "0.6249048", "0.6249048", "0.6242412", "0.6185183", "0.6185183", "0.6185183", "0.6179792", "0.6149692", "0.61212", "0.6117611", "0.6036472", "0.5980473", "0.5975669", "0.5962993", ...
0.553905
42
test if Amenity class is sub class of base model
def issub_class(self): insta = Amenity() self.assertIsInstance(insta, BaseModel) self.assertTrue(hasattr(insta, "id")) self.assertTrue(hasattr(insta, "created_at")) self.assertTrue(hasattr(insta, "update_at"))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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_inheritence(self):\n self.assertTrue(issubclass(City, BaseModel))", "def test_issubc...
[ "0.75792694", "0.7572123", "0.75709414", "0.7559691", "0.747605", "0.7447491", "0.7399368", "0.73784095", "0.71549785", "0.7098198", "0.70283", "0.69586825", "0.69361603", "0.6857281", "0.67388743", "0.6688497", "0.6679375", "0.6669053", "0.66688573", "0.661541", "0.65986925"...
0.74273753
6
test class atribute name
def test_name(self): insta = Amenity() self.assertTrue(hasattr(insta, "name")) self.assertEqual(insta.name, "")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_class_attribute():\n assert isinstance(ResRNNModel.model_name, str)\n assert ResRNNModel.model_name == 'res-RNN'\n assert ResRNNModel.file_name == 'model-{}.pt'", "def test_class_attribute() -> None:\n assert get_type_hints(lmp.tknzr._bpe.BPETknzr) == {'tknzr_name': ClassVar[str]}\n assert lm...
[ "0.7924091", "0.75563633", "0.7213349", "0.71174747", "0.7017771", "0.70100814", "0.6988274", "0.69407445", "0.6888654", "0.68633884", "0.68516046", "0.68323183", "0.68240035", "0.6818084", "0.6769874", "0.6769414", "0.6749988", "0.67472196", "0.6722595", "0.6707448", "0.6702...
0.6934547
8
test to dict method with Amenity and the type and content
def test_to_dictAmenity(self): insta = Amenity() dict_cont = insta.to_dict() self.assertEqual(type(dict_cont), dict) for attr in insta.__dict__: self.assertTrue(attr in dict_cont) self.assertTrue("__class__" in dict_cont)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_cases_for_dict(self):\n pass", "def check_for_dict(check):", "def test_dict_value(self):\n time_format = \"%Y-%m-%dT%H:%M:%S.%f\"\n insta = Amenity()\n dict_con = insta.to_dict()\n self.assertEqual(dict_con[\"__class__\"], \"Amenity\")\n self.assertEqual(t...
[ "0.6309913", "0.6100255", "0.6017125", "0.6013033", "0.5861453", "0.5851398", "0.5751937", "0.57155645", "0.5704528", "0.5674443", "0.5489831", "0.5489222", "0.5486378", "0.5459682", "0.54389507", "0.5426274", "0.54253966", "0.53917867", "0.5372596", "0.53631514", "0.5353716"...
0.6718173
0
test the returned dictionar values
def test_dict_value(self): time_format = "%Y-%m-%dT%H:%M:%S.%f" insta = Amenity() dict_con = insta.to_dict() self.assertEqual(dict_con["__class__"], "Amenity") self.assertEqual(type(dict_con["created_at"]), str) self.assertEqual(type(dict_con["updated_at"]), str) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_cases_for_dict(self):\n pass", "def check_for_dict(check):", "def test_process_dict_true(self):\n\n self.assertIn('userA@domain', self.temp_set)", "def test_dictionary(self):\n self.assertIsInstance(self.test1json, dict)", "def verifyData(self, expectedDict):\n pass...
[ "0.74668956", "0.7450075", "0.6863169", "0.6735632", "0.67031837", "0.6703166", "0.66925013", "0.6565914", "0.65388805", "0.652238", "0.6490509", "0.64760536", "0.6463532", "0.6456877", "0.64442", "0.63880223", "0.6380842", "0.63722336", "0.6369014", "0.6357909", "0.63466287"...
0.59049875
74
Return train and validation data loaders.
def get_dataloaders(args): if args.dataset == 'heat': dataset_class = heat.HeatDiffusionDataset else: raise ValueError(f'Unknown dataset {args.dataset}') train_dataset = dataset_class( dataset_class.get_train_path(args.data_path), args, train=True) if args.dist: train_sam...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_loaders(train_dataset, val_dataset, test_dataset, batch_size=128):\n train_loader = DataLoader(train_dataset, batch_size=batch_size, num_workers=8,\n shuffle=True)\n\n val_loader = DataLoader(val_dataset, batch_size=batch_size, num_workers=8,\n ...
[ "0.8474643", "0.82500017", "0.8021656", "0.782781", "0.78098774", "0.7785202", "0.7696616", "0.7657214", "0.7638478", "0.75306267", "0.74784565", "0.7437562", "0.7394582", "0.73904926", "0.73904926", "0.73904926", "0.73904926", "0.73904926", "0.73904926", "0.73904926", "0.739...
0.6936148
41
Raise a redirect to the specified address.
def redirect(url, status=None): raise cherrypy.HTTPRedirect(url, status)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def redirect(self, url):\n raise RequestRedirect(url)", "def redirect_to(self, route_name, *args, **kwargs):\n self.redirect(self.uri_for(route_name, *args, **kwargs))", "def redirect(to):\r\n def _redirect(environ, start_response):\r\n args, kwargs = environ['wsgiorg.routing_args']\r\n...
[ "0.7055044", "0.69233304", "0.6758245", "0.67327744", "0.667426", "0.65812844", "0.65740865", "0.65307385", "0.65087855", "0.6501073", "0.6361474", "0.6333412", "0.6293397", "0.6284932", "0.6229903", "0.6223891", "0.61812615", "0.6154505", "0.61359704", "0.61100864", "0.61063...
0.6671453
5
Redirect to the url specified by the "next" parameter, if there is one.
def gonext(): next = cherrypy.request.params.get('next', '') if next != '': redirect(next)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def redirect_to_next(self, request):\n\n if 'next' in request.GET:\n next_page = request.GET['next']\n return HttpResponseRedirect(next_page)\n else:\n return redirect('index')", "def _redirect_to_next_page(request):\n url = request.META.get('HTTP_REFERER')\n ...
[ "0.8222811", "0.78880954", "0.75367934", "0.7156515", "0.70321", "0.6950136", "0.69477516", "0.6894561", "0.6818121", "0.6761079", "0.67516637", "0.6492569", "0.64452034", "0.63842064", "0.6364943", "0.61773765", "0.6078935", "0.60003644", "0.5989069", "0.5945314", "0.5938319...
0.7268388
3
Get the url for a given route.
def url(*args, **kwargs): if len(args) == 0 and len(kwargs) == 0: return cherrypy.url() # First read the old args newkwargs = dict( (k, v[3:]) for (k, v) in kwargs.iteritems() if v is not None and k.startswith('old') ) # Apply neither new nor old args for (k, v) in kwargs...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_url(route_name, param=''):\n return '{0}:{1}{2}{3}'.format(\n settings.API['default']['URL'],\n settings.API['default']['PORT'],\n settings.API['default']['ROUTES'][route_name],\n param\n )", "def Url(route, params):\n out = route\n if params:\n # sorting ensures a ...
[ "0.7913678", "0.69358045", "0.6798209", "0.6777154", "0.6249917", "0.62475556", "0.623232", "0.61924344", "0.61772007", "0.6139563", "0.6139563", "0.61302626", "0.6092997", "0.59641576", "0.59227276", "0.5903716", "0.58616525", "0.5853365", "0.5853365", "0.5844931", "0.582162...
0.0
-1
Encode a set of arguments as query parameters.
def queryparams(*args, **kwargs): args = dict(args) args.update(kwargs) return urllib.urlencode(args)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_args(self, args):\n result_str = \"?\"\n for k, v in args.iteritems():\n result_str = result_str + k + \"=\" + v + \"&\"\n return result_str", "def smart_encode(**kwargs):\r\n args = dict(kwargs)\r\n for k, v in args.items():\r\n if v is None:\r\n ...
[ "0.6972559", "0.6377523", "0.6284413", "0.6278043", "0.62177527", "0.6181711", "0.614788", "0.61409354", "0.6094306", "0.608261", "0.6052283", "0.60401416", "0.5980932", "0.59808296", "0.59500444", "0.5933375", "0.59105206", "0.58789176", "0.5873813", "0.5861324", "0.5835321"...
0.75121254
0
Decorator to ensure that the mutex is locked while calling a method. The method's object must have a mutex in a property named "mutex".
def locked(fn): def locked_method(self, *args, **kwargs): self.mutex.acquire() try: return fn(self, *args, **kwargs) finally: self.mutex.release() return locked_method
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def synchronized(func):\n @wraps(func)\n def decorator(*args, **kwargs):\n if not args or not isinstance(args[0], SynchronizedMixin):\n raise ValueError(\"method {} if not part of a Synchronized service\".format(func))\n with args[0].synchronized_mutex:\n return func(*args...
[ "0.747396", "0.7078683", "0.64988536", "0.6423598", "0.6181043", "0.60996515", "0.6053192", "0.60422516", "0.5907164", "0.59065586", "0.5890942", "0.5792372", "0.57086945", "0.57063276", "0.56977254", "0.5688321", "0.5678738", "0.566474", "0.5618551", "0.55935305", "0.557902"...
0.7262485
1
Convert a value, as found in cherrypy parameters, into a list.
def listify(val): if isinstance(val, basestring): return [val] if hasattr(val, '__iter__'): return list(val) return [val]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_python(self, value):\n # Return an empty list if no input was given.\n if not value:\n return []\n return value.split(',')", "def _as_list(value):\n if not isinstance(value, list):\n value = [value]\n return value", "def to_list(value):\n if hasattr(value,...
[ "0.73468643", "0.72042423", "0.7164559", "0.67624813", "0.67364633", "0.67269695", "0.669944", "0.66236186", "0.6555451", "0.6509249", "0.65055346", "0.6492622", "0.638558", "0.6368018", "0.6355396", "0.6350103", "0.6344648", "0.63303983", "0.6301572", "0.6272887", "0.6233129...
0.6515767
9
Return a copy of a dict with values which were strings converted to lists.
def listify_values(params): return dict((k, listify(v)) for (k, v) in params.iteritems())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def str_list(d):\n\td_new = {}\n\tfor key, value in d.items():\n\t\td_new[key] = str(value)\n\n\treturn d_new", "def convert_string_to_list(key, data, errors, context): # noqa\n value = data.get(key, None)\n\n if not value:\n return\n\n if not isinstance(value, basestring):\n return\n\n ...
[ "0.691402", "0.6698248", "0.65281874", "0.6407048", "0.635801", "0.6248653", "0.61880624", "0.61318296", "0.613117", "0.60210264", "0.60082567", "0.6005851", "0.5986658", "0.59833425", "0.59723705", "0.5963291", "0.5958453", "0.5953826", "0.59450114", "0.59250814", "0.5906473...
0.6398695
4
Get a query parameter, in a nice standardised way, with some special handling for old and new values. The query parameter is always returned as a single item, or None if not supplied. If supplied multiple times, one of the values is returned.
def getparam(name, default=None, stash=None, params=None): v = getparamlist(name, stash=stash, params=params) if len(v) > 0: return v[0] return default
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def query_string_get(request, name, default_value=_NOT_SET, validator=None):\n return _XXX_get(request.rel_url.query, name, default_value, validator)", "def get_param(self, key, default=None):\n\n return self._request.query_params[\n key] if key in self._request.query_params else default", ...
[ "0.690922", "0.6714714", "0.6696767", "0.6631019", "0.6494573", "0.64930296", "0.64476246", "0.6412983", "0.64056945", "0.64056945", "0.6349496", "0.63351303", "0.61886054", "0.61374134", "0.6107755", "0.6104838", "0.608852", "0.60360116", "0.595634", "0.59525067", "0.5871174...
0.5900407
20
Get a query parameter, in a nice standardised way, with some special handling for old and new values. The query parameter is always returned as a single integer item, or None if not supplied. If supplied multiple times, one of the values is returned.
def getintparam(name, default=None, stash=None, params=None): v = getparamlist(name, stash=stash, params=params) if len(v) > 0: return int(v[0]) return default
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_GET_parameter(req, key, default_value):\n try:\n return req.GET[key]\n except:\n return default_value", "def url_query_parameter(url, parameter, default=None, keep_blank_values=0):\n\n queryparams = parse_qs(\n urlsplit(str(url))[3],\n keep_blank_values=keep_blank_val...
[ "0.668986", "0.6659504", "0.6653647", "0.6553931", "0.64510137", "0.6419032", "0.63740885", "0.63563275", "0.63563275", "0.634075", "0.6340651", "0.6309048", "0.62937635", "0.6267144", "0.62390244", "0.62061864", "0.6119184", "0.611786", "0.60315233", "0.59661025", "0.5923608...
0.59178174
21
Get a query parameter, in a nice standardised way, with some special handling for old and new values. Returns a list of values.
def getparamlist(name, default=[], stash=None, params=None): if params is None: params = cherrypy.request.params v = params.get("new" + name, None) if v is None: v = params.get(name, None) if v is None: v = params.get("old" + name, None) if v is None: return default ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def query_string_get(request, name, default_value=_NOT_SET, validator=None):\n return _XXX_get(request.rel_url.query, name, default_value, validator)", "def parameter_values(self) -> List[Tuple[str, Any]]:\n pvs = [(param, getattr(self, variable))\n for variable, param in self.variable_na...
[ "0.6428679", "0.6379838", "0.59497017", "0.59497017", "0.5818003", "0.58095396", "0.5796436", "0.5760281", "0.5742639", "0.571403", "0.56975055", "0.56840897", "0.5675714", "0.5658079", "0.56433046", "0.5640743", "0.5624405", "0.5623178", "0.5587443", "0.5578804", "0.5540696"...
0.5610344
18
Get the sequence of numbers stored in a parameter. The parameter should contain the numbers separated by commas. If invalid entries are found, raises an HTTP 400 error.
def getorderparam(name): for num in cherrypy.request.params.get(name, '').split(','): if num.strip() == '': continue try: yield int(num) except ValueError: raise cherrypy.HTTPError(400)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_get_batch_sequence():\n sequence_start = 30000\n sequence_range = 10000\n try:\n n = int(request.args.get(\"n\", 1))\n except (TypeError, ValueError):\n return abort(400)\n\n rv = {\n \"sequence_list\": [\n (i - 1) % sequence_range + sequence_start\n ...
[ "0.6341547", "0.6307575", "0.5780648", "0.5748245", "0.5721855", "0.5681584", "0.5597511", "0.553089", "0.553089", "0.553089", "0.553089", "0.553089", "0.5478601", "0.5462856", "0.541831", "0.53941196", "0.53821325", "0.5249708", "0.5219198", "0.5209926", "0.5100126", "0.50...
0.6358029
0
Return a json formatted value, and set appropriate headers.
def jsonresp(value): body = (json.dumps(value),) cherrypy.response.headers['Content-Type'] = 'application/json' return body
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __call__(self, value, system): \n request = system.get('request') \n if request is not None: \n if not hasattr(request, 'response_content_type'): \n request.response_content_type = 'application/json'\n ...
[ "0.713096", "0.70222473", "0.67486095", "0.64062446", "0.6394241", "0.63649434", "0.6267136", "0.6242035", "0.6197654", "0.6196405", "0.61923635", "0.6191736", "0.61716217", "0.6163177", "0.6101248", "0.6070215", "0.6017754", "0.60043836", "0.5997384", "0.5996148", "0.5965761...
0.69586533
2
adata.X is np.ones((2, 2)) adata.layers['double'] is sparse np.ones((2,2)) 2 to also test sparse matrices
def adata(): return AnnData( X=np.ones((2, 2)), obs=pd.DataFrame( {"obs1": [0, 1], "obs2": ["a", "b"]}, index=["cell1", "cell2"] ), var=pd.DataFrame( {"gene_symbols": ["genesymbol1", "genesymbol2"]}, index=["gene1", "gene2"] ), layers={"double"...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_adata_asarray():\n # test getting a dense matrix\n import scnym\n\n adata = anndata.AnnData(X=np.random.random((100, 100)))\n X = scnym.utils.get_adata_asarray(adata=adata)\n assert type(X) == np.ndarray\n\n # test getting a sparse matrix\n A = np.zeros((100, 100))\n ridx = np....
[ "0.6936926", "0.64935", "0.634528", "0.62285763", "0.62004536", "0.61969906", "0.61583483", "0.61358756", "0.60745305", "0.60254914", "0.6009813", "0.5979208", "0.59780586", "0.59643966", "0.5954079", "0.5932605", "0.5905637", "0.5800646", "0.5795402", "0.57953465", "0.579067...
0.585312
17
Gene symbols column allows repeats, but we can't unambiguously get data for these values.
def test_repeated_gene_symbols(): gene_symbols = [f"symbol_{i}" for i in ["a", "b", "b", "c"]] var_names = pd.Index([f"id_{i}" for i in ["a", "b.1", "b.2", "c"]]) adata = sc.AnnData( np.arange(3 * 4).reshape((3, 4)), var=pd.DataFrame({"gene_symbols": gene_symbols}, index=var_names), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def geneSymbols(self, returnType=\"list\"):\n\t\treturn self._dataframe['GeneSymbol'].to_dict() if returnType==\"dict\" else self._dataframe['GeneSymbol'].tolist()", "def from_symbol_to_entrez_gene_id(row):\r\n\tgene_entry = annotation_client.get_entrez_gene_id_from_symbol(row['symb'])\r\n\t# import pdb; pdb.set...
[ "0.6339396", "0.63331264", "0.6135404", "0.6135404", "0.58969545", "0.57447666", "0.56597024", "0.55993855", "0.5430899", "0.5414765", "0.5396618", "0.5361858", "0.5330334", "0.52989095", "0.5290099", "0.52782935", "0.52259994", "0.5194064", "0.51827484", "0.5176041", "0.5164...
0.63278687
2
compares backed vs. memory
def test_backed_vs_memory(): from pathlib import Path # get location test h5ad file in datasets HERE = Path(sc.__file__).parent adata_file = HERE / "datasets/10x_pbmc68k_reduced.h5ad" adata_backed = sc.read(adata_file, backed='r') adata = sc.read_h5ad(adata_file) # use non-sequential list ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def point_to_same_memory(a, b):\n return a.data == b.data", "def test_inmemory(self):\n\n\t\tself.assertEqual(self.inmemory, self.tracker.inmemory)", "def test_by_ref_no_copy(self):\n self.init()\n # Test with something that really shouldn't be copied.\n ptr = get_memptr(self.ff64_1)\n ...
[ "0.68159366", "0.62367666", "0.6113018", "0.5872939", "0.5870131", "0.5845475", "0.58343357", "0.5777668", "0.57403", "0.5727625", "0.57104295", "0.56647545", "0.56384593", "0.5634684", "0.5609971", "0.5609111", "0.5606924", "0.5601757", "0.55781984", "0.55555457", "0.55273",...
0.62653196
1
uses a larger dataset to test column order and content
def test_column_content(): adata = pbmc68k_reduced() # test that columns content is correct for obs_df query = ['CST3', 'NKG7', 'GNLY', 'louvain', 'n_counts', 'n_genes'] df = sc.get.obs_df(adata, query) for col in query: assert col in df np.testing.assert_array_equal(query, df.colum...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_overall_report_columns():\n assert (len(overall_data['columns']) == 31)", "def test_metadata_filter_general(self):\n metadata = pd.DataFrame({'foo': {'haib18CEM5332_HMGTJCCXY_SL342402': 1}})\n table_factory = DataTableFactory(PACKET_DIR, metadata_tbl=metadata)\n tbl = table_facto...
[ "0.61706156", "0.6071806", "0.59842885", "0.59619904", "0.5905596", "0.59021425", "0.58017594", "0.5796593", "0.57806224", "0.5778132", "0.5770337", "0.57441795", "0.5682358", "0.56763804", "0.56584436", "0.56478804", "0.56360537", "0.56323856", "0.56250155", "0.56172955", "0...
0.65384835
0
Recursively merges dict2 into dict1
def merge_dicts(dict1, dict2, custom_merge_func=None): # type: (Any, Any, Optional[Callable[[str, Any, Any, Any], Any]]) -> Any if not isinstance(dict1, dict) or not isinstance(dict2, dict): return dict2 for k in dict2: if k in dict1: res = None if custom_merge_func: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _merge_dicts(d1, d2):\n for key, value in d2.items():\n if key in d1:\n if isinstance(d1[key], dict) and isinstance(value, dict):\n _merge_dicts(d1[key], value)\n continue\n d1[key] = value", "def _merge_dicts(dict1, dict2, path=None):\n if path is...
[ "0.7955589", "0.79223824", "0.7905807", "0.7891808", "0.78137326", "0.7750845", "0.7599099", "0.75727713", "0.75088084", "0.75088084", "0.74713856", "0.7467959", "0.7399142", "0.73555255", "0.7351608", "0.7299126", "0.7270481", "0.72687936", "0.7255596", "0.724556", "0.720741...
0.76131135
6
Remove a field from the pipeline state.
def run(self, data, config=None, pipeline=None): del data[self.field] return data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def item_remove_field(self, item, field_name):\n\t\treturn self._modify_object(item=item, field_name=field_name, new_value=None, new_field_name=None)", "def remove_field():\n _id = request.form['_id']\n data, code, message = FIELD_SERVICE.remove_field(_id)\n return __result(data, code, message)", "def...
[ "0.7641236", "0.74240726", "0.72662824", "0.68898654", "0.6730517", "0.6705638", "0.66148293", "0.65601236", "0.65354735", "0.6477312", "0.6446842", "0.639435", "0.6365292", "0.62395334", "0.6214176", "0.6161611", "0.61517704", "0.61517704", "0.59788895", "0.5977343", "0.5965...
0.5836593
25
Remove a field from the pipeline state.
def run(self, data, config=None, pipeline=None): data[self.dst] = self.copy_fn(data[self.src]) return data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def item_remove_field(self, item, field_name):\n\t\treturn self._modify_object(item=item, field_name=field_name, new_value=None, new_field_name=None)", "def remove_field():\n _id = request.form['_id']\n data, code, message = FIELD_SERVICE.remove_field(_id)\n return __result(data, code, message)", "def...
[ "0.76402575", "0.7423425", "0.72662175", "0.68894297", "0.6729156", "0.6704401", "0.66132325", "0.655891", "0.65354407", "0.64766407", "0.6445598", "0.6394855", "0.63650954", "0.6237978", "0.6215073", "0.61603", "0.6152025", "0.6152025", "0.5978602", "0.5975703", "0.59646636"...
0.0
-1
Set field in pipeline state.
def run(self, data, config=None, pipeline=None): value = self.value if self.reformat: value = value.format(**data) data[self.field] = value return data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _set_pipeline_cfg(self, field, value):", "def setfield(self, field, value):\n self.__setitem__(field, value)", "def setField(self, field):\n\n # Set the new property to container\n key = (field.getFieldID(), field.getTime())\n self.fields.set_value(key, field)", "def field(sel...
[ "0.79197884", "0.7204912", "0.6996757", "0.67684424", "0.6744169", "0.6541948", "0.6522253", "0.6444997", "0.6348423", "0.63215685", "0.63109994", "0.6223354", "0.62064826", "0.61713195", "0.61332214", "0.61329496", "0.6103687", "0.6096651", "0.60765576", "0.6069227", "0.6045...
0.0
-1
storage_client = storage.Client() bucket = storage_client.get_bucket(os.environ.get('CLOUD_STORAGE_BUCKET')) Create a new blob and upload the file's content to Cloud Storage. blob = bucket.blob("data/imgsrc/{0}{1}.png".format(callnum,query)) blob.upload_from_string( photo.read(), content_type=photo.content_type)
def imageUpload(query,callnum): source_file_name = "data/imgsrc/{0}-{1}.png".format(callnum,query) destination_blob_name = "{0}-{1}.png".format(callnum,query) storage_client = storage.Client() bucket = storage_client.get_bucket(os.environ.get('CLOUD_STORAGE_BUCKET')) blob = bucket.blob(destination_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upload_to_gcs():\n client = storage.Client(project=\"filmreccommendations\")\n bucket = client.get_bucket(\"filmreccommendations.appspot.com\")\n blob = bucket.blob(os.path.basename(PICKLE_FILENAME))\n blob.upload_from_filename(PICKLE_FILENAME)", "def upload_blob(bucket_name, src_file, dst_file_n...
[ "0.7131283", "0.7102576", "0.69331807", "0.68578637", "0.68509537", "0.6745912", "0.6713672", "0.66916", "0.667625", "0.66582566", "0.66516244", "0.66018075", "0.6550635", "0.6464661", "0.6358169", "0.6358007", "0.63572675", "0.634092", "0.63153684", "0.62662184", "0.6210849"...
0.83783364
0
Generate a name prefix to be shared by objects created during this pytest session
def session_scope_prefix(): return ''.join(choice(ascii_uppercase) for _ in range(6)) + '-'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fixture_make_unique_name():\n def _make_unique_name(prefix):\n return f\"{prefix}{time.time_ns()}\"\n return _make_unique_name", "def scope_name_generator():\n return 'mock_' + str(uuid()).lower()[:16]", "def generate_name(self):\n name = self._generate_test_name()\n while sel...
[ "0.76242954", "0.7157857", "0.7063094", "0.70535326", "0.70514536", "0.7022288", "0.69807166", "0.6834252", "0.6829982", "0.6826452", "0.6806904", "0.6785914", "0.6742246", "0.6742246", "0.6742246", "0.6742246", "0.6741043", "0.6677521", "0.66572565", "0.65437025", "0.6518768...
0.6066774
62
Generate a name prefix to be shared by objects created during this pytest module Relies on pytest's builtin fixture "request"
def module_scope_prefix(request, session_scope_prefix): return session_scope_prefix + _del_test_prefix(request.module.__name__.split('.')[-1]) + '-'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fixture_make_unique_name():\n def _make_unique_name(prefix):\n return f\"{prefix}{time.time_ns()}\"\n return _make_unique_name", "def scope_name_generator():\n return 'mock_' + str(uuid()).lower()[:16]", "def generate_name(prefix):\n suffix = generate_uuid()[:8]\n return '{0}_{1}'.for...
[ "0.7337404", "0.6756373", "0.6652459", "0.66451824", "0.6621452", "0.6550261", "0.64901406", "0.6282139", "0.6274779", "0.6230799", "0.61946106", "0.61905575", "0.6171659", "0.6167871", "0.61271787", "0.6125883", "0.61047953", "0.6096244", "0.60622215", "0.60521686", "0.60517...
0.602176
26
Detects if containerized rses for xrootd & ssh are available in the testing environment.
def containerized_rses(rucio_client): from rucio.common.exception import InvalidRSEExpression rses = [] try: xrd_rses = [x['rse'] for x in rucio_client.list_rses(rse_expression='test_container_xrd=True')] xrd_rses = [rucio_client.get_rse(rse) for rse in xrd_rses] xrd_containerized_r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def in_host():\n return not in_docker()", "def is_inside_im_container() -> bool:\n # TODO(*): Why not testing only STAGE?\n condition = (\n os.environ.get(\"STAGE\") == \"TEST\"\n and os.environ.get(\"POSTGRES_HOST\") == \"im_postgres_test\"\n ) or (\n os.environ.get(\"STAGE\") =...
[ "0.68628305", "0.6616888", "0.65769535", "0.632004", "0.6221577", "0.61605847", "0.61605847", "0.61605847", "0.61605847", "0.61605847", "0.61605847", "0.61605847", "0.61605847", "0.61605847", "0.61605847", "0.61605847", "0.61605847", "0.61605847", "0.61605847", "0.61605847", ...
0.0
-1
unittest classes can get access to rse_factory fixture via this fixture
def rse_factory_unittest(request, vo, class_scope_prefix): from .temp_factories import TemporaryRSEFactory with TemporaryRSEFactory(vo=vo, name_prefix=class_scope_prefix) as factory: request.cls.rse_factory = factory yield factory
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setUpFixture(self):\n pass", "def scene_fixture(scene_factory):\n return scene_factory('Test Scene')", "def setUp(self):\n self.factory = RequestFactory()", "def setUp(self):\n self.factory = RequestFactory()", "def setUp(self):\n self.factory = RequestFactory()", "def ...
[ "0.6923604", "0.67980206", "0.6489142", "0.6489142", "0.6489142", "0.6447893", "0.643282", "0.6371821", "0.62180984", "0.6211886", "0.61795783", "0.61584795", "0.61516243", "0.60849744", "0.6066643", "0.6048318", "0.60425305", "0.6014712", "0.6014712", "0.6014712", "0.6014712...
0.69328827
0
Create an inmemory temporary table using the sqlite memory driver. Make sqlalchemy aware of that table by registering it via a declarative base.
def __create_in_memory_db_table(name, *columns, **kwargs): import datetime from sqlalchemy import Column, DateTime, CheckConstraint from sqlalchemy.pool import StaticPool from sqlalchemy.schema import Table from sqlalchemy.orm import registry from rucio.db.sqla.models import ModelBase from r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize_sqlite_memory():\n global engine\n if engine is None:\n engine = create_engine(\"sqlite://\")\n Session.configure(bind=engine)\n _populate()", "def setupTempTables(self):\n cur = self.cursor()\n cur.execute(\"PRAGMA temp_store = MEMORY\")\n for table...
[ "0.72185934", "0.69393677", "0.685504", "0.6638255", "0.6633624", "0.6379129", "0.628769", "0.6187717", "0.6132853", "0.6114666", "0.610305", "0.6090174", "0.60765433", "0.6054707", "0.6054707", "0.6053742", "0.60411364", "0.59569556", "0.5951424", "0.59396255", "0.59396255",...
0.75651777
0
Fixture which overrides the Message table with a private instance
def message_mock(): from unittest import mock from sqlalchemy import Column from rucio.common.utils import generate_uuid from rucio.db.sqla.models import String, PrimaryKeyConstraint, CheckConstraint, Text, Index, GUID InMemoryMessage = __create_in_memory_db_table( 'message_' + generate_uui...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_messages(self):\n pass", "def test_mesage_model(self):\n msg = Message", "def test_message_user():", "def test_message_model(self):\n\n ### no need to take the time to salt & hash password for this test\n u = User(\n username = \"test_user\",\n ...
[ "0.6631871", "0.6597026", "0.6319358", "0.6175457", "0.6169595", "0.6108753", "0.6092316", "0.60744226", "0.6050315", "0.5969392", "0.59614664", "0.5951279", "0.5943328", "0.5928482", "0.59219825", "0.5907207", "0.58726096", "0.5858682", "0.58548224", "0.58273226", "0.5822660...
0.6537503
2
Fixture to allow having pertest core.config tables without affecting the other parallel tests. This override works only in tests which use core function calls directly, not in the ones working via the API, because the normal config table is not touched and the rucio instance answering API calls is not aware of this moc...
def core_config_mock(request): from unittest import mock from sqlalchemy import Column from rucio.common.utils import generate_uuid from rucio.db.sqla.models import String, PrimaryKeyConstraint from rucio.db.sqla.session import get_session # Get the fixture parameters table_content = [] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mock_config():\n from .. import config\n\n _old_fs = os.getenv('FREESURFER_HOME')\n if not _old_fs:\n os.environ['FREESURFER_HOME'] = mkdtemp()\n\n filename = Path(pkgrf('fmriprep', 'data/tests/config.toml'))\n settings = loads(filename.read_text())\n for sectionname, configs in settin...
[ "0.6748329", "0.6531168", "0.6353294", "0.62790483", "0.62598306", "0.6240023", "0.6174493", "0.611571", "0.60569674", "0.60124356", "0.58899754", "0.5880241", "0.58654696", "0.58421725", "0.58381003", "0.58184004", "0.57922375", "0.5792105", "0.57893586", "0.5770912", "0.576...
0.73936003
0
Fixture which allows to have an isolated inmemory configuration file instance which is not persisted after exiting the fixture. This override works only in tests which use config calls directly, not in the ones working via the API, as the server config is not changed.
def file_config_mock(request): from unittest import mock from rucio.common.config import Config, config_set, config_has_section, config_add_section # Get the fixture parameters overrides = [] params = __get_fixture_param(request) if params: overrides = params.get("overrides", overrides)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mock_config():\n from .. import config\n\n _old_fs = os.getenv('FREESURFER_HOME')\n if not _old_fs:\n os.environ['FREESURFER_HOME'] = mkdtemp()\n\n filename = Path(pkgrf('fmriprep', 'data/tests/config.toml'))\n settings = loads(filename.read_text())\n for sectionname, configs in settin...
[ "0.68572384", "0.68024707", "0.67448837", "0.6708275", "0.6573832", "0.6493411", "0.63244575", "0.629747", "0.6227993", "0.6181613", "0.6161833", "0.61605275", "0.6159928", "0.6133413", "0.6103953", "0.6089158", "0.6066062", "0.60482967", "0.60181063", "0.60088384", "0.600827...
0.63549834
6
Fixture which overrides the different internal caches with inmemory ones for the duration of a particular test. This override works only in tests which use core function calls directly, not in the ones working via API. The fixture acts by by mock.patch the REGION object in the provided list of modules to mock.
def caches_mock(request): from unittest import mock from contextlib import ExitStack from dogpile.cache import make_region caches_to_mock = [] expiration_time = 600 params = __get_fixture_param(request) if params: caches_to_mock = params.get("caches_to_mock", caches_to_mock) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_local_cache():", "def local_memory_cache():\n with mock.patch.dict(\n settings.CACHES['default'],\n {'BACKEND': 'django.core.cache.backends.locmem.LocMemCache'},\n ):\n cache_handler = django_cache.CacheHandler()\n\n with mock.patch.object(django_cache, 'caches', cache_...
[ "0.64528155", "0.6154406", "0.6103808", "0.5986139", "0.59815836", "0.58541846", "0.5849203", "0.5818465", "0.57292086", "0.57067186", "0.56926477", "0.567808", "0.56709236", "0.5647826", "0.5628556", "0.5624195", "0.5624187", "0.55843544", "0.5555388", "0.5532626", "0.553116...
0.69867086
0
Overrides the prometheus metric registry and allows to verify if the desired prometheus metrics were correctly recorded.
def metrics_mock(): from unittest import mock from prometheus_client import CollectorRegistry, values with mock.patch('rucio.core.monitor.REGISTRY', new=CollectorRegistry()) as registry, \ mock.patch('rucio.core.monitor.COUNTERS', new={}), \ mock.patch('rucio.core.monitor.GAUGES', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_metrics(self):", "def record_custom_metrics(self, metrics):\n\n if not self.__settings:\n return\n\n for name, value in metrics:\n self.record_custom_metric(name, value)", "def test_update_derived_metric(self):\n pass", "def test_metrics_server(self):\n ...
[ "0.6045466", "0.6006458", "0.5851544", "0.5780638", "0.5756661", "0.5754449", "0.5684377", "0.5680497", "0.5677893", "0.5641396", "0.5639397", "0.5572396", "0.5571547", "0.5559822", "0.5550975", "0.554539", "0.55038655", "0.54996085", "0.5468594", "0.5415941", "0.53738135", ...
0.59168774
2
Integration test by checking the output dirs and files exist
def test_main(): temp_dir = "./deepreg_download_temp_dir" branch = Repo(".").head.object.hexsha main(args=["--output_dir", temp_dir, "--branch", branch]) # Check downloading all req'd folders into temp, verify that they are the same as in main branch. config_dcmp = dircmp("./config", os.path.join...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_output_exists():\n global out_dir, cor_dir\n assert(path.exists(path.join(out_dir, 'oshea_similarity.json')))", "def test_ensure_dir_exists(self):\n pass", "def test_get_result_directory(self):\n pass", "def test_check():\n for f in cfg.required_files:\n assert os.path....
[ "0.73165417", "0.71948725", "0.7081094", "0.7067398", "0.7020966", "0.6896228", "0.685859", "0.6847483", "0.6823817", "0.6798246", "0.6794498", "0.67622465", "0.6714385", "0.66568327", "0.65717137", "0.65642935", "0.65592235", "0.65437466", "0.6536479", "0.65258956", "0.65237...
0.6665038
13
Generate the label for a given item.
def get(self, int_id): thing = Thing.query.filter_by( user_id=flask_login.current_user.id, id=int_id ).first() storage = Storage.query.filter_by(id=thing.storage_id).first() if thing: label = QRLabel( thing.name, thing.description, storage.name,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def item_to_label(cls, item: T) -> LabelItem:\n return LabelItem(id=str(item.id), label=str(item))", "def label(item):\n if isinstance(item, Path):\n if item.is_dir():\n return f\"{Fore.BLUE}{Style.BRIGHT}{item}{Style.RESET_ALL}\"\n return f\"{Style.BRIGHT}{Fore.BLUE}{item.pare...
[ "0.7733917", "0.7108425", "0.68233114", "0.67969096", "0.6662226", "0.64179754", "0.6354822", "0.6326706", "0.6326706", "0.6326706", "0.6326706", "0.63212246", "0.630497", "0.6293684", "0.6265442", "0.6243742", "0.6234701", "0.6234701", "0.6234701", "0.6230895", "0.62277603",...
0.0
-1
Busca un solo complemento que coincida con el RFC
def find_payment(): rfc = request.args["rfc"] message = "" try: payment = pay_service.get_pay({"Receptor.Rfc": rfc}) except Exception as e: message = str(e) payment = None if payment is None: resp = make_response( dumps( { ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_contract(data: bytes):\n res = parse_address(data[:22])\n if len(data) > 22:\n res += f'%{data[22:].decode()}'\n return res", "def iscc_clean(i):\n return i.split(\":\")[-1].strip().replace(\"-\", \"\")", "def complement(seq,transl=None):\n transl = string.maketrans('aAcCgGtTnNx...
[ "0.5691704", "0.5603316", "0.5541569", "0.5444464", "0.54082626", "0.5398046", "0.53598094", "0.53535193", "0.53332424", "0.53140426", "0.52462953", "0.5240732", "0.52214473", "0.51848245", "0.5149577", "0.5134787", "0.5129252", "0.51268387", "0.512105", "0.50935787", "0.5085...
0.0
-1
find_all_payments Busca todos los documentos que coincidan con los filtros
def find_all_payments(): parameters = request.args filters = {} for k, v in parameters.items(): if v == "null": filters[k] = None else: filters[k] = v app.logger.info(filters) payments = pay_service.get_pays(filters) if payments is None or len(payments) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all(self, filters: dict) -> list:\n try:\n payments = Payments.find_all(filters)\n app.logger.info(f\"Se encontraron {len(payments)} documentos\")\n return payments\n except Exception as e:\n app.logger.error(e)\n return None", "def ite...
[ "0.747767", "0.69256926", "0.6099898", "0.5905562", "0.56623566", "0.5582429", "0.5368629", "0.53534", "0.53469366", "0.5260422", "0.52502084", "0.52260137", "0.5209895", "0.5194638", "0.5091038", "0.50493324", "0.4981914", "0.49595767", "0.49559924", "0.49489108", "0.4929017...
0.6898174
2
Busca todos los documentos que coincidan con los filtros
def find_data_basics(): parameters = request.form.to_dict() filters = {} message = "" for k, v in parameters.items(): if v == "null": filters[k] = None else: filters[k] = v try: cfdis = pay_service.find_agg( [ { ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def obj_get_list(self, request=None, **kwargs):\n filter_object = self.get_filter_object(request)\n list = self.get_collection(request).find(filter_object)\n order_field, direction = self.get_order_field_and_direction(request)\n \n if (order_field is not None):\n list....
[ "0.6191308", "0.6157475", "0.59879297", "0.58720756", "0.5816405", "0.5805711", "0.5760924", "0.57328343", "0.5683741", "0.5597259", "0.5569342", "0.55591613", "0.555731", "0.5525252", "0.55042595", "0.54758686", "0.5473788", "0.5444095", "0.5441181", "0.5433393", "0.5409853"...
0.0
-1
data_count Hace un conteo de los documentos que coincidan con los filtros
def data_count(): parameters = request.form.to_dict() if not "totalCol" in parameters: parameters["totalCol"] = "datos.Total" if not "subTotalCol" in parameters: parameters["subTotalCol"] = "datos.SubTotal" try: cfdis = pay_service.find_agg( [ { ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getDataCount(self, filter: t.Mapping[t.Text, t.Any] = {}\n ) -> DatasetCount:\n aggregate_data = self.getAggregateData(\n pipeline={\"count\": {\"$sum\": 1}},\n filter=filter,\n )\n count = first(aggregate_data.data)[\"count\"]\n return DatasetCount(count=co...
[ "0.71717334", "0.70791835", "0.6767281", "0.6670788", "0.66377616", "0.66350293", "0.66176456", "0.6526347", "0.6518975", "0.6479084", "0.64778477", "0.63996136", "0.6354738", "0.63347274", "0.6311516", "0.6240148", "0.62296534", "0.6180926", "0.61687416", "0.61567885", "0.61...
0.69807214
2