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
Creates an initial game state from a layout array (see layout.py).
def initialize( self, layout, numGhostAgents=1000 ): self.data.initialize(layout, numGhostAgents) ##self.data is defined in the Grid() class of game.py REF112.It creates an initial game state from a layout array (see layout.py).
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, layout, player):\n self.layout = [x[:] for x in layout] #this state's layout is a copy\n self.height = len(layout[0])\n self.width = len(layout)\n self.who_played = player\n self.score = self._scoring() #score for this board", "def initGame(width=19):\n st...
[ "0.65404385", "0.62726295", "0.6086132", "0.6086132", "0.6044214", "0.6044214", "0.6044214", "0.6044214", "0.6044214", "0.6044214", "0.6044214", "0.6044214", "0.6044214", "0.6044214", "0.6044214", "0.6044214", "0.6044214", "0.6044214", "0.6044214", "0.6044214", "0.6044214", ...
0.6842221
0
Processes the command used to run pacman from the command line.
def readCommand( argv ): ## argv belongs to the 'sys'-library and can be called through sys.argv. The function reads the console's comand line argument and passes it to a variable like so: args = sys.argv[1:] from optparse import OptionParser ## Option Parser is a powerful library for passing comma...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_command_line():\n commands = scan_for_commands()\n parser = argparse.ArgumentParser(\n description=\"A set of utilities to ease the installation of Modoboa.\",\n epilog=\"\"\"Available commands:\n%s\n\"\"\" % \"\\n\".join([\"\\t%s\" % c for c in sorted(commands)]))\n parser.add_ar...
[ "0.60683686", "0.6021038", "0.5957683", "0.57956135", "0.57873833", "0.5664116", "0.5649994", "0.5588615", "0.555994", "0.55404824", "0.5530758", "0.5511282", "0.5501264", "0.549662", "0.548287", "0.54800344", "0.5472996", "0.54409564", "0.542683", "0.5424045", "0.5418257", ...
0.65644956
0
Create this CSR from a buffer
def from_buffer(data, encoding='pem'): return X509Csr.from_open_file(io.BytesIO(data), encoding)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def frombuffer(buffer, **kwargs):\n\n return call_origin(numpy.frombuffer, buffer, **kwargs)", "def create_from_buffer(cls, buffer: str) -> \"TensorImage\":\n image_data = image_utils.decode_image_from_buffer(buffer, len(buffer))\n return cls(image_data, is_from_numpy_array=False)", "def from_buffer(c...
[ "0.6514623", "0.61291546", "0.60954344", "0.59913373", "0.5929997", "0.5730285", "0.56947875", "0.56856996", "0.5677521", "0.5608824", "0.55828583", "0.5568209", "0.5565738", "0.5550145", "0.5483738", "0.54315054", "0.5386336", "0.5300147", "0.52866995", "0.5259141", "0.52512...
0.6781523
0
Create this CSR from a file on disk
def from_file(path, encoding='pem'): try: with open(path, 'r') as f: return X509Csr.from_open_file(f, encoding) except IOError: raise X509CsrError("Could not read file %s" % path)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def CreateCrtFile(keyfile, csrfile):\n crtfile = tempfile.mkstemp()[1]\n cmd = [\n 'openssl',\n 'x509',\n '-req',\n '-days', '1',\n '-in', csrfile,\n '-signkey', keyfile,\n '-out', crtfile\n ]\n _RunCommand(cmd)\n return crtfile", "def create_from_file(cls, path):\n\n ...
[ "0.6182878", "0.6152139", "0.61361444", "0.59857833", "0.58985895", "0.5867565", "0.58489877", "0.5822996", "0.563695", "0.56063586", "0.5573587", "0.55555207", "0.5551064", "0.55499285", "0.5524422", "0.5514425", "0.55135655", "0.54952925", "0.549421", "0.54896677", "0.54896...
0.68524605
0
Get the public key from the CSR
def get_pubkey(self): return self._csr['certificationRequestInfo']['subjectPublicKeyInfo']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_public_key(self):\n# _log.debug(\"get_public_key\")\n certpath, cert, certstr = self.get_own_cert()\n try:\n cert = load_pem_x509_certificate(certstr, default_backend())\n except Exception as err:\n _log.error(\"Failed to load X509 certificate from PEM, err...
[ "0.7291749", "0.7151937", "0.70317656", "0.69595", "0.6945708", "0.694188", "0.69205004", "0.6918894", "0.6846553", "0.6839397", "0.68323153", "0.6822918", "0.6772169", "0.6771975", "0.67513555", "0.67417294", "0.6733704", "0.6703111", "0.6654886", "0.6640319", "0.66141635", ...
0.7473664
0
Get the subject name field from the CSR
def get_subject(self): ri = self.get_request_info() if ri['subject'] is None: ri['subject'] = None # setup first RDN sequence ri['subject'][0] = None subject = ri['subject'][0] return name.X509Name(subject)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subject(self) -> str:\n return self[\"Sns\"][\"Subject\"]", "def get_name(self):\n return self.load_name(self.subject)", "def get_certificate_name(cert_data) -> str:\r\n if cert_data is None:\r\n return None\r\n\r\n cert = x509.load_pem_x509_certificate(cert_data, def...
[ "0.7051864", "0.70387065", "0.69659764", "0.6949392", "0.6927241", "0.6927241", "0.67928165", "0.6778444", "0.6740706", "0.6726373", "0.6726373", "0.6691816", "0.6677457", "0.66740286", "0.6524414", "0.6519214", "0.65027255", "0.6398681", "0.6398138", "0.6337108", "0.6326856"...
0.81360096
0
Get the CN part of subject.
def get_subject_cn(self): subject = self.get_subject() cns = subject.get_entries_by_oid(name.OID_commonName) return [cn.get_value() for cn in cns]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_subject(self):\n ri = self.get_request_info()\n if ri['subject'] is None:\n ri['subject'] = None\n # setup first RDN sequence\n ri['subject'][0] = None\n\n subject = ri['subject'][0]\n return name.X509Name(subject)", "def getSubject(self):\r\n ...
[ "0.67420936", "0.6689823", "0.6680702", "0.6680702", "0.66017765", "0.65063447", "0.6394712", "0.63077354", "0.6284451", "0.62449497", "0.62449497", "0.6210434", "0.6204365", "0.6199062", "0.61709285", "0.6100831", "0.6037614", "0.59472805", "0.59242284", "0.5875864", "0.5773...
0.7442487
0
Get the list of all X509 V3 Extensions on this CSR
def get_extensions(self, ext_type=None): ext_attrs = [a for a in self.get_attributes() if a['attrType'] == OID_extensionRequest] if len(ext_attrs) == 0: return [] else: exts_der = ext_attrs[0]['attrValues'][0].asOctets() exts = decoder.dec...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def explicit_list(self):\n exts = []\n for ext in self.extensions.values():\n if ext.implicit:\n continue\n exts.append(ext)\n return exts", "def extensions(self):\n return list(self._list(extension.Extension, paginated=False))", "def list_extens...
[ "0.6225858", "0.6220105", "0.6191462", "0.5990831", "0.5963183", "0.59544784", "0.5882228", "0.581221", "0.57532495", "0.5679225", "0.56783944", "0.56783944", "0.56427705", "0.5603688", "0.55754435", "0.5570066", "0.5565384", "0.5565384", "0.5538455", "0.5530417", "0.5508871"...
0.64339465
0
Sorts plot data, labels, and colors in order of increasing median.
def _sort_distributions_by_median(plot_data, plot_labels, plot_colors): sorted_data = [] for distribution, label, color in zip(plot_data, plot_labels, plot_colors): sorted_data.append((median(distribution), distribution, label, color)) sorted_data.sort() plot_data = [] plot_labels = [] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _sort_distributions(plot_data, plot_labels, plot_colors, sort_type):\r\n if sort_type == 'median':\r\n sort_key = lambda item: np.median(item[0])\r\n elif sort_type == 'alphabetical':\r\n sort_key = lambda item: item[1]\r\n else:\r\n raise ValueError(\"Invalid sort type '%s'.\" % ...
[ "0.67502403", "0.61370903", "0.5812121", "0.55651194", "0.5400599", "0.5361287", "0.5318083", "0.52853227", "0.52681786", "0.52646977", "0.519699", "0.51744735", "0.51643634", "0.5154642", "0.51214653", "0.50933886", "0.5091326", "0.5087971", "0.50839293", "0.5041131", "0.502...
0.802016
0
Colors one field by another. Returns a list of matplotlibcompatible colors, one for each of the input field_states. Also returns a dictionary mapping color_by_field states to colors (useful for building a legend, for example). If there are not enough colors available (they are drawn from qiime.colors.data_colors), an e...
def _color_field_states(map_f, samp_ids, field, field_states, color_by_field): colors = [] color_pool = [matplotlib_rgb_color(data_colors[color].toRGB()) for color in data_color_order] metadata_map = MetadataMap.parseMetadataMap(map_f) for field_to_check in field, color_by_field: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _color_field_states(map_f, samp_ids, field, field_states, color_by_field):\r\n colors = []\r\n color_pool = [matplotlib_rgb_color(data_colors[color].toRGB())\r\n for color in data_color_order]\r\n metadata_map = MetadataMap.parseMetadataMap(map_f)\r\n\r\n for field_to_check in fiel...
[ "0.79582155", "0.65347934", "0.5298748", "0.50596595", "0.49272713", "0.48494363", "0.48474175", "0.4675003", "0.4637813", "0.46354294", "0.46199623", "0.4567978", "0.45625272", "0.45435685", "0.4524946", "0.44895437", "0.44807377", "0.44734833", "0.44628522", "0.44232404", "...
0.79464936
1
Change the sortorder of the query set, depending on the form field [sortOrder] This function is used by EntryListView. The value of [sortOrder] is 'woord' by default. [sortOrder] is a hidden field inside the "adminsearch" html form in the template admin_gloss_list.html Its value is changed by clicking the up/down butto...
def order_queryset_by_sort_order(get, qs): def get_string_from_tuple_list(lstTuples, number): """Get the string value corresponding to a number in a list of number-string tuples""" sBack = [tup[1] for tup in lstTuples if tup[0] == number] return sBack # Helper: order a queryset on fiel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def OnReorder( self, event ):\n column = self.columns[event.GetColumn()]\n if column.sortOn:\n # multiple sorts for the click...\n columns = [ self.columnByAttribute( attr ) for attr in column.sortOn ]\n diff = [ (a,b) for a,b in zip( self.sortOrder, columns ) if b is...
[ "0.66559404", "0.65055186", "0.63866353", "0.63482296", "0.6306466", "0.6230435", "0.6193875", "0.60701925", "0.5975241", "0.59398514", "0.58977914", "0.58893275", "0.58859015", "0.5883438", "0.58178324", "0.58157855", "0.5789593", "0.57827884", "0.5777034", "0.5771956", "0.5...
0.65601
1
Get the string value corresponding to a number in a list of numberstring tuples
def get_string_from_tuple_list(lstTuples, number): sBack = [tup[1] for tup in lstTuples if tup[0] == number] return sBack
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def number_to_name(number):\n for name, value in item_dict.items():\n if number == value:\n return name", "def convert_label_num2string(number, num_types):\n dictionary = empty_label_dictionary(num_types)\n all_labels = list(dictionary.keys())\n return all_labels[number]", "def nu...
[ "0.6241433", "0.6169379", "0.59133387", "0.5674001", "0.56030846", "0.55849", "0.55705535", "0.5559834", "0.5558215", "0.5555174", "0.55171454", "0.55084604", "0.5500799", "0.5490005", "0.54363096", "0.5423369", "0.5394054", "0.5364714", "0.53266186", "0.5296184", "0.5288965"...
0.80886817
0
Order a queryset on field [sOrder], which is a number from a list of tuples named [sListName]
def order_queryset_by_tuple_list(qs, sOrder, sListName): # Get a list of tuples for this sort-order tpList = build_choice_list(sListName) # Determine sort order: ascending is default bReversed = False if (sOrder[0:1] == '-'): # A starting '-' sign means: descending o...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def order_queryset(self, queryset):\n if ordering := self.request.query_params.get(\"ordering\"):\n order_by = []\n regex = re.compile(r\"-?annotations__(?P<field_id>\\d+)\")\n fields = [field.strip() for field in ordering.split(\",\")]\n for match in filter(None,...
[ "0.68426776", "0.68241733", "0.6443088", "0.64092714", "0.635529", "0.6322692", "0.6254462", "0.60782796", "0.6071513", "0.6053254", "0.60431546", "0.6017769", "0.60118747", "0.59976304", "0.59976304", "0.5987454", "0.59871304", "0.5966309", "0.59529895", "0.5945509", "0.5930...
0.73274845
0
Paginate by specified value in querystring, or use default class property value.
def get_paginate_by(self, queryset): return self.request.GET.get('paginate_by', self.paginate_by)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_pagination_from_request(\n base_class=Pagination, base_class_constructor_kwargs=None,\n default_size=None\n):\n kwargs = base_class_constructor_kwargs or dict()\n\n get_arg = flask.request.args.get\n return base_class.from_request(get_arg, default_size, **kwargs)", "def paginate(self, req...
[ "0.6643049", "0.644725", "0.6387844", "0.612937", "0.60254294", "0.6023745", "0.5997623", "0.5988467", "0.59765965", "0.596013", "0.59556097", "0.5948403", "0.5948403", "0.5920509", "0.5831184", "0.581555", "0.5793978", "0.57869935", "0.5746473", "0.5735289", "0.57138014", ...
0.6571558
1
This function saves the image to a designated directory
def save_image(dirname, filename, img): if os.path.exists(dirname) == 0: os.makedirs(dirname) cv2.imwrite(dirname+filename+".bmp", img)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_output_image_to_directory(self):\n curr_directory = os.path.dirname(os.path.abspath(__file__))\n images_dir = curr_directory + \"/images/\"\n if not os.path.exists(images_dir):\n os.makedirs(images_dir)\n self.output_image_name = md5(str(uuid4()).encode()).hexdigest(...
[ "0.7956009", "0.78306276", "0.76816463", "0.7545857", "0.7493665", "0.74181014", "0.73043764", "0.7270899", "0.7195625", "0.71778727", "0.7177214", "0.71288425", "0.7123138", "0.70690674", "0.7051356", "0.7048735", "0.7046836", "0.7028891", "0.70088464", "0.69998574", "0.6986...
0.79338574
1
Exibe uma frase que descreve a capacidade da bateria
def descritivo_bateria(self) -> None: print('Este carro tem bateria de ' + str(self.tamanho_bateria) + '-KWh.')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def primera_palabra_mayuscula(cadena):\n palabras = cadena.split(\" \")\n frase_final = \"\"\n for palabra in palabras: # recorro la palabra separada \n frase_final += palabra.capitalize() + \" \" # agarro la palabra separado y la primera letra la pongo en mayuscula \n return frase_fina...
[ "0.5560311", "0.55506593", "0.548226", "0.5430165", "0.534019", "0.5291365", "0.527517", "0.5225864", "0.5213224", "0.5199035", "0.5184053", "0.51668406", "0.51542085", "0.51403135", "0.513504", "0.5109156", "0.51080704", "0.51006496", "0.50771993", "0.50429213", "0.5034565",...
0.61784256
0
Function to add padding to an image
def add_padding(im, pad): return np.pad(im, pad_width=((pad, pad), (pad, pad), (0, 0)), mode='symmetric')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def padding(image, padded_size):\n image_row, image_col = image.shape #asigna alto y ancho de la imagen \n\n padded_image = np.zeros((image_row + padded_size*2, image_col + padded_size*2)) #matriz de imagen con padding en zeros\n print(\"Padded image zeros:\")\n print(padded_image)\n\n padded_image[...
[ "0.7838249", "0.7809977", "0.7655503", "0.7654041", "0.7589162", "0.75757426", "0.7524358", "0.73401976", "0.73400784", "0.7287376", "0.72720695", "0.7152099", "0.70969987", "0.69374233", "0.68974817", "0.68948", "0.68466234", "0.68302625", "0.67844594", "0.67728436", "0.6760...
0.7822523
1
Function for removing padding from an image.
def remove_padding(im, pad): return im[pad:-pad, pad:-pad]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unpadding(img, n):\n img = img[n:img.shape[0]-n, n:img.shape[1]-n]\n\n return img", "def trim_image(image):\n bbox = image.getbbox()\n return image.crop(bbox)", "def trim(im):\n \n bg = Image.new(im.mode, im.size, im.getpixel((0,0)))\n diff = ImageChops.difference(im, bg)\n diff = I...
[ "0.71974975", "0.6799333", "0.65907735", "0.6541983", "0.64343464", "0.64166254", "0.63674694", "0.6343772", "0.63230455", "0.63128173", "0.62604237", "0.6255182", "0.6252271", "0.6218365", "0.6182188", "0.6165211", "0.61537254", "0.6135829", "0.6098082", "0.606794", "0.60555...
0.8617263
0
Sets up the FIREBIRD env var for securty2.fdb lookup
def setup_environmentvars(self, path, mydbfilepath): if not FDB_AVAILABLE: print(BColors.WARNING + "Warning: fdb_embedded couldn't be imported! " \ + "\nMake sure you've installed fdb_embedded correctly." + BColors.ENDC) return False os.environ['FIREBIRD'] = path ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initializeEnvironment(self, count, pid):\n result = os.environ.copy()\n result['LISTEN_FDS'] = str(count)\n result['LISTEN_PID'] = str(pid)\n return result", "def setDB(dbname):\n global DBNAME\n DBNAME = dbname", "def setup_firebase():\n config = {\n \"apiKey\":...
[ "0.545697", "0.5289924", "0.51876014", "0.51839024", "0.51618207", "0.51511234", "0.51040024", "0.50811124", "0.50119406", "0.4972091", "0.48819095", "0.48758987", "0.48557723", "0.48404726", "0.47968003", "0.47911075", "0.4788468", "0.4778985", "0.4770109", "0.47643057", "0....
0.7345562
0
Convert a list of colors to an array of fiber IDs
def colorsToFibers(colors): return np.array(sorted(set(sum([FIBER_COLORS[col] for col in colors], []))))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_colours(colours_list, colours_required):\n colour_range = spectra.range(colours_list, colours_required)\n return [colour.hexcode for colour in colour_range]", "def get_colors(color_list):\n rgba_colors = []\n a = [0.5,0.5,0.6,0.4,0.3,0.2]\n i = 0\n for c in color_list:\n rgba_c...
[ "0.6882833", "0.6552208", "0.64129776", "0.6288388", "0.6265368", "0.62227315", "0.62189955", "0.61927533", "0.6179841", "0.6153262", "0.61470544", "0.6112069", "0.61112076", "0.6054472", "0.60415244", "0.6002511", "0.5993129", "0.5938546", "0.59206957", "0.5844335", "0.58097...
0.7132494
0
Convert a list of colors to a hash for the pfiDesignId
def hashColors(colors): return sum(HASH_COLORS[col] for col in set(colors))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compile_palette(palette_list):\n global _COMPILED_PALETTE\n _COMPILED_PALETTE = {}\n\n for color in palette_list:\n r_sum = math.fabs(color[0] ** _MAGNITUDE)\n g_sum = math.fabs(color[1] ** _MAGNITUDE)\n b_sum = math.fabs(color[2] ** _MAGNITUDE)\n\n _COMPILED_PALETTE[color]...
[ "0.6457131", "0.6365841", "0.6311491", "0.624755", "0.6181713", "0.61611116", "0.61419606", "0.6136244", "0.6124362", "0.6113369", "0.608489", "0.60780436", "0.6064027", "0.5912958", "0.59029126", "0.5857813", "0.58283913", "0.5825066", "0.5819124", "0.5813369", "0.5805134", ...
0.70530593
0
Catches a SIGINT and cleans up
def sigint_handler(sig, frame): print("[i] Caught SIGINT, cleaning up...") server.close() exit(0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_sigint(signum, frame):\n print(\"\\nInterrupted by SIGINT\\n\")\n sys.exit()", "def SIGINT_handler(signal, frame):\n exit(2)", "def keyboard_interrupt_handler(sig: int, _: object) -> None:\n logger.warning(f'KeyboardInterrupt (id: {sig}) has been caught...')\n logger.info('Terminating...
[ "0.73255545", "0.71945477", "0.71799266", "0.70329976", "0.68681586", "0.68055373", "0.67651457", "0.6753512", "0.6715791", "0.6654692", "0.65958405", "0.65705025", "0.6526282", "0.6510839", "0.6495898", "0.6482181", "0.64782625", "0.6475241", "0.641838", "0.640692", "0.64013...
0.7246517
1
Set the width of all the columns at once, taking the percentages from the passed list.
def set_column_widths(self, clist): self.columns = len(clist) for i in range(self.columns): self.colwid[i] = clist[i]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __set_column_width(self):\n for i in range(0, len(self.header_width)):\n self.view.setColumnWidth(i, self.header_width[i])", "def setWidth(*args):", "def setWidth(*args):", "def setWidth(*args):", "def setWidth(*args):", "def setWidth(*args):", "def setWidth(*args):", "def setWi...
[ "0.6759513", "0.6526067", "0.6526067", "0.6526067", "0.6526067", "0.6526067", "0.6526067", "0.6526067", "0.6526067", "0.6526067", "0.6526067", "0.6526067", "0.6467374", "0.6360108", "0.61599517", "0.5957372", "0.5752069", "0.56696403", "0.5639448", "0.5638654", "0.5615438", ...
0.7743246
0
Set the width of a specified column to the specified width.
def set_column_width(self, index, width): self.colwid[index] = width
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def SetColumnWidth(self, column, width):\r\n \r\n if column < 0 or column >= self.GetColumnCount():\r\n raise Exception(\"Invalid column\")\r\n\r\n self._total_col_width -= self._columns[column].GetWidth()\r\n self._columns[column].SetWidth(width)\r\n self._total_col_w...
[ "0.8275198", "0.8051967", "0.7529646", "0.7405566", "0.7389673", "0.7142246", "0.7070048", "0.68435705", "0.6804257", "0.6693521", "0.66881835", "0.65535086", "0.65136516", "0.6489625", "0.6469331", "0.64580953", "0.64580953", "0.64580953", "0.64580953", "0.64580953", "0.6458...
0.8418978
0
Defines if a right border in used
def set_right_border(self, val): self.rborder = val
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rightframeborderoff(cls):\n cls.right_frame['highlightthickness'] = 0", "def border(self):\n ...", "def rightbox(self):\r\n pass", "def getBorderFlags():\n\treturn border_flag", "def border(self):\r\n\t\treturn self._border", "def set_left_border(self, val):\n self.lborder...
[ "0.68664896", "0.6642183", "0.642791", "0.6375472", "0.63121057", "0.6302553", "0.6234603", "0.61621845", "0.6157814", "0.6145464", "0.6145464", "0.6138981", "0.60701907", "0.59811795", "0.5954375", "0.59495926", "0.59238166", "0.5905673", "0.58858347", "0.5884089", "0.588203...
0.80175745
0
Defines if a left border in used
def set_left_border(self, val): self.lborder = val
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def leftframeborderoff(cls):\n cls.left_frame['highlightthickness'] = 0", "def _is_left_edge(self, ndx):\n if len(self._dims)== 1:\n return ndx == 0\n return ndx < self._dims[1]", "def border(self):\n ...", "def getBorderFlags():\n\treturn border_flag", "def IsLeftDoc...
[ "0.70413435", "0.66685605", "0.6345007", "0.6264619", "0.62617964", "0.62232846", "0.62126046", "0.61926544", "0.6165064", "0.6120788", "0.6105952", "0.6072327", "0.60005605", "0.5992448", "0.5982933", "0.5981157", "0.5977957", "0.59509814", "0.5895324", "0.5895324", "0.58911...
0.8141564
0
Defines if a top border in used
def set_top_border(self, val): self.tborder = val
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def border(self):\n ...", "def topBorderFor( player ):\n return centerTextAt( \"\", default_display_vars.borderChar_Top, getUserScreenWidth( player ) )", "def HasGripperTop(self):\r\n\r\n return self.HasFlag(self.optionGripperTop)", "def GripperTop(self, attop=True):\r\n \r\n r...
[ "0.66174763", "0.6470724", "0.64533097", "0.627558", "0.6166172", "0.6139952", "0.6020186", "0.60169846", "0.60169846", "0.6011903", "0.60111123", "0.60063803", "0.5995756", "0.5969622", "0.58888805", "0.58888805", "0.58380824", "0.5770998", "0.57503366", "0.5717747", "0.5710...
0.76243424
0
Defines if a bottom border in used
def set_bottom_border(self, val): self.bborder = val
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def border(self):\n ...", "def bottomBorderFor( player ):\n return centerTextFor( player, \"\", default_display_vars.borderChar_Bottom )", "def isBottom(self):\n return self.bottom", "def HasBorder(self):\r\n \r\n return self.HasFlag(self.optionPaneBorder)", "def borders(self...
[ "0.6883019", "0.6749164", "0.67282933", "0.6515105", "0.6510314", "0.6445598", "0.63622177", "0.6343225", "0.6306105", "0.62943786", "0.62870574", "0.62784487", "0.6187134", "0.61684763", "0.616482", "0.61413944", "0.61413944", "0.61305714", "0.61050344", "0.60874295", "0.606...
0.7958736
0
Initialize and return a tabix reader object for subsequent tabix_get() calls.
def tabix_init(): tabix = load_shared_library('tabix') if (tabix == None): return None tabix.ti_read.restype = c_char_p # on Mac OS X 10.6, the following declarations are required. tabix.ti_open.restype = c_void_p tabix.ti_querys.argtypes = [c_void_p, c_char_p] tabix.ti_querys.restype = c_vo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def open_reader(self, **kw):\n return self.table.open_reader(str(self), **kw)", "def __init__(self, fp, thrift_base):\r\n ThriftRecordIO.assert_has_thrift()\r\n if not thrift_base:\r\n raise ThriftRecordIO.ThriftUnsuppliedException(\r\n 'Must construct ThriftRecordReader with valid thrif...
[ "0.6326279", "0.63021135", "0.6254", "0.607567", "0.59633064", "0.564539", "0.5636553", "0.5579402", "0.55439866", "0.5534084", "0.5520355", "0.5492369", "0.5491401", "0.54427826", "0.54417884", "0.54338014", "0.54261786", "0.5419037", "0.5365143", "0.5346173", "0.5339926", ...
0.6618322
0
Performa query that read data ("select" statement)
def read(self, query): t1 = time.time() if self.database in ['redshift', 'postgres']: ret = postgres_helper.fetchall(config=self.conf, sql=query) else: raise Exception("database not supported yet: '{}'" .format(self.database)) t2...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_data(query):\n db = psycopg2.connect(database=DBNAME)\n c = db.cursor()\n c.execute(query)\n data = c.fetchall()\n db.close()\n return data", "def get_data(query):\n db = psycopg2.connect(database=DBNAME)\n c = db.cursor()\n c.execute(query)\n data = c.fetchall()\n db.clo...
[ "0.709314", "0.709314", "0.6972477", "0.6920157", "0.6900757", "0.6877643", "0.68701386", "0.6856005", "0.67879015", "0.6689552", "0.6670152", "0.6652809", "0.6617898", "0.66163635", "0.6590509", "0.65665734", "0.65189326", "0.6489373", "0.6484665", "0.64830947", "0.6477366",...
0.73528874
0
Freeze all parameters of `net`
def freeze(net): for p in net.parameters(): p.requires_grad_(False) return net
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unfreeze(net):\n for p in net.parameters():\n p.requires_grad_(True)\n return net", "def freeze(self):\n # Freeze.\n self.frozen = True\n for param in self.parameters():\n param.requires_grad = False", "def __freeze(self):\r\n features_layer = self._model...
[ "0.7966241", "0.7187328", "0.7122004", "0.7078595", "0.70181316", "0.68783057", "0.6774389", "0.6707521", "0.66708046", "0.66631836", "0.66451365", "0.6607336", "0.6528228", "0.6503718", "0.6395548", "0.6271478", "0.6230465", "0.6174202", "0.613142", "0.6124019", "0.6113008",...
0.8028887
0
Unfreeze all parameters of `net`
def unfreeze(net): for p in net.parameters(): p.requires_grad_(True) return net
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def freeze(net):\n for p in net.parameters():\n p.requires_grad_(False)\n return net", "def unfreeze_layers(model: torch.nn.Module) -> None:\n for param in model.parameters():\n param.requires_grad = True", "def __freeze(self):\r\n features_layer = self._model._net\r\n for ...
[ "0.72357833", "0.7064379", "0.6781601", "0.6590634", "0.6506778", "0.6480661", "0.63610387", "0.6295241", "0.6283971", "0.62608975", "0.624865", "0.6229807", "0.6151874", "0.6148073", "0.6140297", "0.6124738", "0.61239815", "0.6103413", "0.6091473", "0.60638964", "0.60376936"...
0.8412342
0
Compute the entropy of the categorical distribution specified by the logits `out` along dimension `dim`.
def entropy(out, dim=1, reduce='mean'): log_prob = F.log_softmax(out, dim=dim) h = -torch.sum(log_prob.exp() * log_prob, dim=dim) if reduce == 'none': return h if reduce == 'mean': return h.mean() if reduce == 'sum': return h.sum()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def entropy_fn(args: StepFunctionArgs) -> SingleScorePerStepTensor:\n logits = args.attribution_model.output2logits(args.forward_output)\n out = torch.distributions.Categorical(logits=logits).entropy()\n if out.ndim > 1:\n out = out.squeeze(-1)\n return out", "def entropy(x):\n nz = np.nonz...
[ "0.71384525", "0.69670725", "0.6888391", "0.679668", "0.67822194", "0.6742934", "0.65603775", "0.65472746", "0.6542067", "0.65256166", "0.65150386", "0.64690787", "0.6459301", "0.6450607", "0.6447196", "0.6431473", "0.6423969", "0.6371483", "0.63533247", "0.6341583", "0.63393...
0.8238204
0
Counts the number of parameters of `net`
def nb_parameters(net): return sum(p.numel() for p in net.parameters())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_parameters(net):\r\n return sum(p.numel() for p in net.parameters() if p.requires_grad)", "def get_parameter_number(net):\n # print(type(net.parameters()))\n total_num = sum(p.numel() for p in net.parameters())\n trainable_num = sum(p.numel() for p in net.parameters() if p.requires_grad)\n ...
[ "0.80932635", "0.78887635", "0.7600187", "0.7538338", "0.7526785", "0.7526244", "0.74478954", "0.74346536", "0.74346536", "0.74346536", "0.73890316", "0.7386938", "0.7340822", "0.7327687", "0.7321227", "0.7281321", "0.7249664", "0.7189953", "0.7161822", "0.7148914", "0.713892...
0.8331685
0
Get a submodule at any depth of a net by its name
def layer_by_name(net, name): for l in net.named_modules(): if l[0] == name: return l[1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def returnRigNetworkNode(self):\n modules = []\n networkNodes = cmds.ls(type=\"network\")\n for node in networkNodes:\n attrs = cmds.listAttr(node)\n if \"moduleName\" in attrs:\n if cmds.getAttr(node + \".moduleName\") == self.name:\n ch...
[ "0.597291", "0.5945646", "0.5883425", "0.5883425", "0.5880742", "0.58022046", "0.5745263", "0.5617044", "0.5609998", "0.55480266", "0.5542549", "0.55382264", "0.55318534", "0.5530302", "0.55277735", "0.5472227", "0.5464447", "0.54170537", "0.5414487", "0.54097706", "0.5400159...
0.677068
0
Cycle through `iterable` forever
def forever(iterable): it = iter(iterable) while True: try: yield next(it) except Exception as e: print(e) it = iter(iterable)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cycle(iterator: Iterable[Any]) -> Iterable[Any]:\n while True:\n yield from iterator", "def cycle(obj):\r\n while True:\r\n for item in obj:\r\n yield item", "def iter_sequence_infinite(seq):\n while True:\n for item in seq:\n yield item", "def pick(iterable):\n ...
[ "0.8115654", "0.7242247", "0.70141625", "0.6768458", "0.6365863", "0.63156235", "0.6294322", "0.6273144", "0.6229883", "0.6152843", "0.61099154", "0.60607177", "0.6034094", "0.6027254", "0.5995027", "0.5991488", "0.59734607", "0.59694564", "0.5939427", "0.5904821", "0.5901980...
0.7716013
1
Return the Gram matrix of `m`
def gram(m): m1 = m m2 = m.t() g = torch.mm(m1, m2) / m.shape[1] return g
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_GS_matrix(self, matrix):\n GS_matrix = Matrix(QQ, matrix.transpose().gram_schmidt()[0]).transpose()\n return GS_matrix", "def bgram(m):\n m = m.view(m.shape[0], m.shape[1], -1)\n m1 = m\n m2 = m.permute(0, 2, 1)\n g = torch.bmm(m1, m2) / (m.shape[1] * m.shape[2])\n retur...
[ "0.6688958", "0.6615292", "0.64081323", "0.63711166", "0.6317854", "0.62635905", "0.61815953", "0.6151277", "0.61144227", "0.609927", "0.60449326", "0.60215586", "0.6005096", "0.59399354", "0.5856431", "0.58205944", "0.58048844", "0.5713924", "0.5711078", "0.56965727", "0.569...
0.71347463
0
Return the batched Gram matrix of `m`
def bgram(m): m = m.view(m.shape[0], m.shape[1], -1) m1 = m m2 = m.permute(0, 2, 1) g = torch.bmm(m1, m2) / (m.shape[1] * m.shape[2]) return g
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gram_matrix(input_tensor):\r\n\r\n temp = tf.squeeze(input_tensor)\r\n return tf.matmul(temp, tf.transpose(temp))", "def gram(m):\n m1 = m\n m2 = m.t()\n g = torch.mm(m1, m2) / m.shape[1]\n return g", "def bartlett(M):\r\n return bartlett_(M)", "def gram_matrix(input_data):\n a, b...
[ "0.61024183", "0.6085936", "0.5908195", "0.5840925", "0.5817203", "0.56533", "0.562997", "0.5583973", "0.556033", "0.55166227", "0.54819024", "0.5479146", "0.5469392", "0.5464788", "0.54570687", "0.54411006", "0.5395656", "0.534545", "0.5327879", "0.53123766", "0.5294155", ...
0.66467696
0
Send all tensors contained in `x` to `device`, when `x` is an arbitrary nested datastructure of dicts and lists containing tensors
def send_to_device(x, device, non_blocking=False): if isinstance(x, torch.Tensor): return x.to(device, non_blocking=non_blocking) elif isinstance(x, list): return [ send_to_device(xx, device, non_blocking=non_blocking) for xx in x ] elif isinstance(x, tuple): retu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_device(data, device):\n if isinstance(data, (list,tuple)): # allows to apply function to lists or tuples of tensors\n return [to_device(x, device) for x in data]\n return data.to(device, non_blocking=True)", "def to(self, device):\n for item in self.data:\n if torch.is_tenso...
[ "0.67284745", "0.66008097", "0.6446256", "0.6315414", "0.62373644", "0.62007165", "0.6134738", "0.6002824", "0.5938364", "0.5871974", "0.5869342", "0.57675153", "0.5750202", "0.56997794", "0.56997794", "0.56997794", "0.56997794", "0.5687243", "0.56803846", "0.56477666", "0.56...
0.68736905
0
Recursively call state_dict() on all elements contained in a list / tuple / dict so that it can be saved safely via torch.save().
def recursive_state_dict(x): if hasattr(x, 'state_dict'): return x.state_dict() if isinstance(x, tuple): return tuple(recursive_state_dict(xx) for xx in x) if isinstance(x, list): return [recursive_state_dict(xx) for xx in x] if isinstance(x, dict): return {k: recursive_s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _post_state_dict_hook(\n module: nn.Module,\n state_dict: Dict[str, Any],\n prefix: str,\n *args: Any,\n ) -> Dict[str, Any]:\n self = cast(FullyShardedDataParallel, module)\n processed_state_dict = self._post_state_dict_hook_fn[self._state_dict_type](state_dict, pr...
[ "0.60192704", "0.5873791", "0.58293617", "0.57695657", "0.57536656", "0.5732549", "0.57282263", "0.57053864", "0.5699387", "0.5699387", "0.5684025", "0.5641588", "0.5641588", "0.5633706", "0.5621523", "0.5619566", "0.5619566", "0.5589749", "0.55805403", "0.55455166", "0.55158...
0.6610024
0
r""" Spherical linear interpolate between `z1` and `z2` according to `t`.
def slerp(z1, z2, t): z1_l = z1.pow(2).sum(dim=-1, keepdim=True).sqrt() z1_n = z1 / z1_l z2_l = z2.pow(2).sum(dim=-1, keepdim=True).sqrt() z2_n = z2 / z2_l dot = torch.sum(z1_n * z2_n, dim=-1).clamp(-1, 1) theta_0 = torch.acos(dot) theta = t * theta_0 z3 = z2_n - dot * z1_n z3 = z...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def interpolate(x_list, y_list, z_list):\n x1 = x_list[-2]\n x2 = x_list[-1]\n y1 = y_list[-2]\n y2 = y_list[-1]\n z1 = z_list[-2]\n z2 = z_list[-1]\n r = -y1/y2\n x_land = (x1+r*x2)/(r+1)\n z_land = (z1+r*z2)/(r+1)\n x_list[-1] = x_land\n y_list[-1] = 0.0\n z_list[-1] = z_land"...
[ "0.6512685", "0.6440983", "0.61869675", "0.61836207", "0.6150891", "0.5991571", "0.5864246", "0.5859889", "0.58573407", "0.58359", "0.58130884", "0.5802004", "0.5726565", "0.56494033", "0.564807", "0.56478196", "0.56105006", "0.5579916", "0.5520143", "0.5476111", "0.5449468",...
0.8154768
0
When eps is set to zero, any broken frequency will damage the ref_channel estimation. Independent if target_psd_matrix or noise_psd_matrix is zero or inf.
def test_difficulties_without_eps_multi(self): def get_beamformer(A, B): return get_mvdr_vector_souden( A, B, eps=0, return_ref_channel=True ) for args in [ ( [self.PhiXX * 0, self.PhiXX], ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_difficulties_eps_multi(self):\n well_w = self.get_w_well_behaviour()\n\n def get_beamformer(A, B):\n return get_mvdr_vector_souden(\n A, B,\n return_ref_channel=True\n )\n\n for args in [\n (\n [self.PhiXX *...
[ "0.544045", "0.5354141", "0.52479935", "0.52349603", "0.52272445", "0.51748747", "0.51745343", "0.5129748", "0.5118663", "0.5110409", "0.50291836", "0.5009186", "0.5007034", "0.4982783", "0.4966813", "0.49501437", "0.49423245", "0.49239942", "0.4920314", "0.4920293", "0.49141...
0.5363968
1
Dada uma coordenada da matriz (lin,col) transforma em coordenada Turtle
def em_coord_turtle(lin, col, dim, tam_celula): meio = dim // 2 x = (col - meio) * tam_celula y = (meio - lin) * tam_celula return x, y
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def coordinates(self):", "def position(t):\n return c + tangent_vec * 7 * t ** 2", "def ra2xy(self, ra):\n return -math.sin(ra), math.cos(ra)", "def trajectoire(self):\n trajx = []\n trajy = []\n for i in range(0, len(self.pos)):\n trajx.append(self.pos[i].x)\n ...
[ "0.60562533", "0.5994425", "0.59405386", "0.594034", "0.5853108", "0.57843846", "0.5775709", "0.576947", "0.5756959", "0.57361114", "0.5690496", "0.5659488", "0.5646095", "0.5643621", "0.5636459", "0.5635302", "0.5627718", "0.56259024", "0.562121", "0.5606195", "0.56057143", ...
0.7198467
0
Recreates database table and populates with seed data. Know that this will reset your db to defaults
def recreate(): from data.seed import Seed if click.confirm("Are you sure you want to lose all your data"): db.drop_all() db.create_all() Seed().data()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recreate_db():\n drop_db()\n create_db()\n populate_db()", "def reset_db():\n db.drop_all()\n _init_db()", "def recreate_db():\n\n print(\"will reinit db - FAKE\")\n db.create_tables([Message, Instance])\n\n # no need to prepare a sample record.\n # use http to create init reques...
[ "0.7524338", "0.75184804", "0.7442109", "0.7368387", "0.7292522", "0.72371817", "0.72340506", "0.7040728", "0.6964414", "0.6949868", "0.690078", "0.6897268", "0.6821358", "0.6815195", "0.6735268", "0.67309934", "0.6709054", "0.6651812", "0.6625447", "0.6622221", "0.66213125",...
0.78233486
0
Get attribute values by column name from a shapefile
def get_shp_attribute_by_name(shpfname, attrname): driver = ogr.GetDriverByName("ESRI Shapefile") vector = driver.Open(shpfname, 0) layer = vector.GetLayer(0) f = layer.GetFeature(0) val = [] for i in range(layer.GetFeatureCount()): f = layer.GetFeature(i) val.append(f.Ge...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_column_ontology_details(self, column_name):\n ontology_details = []\n \n try:\n con = self.getMetadataDatabaseConnection()\n ontologies = con.cursor()\n con.cursor().callproc('qiime_assets.get_column_ontologies', [column_name, ontologies])\n ...
[ "0.60772455", "0.56066895", "0.5523452", "0.55085415", "0.54409367", "0.5423855", "0.53664464", "0.53392047", "0.53326654", "0.5331746", "0.53259516", "0.5319814", "0.5301684", "0.52871823", "0.526558", "0.5256799", "0.52234125", "0.52222466", "0.52016175", "0.52005154", "0.5...
0.6711834
0
Method for viewing associated budget lines.
def view_budget_lines(self, cr, uid, ids, context=None): ctx = context.copy() ctx['default_line_id'] = ids[0] ctx['allow_create'] = True # Return view with budget lines return { 'name': _('Budget lines'), 'domain': "[('line_id', 'in', %s)]" % ids, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def view_budgets(self) -> None:\n Menu.prompt_view_budgets()\n for budget in self.user.budget_manager:\n print(f\"{budget}\\n\")", "def view(self):\n\n print('Here\\'s your expense and income records:\\n'+' '*3+'Category'+' '*7+\\\n 'Description'+' '*4+'Amount\\n'+'='*4...
[ "0.6536247", "0.59003717", "0.5458764", "0.5376334", "0.529271", "0.5250406", "0.524472", "0.5224364", "0.5208676", "0.5186037", "0.5180147", "0.5137883", "0.5071792", "0.50220627", "0.49618864", "0.49447742", "0.4937259", "0.49017215", "0.48628005", "0.4855341", "0.481696", ...
0.75069165
0
Get token sequence from cursor when preordered traversing.(exclude node in 'exclude_types')
def get_tokens(self): def _traverse_preorder(cursor, token_list): # There is a method called "walk_preorder" in Cursor class. Here we need to ignore some subtrees so we implement on our own. if cursor.location.file and cursor.location.file.name != self.filepath: # exclude "#include <...>" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cursor(self):\n try:\n return self.tokens[self.pos]\n except IndexError:\n raise ParseError(\"No tokens left for cursor to traverse\")", "def walk(predicate, cursor):\n return (c for c in cursor.walk_preorder() if predicate(c))", "def gettok(self):\n try:\n ...
[ "0.5911447", "0.58838665", "0.57942325", "0.578882", "0.57581866", "0.5740371", "0.5737432", "0.5732957", "0.572129", "0.56305766", "0.5559917", "0.5542572", "0.55267996", "0.55039823", "0.54972017", "0.549295", "0.54885024", "0.54572934", "0.54447335", "0.5441865", "0.540282...
0.6444085
0
Return the integer part of the square root of x, even for very large integer values. Python 'math' module does not operate as expected for large integers.
def integer_sqrt(x: int): assert x > 0 _1_40 = 1 << 40 # 2**40 if x < _1_40: return int(sqrt(x)) # use math's sqrt() for small parameters n = int(x) if n <= 1: return n # handle sqrt(0)==0, sqrt(1)==1 # Make a high initial estimate of the result (a little lower is slower...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mySqrt(self, x: int) -> int:\n if x == 0:\n return 0\n d = 0.1\n y = x / 2\n z = (y + x/y) / 2\n e = abs(z-y)\n while e > d:\n y = z\n z = (y + x/y) / 2\n e = abs(z - y)\n return int(z)", "def my_sqrt(x):\n square_root = x**(0.5)\n return square_root", "def ge...
[ "0.8057233", "0.7838644", "0.78350353", "0.75958186", "0.73332125", "0.72782975", "0.72482723", "0.7227843", "0.7005679", "0.7000568", "0.6877222", "0.68424505", "0.6837487", "0.67499954", "0.67402005", "0.6725246", "0.6717746", "0.6702041", "0.6646816", "0.66265327", "0.6616...
0.8287289
0
Return the nearest value to a given one in a list.
def closestValue(aList: list, givenV: int): abs_diff = lambda list_value: abs(list_value - givenV) return min(aList, key=abs_diff)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getnearest(iterable, value):\n return min(enumerate(iterable), key=lambda i: abs(i[1] - value))", "def closest_value_index(val, lst):\n index = 0\n for item in lst:\n if item > val:\n return index\n index += 1\n return index-1", "def _get_index_closest_val(list, val):\n...
[ "0.82866627", "0.7399142", "0.73603547", "0.73322725", "0.73053616", "0.7174279", "0.7174279", "0.71739745", "0.71574485", "0.71542096", "0.7151316", "0.71261716", "0.7085714", "0.70616233", "0.7042835", "0.69857186", "0.6985201", "0.69779974", "0.69681966", "0.69561845", "0....
0.76117915
1
Return a randomlychosen element from a list and remove it. Be careful to set bucket = GivenList.copy() to not loose original variable !
def randomClosureChoice(bucket: list): import secrets choice = secrets.choice(bucket) bucket.remove(choice) return choice
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_randomico(lista, qtd_remocao):\n for i in range(qtd_remocao):\n lista.pop(random.randrange(len(lista))) \n return lista", "def popitem(self):\n all_items = self.items()\n removed_item = random.choice(all_items)\n self[removed_item[0]] = None\n return removed...
[ "0.66138875", "0.6564587", "0.65421885", "0.6370683", "0.6352258", "0.6317444", "0.61707795", "0.61280763", "0.6087329", "0.60718876", "0.6040918", "0.60279614", "0.58906007", "0.58702135", "0.58437747", "0.58181566", "0.5816611", "0.57801473", "0.57371235", "0.5733281", "0.5...
0.66175485
0
Return a boolean of if the value are coprime. Two values are said to be coprime if they have no common prime factors. This is equivalent to their greatest common divisor (gcd) being 1.
def coprime(a: int, b: int): return euclid(a, b) == 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def coprime(a, b):\n return gcd(a, b) == 1", "def coprime(self,x,y):\r\n return x == 1 or y == 1 or not bool(self.cofactors(x,y))", "def coprime(m,n):\r\n # The function uses the Euclid's algorithm for finding the greatest common divisor. The algorithm is recursive.\r\n # If the GCD is 1, when ...
[ "0.8151116", "0.76198447", "0.6820226", "0.6649169", "0.65843964", "0.6367718", "0.62974745", "0.62864256", "0.6271171", "0.6185582", "0.6122723", "0.6101257", "0.60979694", "0.60873055", "0.6075344", "0.5987454", "0.5984497", "0.5948677", "0.5948677", "0.59447944", "0.592833...
0.7659492
1
Check if elements of a list are pairwise coprime.
def pairwise_coprime(listing: list): assert isinstance(listing, list) size = len(listing) for i in range(0, size - 1): for j in range(i + 1, size): if not coprime(listing[i], listing[j]): return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_restraint_pairs_for_doubles(list): # Also consider that a1 and a2 can be switches\r\n for i in range(len(list) - 1):\r\n for j in range(i + 1, len(list)):\r\n if (list[i].r1 == list[j].r1 and list[i].r2 == list[j].r2) or (\r\n list[i].r1 == list[j].r2 and list[i]....
[ "0.62395567", "0.61482817", "0.6120177", "0.6115486", "0.6090449", "0.592758", "0.5890369", "0.58721393", "0.58647364", "0.58555436", "0.58174556", "0.57909375", "0.5681002", "0.56805116", "0.56683934", "0.5644282", "0.5635076", "0.5634428", "0.5613893", "0.55734193", "0.5571...
0.854069
0
Decomposes an integer n into prime factors and returns the corresponding set. A prime number can only be divided by 1 or itself, so it cannot be factored any further! Every other whole number can be broken down into prime number factors. It is like the Prime Numbers are the basic building blocks of all numbers. Set exp...
def findPrimeFactors(n: int, exponent: bool = False): s = [] # Number of 2s that divide n while n % 2 == 0: s.append(2) n = n // 2 nroot = integer_sqrt(n) # n must be odd at this point. So we can # skip one element (Note i = i +2) for i in range(3, nroot, 2): # Wh...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prime_factors_set(n):\n factors = []\n d = 2\n while n > 1:\n while n % d == 0:\n factors.append(d)\n n /= d\n d = d + 1\n if d*d > n:\n if n > 1: factors.append(n)\n break\n return list(set(factors))", "def getallprimefactors(n):\n...
[ "0.7794402", "0.75982153", "0.7502622", "0.74230844", "0.74169475", "0.73915225", "0.7347283", "0.7342058", "0.7326059", "0.7312405", "0.7305889", "0.72976536", "0.7269161", "0.72683316", "0.7263194", "0.7233486", "0.72117335", "0.7176523", "0.7133461", "0.7125444", "0.710498...
0.80150515
0
Reversible mapping using Chinese Remainder Theorem into/from Zpq.
def mapperCRT(elt, p: int, q: int, action: bool = True, Verbose: bool = False): # Mapping if action: a = elt % p b = elt % q if Verbose and q != p: print(f"Converting {elt} in Zpq to a in Zp and b in Zq.") print(f"With a = {a} mod {p} and b = {b} mod {q}") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decode(self, z):\n if self.switch:\n x = self.bijecter(z, inverse=True)\n return self.decode_(x)\n else:\n return self.decode_(z)", "def getReversePam(self):\n watson = \"ACGTYRSWKMBDHVN\"\n crick = \"TGCARYSWMKVHDBN\"\n return self.forwardPam...
[ "0.5949792", "0.5576696", "0.5559757", "0.5489173", "0.5471126", "0.54544353", "0.54544353", "0.53757817", "0.53221095", "0.52354676", "0.5227212", "0.5202208", "0.5193444", "0.5171219", "0.5162975", "0.5156324", "0.51469314", "0.5143449", "0.5138922", "0.5122853", "0.5093745...
0.6318922
0
BabyStep GiantStep solution for discrete algorithm problem. res = g^x mod modulo => log_g(res) = x mod modulo Use hash table for fast searching of huge values.
def bsgs(g: int, res: int, modulo: int): assert millerRabin(modulo) # https://en.wikipedia.org/wiki/Baby-step_giant-step from ressources.multGroup import inv m = integer_sqrt(modulo) + 1 hashTable = {square_and_multiply(g, j, modulo): j for j in range(m)} # Baby-Step gm = square_and_multi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def r_soft_hash(x):\n if abs(x) < 1e-9:return 0\n # round it to some number of bits\n b = ns.round(ns.log(abs(x)) / ns.log(2))\n gran = 2**(b-30)\n return ns.round(x / gran) * gran", "def PRGA(tab):\n i = 0\n j = 0\n while True:\...
[ "0.63904697", "0.63661796", "0.62169975", "0.6154469", "0.61477077", "0.6140015", "0.60482365", "0.6001942", "0.59961516", "0.59816265", "0.5975602", "0.5973159", "0.59528214", "0.59457916", "0.5908312", "0.5883713", "0.5881319", "0.5855098", "0.5848327", "0.5817985", "0.5809...
0.76539564
0
Get project scoped token suitable for instance creation.
def get_project_token() -> str: body = app.config["TOKEN_BODY"].copy() if app.config.get("ADMIN_PROJECT_ID") is None: app.config["ADMIN_PROJECT_ID"] = get_admin_project_id() body["auth"]["scope"] = {"project": {"id": app.config["ADMIN_PROJECT_ID"]}} token_rq = request(method="POST", url=app.co...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def token(self):\n return self._generate_jwt_token()", "def token(self):\n return self._generate_jwt_token()", "def token(self):\n return self._generate_jwt_token()", "def token(self):\n if self.is_auth_needed():\n self.authorize()\n\n return self.get_from_cache(...
[ "0.6736661", "0.6736661", "0.6736661", "0.6723815", "0.66672206", "0.6584221", "0.65270853", "0.64946264", "0.6408879", "0.6393113", "0.6387492", "0.63707364", "0.63696975", "0.634789", "0.634789", "0.6322874", "0.6322874", "0.6322874", "0.6304796", "0.62858045", "0.62819093"...
0.7176986
0
Find network id by it's name
def get_network_id_by_name(name: str) -> str: networks_info = get_networks() for network in networks_info["networks"]: if network["name"] == name: return network["id"] raise AttributeError(f"No network named {name}")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def network_id(tenant_id, auth_token, network_name):\r\n content = common_utils.do_request(\r\n tenant_id, auth_token,\r\n method='GET',\r\n body='', service=\"network\",\r\n path='networks.json')\r\n for network ...
[ "0.7981729", "0.74194354", "0.6850195", "0.6796734", "0.6718263", "0.671195", "0.665859", "0.665859", "0.665859", "0.65889955", "0.658055", "0.65149903", "0.6505313", "0.6490205", "0.6374185", "0.6365825", "0.63096875", "0.6294096", "0.62506366", "0.62314224", "0.6166681", ...
0.83324456
0
Get admin project identificator
def get_admin_project_id() -> str: token_rq = request( method="POST", url=app.config["TOKEN_REF"], json=app.config["TOKEN_BODY"], ) if not token_rq.ok: raise HTTPError(token_rq.status_code) projects_rq = request( method="GET", url=app.config["PROJECTS_REF"], hea...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_project_admin_instance_name(projectname):\n\n return \"{}admin\".format(projectname.lower())", "def get_project_admin_instance_name(self):\n\n return get_project_admin_instance_name(self.short_name)", "def get_project(self):\n if self.api_version == 2:\n return self.creds.ge...
[ "0.7387236", "0.69870627", "0.69535977", "0.68997014", "0.6872954", "0.6857882", "0.6620361", "0.6620361", "0.6566122", "0.65610564", "0.65610564", "0.65610564", "0.6554312", "0.65290195", "0.65290195", "0.65290195", "0.6526947", "0.6487364", "0.6470634", "0.6441271", "0.6372...
0.7840168
0
Make a request to get active instances from devstack.
def get_instances() -> dict: url = f"{app.config['COMPUTE_SERVERS_REF']}/detail" instances_rq = request( method="GET", url=url, headers=build_header(), params={"vm_state": "active"}, ) if not instances_rq.ok: HTTPError(instances_rq.status_code) answer = {"servers": list()} for ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_instances():\n if request.method == \"GET\":\n return render_template(\"instances.html\")", "def _wait_active(client, request_id, max_num):\n logging.info('Waiting for instances to be active')\n while True:\n res = client.describe_spot_fleet_instances(SpotFleetRequestId=request_id...
[ "0.62801725", "0.6206286", "0.6043972", "0.60251874", "0.601637", "0.6010178", "0.600573", "0.59135395", "0.59109515", "0.59018254", "0.580947", "0.57854295", "0.5749351", "0.5730138", "0.56535864", "0.5635016", "0.5552074", "0.55247796", "0.5519387", "0.5506227", "0.5499615"...
0.63484895
0
Find flavor id by it's name.
def find_flavor_id(flavor_name: str): for flavor in get_flavors()["flavors"]: if flavor_name == flavor["name"]: return flavor["id"] raise AttributeError(f"No flavor '{flavor_name}' found")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_flavor_id(self, flavor_name):\n _url = \"http://\" + self.host_ip + \":8774/v2/\" +\\\n self.cloud_admin_info[\"project_id\"] + \\\n \"/flavors/detail\"\n _headers = {'x-auth-token': self.cloud_admin_info[\"token_project\"]}\n _body = None\n\n response = se...
[ "0.8154346", "0.752519", "0.7301478", "0.72637576", "0.7042125", "0.70403224", "0.6932511", "0.6932511", "0.6680423", "0.66455835", "0.6394901", "0.63073426", "0.626384", "0.61803275", "0.61803275", "0.6032037", "0.59394425", "0.5854552", "0.5762916", "0.5756223", "0.57414234...
0.8740929
0
Prepares the json files for the Voicebank dataset. Expects the data folder to be the same format as the output of ``download_vctk()`` below. Arguments
def prepare_voicebank( data_folder, save_folder, valid_speaker_count=2, skip_prep=False ): if skip_prep: return # Setting ouput files save_json_train = os.path.join(save_folder, TRAIN_JSON) save_json_valid = os.path.join(save_folder, VALID_JSON) save_json_test = os.path.join(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prepare_jsonlbpe_data(data_dir, train_data_file, dev_data_file, vocab_file):\n if not gfile.Exists(data_dir):\n gfile.MkDir(data_dir)\n\n # Get wmt data to the specified directory.\n train_path = get_qa_set(data_dir, train_data_file)\n dev_path = get_qa_set(data_dir, dev_data_file)\n\n # ...
[ "0.62081885", "0.6122723", "0.6101541", "0.6090445", "0.5949171", "0.5927241", "0.59200364", "0.58897924", "0.58572596", "0.5853755", "0.58109206", "0.57762074", "0.57556504", "0.5751836", "0.5726079", "0.57242584", "0.56926864", "0.56814444", "0.5679649", "0.5651899", "0.565...
0.65272224
0
Creates the lexicon object, downloading if it hasn't been done yet. Arguments
def create_lexicon(lexicon_save_filepath): if not os.path.isfile(lexicon_save_filepath): download_file(LEXICON_URL, lexicon_save_filepath) # Iterate lexicon file and add the first pronunciation in the file for # each word to our lexicon dictionary lexicon = MISSING_LEXICON delayed_wo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_lexicon(self):\n self.logger.info(\"Preparing lexicon...\")\n current_dir = Path()\n dir_path = current_dir / \"data\" / \"break_data\" / \"lexicon_by_logical\"\n file_name = \"lexicon\"\n\n if self.domain_split:\n file_name += \"_domain_split\"\n elif s...
[ "0.59617376", "0.5480266", "0.53487563", "0.5315897", "0.50601566", "0.48838323", "0.48664385", "0.48546046", "0.4842769", "0.47873044", "0.47842023", "0.4728167", "0.47178552", "0.47145215", "0.4710691", "0.4710036", "0.47037318", "0.4697695", "0.4661034", "0.46569374", "0.4...
0.5611766
1
Creates the json file given a list of wav files. Arguments
def create_json(wav_lst, json_file, clean_folder, txt_folder, lexicon): logger.debug(f"Creating json lists in {json_file}") # Processing all the wav files in the list json_dict = {} for wav_file in wav_lst: # ex:p203_122.wav # Example wav_file: p232_001.wav noisy_path, filenam...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def create_upload_files(files: List[UploadFile] = File(...)):\n\n if len(files) > 3:\n return {\" \": {\"mode\": \"File Limit Exceeded\"}}\n \n filename = \"_temp_files_one/myfilem.wav\"\n res_json = {}\n file_counter = 0\n for upload_file in files:\n \n with open(f...
[ "0.6976213", "0.6822995", "0.6490898", "0.61406285", "0.6051366", "0.6036552", "0.59901935", "0.59424925", "0.5882625", "0.58272076", "0.5790114", "0.57872635", "0.57773167", "0.5763445", "0.5733302", "0.5714365", "0.57103807", "0.57057214", "0.56364584", "0.563437", "0.55815...
0.795731
0
Mean attentive vectors. Calculate mean attentive vector for the entire sentence by weighted summing all the contextual embeddings of the entire sentence Arguments
def _mean_attentive_vectors(self, x2, cosine_matrix): # (batch_size, x1_timesteps, x2_timesteps, 1) expanded_cosine_matrix = K.expand_dims(cosine_matrix, axis=-1) # (batch_size, 1, x2_timesteps, embedding_size) x2 = K.expand_dims(x2, axis=1) # (batch_size, x1_timesteps, embedding...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def word_average(self, sent):\n\n mean = []\n for word in sent:\n if word in self.word_model.wv.vocab:\n mean.append(self.word_model.wv.get_vector(word) *\n self.word_idf_weight[word]) # idf weighted\n\n if not mean: # empty words\n ...
[ "0.7076769", "0.6930274", "0.68626755", "0.6553769", "0.6473644", "0.64046896", "0.63692224", "0.63644546", "0.6316079", "0.62446725", "0.6241801", "0.6147459", "0.61322665", "0.61276716", "0.6124915", "0.61032724", "0.60569805", "0.6038638", "0.59962136", "0.59507346", "0.59...
0.7121484
0
Max attentive vectors. Calculate max attentive vector for the entire sentence by picking the contextual embedding with the highest cosine similarity as the attentive vector. Arguments
def _max_attentive_vectors(self, x2, cosine_matrix): # (batch_size, x1_timesteps) max_x2_step = K.argmax(cosine_matrix, axis=-1) embedding_size = K.int_shape(x2)[-1] timesteps = K.int_shape(max_x2_step)[-1] if timesteps is None: timesteps = K.shape(max_x2_step)[-1] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def argmax(self, evidence={}):\n if len(evidence)==0:\n return self.v.ind2sub(self.t.argmax())\n ax = tuple([ evidence[v] if v in evidence else slice(None) for v in self.v ])\n return self.v.ind2sub( self.t[ax].argmax() )", "def _max_attentive_matching(self, h1, h2, cosine_matrix, w):\n # h1...
[ "0.66659194", "0.6598962", "0.6142109", "0.61344445", "0.60383004", "0.57514024", "0.57171726", "0.5634056", "0.56250244", "0.552597", "0.54989344", "0.5482426", "0.5477064", "0.5463241", "0.5459621", "0.54456", "0.5424129", "0.54171747", "0.5408878", "0.54040873", "0.5402832...
0.7494539
0
Attentive matching operation. Arguments
def _attentive_matching(self, h1, h2, cosine_matrix, w): # h1 * weights, (batch_size, h1_timesteps, mp_dim, embedding_size) h1 = self._time_distributed_multiply(h1, w) # attentive vector (batch_size, h1_timesteps, embedding_szie) attentive_vec = self._mean_attentive_vectors(h2, cosine_ma...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def matches(self, accession):\n pass", "def matches(self, feature):\n pass", "def matches(self):\n pass", "def match(self, *args):\n return _ida_hexrays.udc_filter_t_match(self, *args)", "def match(self, other):", "def match(self, *args):\n return _ida_hexrays.micro...
[ "0.66484064", "0.66251063", "0.658383", "0.65670645", "0.65059847", "0.6425929", "0.638338", "0.62863594", "0.62749875", "0.6251956", "0.6106831", "0.61030066", "0.60764915", "0.6075009", "0.60259986", "0.596115", "0.5895979", "0.58370674", "0.5822391", "0.5820696", "0.572014...
0.6913306
0
Max attentive matching operation. Arguments
def _max_attentive_matching(self, h1, h2, cosine_matrix, w): # h1 * weights, (batch_size, h1_timesteps, mp_dim, embedding_size) h1 = self._time_distributed_multiply(h1, w) # max attentive vector (batch_size, h1_timesteps, embedding_szie) max_attentive_vec = self._max_attentive_vectors(h2...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search_for_maximum(self):\n return self.maximise_aquisition(self.expected_improvement)", "def get_max(im, class_name, dets, thresh=0.5):\n inds = np.where(dets[:, -1] >= thresh)[0]\n max_inds = 0\n max_score = 0.0\n if len(inds) == 0:\n # print('Warning: no target detected!')\n ...
[ "0.64489824", "0.6357069", "0.6196171", "0.61691546", "0.6102832", "0.6094383", "0.60835683", "0.60593593", "0.605532", "0.5972025", "0.59391737", "0.5898913", "0.5883085", "0.5875223", "0.5875223", "0.58261126", "0.5818731", "0.5808261", "0.58059007", "0.57965726", "0.579289...
0.6604338
0
Create a wrapped, monitored SubprocVecEnv for Atari.
def make_atari_env(env_id, num_env, seed, wrapper_kwargs=None, start_index=0): if wrapper_kwargs is None: wrapper_kwargs = {} def make_env(rank): # pylint: disable=C0111 def _thunk(): env = make_atari(env_id) env.seed(seed + rank) env = Monitor(env, logger.get_dir() a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_custom_env(env_id, num_env, seed, wrapper_kwargs=None, start_index=0):\n if wrapper_kwargs is None: wrapper_kwargs = {}\n def make_env(rank): # pylint: disable=C0111\n def _thunk():\n env = gym.make(env_id)\n env.seed(seed + rank)\n env = Monitor(env, logger.g...
[ "0.6760588", "0.60681564", "0.58781356", "0.57016915", "0.55395484", "0.5519906", "0.55161077", "0.5502174", "0.5502174", "0.5502174", "0.5375453", "0.53703487", "0.53489786", "0.53385574", "0.5283076", "0.5265281", "0.52512294", "0.5250794", "0.5244433", "0.5228819", "0.5216...
0.6632491
1
Create an argparse.ArgumentParser for run_atari.py.
def atari_arg_parser(): parser = arg_parser() parser.add_argument('--env', help='environment ID', default='BreakoutNoFrameskip-v4') parser.add_argument('--seed', help='RNG seed', type=int, default=0) parser.add_argument('--num-timesteps', type=int, default=int(10e6)) return parser
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_arg_parser():\n parser = argparse.ArgumentParser()\n parser.add_argument('-a', '--path_annots', type=str, required=False,\n help='path to folder with annotations',\n default='annotations')\n parser.add_argument('-i', '--path_dataset', type=str, requ...
[ "0.7437883", "0.7176363", "0.7108517", "0.70549893", "0.69963837", "0.6963611", "0.69511694", "0.6942633", "0.6907705", "0.690574", "0.6889434", "0.68267024", "0.6776402", "0.67660815", "0.67581695", "0.6749728", "0.6739547", "0.67250913", "0.6722918", "0.6718469", "0.6718469...
0.78375757
0
Create an argparse.ArgumentParser for run_mujoco.py.
def mujoco_arg_parser(): parser = arg_parser() parser.add_argument('--env', help='environment ID', type=str, default='Reacher-v2') parser.add_argument('--seed', help='RNG seed', type=int, default=0) parser.add_argument('--num-timesteps', type=int, default=int(1e6)) parser.add_argument('--play', defa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_parser():\n parser = argparse.ArgumentParser()\n parser.add_argument('-r', '--reference', required=True, help=\"Reference Genome URL\")\n parser.add_argument('-n', '--normal', required=True, help='Normal BAM URL. Format: UUID.normal.bam')\n parser.add_argument('-t', '--tumor', required=True, ...
[ "0.74008834", "0.7385079", "0.734619", "0.7270096", "0.7255497", "0.72188497", "0.7181056", "0.711708", "0.7066124", "0.7051665", "0.69526327", "0.69313985", "0.69306207", "0.6892286", "0.6878253", "0.6875072", "0.68702185", "0.6867738", "0.6864742", "0.6836086", "0.6824759",...
0.7750742
0
Create an argparse.ArgumentParser for run_halide.py.
def halide_arg_parser(): parser = arg_parser() parser.add_argument('--env', help='environment ID', type=str, default='HalideBlur-v0') parser.add_argument('--seed', help='RNG seed', type=int, default=0) parser.add_argument('--num-episodes', type=int, default=int(1e4)) parser.add_argument('--target', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def CreateArgumentParser():\n parser = argparse.ArgumentParser(description='Map code pages to paths')\n parser.add_argument('--native-library', type=str, default='libchrome.so',\n help=('Native Library, e.g. libchrome.so or '\n 'libmonochrome.so'))\n parser.add_ar...
[ "0.7197537", "0.6993285", "0.69330865", "0.6906845", "0.6859712", "0.68452096", "0.68273073", "0.68136126", "0.68066984", "0.68066984", "0.67940253", "0.677414", "0.676706", "0.6746096", "0.6712245", "0.6703995", "0.6702579", "0.6688436", "0.668237", "0.6670573", "0.66450006"...
0.7754485
0
Print out the pods of a Deployment and return a list of those lines. Abort if there's an error.
def showPods(dpl:str) -> List[str]: tt = runCmd(f"kubectl -n {ns} get po --no-headers".split()) if tt.stderr: print(f"Got error: {tt.stderr.decode()}") sys.exit(1) else: tmp_output = tt.stdout.decode().splitlines() output = [] for line in tmp_output: if f"{dpl}-" in ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_deployment_logs(namespace, name, tail_lines=TAIL_LINES_DEFAULT):\n pods = []\n try:\n api_response = k8s_client.list_namespaced_pod(namespace, label_selector='release={}'.format(name))\n for api_items in api_response.items:\n pods.append(api_items.metadata.name)\n except ...
[ "0.6920317", "0.6094677", "0.6093674", "0.5900195", "0.57868785", "0.5718521", "0.56805205", "0.5641895", "0.55443937", "0.55176693", "0.5475469", "0.54315686", "0.54242504", "0.53848684", "0.5346442", "0.5276105", "0.5257879", "0.5232856", "0.5193414", "0.51866174", "0.51849...
0.7404265
0
Check a Deployment and loop until it's spec.replicas == spec.availableReplicas. I.e., loop until the Deployment is fully up. Abort if there's any error.
def waitForDeployment(aNs: str, aDeploy: str): count = 1 while count < MAX_WAIT: _ = showPods(aDeploy) specStr = "{.spec.replicas}" tt = runCmd(f"kubectl -n {ns} get deployment {aDeploy} --output=jsonpath={specStr}".split()) if not tt.returncode == 0: print(tt.stderr....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wait_for_deployment_complete(deployment_name):\n complete = False\n try:\n response = api.read_namespaced_deployment(deployment_name, namespace)\n status = response.status\n if (status.unavailable_replicas is None and\n (status.updated_replicas is None or\n ...
[ "0.6113765", "0.59651905", "0.57463384", "0.5624836", "0.5491231", "0.5444146", "0.54303986", "0.53961396", "0.5384387", "0.5310088", "0.5265068", "0.52341497", "0.5220307", "0.5184391", "0.5174394", "0.51594555", "0.51520747", "0.5116851", "0.5104893", "0.51041263", "0.50581...
0.73408425
0
Fetches command line history. Returns dict of all lines.
def hist(): history_dict = {} # create history_list for i in range(readline.get_current_history_length()): history_dict[i+1] = (readline.get_history_item(i+1)) return history_dict
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetch_history(*args, **kwargs):\n return collect_history(*args, **kwargs)", "def get_history():\n return response_texts_to_entries(make_post_request(HISTORY_API, data={\"k\": config[\"api_key\"]}))", "def _grab_history(self):\n self.data['history_lines'] = []\n self.data['history_file']...
[ "0.67691666", "0.6743514", "0.6678989", "0.6584406", "0.65492815", "0.65242946", "0.6466275", "0.6459106", "0.64207", "0.6397794", "0.6306527", "0.62967515", "0.6266161", "0.6215038", "0.6183607", "0.6183607", "0.6160345", "0.61151826", "0.61032844", "0.6101701", "0.60996354"...
0.73838085
0
returns the line at said number
def getline(number): number = int(number) return readline.get_history_item(number)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_line(file, linenum):\n try:\n with open(file, \"r\") as f:\n return f.readlines()[linenum - 1].replace(\"\\n\", \"\")\n except:\n return f\"[ERROR]: could not open '{file}'\"", "def get_line(self, lnum):\n return self._get_line(lnum - self.LINE_NUM_BASE)", "def _ge...
[ "0.7743274", "0.7708246", "0.7590957", "0.74724716", "0.73670316", "0.7362971", "0.73194325", "0.7204581", "0.71783227", "0.7120488", "0.7118482", "0.6980352", "0.69720906", "0.68986243", "0.6873201", "0.6799118", "0.6754275", "0.6754275", "0.6754275", "0.6754275", "0.6750012...
0.7848607
0
Prints the command line history.
def phist(): history = hist(); for line in history: print(line, ":", history[line])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def history(command):\n namespace = app.main(command)\n assert namespace.command == 'h' or namespace.command == \"history\"", "def history():", "def print_history(self):\n self.game_started = False\n for state in self.history:\n self.__draw_board(state)", "def print_history(his...
[ "0.7362004", "0.70220554", "0.6984039", "0.68035895", "0.6690122", "0.6628696", "0.66093284", "0.65976226", "0.6401826", "0.6313359", "0.6234132", "0.6234132", "0.6234132", "0.61766535", "0.61704844", "0.6063267", "0.6049553", "0.6024649", "0.60210574", "0.5991742", "0.596467...
0.7108759
1
copies the line to your clipboard. Works on OS X.
def copyline(number): my_line = getline(number) my_command = "echo '" + my_line + "' | pbcopy" os.system(my_command)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clipboard_copy(text):\n result = subprocess.run(\n # \"primary\" because \"clipboard\" doesn't seem to work for all apps\n # you must paste with middle click\n [\"xclip\", \"-selection\", \"primary\", \"-l\", \"1\"],\n input=bytes(text, encoding=\"utf-8\")\n )\n if resu...
[ "0.7116051", "0.6889499", "0.6693996", "0.65692973", "0.6540873", "0.6487246", "0.6455572", "0.64535856", "0.6359736", "0.63467944", "0.625682", "0.62332565", "0.61990815", "0.6185667", "0.60845", "0.5983435", "0.5977336", "0.5970804", "0.5968446", "0.5907072", "0.58960956", ...
0.72597814
0
Return the face indices of any face with a naked vertex
def getNakedFaceIDs(mesh): nakedFaces = [] # Get naked vertices nPts = list( mesh.GetNakedEdgePointStatus()) nIDs = [i for i,v in enumerate(nPts) if v == True] for i in range(mesh.Faces.Count): # Get face vertices f = mesh.Faces.Item[i] if f.IsTriangle...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def faces_from_vertex(self, vertex):\n assert isinstance(vertex, Vertex)\n return map(Face, self._top_exp.faces_from_vertex(vertex.topods_shape()))", "def getVertexNumbers(self):\n return self.vertexIndex.keys()", "def GetFaceToAdjacentFacesArray(self, p_int):\n ...", "def out_ver...
[ "0.65702415", "0.6509233", "0.6472732", "0.6163369", "0.6108471", "0.6058534", "0.60497165", "0.60435593", "0.6026859", "0.6016006", "0.6011606", "0.5981142", "0.59727657", "0.5972455", "0.5950641", "0.5911575", "0.58671874", "0.58626544", "0.5853577", "0.58423615", "0.584225...
0.76183254
0
Reads the requested number of bytes from the specified endpoint.
def read(self, endpoint, size): return self.device.read(endpoint, size)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read(self, num_bytes_to_read):\n pass", "def readfrom(self, addr: int, nbytes: int, stop: bool = True, /) -> bytes:", "def readfrom(self, addr: int, nbytes: int, stop: bool = True, /) -> bytes:", "def read(self, size: int=-1) -> bytes:\n ...", "def read(self, size: int=-1) -> bytes:\n...
[ "0.6763095", "0.6141447", "0.6141447", "0.613305", "0.613305", "0.6132118", "0.6117879", "0.6090794", "0.60861325", "0.6072254", "0.6069751", "0.6054077", "0.60516727", "0.60494274", "0.6046029", "0.6044382", "0.6037771", "0.6015013", "0.5982061", "0.59549093", "0.59500825", ...
0.7538086
0
Writes the given data to the specified endpoint.
def write(self, endpoint, data): return self.device.write(endpoint, data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _write(self, location, data):\n self._connector.write(location=location, data=data)", "def write(self, data):\n raise NotImplementedError()", "def write(data):", "def _write(self, data):\n self._writer.write(data)", "def write( data ):", "def SendPacket(self, endpoint_addr, data)...
[ "0.6847767", "0.67225677", "0.6463698", "0.64547944", "0.6416697", "0.63848853", "0.63613605", "0.63533884", "0.63493294", "0.6248264", "0.6236459", "0.6230846", "0.62266326", "0.62134635", "0.61800426", "0.617929", "0.61328673", "0.6100123", "0.60997343", "0.6064489", "0.598...
0.8481159
0
r"""Fill or create array of lengthm D, from value or value form a.
def fullArray(a, D): A = list() if isinstance(a, (int, float)): A = full(D, a) elif isinstance(a, (ndarray, list)): if len(a) == D: A = a if isinstance(a, ndarray) else asarray(a) elif len(a) > D: A = a[:D] if isinstance(a, ndarray) else asarray(a[:D]) else: for i in range(int(ceil(float(D) / len(a)))): A.e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_one_d_array(len, val):\n return [val for i in range(len)]", "def fill_array(data, size, fill_value=numpy.nan, push_back=True):\n\n if push_back:\n return numpy.append(data, numpy.repeat(fill_value, size - data.size))\n\n return numpy.append(numpy.repeat(fill_value, size - data.size), dat...
[ "0.66143", "0.5841869", "0.58300316", "0.56885254", "0.5657182", "0.5595944", "0.5565606", "0.5515568", "0.5509467", "0.5499455", "0.545319", "0.5421347", "0.54124904", "0.53535265", "0.53260875", "0.5307944", "0.5293515", "0.5288737", "0.52843624", "0.52706736", "0.52219445"...
0.6009062
1
r"""Check if stoping condition reached.
def stopCond(self): return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stop(self):\n return not self.iteration < self.options['max_iters']", "def check(self, context):\r\n return context.config.stopAt is not None", "def stop_check(self):\n pass", "def stopped_check(self, timeout=None):", "def _stop(self):\n return True", "def _termination(sel...
[ "0.75141114", "0.7417896", "0.73706514", "0.7015613", "0.7012812", "0.6949197", "0.6934178", "0.6902843", "0.68835634", "0.68042654", "0.67862904", "0.6783206", "0.67785966", "0.6764178", "0.67639863", "0.67567784", "0.67475766", "0.6744244", "0.6728208", "0.67224294", "0.669...
0.8338078
0
r"""Evaluate the solution A.
def eval(self, A): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluate(self) -> int:", "def evaluate(self):\n #fac o lista cu toate perechile si vad daca se repeta vreuna (pana acum)\n nr=0\n \n pairs = []\n for i in range(0,self.__size):\n for j in range(0, self.__size):\n if self.__solution[i] != [] and sel...
[ "0.6217597", "0.62039953", "0.60716563", "0.6069594", "0.6069594", "0.60084265", "0.5963306", "0.59397626", "0.5933084", "0.5912575", "0.5874191", "0.5874191", "0.5852872", "0.5846498", "0.5827469", "0.58160734", "0.58049905", "0.57597136", "0.57506883", "0.5730561", "0.57292...
0.70369786
0
r"""Get the number of times that this class returnd inf in the evaluation function, because of stoping condition error.
def unused_evals(self): return self.Evals - self.nFES
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inf(self):\n return self._inf", "def stop(self):\n return S.Infinity", "def get_number_of_evaluation(self):\n return self.n_eval", "def evaluate(self) -> int:", "def _evaluate(self, state):\n leading_power_error = self.get_leading_power_error(state)\n if np.isfinite(leading_p...
[ "0.64540565", "0.6115566", "0.6067888", "0.6027168", "0.598054", "0.5936932", "0.591695", "0.59072673", "0.5906285", "0.589785", "0.5794203", "0.5791656", "0.5791656", "0.57543516", "0.572959", "0.5719795", "0.5703006", "0.57021004", "0.57021004", "0.56639737", "0.56598085", ...
0.6201155
1
Implements a deep neural network for classification. params is a list of (weights, bias) tuples. inputs is an (N x D) matrix. returns normalized class logprobabilities.
def neural_net_predict(params, inputs): for W, b in params: outputs = np.dot(inputs, W) + b inputs = np.tanh(outputs) return outputs - logsumexp(outputs, axis=1, keepdims=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def neural_net_predict(self, inputs):\n for W, b in self.params:\n outputs = np.dot(inputs, W) + b\n inputs = np.tanh(outputs)\n return outputs # - logsumexp(outputs, axis=1, keepdims=True)", "def __init__(self, hidden_dims, input_dim=3*32*32, num_classes=10,\n ...
[ "0.6198682", "0.6188579", "0.5969461", "0.5948908", "0.59376526", "0.59095854", "0.58389044", "0.57970214", "0.57521266", "0.574874", "0.5740589", "0.57374215", "0.5727985", "0.5725142", "0.5716328", "0.5698211", "0.5688488", "0.5681211", "0.5670693", "0.5665312", "0.565391",...
0.72680444
0
Computes l2 norm of params by flattening them into a vector.
def l2_norm(params): flattened, _ = flatten(params) return np.dot(flattened, flattened)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _l2s(self, params):\n return [np.linalg.norm(param) for param in params]", "def norm_l2(u):\n return linalg.norm(u.ravel())", "def l2_norm(v):\n res = 0\n for e in v:\n res += e * e\n return math.sqrt(res)", "def l2(vec):\n return np.linalg.norm(vec)", "def norm_l2(v):\n ...
[ "0.82546264", "0.77542174", "0.7592876", "0.7537406", "0.746447", "0.7305168", "0.72727126", "0.712277", "0.70562875", "0.70500493", "0.69952273", "0.6988028", "0.6913676", "0.6865785", "0.6841669", "0.6832344", "0.68215376", "0.6781754", "0.67134154", "0.6705719", "0.6691719...
0.8654899
0
Get all company lists
def company_lists(self): return self.client.get('company/named-lists')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_companies_and_people():", "def get_companies(self):\n url = 'companies'\n result = self.get(url)\n return result['companies']", "def get_companies():\n all_companies = storage.all(Company).values()\n list_companies = []\n for company in all_companies:\n list_com...
[ "0.7882304", "0.7596987", "0.70944256", "0.6964053", "0.69328797", "0.691499", "0.6873857", "0.6873857", "0.6873857", "0.6873857", "0.686815", "0.6856728", "0.6840562", "0.67586446", "0.67511743", "0.6706522", "0.6700748", "0.6663124", "0.6660832", "0.65631896", "0.6477927", ...
0.86757165
0
Get a specific company list by name
def company_list_by_name(self, list_name): return self.client.get( 'company/named-lists/{list_name}'.format( list_name=list_name ) )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def company_lists(self):\n return self.client.get('company/named-lists')", "def get_companies(self, **kwargs):\n return self.get('companies.json', **kwargs)", "def search_company(cls, name, clause):\n return [('sale.company', ) + tuple(clause[1:])]", "def get_all_companies_and_people():"...
[ "0.7050499", "0.70122504", "0.6967497", "0.69125587", "0.68775976", "0.68144214", "0.67415774", "0.6726178", "0.6497163", "0.6486741", "0.6471226", "0.6468147", "0.6429776", "0.6398427", "0.63927275", "0.6366573", "0.6242466", "0.61506873", "0.61404985", "0.6133206", "0.60923...
0.8003518
0
Returns a list of all 970 characters long texts from the given book file.
def get_texts(book: TextIO) -> list: content = book.read() chars_limit = 970 texts = [content[i:i + chars_limit] for i in range(0, len(content), chars_limit)] return ["..." + t + "..." if t != texts[0] else t + "..." for t in texts]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_words_in_book(filename):\n f = open(filename, \"r\")\n content = f.read()\n f.close()\n wds = text_to_words(content)\n return wds", "def get_word_list(file_name):\n\tnew_list = []\n\n\tf = open(file_name,'r')\n\tlines = f.readlines()\n\tcurr_line = 0\n\tend_line = 0\n\twhile lines[curr_lin...
[ "0.700185", "0.6625363", "0.64112055", "0.6399384", "0.6379729", "0.6248625", "0.62249917", "0.6207146", "0.61987627", "0.6133272", "0.612571", "0.610539", "0.61017334", "0.60968274", "0.60438025", "0.6038257", "0.6001676", "0.59936243", "0.5934076", "0.5932082", "0.5926508",...
0.7710512
0
Returns the complexity of the given text by adding up the frequencies of all its words.
def complexity(text:str) -> float: words = text.split(' ') freqs = [frequency(w) for w in words] return sum(freqs) / (len(frequency_list) - freqs.count(0)) #sum of the frequencies / all the words that were in the list
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_word_counts(text : Text)->Counter:\n return Counter(tokenized_text(text))", "def frequency(text):\n # TODO: change function input to a textfile?\n import collections\n freq = collections.Counter(text)\n # print freq\n return freq", "def analyze(self, text):\n\n text = tknzr...
[ "0.7327232", "0.6928021", "0.69135123", "0.68309027", "0.6820116", "0.6802307", "0.67886895", "0.6788378", "0.6680395", "0.66369337", "0.6606218", "0.659399", "0.6587242", "0.6502463", "0.64892", "0.64823335", "0.64613557", "0.64479107", "0.64078027", "0.63496876", "0.6345047...
0.86525756
0
Returns a list of 5 keywords from the given text.
def keywords(text:str) -> list: return sorted(set(text.split(' ')), key=frequency, reverse=True)[0:5]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_keywords(text, max_keywords=10):\n keywords = rake.apply(text)\n return \" ; \".join([item[0] for item in keywords[:max_keywords]]).strip()", "def __get_keywords(self, text_list):\r\n specialKW = [\r\n 'run keyword',\r\n 'run keyword and continue on failure',\r\n ...
[ "0.74684423", "0.7436489", "0.714602", "0.6927766", "0.68687236", "0.669178", "0.65788835", "0.6512408", "0.6431235", "0.6420499", "0.6381746", "0.6351155", "0.6331313", "0.6329686", "0.6294298", "0.62856007", "0.626946", "0.6194702", "0.61862916", "0.6180569", "0.6156291", ...
0.83092326
0
Returns a list with all the 100 words long texts from the given book along with their difficulties and keywords.
def categorize(book: TextIO) -> list: chunks = get_texts(book) texts = [] for t in chunks: level = difficulty(complexity(t)) texts.append((t, level, keywords(t))) return texts
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_texts(book: TextIO) -> list:\n content = book.read()\n chars_limit = 970\n texts = [content[i:i + chars_limit] for i in range(0, len(content), chars_limit)]\n return [\"...\" + t + \"...\" if t != texts[0] else t + \"...\" for t in texts]", "def get_words_in_book(filename):\n f = open(file...
[ "0.7427155", "0.6878758", "0.607292", "0.5961577", "0.5925289", "0.5917224", "0.59168714", "0.5914988", "0.5853547", "0.5837389", "0.5834911", "0.58301675", "0.5810416", "0.5801972", "0.5788824", "0.5769443", "0.57662934", "0.5717366", "0.57149994", "0.57097614", "0.57049674"...
0.69261056
1
Stores the given frequency list in a file ('freq_list').
def save_frequencies(freqs: dict) -> None: with open("freq_list", 'w') as stored_freq_list: json.dump(freqs, stored_freq_list)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_frequency(count_table, input_file):\n # Opens new file to output to\n with open(f\"{input_file}.out\", \"w\") as text:\n # Total sum of every word's occurrence in the file.\n totalCount = sum(count_table.values())\n\n # Loop through each key and corresponding value in the dictio...
[ "0.65452045", "0.6469228", "0.6206968", "0.61666906", "0.61665314", "0.6154107", "0.6147396", "0.61170024", "0.6072871", "0.60628444", "0.6055825", "0.5916679", "0.59073734", "0.5903439", "0.5807971", "0.5796866", "0.57708037", "0.5752463", "0.57255787", "0.5714908", "0.57087...
0.78073126
0
Loads the frequency list stored in a file ('freq_list') and returns it.
def load_frequencies() -> dict: with open("freq_list", 'r') as stored_freq_list: return json.load(stored_freq_list)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_frequency_list():\n freqs = {}\n file = get_or_download_wordlist_file()\n for line in file:\n word, freq = line.split()\n freqs[word] = int(freq)\n return freqs", "def read_list(f, nb_freqs):\n alist = []\n while len(alist) < nb_freqs:\n line = f.readline()\n ...
[ "0.74670994", "0.6564719", "0.65079457", "0.65046173", "0.635506", "0.63179034", "0.63179034", "0.6299468", "0.6258039", "0.6222253", "0.61386144", "0.6090718", "0.5913977", "0.59138477", "0.5908088", "0.5902046", "0.589864", "0.5881651", "0.5880706", "0.5848204", "0.5814777"...
0.78461945
0
After each experiment has been run, need to figure out the worker that will finish next. After each experiment, the model has to update its internal records of what has been tested and how. It then will update the history of the screening. Finally the index of the worker which has now finished is returned so that more ...
def _record_experiment(self, final): i = np.argmin(self.finish_time) # get the worker which is closest to finishing idone = self.workers[i][0] if self.workers[i][1] == 'z': self.model.tz.remove(idone) self.model.z[idone] = self.z[idone] self.model.uu.remove(i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def worker(worker_idx: int, work_queue: Queue, result_queue: Queue):\n game = self.get_env()\n predictor = self.get_model(game)\n msg.good(f\"Worker {worker_idx} started.\")\n\n while (\n ParallelPracticeRunner.request_quit is False\n and wo...
[ "0.63682723", "0.6095888", "0.608978", "0.604774", "0.5840345", "0.5793326", "0.57848585", "0.57784337", "0.57582265", "0.57426524", "0.5739973", "0.57374585", "0.57232004", "0.5715764", "0.5707506", "0.56954587", "0.56887776", "0.5670632", "0.5664259", "0.5647323", "0.564546...
0.769474
0
Performs the full automated screening with multiple workers. First each worker (determined by the number of threads) is assigned a material to investigate. After this initialisation, the screener alternates selecting and recording experiments. This proceeds until the budget is spent (all the while recording the history...
def full_screen(self,ploton=False): self._screener_init() # initialise the model with a single expensive test for i in range(self.nthreads): # at the start, give the workers a job to do each self._select_and_run_experiment(i) while self.model.b >= self.cy: # spend budget till ca...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train_workers(self):\n args = dict(actor=self.actor,\n critic=self.critic,\n gamma=self.gamma,\n lamda=self.lamda or self.gamma / 1.005,\n device=self.device,\n optimizers=[self.actor_optimizer, self.critic_op...
[ "0.630366", "0.6252322", "0.6240117", "0.60842514", "0.6068625", "0.60128623", "0.5983428", "0.59683526", "0.5961476", "0.59357417", "0.59309727", "0.58802766", "0.5866607", "0.5844822", "0.5843062", "0.58358", "0.58219063", "0.58118093", "0.57361317", "0.5730246", "0.572647"...
0.6466254
0
Helper function to change current state's video frame to input tensor for nn
def vid2tensor( self, current_frame):
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_input_tensor(image):\n tensor_index = interpreter.get_input_details()[0]['index']\n input_tensor = interpreter.tensor(tensor_index)()[0]\n input_tensor[:, :] = image", "def set_input_tensor(self, image):\n tensor_index = self.model.get_input_details()[0]['index']\n input_tensor = s...
[ "0.6438571", "0.64079285", "0.63817257", "0.63208973", "0.63205355", "0.62463313", "0.62463313", "0.62463313", "0.6121116", "0.6089716", "0.604558", "0.60415477", "0.6013444", "0.5952376", "0.5912326", "0.5900172", "0.5891946", "0.583032", "0.5830268", "0.57746786", "0.575319...
0.78311425
0
Wait for the replica to become AVAILABLE on the given RSE as a result of a pending transfer
def __wait_for_replica_transfer(dst_rse_id, scope, name, max_wait_seconds=MAX_POLL_WAIT_SECONDS, transfertool=None): replica = {} for _ in range(max_wait_seconds): poller(once=True, older_than=0, partition_wait_time=0, transfertool=transfertool) finisher(once=True, partition_wait_time=0) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wait(self):\n for _ in range(15):\n time.sleep(10)\n if self.ready:\n break\n else:\n raise RuntimeError('timeout, lease failed to start')", "def _wait_ready(self):\n command = self._recv_from_client()\n while command != \"READY\":\n...
[ "0.61075014", "0.5906587", "0.58969945", "0.5668024", "0.5624796", "0.5596052", "0.55692685", "0.55332476", "0.54996914", "0.54770476", "0.5470404", "0.5461595", "0.54182893", "0.537774", "0.53650314", "0.5363016", "0.5363016", "0.5363016", "0.53622925", "0.5357257", "0.53549...
0.6588461
0
Verify that the poller correctly handles nonrecoverable FTS job failures
def test_fts_non_recoverable_failures_handled_on_multihop(vo, did_factory, root_account, replica_client, caches_mock, metrics_mock): src_rse = 'XRD1' src_rse_id = rse_core.get_rse_id(rse=src_rse, vo=vo) jump_rse = 'XRD3' jump_rse_id = rse_core.get_rse_id(rse=jump_rse, vo=vo) dst_rse = 'XRD4' dst...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_job_failure(app):\n with worker(app):\n state = wait_for_results(app, length=100, sleep=0.2, maxwait=4)\n\n # Tasks have been delivered and executed.\n assert set(r.return_value for r in all_results(app)) == set(range(100))\n assert len(state.queue.messages) == 0\n\n # Consumer group...
[ "0.62607217", "0.59742904", "0.58287543", "0.57768625", "0.57686794", "0.57673967", "0.5752812", "0.57482076", "0.5740342", "0.5722048", "0.56978965", "0.5689482", "0.5688108", "0.5656253", "0.5634875", "0.56320745", "0.5628242", "0.5626997", "0.56194526", "0.5616439", "0.559...
0.60350597
1
Verify that the receiver correctly handles multihop jobs which fail
def test_multihop_receiver_on_failure(vo, did_factory, replica_client, root_account, caches_mock, metrics_mock): receiver_thread = threading.Thread(target=receiver, kwargs={'id_': 0, 'all_vos': True, 'total_threads': 1}) receiver_thread.start() try: src_rse = 'XRD1' src_rse_id = rse_core.ge...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_job_failure(app):\n with worker(app):\n state = wait_for_results(app, length=100, sleep=0.2, maxwait=4)\n\n # Tasks have been delivered and executed.\n assert set(r.return_value for r in all_results(app)) == set(range(100))\n assert len(state.queue.messages) == 0\n\n # Consumer group...
[ "0.64318717", "0.62214303", "0.6139489", "0.6066804", "0.6022608", "0.5992404", "0.59125996", "0.591222", "0.5903248", "0.5877526", "0.58677924", "0.58624184", "0.58438545", "0.5821324", "0.58089757", "0.57990533", "0.57859594", "0.57769114", "0.57712877", "0.5770392", "0.576...
0.6547255
0