query
stringlengths
9
9.05k
document
stringlengths
10
222k
metadata
dict
negatives
listlengths
30
30
negative_scores
listlengths
30
30
document_score
stringlengths
4
10
document_rank
stringclasses
2 values
Set as target currently selected login on login list
def selected_login_event(self, event): cursor = self.logins_list.get(self.logins_list.curselection()) target = cursor.split(':')[0] status = cursor.split(':')[1][1:] if target == None: return self.Target.config(text=target) self.client.target = target ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def switchToLogin(self):\n self.username.setText(\"\")\n self.password.setText(\"\")\n self.lastView = None\n self.currentView = 0\n self.stacked.setCurrentIndex(0)\n self.show()", "def login(self, login):\n\n self._login = login", "def _setstaff_login(self):\r\...
[ "0.6249682", "0.611241", "0.60492665", "0.59257644", "0.5898063", "0.58395225", "0.5781492", "0.572091", "0.5709027", "0.5698393", "0.569639", "0.5675576", "0.56696826", "0.5641832", "0.56213915", "0.5619973", "0.5607311", "0.56019825", "0.5600737", "0.55805004", "0.5575723",...
0.7160275
0
Thread parser, yielding items populated with thread details
def parse_thread(self, response): item = DataakForumItem() # xpath selectors thread = '//span[@class="active"]/text()' navpath = '//div[@class="navigation"]/a/text()' posts = '//div[@class="post "]' # author_not_admin = '//div[@class="author_information"]//a/text()' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_thread(self):", "def get_threads(subforum_soup):\n threads = subforum_soup.findAll('a', attrs={'id':lambda x:x and x.startswith('thread_title')}) #pulls out the thread links\n\n #page _ of _\n page = 1\n page_count = subforum_soup.find('td', attrs={'class':'vbmenu_control'})\n if page...
[ "0.58861786", "0.55657154", "0.5539562", "0.5480844", "0.541937", "0.5359861", "0.53432167", "0.53350884", "0.5288622", "0.5271926", "0.52689695", "0.5246764", "0.52366966", "0.52285147", "0.52147704", "0.52132064", "0.5210715", "0.51756674", "0.5155512", "0.51327235", "0.511...
0.6050263
0
Forum parser, yielding items populated with forum names
def parse_forum(self, response): item = ForumItem() item['forum'] = response.xpath('//span[@class="active"]/text()').extract_first() yield item
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_thread(self, response):\n item = DataakForumItem()\n\n # xpath selectors\n thread = '//span[@class=\"active\"]/text()'\n navpath = '//div[@class=\"navigation\"]/a/text()'\n posts = '//div[@class=\"post \"]'\n # author_not_admin = '//div[@class=\"author_informatio...
[ "0.71872187", "0.63297033", "0.62052065", "0.6028845", "0.5970876", "0.5775043", "0.5596723", "0.55596906", "0.5426935", "0.5399257", "0.53686744", "0.5265473", "0.5253417", "0.52366894", "0.51989734", "0.5187849", "0.5074167", "0.5050157", "0.50387317", "0.49944046", "0.4964...
0.7352012
0
header line associated with MAF block (first position of list)
def block_header(self): return self._current_block[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def header(self):\n ...", "def header(self) -> NoReturn:\n self.set_x(self.t_margin + self.b_margin)\n self.ln(self.line_height)", "def __make_header__(self):\n header = lashead.Header(point_format=0)\n return header", "def section_header(text):\n\n print \"---- %s ----\...
[ "0.6755511", "0.63866097", "0.6302058", "0.62535906", "0.62517387", "0.62265146", "0.62243164", "0.61960685", "0.61885786", "0.61462426", "0.613061", "0.61277497", "0.61277497", "0.6099594", "0.6066107", "0.6057303", "0.60342145", "0.60192156", "0.60112727", "0.6006213", "0.5...
0.64879733
1
A generator that splits a full chromosome MAF file into subfiles. Each time a file is completed the generator yields the name of the completed file.
def split_file(self): # process lines into blocks with Parser until EOF triggers StopIteration while self.maf_lines: try: # rest counters and open new file at the top of the loop AFTER # the most recent yield if self._stop: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mbatGen(file_obj, mbatsize):\n for _, lines in enumerate(itertools.islice(file_obj, mbatsize)): \n #TODO(Akshay): Add filtering condition here, if any.\n yield lines", "def split_fasta(infile, seqs_per_file, outfile_prefix, working_dir=''):\r\n if seqs_per_file <= 0:\r\n raise Valu...
[ "0.60271287", "0.58416164", "0.5833081", "0.5790323", "0.5722602", "0.569153", "0.56704223", "0.56582576", "0.565721", "0.5654158", "0.562368", "0.5616169", "0.5610848", "0.56098634", "0.55184925", "0.55172205", "0.5510026", "0.5495891", "0.54387915", "0.54282844", "0.5399085...
0.647833
0
return True if the Splitter should stop and create a new file; always False if no char_limit
def _stop(self): if self.char_limit is not None: return self.char_count > self.char_limit else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_truncation(self):\n\n temp_pos = self._handle.tell()\n self._handle.seek(-28, 2)\n eof = self._handle.read()\n self._handle.seek(temp_pos)\n if eof == _bgzf_eof:\n return False\n else:\n warnings.BytesWarning('No EOF character found. File m...
[ "0.60422593", "0.58545196", "0.55908334", "0.5479781", "0.54545206", "0.5429927", "0.542197", "0.53861135", "0.5348217", "0.53061837", "0.5257799", "0.5238273", "0.52270555", "0.51750046", "0.51486933", "0.5139923", "0.51225036", "0.51225036", "0.5110876", "0.5105658", "0.509...
0.6584869
0
Iterate through 'call_limit' MAF files with the splitter and analyze with phastcons
def send_jobs(self, call_limit=None): for f in self.splitter.split_file(): # if using a call limit, break once call limit is reached if (call_limit is not None) and (self.fnum > call_limit): break self.maf = f self._jobfile() # print se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_arem(in_files, out_peaks, max_fdr):\n in_treat, in_control = in_files[0]\n matches = re.search(r'(.*\\.treat)(.*)\\.mapped_reads', in_treat).groups()\n name = matches[0] + matches[1] + '.arem.peaks'\n cmd = 'arem -t %s -c %s --name=%s %s' % (in_treat, in_control, name,\n ...
[ "0.59097695", "0.57130927", "0.56844276", "0.56577593", "0.5633177", "0.5608301", "0.5600647", "0.5502245", "0.54992604", "0.54839313", "0.5466021", "0.5442815", "0.54148203", "0.53719056", "0.5355851", "0.5337445", "0.53222096", "0.53084624", "0.5303184", "0.52833384", "0.52...
0.6520813
0
returns rm command to delete MAF file after it has been used by phastCons
def cleanup_cmmd(self): return 'rm {}\n'.format(self.maf)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cleanUp(self, f):\n os.system('rm ' + f)", "def fake_sudo_rm(self, cmd):\n for filename in cmd[2:]:\n if os.path.exists(filename):\n os.remove(filename)", "def rm(cli):\n __check_in_autonotes_dir()\n\n # File args\n files = cli.config.rm.file\n\n # Remov...
[ "0.71679854", "0.6729233", "0.67085826", "0.6530478", "0.64783084", "0.64774156", "0.64272", "0.64220965", "0.6401939", "0.63940406", "0.6365888", "0.6314277", "0.61995727", "0.6196345", "0.6186721", "0.6138527", "0.6134482", "0.61244386", "0.6114564", "0.6044866", "0.6037266...
0.72506166
0
Computes the probability of finding an active transcription factor at a given range of ligand concentrations.
def p_act(c_range, k_a, k_i, ep_ai=5, n_sites=int(2)): if type(n_sites) is not int: raise TypeError('n_sites must be an integer.') numer = (1 + c_range / k_a)**n_sites denom = numer + np.exp(-ep_ai) * (1 + c_range / k_i)**n_sites return numer / denom
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_probability_for(fixation):\n probabilities = np.zeros(Number_of_locs) #MOD Number_of_locs deleted\n for possible_target_location in xrange(Number_of_locs): #MOD Number_of_locs deleted\n probabilities[possible_target_location] = integrate.quad(\n integral_function,\n ...
[ "0.578839", "0.5781874", "0.5769571", "0.5661054", "0.56165594", "0.55934966", "0.55533504", "0.5542344", "0.55398613", "0.55281544", "0.5497608", "0.54954404", "0.54951864", "0.54611725", "0.5446603", "0.5415126", "0.5392379", "0.5385614", "0.53782094", "0.53614104", "0.5341...
0.58372784
0
Computes the foldchange for a simple repression motif over a range of ligand concentrations.
def fc_repression(c_range, num_rep, k_a, k_i, ep_r, ep_ai=5, n_sites=int(2), n_ns=4.6E6): # Compute the MWC probability. mwc_term = p_act(c_range, k_a, k_i, n_sites=n_sites, ep_ai=ep_ai) # Compute and return the foldchange. repression = 1 + mwc_term * (num_rep / n_ns) * np.exp(-ep_r)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _large_range_correction(self, old_estimate):\n return -(1 << 32) * math.log(1 - (old_estimate / (1 << 32)))", "def _log_fold_change_pairs(self, idx0, idx1, base):\n logfc = np.zeros(shape=(len(idx0), len(idx1), self._theta_mle.shape[1]))\n for i, xi in enumerate(idx0):\n for j...
[ "0.5857831", "0.56895924", "0.56431454", "0.56082547", "0.5581456", "0.54859054", "0.53650284", "0.53091687", "0.5304077", "0.527651", "0.523607", "0.5227839", "0.51792836", "0.5168524", "0.51494545", "0.5106263", "0.5094823", "0.50880575", "0.50576776", "0.5037168", "0.49865...
0.6041696
0
>>> s = Solution() >>> s.goodDaysToRobBank([5,3,3,3,5,6,2], 2) [2, 3] >>> s.goodDaysToRobBank([1,1,1,1,1], 0) [0, 1, 2, 3, 4] >>> s.goodDaysToRobBank([1,2,3,4,5,6], 2) []
def goodDaysToRobBank(self, security: list[int], time: int) -> list[int]: decreasing_count_before_i = [] for i, n in enumerate(security): if i == 0: decreasing_count_before_i.append(0) else: if n <= security[i - 1]: decreasing_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def findRanks(toBeRanked, values):\n\treturn list(map(lambda e: findRank(e, values), toBeRanked))", "def bst_right_balance():\n from bbst import Bst\n return Bst([5, 8, 6, 9, 2, 7])", "def day2_data():\n test_data = []\n test_data.append([5, 1, 9, 5])\n test_data.append([7, 5, 3])\n test_data...
[ "0.55433816", "0.5128601", "0.5094142", "0.50570726", "0.5002229", "0.5002229", "0.5002229", "0.5002229", "0.5002229", "0.5002229", "0.5002229", "0.4991885", "0.4982164", "0.4953555", "0.48787373", "0.4858374", "0.48419097", "0.4826743", "0.48230216", "0.48056105", "0.4801332...
0.67538345
0
Gets the image tensor from the path
def get_image_tensor(img_path): img_tensor = path_to_tensor(img_path) / 255.0 return img_tensor
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_image_as_tensor(path: Path) -> tf.Tensor:\n img_data = tf.io.read_file(str(path))\n img_tensor = tf.io.decode_jpeg(img_data, channels=3)\n\n return img_tensor", "def path_to_tensor(img_path, dim):\n\n # Load RGB image\n img = image.load_img(img_path, target_size=(dim,dim))\n # Convert ...
[ "0.7548212", "0.74834365", "0.73381865", "0.7061357", "0.7038939", "0.701489", "0.69295824", "0.67972696", "0.67446417", "0.67446417", "0.66678107", "0.6606885", "0.65754026", "0.6573447", "0.65305334", "0.643628", "0.64324105", "0.64258087", "0.6414476", "0.6360211", "0.6355...
0.8271076
0
Issues a POST request to the UC annual website to retrieve all possible employee financial data.
def acquire_data(year: int) -> dict: base_url: str = "https://ucannualwage.ucop.edu" search_url: str = base_url + "/wage/search.action" # Request headers copied of out Chrome's devtools. request_headers = { "Host": re.sub('https://', '', base_url), "Content-Length": '255', "Orig...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dataset(request):\n from trytond.transaction import Transaction\n from trytond.tests.test_tryton import USER, CONTEXT, DB_NAME, POOL\n\n Party = POOL.get('party.party')\n Company = POOL.get('company.company')\n Country = POOL.get('country.country')\n Subdivision = POOL.get('country.subdivisio...
[ "0.57792485", "0.54393226", "0.5438739", "0.5402887", "0.534966", "0.53278506", "0.5327787", "0.51945466", "0.5179972", "0.5149336", "0.51491547", "0.51397854", "0.51358885", "0.5127249", "0.5085375", "0.50775725", "0.50627774", "0.50594234", "0.5047741", "0.50285554", "0.501...
0.6005374
0
Takes a Python object that holds every employee's salary data; extracts that into a CSV file.
def parse_salary_data_to_csv(data: dict): # These come from website's form. column_names = [ "id", "year", "location", "first name", "last name", "title", "gross pay", "regular pay", "overtime pay", "other pay" ] number_of_requests_to_search_over = data['records'] data_records: lis...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_employees_salary(self, employees_info: List[List[str]]) -> None:\n pass", "def generate_csv_output(payslip_data):\n payslip_output = StringIO(newline=None)\n csvFileWriter = csv.writer(payslip_output, delimiter=',')\n\n data = [['Full Name', 'Payment Period', 'Gross Income',\n ...
[ "0.6110135", "0.5721901", "0.56247103", "0.5470739", "0.54523957", "0.5402318", "0.5387349", "0.5354204", "0.5340569", "0.53081775", "0.5222946", "0.52161574", "0.5165061", "0.51539856", "0.51404184", "0.5131543", "0.5097248", "0.5090373", "0.5044837", "0.5016266", "0.5010205...
0.69983995
0
Exports selected rows in grid_data_out['rows']. Works in rowSelection or rangeSelection enabled.
def get_selected_rows(self): self._export_mode = 'rows' self._counter_update_data += 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_selected_rows(self):\n self._export_mode = 'delete'\n self._counter_update_data += 1", "def export(self,**kwargs):\n \n # import pdb;pdb.set_trace()\n \n # provide for case where recs are set extenally\n if not self.recs:\n self.select_recs(*...
[ "0.5814463", "0.5305055", "0.5239921", "0.5221338", "0.5161866", "0.5152546", "0.51030695", "0.5083933", "0.5071529", "0.50212586", "0.5013975", "0.49973035", "0.49512377", "0.4944411", "0.4929218", "0.49113068", "0.4886944", "0.48782787", "0.4876333", "0.48565313", "0.484034...
0.70378476
0
Exports selected columns in grid_data_out['columns']. Only works in rangeSelection enabled.
def get_selected_columns(self): self._export_mode = 'columns' self._counter_update_data += 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def export_to_csv(da_locals, selection_widget, out):\n df_name = selection_widget.value\n da_locals[df_name].to_csv(\"output/{}.csv\".format(df_name), index=False)\n out.clear_output()\n out.append_display_data(FileLinks(\"output\"))", "def output_columns(self) -> List[str]:", "def get_export_csv_c...
[ "0.6418224", "0.63222647", "0.60406005", "0.5980222", "0.58804923", "0.58022165", "0.574687", "0.5723135", "0.564667", "0.55667466", "0.5561893", "0.5499155", "0.549359", "0.5469247", "0.54481393", "0.54277176", "0.5393627", "0.5368741", "0.5366894", "0.53613985", "0.5361262"...
0.7363901
0
Exports whole grid in grid_data_out['grid'].
def get_grid(self): self._export_mode = 'grid' self._counter_update_data += 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def export_grid(self, vtk_fname='GRID', toVTK=True, toNumpy=True):\r\n print('Exporting grids')\r\n tID = 0\r\n # Start by exporting input properties (from read_prop() or read_ext_prop())\r\n # In VTK files, these props will only be visible at only the first timestep\r\n dp = []\...
[ "0.67669964", "0.643687", "0.6178726", "0.616679", "0.61331165", "0.6103156", "0.6066939", "0.6062741", "0.5989929", "0.5965376", "0.58768976", "0.580032", "0.57934624", "0.577638", "0.5772764", "0.5735569", "0.5720665", "0.568421", "0.56778306", "0.5647633", "0.56244725", ...
0.6646964
1
If build==True, returns a str containing HTML code for embedding as a standalone widget. If build==False, returns a dict containing 4 parts necessary to put several embed widgets in the same page.
def export_html(self, build=False): if build: html = export_html_code(self) return (html['script_tags'] + (html['html_state']).format(manager_state=json.dumps(html['manager_state'])) + html['grid_div']) return export_html_code(self)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render(self):\n content = self._render_pre_content('div')\n for widget in self._child_widgets:\n content += \"\\n\" + widget.render()\n content += self._render_post_content('div')\n content += \"\"\"<script>\n $(function(){\n ...
[ "0.5747042", "0.5426093", "0.53925323", "0.53382397", "0.5317704", "0.5224264", "0.5208884", "0.5170875", "0.5137135", "0.51103103", "0.5095983", "0.50568163", "0.5054981", "0.5054563", "0.50098556", "0.4979679", "0.4960313", "0.4940549", "0.49374953", "0.49297464", "0.492752...
0.57427734
1
Translates the center point, and keeps it in bounds.
def translate_center(self, dx, dy, dz): center = self.center center[0] -= dx center[1] -= dy center[2] -= dz center[0] = min(max(center[0], self.bounds[0]), self.bounds[1]) center[1] = min(max(center[1], self.bounds[0]), self.bounds[1]) center[2] = min(max(center[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def center(self):\n if self.pos != 0.0:\n self.pos = 0.0", "def translate(self, displacement):\n\n self.center = (self.center[0] + displacement[0],\n self.center[1] + displacement[1])", "def update_center(self): \r\n \r\n self.grfx[0].center = self.center\r\n\r\n ...
[ "0.71007794", "0.7073161", "0.70145607", "0.6979378", "0.6753653", "0.6747097", "0.66957575", "0.6648545", "0.66472554", "0.6637636", "0.660891", "0.6562517", "0.64696074", "0.6463932", "0.6463932", "0.6411822", "0.6394372", "0.6394372", "0.6394372", "0.63817835", "0.6370019"...
0.76299447
0
Use the mouse wheel to zoom.
def on_mouse_wheel(self, event): delta = event.delta[1] if delta > 0: # Zoom in factor = 0.9 elif delta < 0: # Zoom out factor = 1 / 0.9 for _ in range(int(abs(delta))): self.zoom(factor, event.pos)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_zooming_wheel(self):\n # Zooming: wheel\n self.set('Wheel', 'Zoom',\n param_getter=lambda p: (\n p[\"wheel\"]*.002, \n p[\"mouse_position\"][0],\n p[\"wheel\"]*.002, \n ...
[ "0.84443176", "0.7937277", "0.78334904", "0.77894384", "0.74605197", "0.7382998", "0.7369537", "0.73458064", "0.7263063", "0.7241332", "0.721578", "0.71982265", "0.7182637", "0.7154681", "0.7117357", "0.7109941", "0.71053416", "0.70348686", "0.7025429", "0.701461", "0.6977925...
0.8668343
0
Factors less than zero zoom in, and greater than zero zoom out. If mouse_coords is given, the point under the mouse stays stationary while zooming. mouse_coords should come from MouseEvent.pos.
def zoom(self, factor, mouse_coords=None): if mouse_coords is not None: # Record the position of the mouse x, y = float(mouse_coords[0]), float(mouse_coords[1]) x0, y0, z0 = self.pixel_to_coords(x, y) self.scale *= factor self.scale = max(min(self.scale, self.max_scale)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def callback_mouse_zoom(self, event):\n\n if self.variables.zoom_on_wheel:\n delta = event.delta\n single_delta = 120\n\n # handle case where platform is linux:\n if platform.system() == \"Linux\":\n delta = single_delta\n if event.nu...
[ "0.6173162", "0.5783437", "0.5664475", "0.55626905", "0.5560327", "0.5393201", "0.5381642", "0.5365337", "0.53392553", "0.52633005", "0.5250451", "0.5242291", "0.5166117", "0.5082881", "0.50540864", "0.50444806", "0.4985049", "0.49819043", "0.49564654", "0.4937829", "0.493707...
0.71623904
0
Generic callback for web requests receive a Deferred from the mapped function. This simply json encodes the response and passes it to the request
def deferred_response(response, request): request.write(simplejson.dumps(response)) request.finish()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def jsonResult(f):\n def _inner(self, request):\n d = maybeDeferred(f, self, request)\n d.addCallback(_writeJSONResponse, request)\n d.addErrback(_writeJSONErrorResponse, request)\n return NOT_DONE_YET\n return _inner", "def request_callback(request):\n headers = {'co...
[ "0.6835601", "0.64164114", "0.62959665", "0.62895465", "0.6273546", "0.6271747", "0.62673527", "0.6228324", "0.6218314", "0.6022155", "0.59871244", "0.5986469", "0.59107774", "0.5852411", "0.58145773", "0.5737035", "0.57284033", "0.5719401", "0.5699597", "0.5644658", "0.56393...
0.6709971
1
renders this resource. By default his returns a list of available interfaces. This should be used for things such as configuring clients.
def render(self, request): return simplejson.dumps(self.module._registered_interfaces.keys())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def interface(self):\n\n data = ['[Interface]']\n for item in INTERFACE_KEYS:\n value = getattr(self, item, None)\n if value:\n data.append(value)\n\n return '''\n'''.join(data)", "def interface(self, **kwargs):\n\n return self.api_request(self._ge...
[ "0.669263", "0.6505434", "0.63153064", "0.62008065", "0.6175075", "0.6163913", "0.6163913", "0.60404605", "0.60120076", "0.60120076", "0.60120076", "0.5910974", "0.5910974", "0.5809516", "0.57388264", "0.57246846", "0.5709058", "0.5708651", "0.56945944", "0.567488", "0.563987...
0.65413374
1
constructs a twisted service for Controllers to connect to
def get_controller_service(self, master): root = InterfaceResource(self) #setup services from twisted.internet.ssl import DefaultOpenSSLContextFactory try: key = '%s/ca-key.pem' % pydra_settings.RUNTIME_FILES_DIR cert = '%s/ca-cert.pem' % pydra_settings.R...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n self.config = get_config()\n self.log = get_logger(self)\n\n self.factory = SugarServerFactory(\"wss://*:5505\")\n self.factory.protocol = SugarServerProtocol\n\n self.console_factory = SugarConsoleServerFactory(\"wss://localhost:5507\")\n self.consol...
[ "0.6571904", "0.64633", "0.6196638", "0.6151193", "0.6000536", "0.59042215", "0.5902473", "0.5842252", "0.5804326", "0.5796099", "0.57555985", "0.5744625", "0.57371265", "0.5727141", "0.56836724", "0.56834257", "0.56805915", "0.56765467", "0.56684613", "0.5661595", "0.5650018...
0.66206247
0
Wraps all registered interfaces in an InterfaceResource. This allows all interfaces to conform to twisted.web2 API.
def wrap_interface(self, interface, **params): return FunctionResource(self, interface, params)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def register_resources(self):\n raise NotImplementedError", "def interface(self, **kwargs):\n\n return self.api_request(self._get_method_fullname(\"interface\"), kwargs)", "def interfaces(self):", "def interfaces(self):", "def _get_interfaces(self):\n return self.__interfaces", "def _get...
[ "0.6046428", "0.5889628", "0.5802768", "0.5802768", "0.5750699", "0.5750699", "0.5750699", "0.56934875", "0.5583384", "0.5552356", "0.545261", "0.54448354", "0.54429495", "0.54423016", "0.54400826", "0.5387046", "0.5379664", "0.5370704", "0.5367093", "0.5338333", "0.5335844",...
0.6628737
0
Render paths for operations, comparisons, and multiconditions
def test_path_comparator(renderer): rating = Document.data["Rating"] > 0.5 no_body = Document.data["Description"]["Body"].is_(None) stock = Document.data["Stock"].in_([1, 2, 3]) condition = (rating & no_body) | stock expected = { 'ConditionExpression': ( '(((#n0.#n1 > :v2) AND ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_paths(self):\r\n print(\"------------------------\")\r\n print(\"######### ALL PATHS #########\")\r\n\r\n if self.size == 0:\r\n print(\"Empty tree!\")\r\n else:\r\n for i in range(1, self.root.size_tree + 1):\r\n node = self.select(i)\r\n ...
[ "0.587495", "0.57889", "0.56957084", "0.5665316", "0.5621274", "0.5618509", "0.5589289", "0.54609245", "0.5458783", "0.5372383", "0.5368813", "0.53570604", "0.53273654", "0.53273654", "0.53273654", "0.5310065", "0.52882737", "0.52749777", "0.52570295", "0.5243752", "0.523105"...
0.581619
1
! Return a pair of GARC/GAFE pairs for a tile name \param tileName A string valid as a tile name \return (garcA,gafeA),(garcB,gafeB) or None if tileName isn't a valid tile name
def getTilePair(cls, tileName): return ( TILENAMEMAP[tileName]['A'], TILENAMEMAP[tileName]['B'] ) if\ tileName in TILENAMEMAP else None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getA(cls, tileName):\n return TILENAMEMAP[tileName]['A'] if tileName in TILENAMEMAP else None", "def getMatchup(self, name):\n if self.atHome:\n return (name, self.opponent)\n else:\n return (self.opponent, name)", "def bridges(species1_names, species2_names):\n ...
[ "0.5906764", "0.5495438", "0.5047626", "0.5033779", "0.492645", "0.49116278", "0.4895632", "0.4837358", "0.48061812", "0.4783528", "0.47784486", "0.47697797", "0.47350457", "0.47343346", "0.4715393", "0.46583953", "0.46310627", "0.46287656", "0.4628159", "0.4617784", "0.46046...
0.71674925
0
! Return the GARC/GAFE pair on side A for a tile name \param tileName A string valid as a tile name \return (garcA,gafeA) or None if tileName isn't a valid tile name
def getA(cls, tileName): return TILENAMEMAP[tileName]['A'] if tileName in TILENAMEMAP else None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getTilePair(cls, tileName):\n return ( TILENAMEMAP[tileName]['A'], TILENAMEMAP[tileName]['B'] ) if\\\n tileName in TILENAMEMAP else None", "def getMatchup(self, name):\n if self.atHome:\n return (name, self.opponent)\n else:\n return (self.opponent, na...
[ "0.71642846", "0.5385321", "0.52549493", "0.5067009", "0.5058756", "0.4986926", "0.4952591", "0.4868478", "0.475587", "0.47441566", "0.47377697", "0.47101924", "0.47093934", "0.46922797", "0.46634054", "0.4657869", "0.46430093", "0.4626833", "0.46260536", "0.46144578", "0.457...
0.7107519
1
! Return the GARC/GAFE pair on side B for a tile name \param tileName A string valid as a tile name \return (garcB,gafeB) or None if tileName isn't a valid tile name
def getB(cls, tileName): return TILENAMEMAP[tileName]['B'] if tileName in TILENAMEMAP else None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getTilePair(cls, tileName):\n return ( TILENAMEMAP[tileName]['A'], TILENAMEMAP[tileName]['B'] ) if\\\n tileName in TILENAMEMAP else None", "def getA(cls, tileName):\n return TILENAMEMAP[tileName]['A'] if tileName in TILENAMEMAP else None", "def m_get(state,b1,b2):\n if b2 == ...
[ "0.7218316", "0.58944786", "0.52915806", "0.51511645", "0.5137124", "0.5098144", "0.5010399", "0.49642134", "0.4842259", "0.4833628", "0.48233297", "0.48232582", "0.48086935", "0.47859505", "0.47837585", "0.47637662", "0.47624096", "0.4733318", "0.47020528", "0.46869817", "0....
0.6829084
1
! Return the canonical tile number for a tile name \param tileName A string valid as a tile name \return integer tile number or None if tileName isn't a valid tile name
def number(cls, tileName): return TILENAMEMAP[tileName]['Number'] if tileName in TILENAMEMAP else None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def findTile(self, tileImage):\n str = tileImage.tostring()\n if str in self.TileDict:\n return self.TileDict[str] + 1\n else:\n return 0", "def getTilePair(cls, tileName):\n return ( TILENAMEMAP[tileName]['A'], TILENAMEMAP[tileName]['B'] ) if\\\n t...
[ "0.61193204", "0.5630647", "0.56111467", "0.5555727", "0.54503417", "0.5445518", "0.5364563", "0.5335817", "0.5333355", "0.5324129", "0.53230995", "0.5309463", "0.5303459", "0.5206147", "0.5185187", "0.51694244", "0.51635987", "0.51442856", "0.5140779", "0.5137861", "0.510792...
0.7870066
0
! Return a sorted list of tile names
def getTileNames(cls): return sorted(TILENAMEMAP.keys())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tile_data_sorted(self) -> List[TileData]:\n return sorted(\n self._tiles.values(),\n key=lambda x: x.octree_chunk.location.level_index,\n reverse=True,\n )", "def sort_name(sprite):\n return sprite.name", "def sorted_gnames():\n return sorted(gro...
[ "0.68089956", "0.64828146", "0.63991916", "0.6382159", "0.6380592", "0.63060194", "0.62003714", "0.616663", "0.6013075", "0.59970295", "0.5937122", "0.5923884", "0.5878749", "0.58711106", "0.585727", "0.5845981", "0.5824051", "0.5812356", "0.57984525", "0.5756947", "0.5756292...
0.86915565
0
transforms date in human format to date used in sql query
def sql_date(date): return "to_date('{}', 'dd.mm.yyyy')".format(date)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transform_date(date):\n if type(date) == str:\n return date\n\n formatted_string = date.strftime(\"%d/%m/%Y\")\n\n return formatted_string", "def convert_date(date):\n\n if len(date) > 10: date = date[:date.rfind(\"-\")]\n return convf(date)", "def convert_date(raw_dat...
[ "0.7220046", "0.7032278", "0.6782775", "0.6732669", "0.6480039", "0.64462054", "0.6420159", "0.6401254", "0.6381813", "0.63493663", "0.6343099", "0.63151354", "0.6298463", "0.6281442", "0.62560976", "0.6254294", "0.6253558", "0.61913806", "0.61866134", "0.61836547", "0.616362...
0.73328876
0
Listener when user create invite in a guild
async def on_invite_create(self, invite): await add_invite_in_db(invite) logger.info(f'{invite.guild}: user {invite.inviter} create invite')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def invite(self, ctx):\n await ctx.send(f'🐱You can invite me to your server using the following url:\\n{self.invite_url}'\n '\\n\\nYou will need the **Manage Server** permission to add me to a server. '\n f'Run `{self.heleus.command_prefix[0]}help` to see w...
[ "0.7003141", "0.6786849", "0.6755741", "0.66672224", "0.659637", "0.65516216", "0.65509593", "0.6550935", "0.652335", "0.6459283", "0.644018", "0.64129496", "0.6411395", "0.64018804", "0.6391156", "0.63838065", "0.62951034", "0.6294505", "0.6286033", "0.628171", "0.6219996", ...
0.7565148
0
Test parseLineCSV with good data (all fields present)
def test_parseLine1(mocker): # given: setup test framework worker = Worker() testString = "12Nov2019,Teacher,Brighter Futures,12000" expectedResult = { 'date': '2019-11-12', 'job_title': 'Teacher', 'company_name': 'Brighter Futures', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_parseLine2(mocker):\n \n # given: setup test framework\n worker = Worker()\n testString = \"11/11/19,Brighter Futures,12000\"\n \n # when:\n result = worker.parseLineCSV(testString)\n \n # then: (Using PyTruth assertions)\n AssertThat(result).IsNone()", "def test_multiple_l...
[ "0.78631055", "0.75031304", "0.7422704", "0.73800725", "0.7375032", "0.7319514", "0.7308899", "0.7113874", "0.7112114", "0.7110554", "0.71081805", "0.7057524", "0.6904167", "0.6871032", "0.6755092", "0.65902114", "0.65860367", "0.65798193", "0.6544577", "0.65245825", "0.65041...
0.77302605
1
Test parseLineCSV with bad data (some fields missing)
def test_parseLine2(mocker): # given: setup test framework worker = Worker() testString = "11/11/19,Brighter Futures,12000" # when: result = worker.parseLineCSV(testString) # then: (Using PyTruth assertions) AssertThat(result).IsNone()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_parse_invalid_file(self):\n with pytest.raises(ParserError):\n self.parser.parse(\"invalid csv\")", "def csv_parser_test():\n data = csv_parser(myspreadsheet)\n print 'Your data object:'\n pp = pprint.PrettyPrinter(indent=4)\n pp.pprint(data) \n # Did your parser wo...
[ "0.744", "0.7357617", "0.73319453", "0.7304873", "0.7091926", "0.70851797", "0.7049803", "0.70358664", "0.69938964", "0.694792", "0.6922245", "0.68506056", "0.6797974", "0.6778899", "0.67742884", "0.67630935", "0.6757114", "0.67115325", "0.668969", "0.6673625", "0.66619074", ...
0.76332486
0
Takes a current board and a grid of scores. Find all of the empty squares with the maximum score and randomly return one of them as a (row, column) tuple. It is an error to call this function with a board that has no empty squares (there's no possible next move), so your function may do whatever it wants in that case. ...
def get_best_move(board, scores): empty_squares = board.get_empty_squares() max_score = -float("inf") max_list = [] if len(board.get_empty_squares()) == 0: print "No Empty Tiles Left!" else: for row in range(board.get_dim()): for col in range(board.get_dim()): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_best_move(board, scores):\n all_scores = {}\n for row_num in range(board.get_dim()):\n for col_num in range(board.get_dim()):\n if board.square(row_num, col_num) == provided.EMPTY:\n all_scores [(row_num, col_num)] = scores[row_num][col_num]\n max_score = max(all_s...
[ "0.7876179", "0.77359706", "0.77333856", "0.76157695", "0.754121", "0.7529987", "0.7299099", "0.72018903", "0.68783015", "0.68334043", "0.6773583", "0.67494977", "0.67163146", "0.6645171", "0.66307026", "0.66291565", "0.6628532", "0.6612501", "0.6598513", "0.6596278", "0.6557...
0.8180115
0
Return the total utilization for ALL TASKS, INCLUDING MIGRATORY
def util(self): total = 0.0 for task in self._slices: total += task.util() return self._nonmigutil + total
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def totaltasks(conn):\n c = conn.cursor()\n r = c.execute(\"SELECT count(id) as total_tasks FROM event WHERE type_id = \" + taskid(\"run_task\")).fetchall()\n return r[0]['total_tasks']", "def report_total_usage(self):\n work_time = 0\n if self.type == 'normal':\n work_time = se...
[ "0.62125945", "0.61996835", "0.61156285", "0.592562", "0.59167385", "0.58263236", "0.57747537", "0.5767992", "0.5742559", "0.573287", "0.5701323", "0.56973714", "0.5653184", "0.56467575", "0.560962", "0.5592798", "0.5591778", "0.55893356", "0.558803", "0.5564105", "0.55607414...
0.652446
0
Return a list with all slices
def slices(self): return self._slices
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def img_to_slices(img):\n res = []\n\n for i, slice_img in enumerate(img):\n res.append(slice_img)\n return res", "def _slice(self, start, stop, step=None):\n\n slices = [slice(None)] * self.data.ndim\n slices[self.axis] = slice(start, stop, step)\n return tuple(slices)", "...
[ "0.7073947", "0.6884096", "0.6862915", "0.6702075", "0.6666773", "0.66185397", "0.66151047", "0.66034317", "0.653593", "0.6535644", "0.64788175", "0.6473772", "0.6450125", "0.64454293", "0.6411023", "0.64006263", "0.63614595", "0.63422865", "0.6328264", "0.6324742", "0.632016...
0.7627962
0
Return a list with all tasks and slices
def tasks(self): return self._tasks + self._slices
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def list_tasks():", "def get_task_list(self):\n raise NotImplementedError()", "def tasks():", "def get_tasks(self):\n return self.stn.get_tasks()", "def get_tasks_list(self):\n return self.task_controller.get_list()", "def normalTasks(self):\n return self._tasks", "def...
[ "0.7359236", "0.71100533", "0.69691336", "0.6961912", "0.6829681", "0.6800806", "0.678541", "0.6761252", "0.6731112", "0.67283285", "0.66204923", "0.6614988", "0.6608938", "0.66082376", "0.660442", "0.658818", "0.6573101", "0.6568259", "0.6560644", "0.6559535", "0.65567577", ...
0.8244439
0
Apply schedulability test. Assumes that only migratory tasks can have restricted deadlines (due to parameter modification).
def _schedTest(self): if not self._hasSlices(): # There are no migratory tasks, so let's check utilization return self.util() <= 1.0 else: return self._qpa()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def checkUpstreamScheduler():", "def testJobTRSetRestrictTask(databases):\n gen = DataGenerator(databases)\n fwName = gen.createFramework('testfw1')\n taskName = gen.createTask('task1', fwName)\n tr1Name = gen.createTaskRunner(capabilities=[fwName])\n tr2Name = gen.createTaskRunner(capabilities=[f...
[ "0.60494995", "0.59117544", "0.58629143", "0.5710559", "0.5710446", "0.56452847", "0.5637244", "0.5563337", "0.5528159", "0.54618025", "0.5455458", "0.54490566", "0.54092175", "0.5387321", "0.53783834", "0.5360575", "0.534527", "0.5332817", "0.5274864", "0.52744997", "0.52741...
0.6594417
0
Return the free execution time for a migratory task in this partition
def _calcExecTime(self, migTask, dPrime): #print "ae", self # Let's start making U = 0.9999 (which probably causes deadline misses). # If we force U = 1, we won't be able to use La. if self.util() >= 0.9999: self._lastCost = 0.0 return 0.0 cPrime = (0.9999...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def estimated_time(self):\n self._update()\n if not self.running_mode:\n return 0 if self._is_finished() else float(\"nan\")\n elif self.running_mode == \"local\":\n start = self.processes[0].create_time()\n elif self.running_mode == \"grid\":\n start = ...
[ "0.6263205", "0.60351074", "0.59931386", "0.5978507", "0.5912567", "0.5891301", "0.58882743", "0.5881097", "0.5842023", "0.5826707", "0.5752384", "0.5737175", "0.57205445", "0.5720036", "0.5698623", "0.5698623", "0.5694059", "0.5669578", "0.5656949", "0.5654609", "0.56376934"...
0.6479419
0
Eliminate values using the naked twins strategy.
def naked_twins(values): # Find all instances of naked twins # Eliminate the naked twins as possibilities for their peers
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def purge_outlying_trials(self, trial_nums, thresh=5.0):\n for injkey in self.values.keys():\n for fit_key in self.values[injkey].keys():\n points = np.array(self.values[injkey][\n fit_key]['metric_val']['vals'])\n if len(points.shape) == 1:\n ...
[ "0.6560856", "0.63050807", "0.6227025", "0.61716145", "0.6147236", "0.61047584", "0.61028165", "0.6063567", "0.60429865", "0.59686977", "0.59654444", "0.5957118", "0.5945127", "0.5822696", "0.5820852", "0.58206373", "0.58202213", "0.58170843", "0.5815434", "0.58153576", "0.58...
0.67530364
0
VarianceCovariance calculation of daily ValueatRisk using confidence level 'c', with mean of returns 'mu' and standard deviation of returns 'sigma', on a portfolio of value 'P'.
def var_cov_var(P, c, mu, sigma): alpha = norm.ppf(1-c, mu, sigma) return P - P * (alpha + 1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def var_cov_var_normal(P, c, mu=0, sigma=1):\n\n alpha = sp.sp.stats.norm.ppf(1 - c, mu, sigma)\n return P - P * (alpha + 1)", "def compute_measurement_covariance(jacobian, oldCovariance, sigmaObservation): \n\n return None", "def compute_initial_covariance(jacobian, sigmaObservation):\n\n retur...
[ "0.6847843", "0.6526581", "0.6272541", "0.6260589", "0.62504464", "0.61954904", "0.61854136", "0.61352956", "0.61109257", "0.6048535", "0.60057604", "0.5979164", "0.59760386", "0.59689605", "0.5947482", "0.5946931", "0.59439176", "0.5938865", "0.5895788", "0.58956015", "0.589...
0.7584912
0
Given klgetcomponents command When Running `run` command on it with jsontooutputs flag and no prefix argument Then Ensure the json_to_outputs command is failing due to no prefix argument provided.
def test_json_to_outputs_flag_fail_no_prefix( mocker, monkeypatch, set_environment_variables ): logger_info = mocker.patch.object(logging.getLogger("demisto-sdk"), "info") monkeypatch.setenv("COLUMNS", "1000") # mocks to allow the command to run locally mocker.patch.object(Runner, "_get_playground_i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def output_from_json(self, output: Dict[str, Any]) -> OutputInfo:", "def test_output_invalid(self):\n assert (\n self.route.output_invalid(hug_core.output_format.json).route[\"output_invalid\"]\n == hug_core.output_format.json\n )", "def xcresulttool_json(*args):\n args = l...
[ "0.55570996", "0.54450536", "0.54315525", "0.54315525", "0.542043", "0.5378358", "0.5360909", "0.53541315", "0.5313696", "0.5289341", "0.52827024", "0.5255093", "0.5228024", "0.5222124", "0.5177748", "0.51397806", "0.51249546", "0.5121813", "0.51027524", "0.5102597", "0.50788...
0.6202639
0
Given klgetcomponents command and incidentid argument. When Running `run` command on it. Then Ensure the investigationid is set from the incidentid.
def test_incident_id_passed_to_run(mocker, monkeypatch, set_environment_variables): logger_debug = mocker.patch.object(logging.getLogger("demisto-sdk"), "debug") logger_warning = mocker.patch.object(logging.getLogger("demisto-sdk"), "warning") logger_error = mocker.patch.object(logging.getLogger("demisto-sd...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_installments_id_get(self):\n pass", "def test_id_is_set_without_original_id(mocker):\n runner = CliRunner()\n result = runner.invoke(main, ['id', 'abcd'])\n assert result.exit_code != 0", "def main():\n demisto.info('Command being called is ' + demisto.command())\n\n \"\"\"\n ...
[ "0.530482", "0.5264318", "0.49025062", "0.48202714", "0.4806076", "0.4735691", "0.4722407", "0.47197405", "0.47131798", "0.46948573", "0.46831575", "0.4672817", "0.46602222", "0.46404818", "0.4632036", "0.4598876", "0.4589877", "0.4585696", "0.4569471", "0.45632952", "0.45611...
0.6833365
0
Appends File info to input arrays
def appendFileInfo(File, params, extractedValues, names): for p in params: extractedValues[p].append(getValue(File, p)) names.append(getName(File))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def associate_files(self):\n # Open starinfo file and define structured array\n starinfo_file = self.starinfo_file\n nstar = sum(1 for line in open(starinfo_file))\n infoname = ['obj', 'std', 'caldir', 'altname']\n infofmt = ['|S25', '|S25', '|S25', '|S25']\n starinfo = np...
[ "0.6511712", "0.6023056", "0.59897375", "0.58889556", "0.5849256", "0.5835569", "0.58307076", "0.5823733", "0.5703966", "0.5639739", "0.5636581", "0.5610219", "0.5601616", "0.55730885", "0.55701035", "0.55312705", "0.5526952", "0.5526862", "0.55259305", "0.5499703", "0.549698...
0.6418849
1
Appends File info to input arrays, for cycles mode
def appendFileInfoCycles(File, params, extractedValues, names, cyclesColumn): for cycle in getCycleRange(File): for p in params: extractedValues[p].append(getValue(File, p, cycle)) names.append('{}_cycle{}'.format(getName(File), makeCycleSortable(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def associate_files(self):\n # Open starinfo file and define structured array\n starinfo_file = self.starinfo_file\n nstar = sum(1 for line in open(starinfo_file))\n infoname = ['obj', 'std', 'caldir', 'altname']\n infofmt = ['|S25', '|S25', '|S25', '|S25']\n starinfo = np...
[ "0.62886095", "0.59401524", "0.5788338", "0.57699704", "0.57441694", "0.5552395", "0.55344814", "0.5515049", "0.549071", "0.5488106", "0.54504967", "0.5429675", "0.5382784", "0.53214943", "0.5320739", "0.52730936", "0.52273995", "0.52198684", "0.52138954", "0.52115697", "0.51...
0.6070096
1
Verify that /products/ page renders topics.
def test_product_landing(self, flag_is_active): flag_is_active.return_value = True # Create a product p = product(save=True) # Create some topics topics = [] for i in range(11): topics.append(topic(save=True)) # Create a document and assign the prod...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_topics_for_products(self):\n desktop_topics = topics_for(product=self.desktop)\n eq_(len(desktop_topics), 3)\n\n mobile_topics = topics_for(product=self.mobile)\n eq_(len(mobile_topics), 2)", "def test_topic_list_view_unauthenticated(self):\n response = self.client.get...
[ "0.73147404", "0.68919265", "0.67828816", "0.673037", "0.6644931", "0.6602935", "0.658075", "0.65539205", "0.6488625", "0.6419945", "0.63692284", "0.62638444", "0.6259497", "0.6241161", "0.6187955", "0.61411256", "0.6132648", "0.6115197", "0.61077875", "0.61029375", "0.609717...
0.7508032
0
Return time as a string
def timestr(): return dt.strftime(dt.now(),'%H:%M:%S')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_time() -> str:\n return strftime(\"%H:%M:%S\")", "def get_time() -> str:\r\n return time.strftime(TIMEFORMAT)", "def _time_str(self):\n try:\n if not self._time:\n raise ValueError\n format_ = '%a, %d %b %Y %H:%M:%S'\n return datetime.fromtim...
[ "0.8559975", "0.8342602", "0.8303421", "0.8176281", "0.80305576", "0.7968672", "0.79652303", "0.79423606", "0.79199684", "0.79052913", "0.7892776", "0.7873904", "0.7864454", "0.785743", "0.7819786", "0.7692401", "0.76851183", "0.76786953", "0.7673926", "0.760527", "0.7554719"...
0.83846116
1
Create or replace file indicated by filename, as a yaml serialization of dict d.
def save_file(filename,d): f = open(filename, 'w') yaml.dump(d, f) f.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_file(filename,d):\n if os.path.exists(filename):\n f_old = open(filename,'r')\n d_old = yaml.load(f_old)\n f_old.close()\n d_old.update(d)\n d = d_old\n f = open(filename, 'w')\n yaml.dump(d, f)\n f.close()", "def save(self, filename):\n with open(...
[ "0.79054904", "0.7014788", "0.6703491", "0.66639715", "0.6618562", "0.65786463", "0.6543921", "0.6513153", "0.64326257", "0.6422186", "0.64148986", "0.63806546", "0.636776", "0.62917686", "0.6282388", "0.62787414", "0.62067103", "0.61989194", "0.61850554", "0.6184453", "0.618...
0.7766528
1
Check key validity. Keys may contain upper case letters, lower case letters, numbers, dashes (), and underscores (_) and period (.) marks. Any whitespace or any character in the string.punctuation library (other than , _, or .) results in an invalid key.
def is_key_valid(self,key): if not key or any(map(lambda s: s in key,space_chars))\ or any(map(lambda s: s in key,bad_chars)): return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _is_valid_key(self, key):\r\n\r\n # Check the length\r\n if len(key) > 250:\r\n return False\r\n\r\n # Check that there are no spaces or control characters\r\n for char in key:\r\n if ord(char) < 33 or ord(char) == 127:\r\n return False\r\n\r\n ...
[ "0.7808719", "0.7333275", "0.7270658", "0.69943017", "0.691718", "0.68068576", "0.6782772", "0.67734516", "0.6724122", "0.6623195", "0.6615757", "0.6496824", "0.6456321", "0.6442815", "0.64237046", "0.6417285", "0.6412873", "0.6395467", "0.638066", "0.6371316", "0.630625", ...
0.76165247
1
Provide a humanreadable error message for bad keys.
def key_error_message(self,key): if not key: return 'key is blank.' elif any(map(lambda s: s in key,space_chars)): return '"{}" contains whitespace.'.format(key) elif any(map(lambda s: s in key,bad_chars)): return '"{}" contains special characters.'.format(key...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _KeyMissing(side):\n return 'Key missing from %s' % side", "def format_error(invalid, doc_type):\n # using string for checking is probably not ideal,\n # but voluptuous does not have specific sub error\n # types for these errors\n if invalid.error_message == 'extra keys not allowed':\n ms...
[ "0.7176447", "0.65737236", "0.6520215", "0.6431213", "0.63895214", "0.6355162", "0.6349505", "0.6349505", "0.6349505", "0.62899137", "0.6279792", "0.6276709", "0.62599", "0.6225085", "0.6197143", "0.61797196", "0.61726445", "0.6146756", "0.6134861", "0.61106735", "0.6099486",...
0.79099184
0
Adds dictionary data to hdf5 group with same keys as dictionary. See data_to_h5 for how datatypes are handled.
def dict_to_h5(data, grp, **kwargs): for key in data: s_key = str(key) sub_data = data[key] data_to_h5(sub_data, grp, s_key, **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _save_h5_r(data_dict, h5obj, dlen):\n for key, val in data_dict.items():\n if isinstance(val, dict):\n h5group = h5obj[key] if key in h5obj.keys() else h5obj.create_group(key)\n _save_h5_r(val, h5group, dlen)\n else:\n if val.dtype == 'object':\n ...
[ "0.7259529", "0.67084503", "0.6640664", "0.66189474", "0.65644884", "0.65580463", "0.6532053", "0.63650477", "0.634904", "0.6265646", "0.61399484", "0.6080792", "0.60668784", "0.60593045", "0.6021528", "0.5996762", "0.59759545", "0.59177995", "0.58672106", "0.5858261", "0.583...
0.75657034
0
Function which takes a list of class attributes and stores them in a provided h5py group. See data_to_h5 for how datatypes are handled.
def attributes_to_h5(obj, grp, lst_attr=None, priv=False, dpriv=False, **kwargs): if lst_attr is None: if dpriv: lst_attr = list(obj.__dict__.keys()) elif priv: lst_attr = [x for x in obj.__dict__.keys() if '__' not in x] else: lst_att...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_hdf5_attributes(dset, attributes):\n for key in attributes.iterkeys():\n dset.attrs[key] = attributes[key]\n\n return dset", "def h5_to_dict(grp, **kwargs):\n data = {}\n for key in grp.keys():\n try:\n e_key = eval(key, {})\n except:\n e_key = key\n...
[ "0.59058964", "0.5679107", "0.5664282", "0.5615434", "0.5584132", "0.5538772", "0.5410745", "0.53981966", "0.5395402", "0.5338279", "0.5302236", "0.5268607", "0.51904416", "0.51860553", "0.5129682", "0.5127386", "0.50981534", "0.50860167", "0.5078723", "0.5053184", "0.5039512...
0.70967436
0
Converts h5py group to dictionary. See h5_to_data for how different datatypes are handled.
def h5_to_dict(grp, **kwargs): data = {} for key in grp.keys(): try: e_key = eval(key, {}) except: e_key = key data[e_key] = h5_to_data(grp[key], **kwargs) return data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_subtree(group: h5py.Group, refs: h5py.Group):\n d = {}\n for key in group:\n if key == \"#refs#\":\n continue\n value = group[key]\n if isinstance(value, h5py.Group):\n d[key] = convert_subtree(value, refs=refs)\n elif isinstance(value, h5py.Datas...
[ "0.65968794", "0.65202844", "0.64542043", "0.6409155", "0.62138003", "0.6023547", "0.5987318", "0.5958378", "0.59519386", "0.59472114", "0.58982855", "0.58897305", "0.5867148", "0.58339214", "0.5762532", "0.5750586", "0.5739597", "0.57342637", "0.5716493", "0.5699773", "0.562...
0.8002928
0
Tries to create list of evaluated items in data. If exception is thrown by eval, it just adds the element as is to the list.
def soft_list_eval(data): out = [] for x in data: try: out.append(eval(x, {})) except: try: out.append(x.decode()) except (AttributeError, SyntaxError): out.append(x) return out
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_literal_eval(data):\n if type(data) != type([]):\n try:\n return ast.literal_eval(data)\n except:\n return [data] if data is not np.nan else []\n\n return data", "def my_evalf(expr, chop=False):\r\n if type(expr) == list:\r\n try:\r\n return ...
[ "0.5927537", "0.56138974", "0.5492731", "0.5462819", "0.54572475", "0.54434615", "0.5393195", "0.531069", "0.5254724", "0.5226049", "0.5118209", "0.50996184", "0.50991887", "0.50744665", "0.50701755", "0.50688696", "0.5019691", "0.500871", "0.5003541", "0.49978063", "0.496033...
0.71692944
0
Function k_means applies kmeans clustering alrorithm on dataset and prints the crosstab of cluster and actual labels and clustering performance parameters.
def k_means(n_clust, data_frame, true_labels): k_means = KMeans(n_clusters=n_clust, random_state=123, n_init=30) k_means.fit(data_frame) c_labels = k_means.labels_ df = pd.DataFrame({'clust_label': c_labels, 'orig_label': true_labels.tolist()}) ct = pd.crosstab(df['clust_label'], df['orig_label']) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def kmeans_clustering(self,k):\r\n \r\n print(colored(\"Performing K-means clustering with %d clusters\\n\"%k,color = 'yellow', attrs=['bold']))\r\n kmeans = KMeans(n_clusters=k, random_state=0, n_init=10, max_iter=100, n_jobs=-1, ).fit(self.X)\r\n self.labels = kmeans.labels_\r\n ...
[ "0.7423728", "0.687318", "0.6822117", "0.6821187", "0.65778583", "0.6511952", "0.6426332", "0.64061534", "0.63889825", "0.6368608", "0.6357942", "0.6357617", "0.6327497", "0.6320824", "0.62938166", "0.6260522", "0.6256508", "0.6255686", "0.6255126", "0.6225553", "0.61986464",...
0.7953019
0
Displays the list of options.
def display_options(self): print() options = list(self.get_commands().values()) options.sort(key=lambda op: int(op.name)) for option in options: print(f'{"%3d" % int(option.name)}. {option.description}')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display(self):\n\n print('\\n')\n for key, val in self.option.items():\n print(key, val, '\\n') # make it more confortable to read\n self.get_choice() # launch automaticly the choice method after display", "def show_menu():\r\n print(\"Write a number of the next options:\...
[ "0.7148875", "0.7040174", "0.69901764", "0.6922297", "0.68601656", "0.66925323", "0.6622868", "0.6622868", "0.6617802", "0.6555089", "0.6488466", "0.6478217", "0.6464231", "0.64514065", "0.6409447", "0.6362477", "0.63184685", "0.6313654", "0.6292926", "0.6234333", "0.62332445...
0.7489189
0
Vary a (sub)query represented by the given operator node
def vary_query(operator_node, num_columns, tables_to_colums): # Adapt predicates of this Operator Node if operator_node.original_predicates_list is not None and len(operator_node.original_predicates_list) > 0: valid_ids = tables_to_colums[operator_node.table_id] new_predicates = [] # For...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mutate_single_node(self, node, operator):\n if node.__class__ is operator[0] or (operator[1] is StatementDeletion and node.__class__ is ast.Pass):\n mutated_node = operator[1].mutate(node)\n node = mutated_node\n\n return node", "def mutate_bySingleOperator(self, root, ope...
[ "0.611861", "0.6039169", "0.5810166", "0.57214564", "0.5701275", "0.56353176", "0.5629461", "0.557142", "0.55459064", "0.5535041", "0.54918355", "0.5490138", "0.54886895", "0.5476805", "0.54562044", "0.5445115", "0.5409686", "0.53946817", "0.5333961", "0.53089803", "0.5297665...
0.62107515
0
Save indices of train and test queries into a json file
def save_train_test_split(base_path, experiment_name, train_queries, test_queries): filename_prefix = path.join(base_path, "data", experiment_name) train_indices = list(set(query[2] for query in train_queries)) test_indices = list(set(query[2] for query in test_queries)) with open(filename_prefix + "....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_target_data(term_to_index, output_prefix):\n index_to_term = dict((i,t) for t,i in term_to_index.iteritems())\n names = sorted(index_to_term.iteritems(), key=itemgetter(0))\n names = [n[1] for n in names]\n target_data = {}\n target_data['y'] = {}\n target_data['y']['names'] = names\n ...
[ "0.6417914", "0.62603885", "0.6204297", "0.6181379", "0.61736476", "0.5953024", "0.5868456", "0.5851617", "0.5841516", "0.57562774", "0.5734983", "0.57247096", "0.5689729", "0.5672398", "0.5640475", "0.563358", "0.5581112", "0.55707127", "0.55586636", "0.55359846", "0.5528968...
0.77021956
0
Subclass the save method, to hash ndarray subclass, rather than pickling them. Off course, this is a total abuse of the Pickler class.
def save(self, obj): if isinstance(obj, self.np.ndarray): # Compute a hash of the object: try: self._hash.update(self.np.getbuffer(obj)) except TypeError: # Cater for non-single-segment arrays: this creates a # copy, and thus al...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _save(self, data: np.ndarray) -> None:\n ...", "def save(self, obj):\r\n if self.np is not None and type(obj) in (self.np.ndarray,\r\n self.np.matrix, self.np.memmap):\r\n size = obj.size * obj.itemsize\r\n if self.compress and si...
[ "0.73430663", "0.7268807", "0.72580737", "0.6872324", "0.67022103", "0.63646066", "0.6179825", "0.60192174", "0.60099596", "0.6003321", "0.5994046", "0.5980241", "0.5976691", "0.5966399", "0.59421", "0.5908745", "0.587527", "0.58730143", "0.5858162", "0.585457", "0.58540595",...
0.76393694
0
This routine must be implemented by subclasses. Returns an array of binaries that need to be symbolized.
def _binaries_to_symbolize(self): raise NotImplementedError()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetSymbolBinaries(self, minidump):\n libraries = self._ExtractLibraryNamesFromDump(minidump)\n symbol_binary_dir = self._GetSymbolBinaryDirectory(minidump, libraries)\n if not symbol_binary_dir:\n return []\n\n return [os.path.join(symbol_binary_dir, lib) for lib in libraries]", "def get_pas...
[ "0.61693114", "0.61270034", "0.5790367", "0.57455647", "0.56719047", "0.56250364", "0.5542743", "0.536507", "0.53464913", "0.53261465", "0.5300343", "0.52819985", "0.5180829", "0.5157225", "0.5139798", "0.5120473", "0.5091495", "0.5066631", "0.5062331", "0.5053902", "0.504442...
0.75760055
0
Generator yielding the flight index, assigned bay and flight object of departing flights.
def departing_flights(self): for i in range(self.flights.n_flights): if self.flights.departing(i): yield i, self.bay[i], self.flights.flight_schedule[i]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_return_flights(self):\n flights = []\n for date in self.return_dates:\n for src in self.src_airports:\n for dst in self.dst_airports:\n flights.append( Flight(dst, src, date) )\n\n return flights", "def __iter__(self):\n\n return i...
[ "0.6066153", "0.60416305", "0.5919573", "0.5495734", "0.5476187", "0.54701424", "0.53442407", "0.5342146", "0.5320868", "0.53155226", "0.5294439", "0.5286481", "0.528069", "0.5221552", "0.51874614", "0.5186745", "0.5112128", "0.5110774", "0.5096295", "0.50627136", "0.50627136...
0.79937047
0
Checks whether a certain flight gate combination is feasible.
def is_feasible(self, i, l): # Get the bay assigned to the flight k = self.bay[i] if self.flights.domestic(i, departing=True): # If it's a domestic flight, then only the domestic gates are feasible. Also check if the bay gate # combination is feasible. return ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid_trip(self):\n if self.pickupcoords is None or self.dropoffcoords is None:\n return False\n valid = lambda x, y: 41 < x < 43.5 and -72.5 < y < - 70.5\n return valid(self.pickupcoords[0], self.pickupcoords[1]) and valid(self.dropoffcoords[0], self.dropoffcoords[1])", "def ...
[ "0.6605091", "0.6594661", "0.6543195", "0.63051647", "0.6281908", "0.62644327", "0.6178001", "0.6077229", "0.6027049", "0.60206586", "0.59558594", "0.5950025", "0.5949242", "0.59165204", "0.5897148", "0.58894616", "0.5884269", "0.5869693", "0.5857131", "0.5834676", "0.5802076...
0.71497816
0
This constraint makes sure that one gate is assigned to each departing flight.
def constraint_single_gate_per_flight(self): print(" - Constraint: Single gate per flight constraint.") c = "\\ Single gate per flight constraint.\n " # Loop through each flight. for i, k, flight in self.departing_flights(): # Start writing the constraint for this flight. ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _constraints_task_valid(self):\n def rule(model):\n \"\"\"\n Bind the tail entries to zero\n \"\"\"\n num = self.num_timeslots\n ind_j = model.tasks\n total = sum(model.A2[num-1, j] for j in ind_j)\n total += sum(model.A3[num-1...
[ "0.58306277", "0.5543608", "0.51670986", "0.51483375", "0.514472", "0.504169", "0.5010115", "0.5004392", "0.50034606", "0.49957335", "0.49898705", "0.49694562", "0.4947864", "0.49331027", "0.49331027", "0.4885146", "0.48799786", "0.4871206", "0.48651466", "0.4862099", "0.4854...
0.69282305
0
Gets the _5qi of this RequestedQos.
def _5qi(self): return self.__5qi
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _5qi(self, _5qi):\n if _5qi is None:\n raise ValueError(\"Invalid value for `_5qi`, must not be `None`\") # noqa: E501\n\n self.__5qi = _5qi", "def __init__(self, _5qi=None, gbr_ul=None, gbr_dl=None): # noqa: E501\n self.swagger_types = {\n '_5qi': Model5Qi,\n ...
[ "0.6760163", "0.60865784", "0.5826613", "0.5826613", "0.5826613", "0.57201535", "0.5680535", "0.5635592", "0.5635423", "0.55357844", "0.53329676", "0.5326896", "0.52858484", "0.52672887", "0.52363986", "0.5208113", "0.52069074", "0.52045333", "0.5195297", "0.5194402", "0.5188...
0.8261977
0
Sets the _5qi of this RequestedQos.
def _5qi(self, _5qi): if _5qi is None: raise ValueError("Invalid value for `_5qi`, must not be `None`") # noqa: E501 self.__5qi = _5qi
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _5qi(self):\n return self.__5qi", "def __init__(self, _5qi=None, gbr_ul=None, gbr_dl=None): # noqa: E501\n self.swagger_types = {\n '_5qi': Model5Qi,\n 'gbr_ul': BitRate,\n 'gbr_dl': BitRate\n }\n\n self.attribute_map = {\n '_5qi': '5qi...
[ "0.7202126", "0.6528238", "0.5769253", "0.55811924", "0.5257013", "0.5193161", "0.51654893", "0.5160565", "0.51235825", "0.51198363", "0.5082881", "0.5069115", "0.5051344", "0.5051314", "0.50429034", "0.50429034", "0.50429034", "0.50429034", "0.50224656", "0.5010282", "0.4956...
0.81541806
0
Gets the gbr_ul of this RequestedQos.
def gbr_ul(self): return self._gbr_ul
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gbr_dl(self):\n return self._gbr_dl", "def getBL(self):\r\n return self.bL;", "def gbr_ul(self, gbr_ul):\n\n self._gbr_ul = gbr_ul", "def get_bribe(self):\r\n return self.bribe", "def _get_qos(self):\n return self.__qos", "def _get_qos(self):\n return self.__qos", ...
[ "0.6624793", "0.6183227", "0.5677202", "0.56101704", "0.55133814", "0.55133814", "0.55133814", "0.5454623", "0.5451101", "0.5410858", "0.54033214", "0.54033214", "0.54033214", "0.54033214", "0.54033214", "0.54033214", "0.54033214", "0.54033214", "0.54033214", "0.54033214", "0...
0.7476282
0
Sets the gbr_ul of this RequestedQos.
def gbr_ul(self, gbr_ul): self._gbr_ul = gbr_ul
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gbr_dl(self, gbr_dl):\n\n self._gbr_dl = gbr_dl", "def gbr_ul(self):\n return self._gbr_ul", "def set_unlock_comb(self, comb_no, ulg_comb):\n wreq_ulg = bytearray([0x00]*8)\n wreq_ulg[0] = comb_no\n wreq_ulg[6:8] = struct.pack('<H', len(ulg_comb))\n\n for n in rang...
[ "0.61691666", "0.594303", "0.5098859", "0.5023717", "0.49849656", "0.49809927", "0.49650007", "0.48411912", "0.4841159", "0.4805827", "0.4739387", "0.47129312", "0.4658429", "0.46445525", "0.4636409", "0.461732", "0.45834967", "0.45813844", "0.45802906", "0.45802906", "0.4570...
0.760756
0
Gets the gbr_dl of this RequestedQos.
def gbr_dl(self): return self._gbr_dl
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gbr_ul(self):\n return self._gbr_ul", "def getBL(self):\r\n return self.bL;", "def snmpqosqos_packets_droppedrate(self) :\n\t\ttry :\n\t\t\treturn self._snmpqosqos_packets_droppedrate\n\t\texcept Exception as e:\n\t\t\traise e", "def _get_ldp_sync_hold_down(self):\n return self.__ldp_syn...
[ "0.6006991", "0.5707925", "0.5370055", "0.53580135", "0.5345465", "0.5287211", "0.52737546", "0.5232863", "0.52164197", "0.52164197", "0.52164197", "0.51493675", "0.51317436", "0.51186025", "0.51073915", "0.5064704", "0.505674", "0.50535154", "0.5048442", "0.50189704", "0.501...
0.7665163
0
Sets the gbr_dl of this RequestedQos.
def gbr_dl(self, gbr_dl): self._gbr_dl = gbr_dl
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gbr_ul(self, gbr_ul):\n\n self._gbr_ul = gbr_ul", "def gbr_dl(self):\n return self._gbr_dl", "def gallbladder(self, gallbladder):\n\n self.logger.debug(\"In 'gallbladder' setter.\")\n\n self._gallbladder = gallbladder", "def dnb(self, dnb):\n\n self._dnb = dnb", "def ...
[ "0.6014968", "0.569527", "0.52426", "0.52092737", "0.51112777", "0.49458075", "0.49458075", "0.4866286", "0.48009413", "0.47358114", "0.4625417", "0.46135667", "0.46096244", "0.45907134", "0.45766228", "0.45682302", "0.4564721", "0.45394444", "0.45390162", "0.45298594", "0.45...
0.7670086
0
Keypoint evaluation using COCOAPI.
def _do_python_keypoint_eval(self, res_file): coco_det = self.coco.loadRes(res_file) coco_eval = COCOeval( self.coco, coco_det, 'keypoints', self.sigmas, use_area=False) coco_eval.params.useSegm = None coco_eval.evaluate() coco_eval.accumulate() coco_eval.summ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _evaluate_predictions_on_coco_ps(coco_gt, coco_results, iou_type, ps_mode, kpt_oks_sigmas=None):\n assert len(coco_results) > 0\n\n if iou_type == \"segm\":\n coco_results = copy.deepcopy(coco_results)\n # When evaluating mask AP, if the results contain bbox, cocoapi will\n # use the...
[ "0.62909716", "0.60523283", "0.5970072", "0.5801929", "0.5801929", "0.57388675", "0.571071", "0.55617356", "0.5529449", "0.5511643", "0.5455271", "0.5396832", "0.5377042", "0.53401375", "0.5296298", "0.5288935", "0.5284459", "0.52335393", "0.52335393", "0.52335393", "0.518344...
0.61717105
1
Extend the given Frame.
def extend(self, frame): self.static_link = StaticLink(self.canvas, self, frame) self.update()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def raiseframe_extra(self, name):\n\n self.extraframe.forget()\n frame = self.frames[name]\n frame.pack(expand=True, fill='both', padx=10)\n frame.update()\n frame.event_generate('<<ShowFrame>>')", "def FrameAddBlendFrame(builder, blendFrame):\n return AddBlendFrame(builder,...
[ "0.62277865", "0.6135089", "0.6081007", "0.6039482", "0.60271853", "0.5970307", "0.59035146", "0.5898341", "0.58268374", "0.58001316", "0.5760515", "0.57385683", "0.5728255", "0.56615496", "0.5592534", "0.5527621", "0.5516896", "0.5500574", "0.54418653", "0.5379401", "0.53434...
0.6509338
0
The frame that encloses this frame (what is pointed to by the static link).
def enclosing_frame(self): return self.static_link.frame
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main_frame(self):\n return self.frame", "def get_frame(self):\n return self.frame", "def frame(self):\n return self._frame", "def frame(self):\n return self._frame", "def frame(self):\n return self._frame", "def frame(self):\n return self.head", "def get_fr...
[ "0.767556", "0.74161756", "0.7345391", "0.7345391", "0.7345391", "0.71622056", "0.6995642", "0.6989063", "0.6887034", "0.68754154", "0.6817774", "0.6768423", "0.6639166", "0.6615822", "0.6602196", "0.6492776", "0.6487509", "0.6400091", "0.6300003", "0.62185115", "0.6148845", ...
0.8402784
0
Adds a Binding to this Frame.
def add_binding(self, variable, value): # If there's already a binding, update it rather than add a new one. for binding in self.bindings: if binding.variable.name == variable: return self.update_binding(variable, value) variable = Variable(self.canvas, self, variable...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addBindingToFrame(var, val, frame):\n set_car(frame, cons(var, frame_variables(frame)))\n set_cdr(frame, cons(val, frame_values(frame)))\n return", "def bind(self, sequence=None, func=None, add=None):\n return self._widget_bind(sequence, func, add, internal=False)", "def add_binding(ctx, bi...
[ "0.66476285", "0.61366373", "0.6026425", "0.60156393", "0.59045696", "0.58596855", "0.57560503", "0.5732177", "0.5641009", "0.54628783", "0.5456201", "0.5436792", "0.54301035", "0.53278595", "0.532564", "0.5314", "0.52351445", "0.5233988", "0.52169967", "0.51750636", "0.51471...
0.73459095
0
Updates a preexisting Binding in this or some enclosing Frame.
def update_binding(self, variable, value): old_value = self.lookup(variable).value if old_value is None: raise BaseException( "Tried to update a variable that's not in scope!") var_x, var_y = self.lookup(variable).variable.pos self.lookup(variable).value = val...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_binding(self, variable, value):\n # If there's already a binding, update it rather than add a new one.\n for binding in self.bindings:\n if binding.variable.name == variable:\n return self.update_binding(variable, value)\n variable = Variable(self.canvas, self...
[ "0.5982152", "0.5768461", "0.5693645", "0.5657816", "0.5610024", "0.5507929", "0.54648364", "0.54608685", "0.54569656", "0.5437134", "0.5436132", "0.5410777", "0.5389101", "0.5331553", "0.532694", "0.52867365", "0.52445334", "0.522141", "0.5190998", "0.51589876", "0.5157782",...
0.68966717
0
Get the binding associated with this variable.
def lookup(self, variable): for binding in self.bindings: if binding.variable.name == variable: return binding if self.static_link is not None: return self.enclosing_frame.lookup(variable) return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_binding(self, v: str) -> Optional[str]:\n assert is_var(v)\n t = self\n ret = t.binding.get(v)\n while not ret and t.parent:\n t = t.parent\n ret = t.binding.get(v)\n return ret", "def _get_binding_record(self):\n binding = self.binder.get_b...
[ "0.74545455", "0.6984103", "0.6952437", "0.6926125", "0.6841516", "0.68226844", "0.67925", "0.6688647", "0.6679474", "0.6650369", "0.6598982", "0.65434706", "0.64257133", "0.6307767", "0.630486", "0.62405646", "0.62294364", "0.6209628", "0.618126", "0.59600055", "0.5916183", ...
0.71176594
1
The frame pointed to by a StaticLink is the head.
def frame(self): return self.head
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def enclosing_frame(self):\n return self.static_link.frame", "def head(self):\n return self._head", "def head(self):\n return self._head", "def do_HEAD(self):\n self.log.debug('do_HEAD called')\n self.HeadGet('HEAD')", "def get_head_vertex(self):\n return self.graph.vertic...
[ "0.57880884", "0.5785145", "0.5785145", "0.550507", "0.55021834", "0.54791784", "0.53977954", "0.53869563", "0.53779864", "0.53493875", "0.5296728", "0.528315", "0.52398014", "0.52345103", "0.52054757", "0.52017754", "0.51980126", "0.5196535", "0.5196535", "0.5196535", "0.519...
0.6079391
0
The base of a StaticLink is the tail.
def base(self): return self.tail
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rel_base(self, p_addr = 0):\n\t\trel_pos = self.get_address(p_addr, 1)\n\t\trel_val = self.get_data(rel_pos)\n\t\tself.rel_pos += rel_val\n\t\tself.pos += 2", "def base(self):\n return self if self._base is None else self._base", "def base_path(self):\n return self._base_path", "def base_on...
[ "0.56164706", "0.5547956", "0.5547714", "0.5442039", "0.5399766", "0.53787285", "0.5375355", "0.53430074", "0.5331589", "0.5316092", "0.5314165", "0.53085375", "0.5287327", "0.5280603", "0.5275888", "0.52740526", "0.52636313", "0.52579504", "0.52409434", "0.52350146", "0.5231...
0.67270696
0
The variable is at the tail of the Binding Connector.
def variable(self): return self.tail
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def LocalEndPoint(self) -> _n_5_t_1:", "def _bind(self):\n\n pass", "def add_binding(self, variable, value):\n # If there's already a binding, update it rather than add a new one.\n for binding in self.bindings:\n if binding.variable.name == variable:\n return sel...
[ "0.5865614", "0.58038676", "0.5525564", "0.55219877", "0.54474205", "0.5439413", "0.53656787", "0.5347091", "0.5347091", "0.5289647", "0.5277234", "0.5262203", "0.52546877", "0.5248067", "0.5224067", "0.520301", "0.51902634", "0.51829165", "0.51748765", "0.5161431", "0.515852...
0.60987073
0
The value is at the tail of the Binding Connector.
def value(self, new_val): # TODO: This is a hack, we should have the head/tail be properties with # appropriate setter methods in Connector. self.head = new_val self.head.add_connector(self) self.update()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bottom(self, value):\n\n pass", "def value(self):\n if self.is_bound():\n return self._value\n else:\n raise UninitializedBinding('{} is unbound.'.format(self))", "def binding_information(self):\n return self._binding_data", "def cdr(self, value):\n ...
[ "0.60678184", "0.5622013", "0.56060386", "0.5578984", "0.55146396", "0.54757786", "0.5419785", "0.5415978", "0.5368446", "0.53399867", "0.5329448", "0.5305098", "0.5272067", "0.5272067", "0.52655005", "0.5237537", "0.5227217", "0.5215954", "0.52116716", "0.5199955", "0.517722...
0.6146018
0
Move the Binding. Moves the variable by the given amounts. If value.moves_with_binding is True, it is also moved by the given amounts. Updates the Connector after the movement has been done.
def move(self, dx, dy): self.variable.move(dx, dy) if self.value.moves_with_binding: self.value.move(dx, dy) self.update()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_binding(self, variable, value):\n old_value = self.lookup(variable).value\n if old_value is None:\n raise BaseException(\n \"Tried to update a variable that's not in scope!\")\n var_x, var_y = self.lookup(variable).variable.pos\n self.lookup(variable...
[ "0.60930204", "0.5636774", "0.56021535", "0.5309398", "0.5231337", "0.52088094", "0.5198945", "0.51483846", "0.51353896", "0.50959015", "0.50775903", "0.5074223", "0.50660914", "0.50594985", "0.50539726", "0.50329864", "0.5032517", "0.5019829", "0.50132936", "0.5010506", "0.4...
0.6740303
0
Location of the center of gravity of the compound stabilizer w.r.t the origin. This is calculated with weighted averages.
def center_of_gravity(self): weights = [self.stabilizer_h.weight, self.stabilizer_vright.weight, self.stabilizer_vleft.weight] cgs = [self.stabilizer_h.center_of_gravity, self.stabilizer_vright.center_of_gravity, self.stabilizer_vleft.center_of_gravity] total_weight = sum(weights)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _center(self, forces):\n\t\t\n\t\tzipped = zip(self.grid.corners(), forces)\n\t\treturn self._weightedAverage(zipped)", "def center(self):\n return self._lower + 0.5 * (self._upper - self._lower)", "def center(self):\n try: \n return self._center\n except AttributeError:\n ...
[ "0.68209493", "0.6734817", "0.67244107", "0.67140454", "0.66436017", "0.6559522", "0.64326143", "0.6418216", "0.6416276", "0.63852113", "0.635442", "0.63412035", "0.63249606", "0.6314047", "0.6261982", "0.6245681", "0.6224372", "0.61856043", "0.61612463", "0.6155308", "0.6079...
0.798243
0
This joins the tails and connector shafts together through a series of Fuse operations to be able to present a single `external_shape` required for the .step file output.
def tail_joiner(self): # Fusing Right Horizontal Tail: shape_in_r = Fused(shape_in=self.stabilizer_h.solid, tool=self.stabilizer_vright.solid) shape_out_r = Fused(shape_in=shape_in_r, tool=self.connector_right) # Fusing Left Horizontal Tail: shape_in_l = Fused(shape_in=self.sta...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mainFunction(f):\n\n #############################################################################\n \n \n # biomass hexagon\n predF = '/vol/v3/lt_stem_v3.1/models/biomassfiaald_20180708_0859/2000/biomassfiaald_20180708_0859_2000_mean.tif'\n trainF = '/vol/v2/datasets/biomass/nbcd/fia_ald/nbcd_fia_ald_bi...
[ "0.5428593", "0.53293943", "0.5111582", "0.50676537", "0.50566024", "0.5017332", "0.49942586", "0.4984784", "0.4978153", "0.4896247", "0.48875964", "0.48859593", "0.4797835", "0.47945777", "0.4774569", "0.47722545", "0.47544155", "0.47473112", "0.47439614", "0.4709717", "0.47...
0.5575888
0
This attribute finds the larger airfoil thickness of the HT or VT stabilizers to then be able to construct the tailboom shaft with a radius equal to this larger thickness.
def critical_thickness(self): horizontal_tail_thickness = sorted(self.stabilizer_h.solid.faces, key=lambda f: f.cog.y)[-1].bbox.height vertical_tail_thickness = sorted(self.stabilizer_vright.solid.faces, key=lambda f: f.cog.z)[0].bbox.length if horizontal_tail_thickness >= vertical_tail_thicknes...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calc_optical_thickness(self, atmosphere, t_surface):\n self.set_atmospheric_state(atmosphere, t_surface)\n\n self.ws.propmat_clearsky_fieldCalc()\n\n tau = np.trapz(\n y=self.ws.propmat_clearsky_field.value[:, :, 0, 0, :, 0, 0],\n x=self.ws.z_field.value[:, 0, 0],\n ...
[ "0.58767277", "0.577812", "0.57439417", "0.57420033", "0.57348126", "0.5701691", "0.56614035", "0.5627972", "0.5577274", "0.5555835", "0.55312794", "0.5513159", "0.55019605", "0.5464188", "0.5458677", "0.5456074", "0.5408051", "0.5388599", "0.53871053", "0.53454113", "0.53291...
0.6089675
0
This is the internal shape of the compound stabilizer. It is None because the current app uses a boom tail\ structure instead of a single fuselage, and thus there is no shape to present for the fuselage builder.
def internal_shape(self): return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shape(self):\n return None", "def shape(self):", "def shape(self):", "def shape(self) -> Shape:", "def shape(self) -> str:\n return \"box\"", "def surface(self):\n return BRep_Tool_Surface(self.topods_shape())", "def shape(self):\n return self.active.shape", "def exter...
[ "0.6660259", "0.6377907", "0.6377907", "0.6350067", "0.61458004", "0.6072909", "0.59808654", "0.5950499", "0.58973956", "0.5789104", "0.57881624", "0.57205176", "0.567865", "0.56527114", "0.56421506", "0.5631697", "0.5566981", "0.55606943", "0.55593157", "0.55571765", "0.5546...
0.65808225
1
This rotates the extruded right boom shaft connector to point in the X direction.
def connector_right(self): return RotatedShape(shape_in=self.tail_shaft_circle[1], rotation_point=self.tail_shaft_circle[0].center, vector=Vector(0, 1, 0), angle=radians(90))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def right(self, angle):\r\n self.rotation += angle", "def rotateRight(self):\n self.faceHeading+=-1*shipRotationSpeed\n self.reDraw()", "def move_right(self):\n\t\tself.set_x_vector(constants.DONKEY_SPEED)", "def read_rotor(self):\n self.sig_a = self.pin_a.read_digital()\n self.sig...
[ "0.58585054", "0.58475804", "0.5752721", "0.56557125", "0.565259", "0.5642582", "0.55889606", "0.55838734", "0.55481523", "0.5542192", "0.55371916", "0.553619", "0.5532067", "0.5516594", "0.54965496", "0.54788023", "0.54788023", "0.5476728", "0.5452291", "0.5441863", "0.54217...
0.6050355
0
This attribute names the component 'ct' for compound stabilizer.
def component_type(self): return 'ct'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ct(self):\n return self._ct", "def n_cs(self):\n pass", "def delta_c(self):\n if self._deltac is None:\n raise AttributeError('Attribute has not yet been initialized.')\n else:\n return self._deltac", "def get_bertzCTs(self):\n\n self.r_max_bCT = 0...
[ "0.6306071", "0.5830233", "0.55300504", "0.54758626", "0.5464467", "0.54112226", "0.5399572", "0.53634334", "0.53443295", "0.5325333", "0.5307353", "0.526817", "0.526817", "0.5239267", "0.5178399", "0.5164254", "0.51474506", "0.51014316", "0.51014316", "0.50527024", "0.502405...
0.7008896
0
This defines the external shape for the ExternalBody class in definitions.
def external_shape(self): return ScaledShape(shape_in=self.tail_joiner, reference_point=Point(0, 0, 0), factor=1, hidden=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def internal_shape(self):\n return None", "def shape(self) -> Shape:", "def createExternalModelDefinition(self):\n return _libsbml.CompSBMLDocumentPlugin_createExternalModelDefinition(self)", "def nativeObject(self):\n return ParaMeshBody()", "def shape(self):\n path = super(Arr...
[ "0.59475553", "0.55709356", "0.551432", "0.5420617", "0.53448313", "0.5337472", "0.53151894", "0.5227796", "0.52101886", "0.52101886", "0.520175", "0.5200861", "0.5182683", "0.5145877", "0.5120419", "0.5115572", "0.50709313", "0.5045184", "0.495258", "0.49308845", "0.49179575...
0.6451578
0
Find a cycle in a graph. s is a solver object, graph is an igraph object. Given the graph iterate over the graph, convert the key and values to symbolic terms and check for a cycle. Returns the unsat core as a list of strings e.g. [1>2, 2>3, 3>4, 4>1] I'm leaving this here just to try to get the abstract hamiltonian cy...
def find_all_cycles(s,graph): grph = u.edge_to_list_dict(graph) node_cnt = len(grph) k = z.Int("k") syms = [z.Int('node%s'%i) for i in range(node_cnt)] # s.add(syms[0] == 0) # start node is a 0 s.add(k < node_cnt) s.add(k > 1) o = z.Optimize() # for source, sinks i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_eulerian_cycle(adj_dict, edges):\n if not adj_dict:\n return []\n\n checked = [False] * len(edges)\n list_keys = list(adj_dict.keys())\n for i in list_keys: # the first time will return true anyway\n cycle = []\n if dfs(i, adj_dict, edges, checked, cycle, i):\n ...
[ "0.6317372", "0.611582", "0.5957695", "0.5797448", "0.57344425", "0.5620256", "0.56129", "0.5610811", "0.5604997", "0.5584068", "0.5572033", "0.5533192", "0.5509296", "0.550141", "0.5495953", "0.5464865", "0.5461448", "0.54586077", "0.5360699", "0.5358017", "0.5301723", "0....
0.7576485
0
Find the minimum feedback arc set by encoding it as a minimum set cover. The encoding requires a cycle matrix which we find externally to the SAT
def MFAS_set_cover(s,graph): ## initialization m = graph.ecount() cycle_matrix = u.mk_cycle_matrix(u.find_all_cycles(graph), m) n, c = graph.get_adjacency().shape num_cycles = len(cycle_matrix) edge_list = graph.get_edgelist() sym_to_edge_cache = {} edge_to_sym_c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dauxmin_cc_piece(x,k_ind,m_ind):\n g_cc = np.zeros_like(x)\n if cfg.min_line[k_ind,m_ind] == cfg.jk[k_ind]-1:\n g_cc[0:cfg.nfea-1]=cfg.a[m_ind,:cfg.nfea-1] \n g_cc[cfg.nfea-1] = 1.0\n \n return g_cc", "def decode_MST(energies, lengths, leading_symbolic=0, labeled=Tr...
[ "0.5864169", "0.57378393", "0.5687902", "0.56660724", "0.56399906", "0.56240785", "0.562271", "0.56220156", "0.561726", "0.56002665", "0.55332106", "0.55105716", "0.54956925", "0.54948974", "0.5421922", "0.53512096", "0.5348889", "0.53431565", "0.5338174", "0.5308137", "0.523...
0.6773402
0
Multiply the edge by its corresponding value in the cycle matrix
def constraint_1(i,s_edge): edge = sym_to_edge_cache[s_edge] value = 0 if edge in cycle_matrix[i]: value = cycle_matrix[i][edge] return (value * s_edge)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def directed_cycle_score(A):\n\n # Implement your cycle score given Problem 4 Part 2\n temp_matrix = np.zeros(A.shape)\n alpha = 0.05\n k = 0\n summation_term = 999999\n num_terms = A.shape[0]\n # while change < 0.05:\n for i in range(num_terms):\n summation_term = (1 / np.math.facto...
[ "0.60190064", "0.5874437", "0.5793331", "0.5536843", "0.5514731", "0.5514731", "0.5465191", "0.5450256", "0.54244536", "0.54083383", "0.5379471", "0.5352703", "0.53356016", "0.52899003", "0.52723056", "0.52532554", "0.52459836", "0.52313924", "0.52127993", "0.5145558", "0.514...
0.62255317
0
Given the dimension of the lattice, size of the lattice along all dimensions, the number of steps within which two vertices are connected (nei), and the probability p, find the minimum feedback arc set of a wattsstrogatz graph
def runWattsStrogatz(dim, size, nei, p): s = z.Optimize() g = ig.Graph.Watts_Strogatz(dim, size, nei, p, loops=True, multiple=False) while g.is_dag(): g = ig.Graph.Watts_Strogatz(dim, size, nei, p, loops=True, multiple=False) return MFAS_set_cover(s,g), u.get_feedback_arc_set(g)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def probability(N_dr, L_opmin, L_opmax, L_min, L_max, L_d):\n opening_nomullignas = []\n opening_withmullignas = []\n sum_nomulligans = 0\n sum_withmulligans = 0\n mulligan_coeff = 0\n\n for i in range(L_opmin, min(L_opmax + 1, 8)): # first make a list of tuples of the form:\n # (number_o...
[ "0.6027979", "0.5936431", "0.5802892", "0.5774201", "0.57534164", "0.5735415", "0.56888187", "0.56885964", "0.56682485", "0.56297076", "0.55605185", "0.55485064", "0.5500358", "0.54803574", "0.54629415", "0.54441243", "0.5442056", "0.5441907", "0.54413617", "0.54407454", "0.5...
0.622067
0
The `is_mersenne` method for the beginner challenge.
def is_mersenne(num: int) -> bool: s = 4 m = (2 ** num) - 1 for i in range(0, num - 2): s = ((s**2) - 2) % m return s == 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verify_MT19937Cipher():\n plaintext = \"h#llo PRNG stream cipher w@rld!!!!\"\n cipher = MT19937Cipher(0xdeadbeef)\n ciphertext = cipher.encrypt(plaintext)\n decrypted_plaintext = cipher.decrypt(ciphertext)\n is_match = plaintext.__eq__(decrypted_plaintext)\n assert(is_match == True)", "def ...
[ "0.59019184", "0.57263315", "0.5583907", "0.5496015", "0.54939693", "0.5433102", "0.53913236", "0.53913236", "0.53301436", "0.5304294", "0.5301869", "0.52900606", "0.52485555", "0.5239065", "0.5235083", "0.5229403", "0.5112689", "0.5111179", "0.51060545", "0.50973195", "0.509...
0.8502041
0
The `swap_nodes` method can be used as a helper for `invert_tree`.
def swap_nodes(tree) -> None: if tree is None: raise ValueError('Empty tree') tmp = tree.left tree.left = tree.right tree.right = tmp
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def swap(self, subtree_a, subtree_b):\n\n temp1 = subtree_a.parent\n temp2 = subtree_b.parent\n\n temp1.children[temp1.children.index(subtree_a)] = subtree_b\n temp2.children[temp2.children.index(subtree_b)] = subtree_a\n \n subtree_a.parent = temp2\n subtree_b.pare...
[ "0.68996036", "0.66603166", "0.66058844", "0.65468365", "0.647947", "0.6389255", "0.63157016", "0.60198313", "0.5989695", "0.59827334", "0.5894863", "0.5893917", "0.5848373", "0.58432406", "0.5836522", "0.5817962", "0.5729272", "0.57066095", "0.56845456", "0.5676853", "0.5675...
0.80218107
0
The `invert_tree` method for the proficient challenges.
def invert_tree(tree: TreeNode) -> TreeNode: if tree is None: raise ValueError('Empty treee') swap_nodes(tree) invert_tree(tree.left) invert_tree(tree.right) return tree
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_inverted_tree(tree: NodeTree) -> NodeTree:\n inverted_tree = NodeTree(tree.value)\n\n if tree.left is not None:\n inverted_tree.right = create_inverted_tree(tree.left)\n\n if tree.right is not None:\n inverted_tree.left = create_inverted_tree(tree.right)\n\n return inverted_tre...
[ "0.6759059", "0.6705779", "0.58604103", "0.57773787", "0.57395315", "0.57179874", "0.5696101", "0.5665392", "0.5645661", "0.5622745", "0.56212926", "0.5608631", "0.5527884", "0.550309", "0.5494076", "0.54709524", "0.54265046", "0.53877723", "0.53698325", "0.5364037", "0.52984...
0.7347783
0
Caculate the Costs J= sum(sum(r[k,n] squared_distance(m[k],x[n]))
def cost(X, R, M): cost = 0 for k in range(len(M)): for n in range(len(X)): cost += R[n,k] * d(M[k], X[n]) return cost
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def total_cost(self):\n return np.einsum('i->', self.c[self.s])", "def cost_matrix(x, y, p=2):\n xc = tf.expand_dims(x, 1)\n yr = tf.expand_dims(y, 0)\n d = tf.math.pow(tf.abs(xc - yr), p)\n return tf.reduce_sum(d, axis=-1)", "def calculate_cost(self, medoids, clusters):\n ...
[ "0.6906183", "0.67312104", "0.67167264", "0.6657094", "0.6641777", "0.66405445", "0.65683174", "0.65535605", "0.6470182", "0.64275986", "0.6414472", "0.63875943", "0.6365623", "0.63528895", "0.63380504", "0.6333762", "0.6333615", "0.62924534", "0.62811", "0.6254352", "0.62414...
0.765551
0
Find valid path from options, which is a list of 2tuple of (name, path). Return first pair where path is not None. If no valid path is found, return ('', None)
def _find_valid_path(options): for by, data in options: if data is not None: return by, data else: return '<unknown>', None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def option_qualified_name(self, opt):\n if not opt in self.results:\n return ('unknown', opt)\n elif not self.results[opt][1] in self._is_funny:\n return ('trac.ini', self.results[opt][1])\n else:\n return (self.results[opt][1], opt)", "def find_path_options(...
[ "0.5819407", "0.5445068", "0.5414672", "0.541425", "0.54042286", "0.5392301", "0.53444403", "0.5334321", "0.5334321", "0.5205876", "0.5203414", "0.51825213", "0.5180476", "0.51746553", "0.5171607", "0.51599324", "0.51492083", "0.5144711", "0.5144711", "0.5144711", "0.514106",...
0.85310924
0
Return path to systemwide cudatoolkit; or, None if it doesn't exist.
def get_system_ctk(*subdirs): # Linux? if sys.platform.startswith('linux'): # Is cuda alias to /usr/local/cuda? # We are intentionally not getting versioned cuda installation. base = '/usr/local/cuda' if os.path.exists(base): return os.path.join(base, *subdirs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_conda_ctk():\n is_conda_env = os.path.exists(os.path.join(sys.prefix, 'conda-meta'))\n if not is_conda_env:\n return\n # Assume the existence of NVVM to imply cudatoolkit installed\n paths = find_lib('nvvm')\n if not paths:\n return\n # Use the directory name of the max path...
[ "0.6586595", "0.6505726", "0.62108535", "0.61482155", "0.6069431", "0.59912306", "0.5942864", "0.5693473", "0.56767124", "0.5654563", "0.55638784", "0.551995", "0.55120856", "0.5467015", "0.54590136", "0.5451404", "0.54293686", "0.54079705", "0.537745", "0.53771037", "0.53624...
0.672219
0
Return path to directory containing the shared libraries of cudatoolkit.
def get_nvidia_cudalib_ctk(): nvvm_ctk = get_nvidia_nvvm_ctk() if not nvvm_ctk: return env_dir = os.path.dirname(os.path.dirname(nvvm_ctk)) subdir = 'bin' if IS_WIN32 else 'lib' return os.path.join(env_dir, subdir)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_library_dir():\n return os.path.join(get_script_path(), 'library')", "def get_nvidia_static_cudalib_ctk():\n nvvm_ctk = get_nvidia_nvvm_ctk()\n if not nvvm_ctk:\n return\n env_dir = os.path.dirname(os.path.dirname(nvvm_ctk))\n dirs = ('Lib', 'x64') if IS_WIN32 else ('lib',)\n ret...
[ "0.71016824", "0.6860122", "0.65566653", "0.6523251", "0.6495012", "0.63525116", "0.63236153", "0.63159585", "0.6251684", "0.6166421", "0.6151194", "0.6136339", "0.6069506", "0.6065325", "0.59846205", "0.5933944", "0.5912517", "0.5902956", "0.5875484", "0.587457", "0.58695763...
0.6947953
1