query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Make smooth animations as predictions are only generated at 500 ms interval
def interpolate(self, interp): x = np.linspace(0, 29, len(self.ya)) f_ya = interpolate.interp1d(x, self.ya) f_yv = interpolate.interp1d(x, self.yv) f_pa = interpolate.interp1d(x, np.reshape(self.pa, [-1])) f_pv = interpolate.interp1d(x, np.reshape(self.pv, [-1])) x_inter...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_sim(self):\n self.anim = animation.FuncAnimation(self.fig, self.anim_func, frames = self.timesteps, interval = 1, blit=True)\n plt.show()", "def do_animations(self):\n self.animate_bloop(700, 160, 50)", "def animate(frames):\n plt.grid('on')\n ax = plt.gca()\n ax.set_xti...
[ "0.6428782", "0.6333642", "0.60175997", "0.5979958", "0.59758747", "0.5957836", "0.5927737", "0.5871824", "0.5776904", "0.5766929", "0.5740155", "0.5687559", "0.5678273", "0.5677279", "0.5654695", "0.56387275", "0.5606893", "0.5543152", "0.55242366", "0.5513519", "0.5459959",...
0.0
-1
Get frames for the animations
def frame_generator(self, frame_size, frame_step): num_frames = frame_size while self.ya: ya = self.ya[:num_frames] del self.ya[:frame_step] yv = self.yv[:num_frames] del self.yv[:frame_step] pa = self.pa[:num_frames] del self.pa[:f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def frames(self):\n return self._frames", "def getFrames():\n\t\tfor cam in Camera.CAMERAS: cam.getFrame()", "def frames(self):\n return list(self._frames)", "def get_frames(self):\n\n log(\"Getting frames for {} at {}\".format(self._location, self._t0))\n fn_get = lambda time_str...
[ "0.7557698", "0.7542063", "0.73664993", "0.7355739", "0.73070145", "0.72645676", "0.70264816", "0.70152026", "0.68886703", "0.6870058", "0.68352693", "0.6816862", "0.6776024", "0.6679148", "0.6611184", "0.643768", "0.64125896", "0.6412472", "0.6395641", "0.637194", "0.6355288...
0.0
-1
create a background with
def __init__(self, map_file, wall, floor, size_img): # initialize a available positions and size window dict.__init__(self) self.available_positions = [] # read the .txt with the background with open(map_file, "r") as bg_file: # Initialize position and number of line...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def background_maker():\n background = GRect(window.width, window.height)\n background.filled = True\n background.fill_color = '0xFFFCEC'\n background.color = '0xFFFCEC'\n return background", "def _build_background(self, name=None):\n if self._background is None:\n self._backgrou...
[ "0.7908", "0.75448", "0.7480981", "0.73289603", "0.7325924", "0.72652113", "0.721995", "0.71516335", "0.7125712", "0.7105341", "0.7103702", "0.6967297", "0.6961718", "0.6961718", "0.6940961", "0.69393766", "0.69023347", "0.68646824", "0.6857636", "0.68528235", "0.68311", "0...
0.0
-1
Concatenates the cells from the header and footer notebooks to the given cells.
def preprocess(self, nb: NotebookNode, resources: ResourcesDict) -> Tuple[NotebookNode, ResourcesDict]: new_cells = [] # header if self.header: with io.open(self.header, encoding='utf-8') as fh: header_nb = read_nb(fh, as_version=current_nbformat) new_cel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def join_markdown_cells(cells: List[Dict]) -> str:\n src = []\n for c in cells:\n cell_src = []\n if c['type'] == 'markdown':\n if 'class' in c:\n cell_src.append(f':begin_tab:{c[\"class\"]}')\n cell_src.append(c['source'])\n if 'class' in c:\n ...
[ "0.6018911", "0.5785152", "0.573992", "0.56964177", "0.5338453", "0.5302862", "0.5278419", "0.5244307", "0.52227336", "0.51981604", "0.50574815", "0.50387275", "0.5030273", "0.49325353", "0.49148065", "0.48783618", "0.48736855", "0.48300564", "0.47832954", "0.4761173", "0.475...
0.55830485
4
Returns the age stratified population used for case detection testing. Use state denominator for testing rates for the Victorian health cluster models and temporarily use Philippines regional pops for all the Philippines subregions
def get_testing_pop(agegroup_strata: List[str], country: Country, pop: Population): testing_region = "Victoria" if country.iso3 == "AUS" else pop.region testing_year = 2020 if country.iso3 == "AUS" else pop.year testing_pop = inputs.get_population_by_agegroup( agegroup_strata, country.iso3, testing_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getPopulation(self):\n\n return self.p", "def test_state(self):\n states = self.geographies.find({ 'geoid': config.SUMLEV_STATE })\n\n self.assertEqual(states.count(), 1)\n\n state = states[0]\n\n self.assertEqual(state['sumlev'], config.SUMLEV_STATE)\n self.assertEq...
[ "0.5675838", "0.5655509", "0.5640945", "0.55368376", "0.5536563", "0.55261403", "0.5399596", "0.53897786", "0.53655875", "0.52701634", "0.52652085", "0.5259422", "0.52373123", "0.5232317", "0.5202828", "0.51550114", "0.5124957", "0.51231694", "0.5122542", "0.5077461", "0.5061...
0.66339207
0
Returns a time varying function that gives us the proportion of cases detected.
def build_detected_proportion_func( agegroup_strata: List[str], country: Country, pop: Population, testing: TestingToDetection, case_detection: CaseDetection, ): if testing is not None: # More empiric approach based on per capita testing rates assumed_tests_parameter = testing.as...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process(self, compartment_values, computed_values, time):\n return self.detected_proportion_func(time)", "def cond_prob(self, event, context):\n count = self.table[event, context] + self.prior\n norm = self.margin[context] + (self.prior * len(self.alphabet))\n return count / norm"...
[ "0.56486714", "0.5399324", "0.53938836", "0.5349418", "0.53207636", "0.52834475", "0.527038", "0.5253039", "0.51995337", "0.5193554", "0.5186247", "0.5145516", "0.51392543", "0.5114639", "0.5083481", "0.50816566", "0.50375867", "0.5034541", "0.50288093", "0.50219774", "0.5019...
0.64043784
0
Calculate the actual prevalence during runtime
def process(self, compartment_values, computed_values, time): return self.detected_proportion_func(time)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def precalculate():\n pass", "def precalculate():\n pass", "def precompute_scoring():\n global volume_void_inclusion\n global attract_point_distances\n global perlin_values\n \n volume_void_inclusion = []\n for i,void in enumerate(volumes_void):\n inclusion = gh.PointInBrep(void,...
[ "0.70535856", "0.70535856", "0.7031411", "0.67749435", "0.6493947", "0.6482302", "0.6269704", "0.62223643", "0.61939234", "0.6182415", "0.6175716", "0.6152258", "0.61377895", "0.609314", "0.6075508", "0.6069201", "0.60471123", "0.60425705", "0.6015367", "0.59943706", "0.59916...
0.55898887
62
Computes the modular exponent of a number
def expMod(b,n,m): """returns (b^n mod m)""" if n==0: return 1 elif n%2==0: return expMod((b*b)%m, n/2, m) else: return(b*expMod(b,n-1,m))%m
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def myExp(base,exponent,modulus):\n result = 1\n while exponent > 0:\n if exponent & 1 == 1:\n result = (result * base) % modulus\n exponent = exponent >> 1\n base = (base * base) % modulus\n return result", "def modExponent(self, base, power):\n result = 1\n ...
[ "0.8157817", "0.8092614", "0.8023704", "0.8023351", "0.7755564", "0.77176094", "0.7643725", "0.75809604", "0.7468588", "0.742563", "0.734927", "0.72572875", "0.72372055", "0.7221869", "0.7214778", "0.7206781", "0.71085316", "0.7105926", "0.7104239", "0.7095651", "0.7094623", ...
0.7284228
11
Encryption side of RSA
def RSAencrypt(m, e, n): # Fill in the code to do RSA encryption.............. c = expMod(m, e, n) return c
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encryptRSA(e, n , text):\r\n\r\n cyphertext = pow(text, e, n)\r\n return cyphertext", "def RSAencrypt(m, e, n):\n # Fill in the code to do RSA encryption\n cipher = expMod(m,e,n)\n return cipher", "def encrypt(string,pub):\r\n string = livingDead.utfE(string)\r\n crypto...
[ "0.7821584", "0.7661074", "0.73714435", "0.73482984", "0.6953182", "0.6909501", "0.68847466", "0.6855016", "0.6800743", "0.67874444", "0.6680838", "0.6637164", "0.6524958", "0.6489339", "0.64674616", "0.642839", "0.6427356", "0.64025027", "0.63709706", "0.63231283", "0.631747...
0.76464295
2
Decryption side of RSA
def RSAdecrypt(c, d, n): # Fill in the code to do RSA decryption.................... c = expMod(c, d, n) return c
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rsa_decrypt(cypher, privatekey):\r\n \r\n # A key object is created to interact with the PyCrypto\r\n # encryption suite. The object contains key data and\r\n # the necessary rsa functions.\r\n temp_key_obj = _rsa_keydict_to_keyobj(privatekey = privatekey) \r\n \r\n return _rsa_gluechops(cypher, temp...
[ "0.76538956", "0.7415473", "0.73781157", "0.72886574", "0.7264294", "0.71205086", "0.701326", "0.6951223", "0.6870579", "0.6856573", "0.67939925", "0.6748481", "0.6723374", "0.6700977", "0.65705913", "0.6508196", "0.64509195", "0.6379471", "0.6374649", "0.63507134", "0.627083...
0.7362476
3
This method returns a 16bit random integer derived from hashing the current time. This is used to test for liveness
def generateNonce(): hash = hashlib.sha1() hash.update(str(time.time()).encode('utf-8')) return int.from_bytes(hash.digest()[:2], byteorder=sys.byteorder)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def now():\n return int(time.time() * 1000)", "def GenerateTime(self):\n return str(bin(int(round(time.time() * 1000))))[2:]", "def now():\r\n return time.time()", "def generate_random_num():\n return (long(hexlify(urandom(7)), 16) >> 3) * 2**(-53)", "def generate_timer_id():\n\treturn bas...
[ "0.6658087", "0.6516331", "0.64356923", "0.6401894", "0.6385596", "0.63273597", "0.62852365", "0.627362", "0.6248737", "0.6239527", "0.62356806", "0.62165534", "0.6201011", "0.61924225", "0.6190664", "0.6166084", "0.6160676", "0.6158578", "0.61437804", "0.6139684", "0.6138843...
0.5744526
59
Generate n, phi(n), e, and d.
def genKeys(p, q): # Fill in code to generate the server's public and private keys. # Make sure to use the Extended Euclidean algorithm............................... n = p * q phi = (p-1)*(q-1) #e = e_finder(n, phi) while True: e = random.randint(1, phi) if gcd_iter(e, phi) == 1...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eulerphi(n):\n\treturn euler_phi(n)", "def eulerphi(n):\r\n\treturn euler_phi(n)", "def phi(x,n):\n return 1/(np.sqrt(2**n*np.math.factorial(n))) * (1/np.pi)**0.25 * \\\n np.exp(-x**2/2)*sp.special.eval_hermite(n,x)", "def euler_phi(n):\n\n if n == 1:\n return 1\n\n phi = n\n ...
[ "0.7230467", "0.72119355", "0.7163619", "0.70690507", "0.6940538", "0.674169", "0.6737629", "0.665743", "0.66033924", "0.6571762", "0.6441839", "0.63934433", "0.63900155", "0.6371469", "0.63675463", "0.63340646", "0.61868167", "0.6121966", "0.60412896", "0.6009271", "0.599962...
0.56430006
50
Responds to client's hello message with modulus and exponent
def clientHelloResp(n, e): status = "105 Hello "+ str(n) + " " + str(e) return status
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clientHello():\r\n status = \"100 Hello message\"\r\n return status", "def clientHello():\r\n status = \"100 Hello\"\r\n return status", "def hello_command(chat, message, args):\n resp = \" , \".join( list(global_coin_dct.keys())[:10] )\n chat.send ( resp )", "def greetting(self):\n ...
[ "0.6479198", "0.6302376", "0.6201765", "0.6080746", "0.59467787", "0.59077334", "0.57898474", "0.57415533", "0.5655386", "0.5647336", "0.5623555", "0.5618372", "0.55751806", "0.5560137", "0.5546643", "0.5518849", "0.55178034", "0.54985315", "0.54746735", "0.5465453", "0.54600...
0.6584107
1
Responds to session key with nonce
def SessionKeyResp(nonce): status = "113 Nonce "+ str(nonce) return status
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ns_authentication(conn):\n # get RSA key of Bob for decrypting\n rsa_key = rsa.import_key(\"RsaKey.asc\")\n\n # A -- {N_A, A}(K_PB) --> B\n request = rsa.decrypt(rsa_key, conn.recv(1024))\n client_nonce, client_name = request.split(',')\n print(\"Bob: recieved nonce {} from client {}\".format...
[ "0.5793612", "0.5780483", "0.5770326", "0.57409924", "0.57409924", "0.57370645", "0.5552399", "0.55310404", "0.5527948", "0.54812276", "0.5478223", "0.5460246", "0.54412866", "0.54359895", "0.5398782", "0.53968924", "0.5381679", "0.5344254", "0.5343409", "0.5310444", "0.53012...
0.77256626
1
Verifies that the transmitted nonce matches that received from the client.
def nonceVerification(nonce, decryptedNonce): #Enter code to compare the nonce and the decryptedNonce. This method # should return a string of "200 OK" if the parameters match otherwise # it should return "400 Error Detected" if nonce == decryptedNonce: return "200 OK" else: return "...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nonceVerification(nonce, decryptedNonce):\r\n if (nonce == decryptedNonce):\r\n status = \"150 OK\"\r\n else:\r\n status = \"400 Error\"\r\n return status", "def nonceVerification(nonce, decryptedNonce):\n if nonce == decryptedNonce:\n return \"200 OK\"\n else:\n re...
[ "0.73665047", "0.73254204", "0.7015631", "0.6736863", "0.64736456", "0.64222115", "0.64045054", "0.64045054", "0.63911307", "0.61404437", "0.6129229", "0.61064225", "0.60114044", "0.59985316", "0.5985546", "0.596006", "0.5935649", "0.5932109", "0.59176725", "0.59117854", "0.5...
0.72356075
2
Get and parse HTML from url to return a BeautifulSoup object
def get_soup_for_page(url: str) -> BeautifulSoup: return BeautifulSoup(get_html(url), 'html.parser')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_html_parser(url):\n response = requests.get(url)\n return BeautifulSoup(response.content, 'html.parser')", "def getSoup(url):\n return BeautifulSoup(getHtml(url), 'lxml')", "def get_soup(url):\n return BeautifulSoup(requests.get(url).content, 'lxml')", "def get_soup(url):\n\tresponse = ur...
[ "0.85314804", "0.8485308", "0.8195754", "0.812122", "0.81066984", "0.8082718", "0.80745155", "0.80275524", "0.7982905", "0.7975306", "0.7965569", "0.79574174", "0.7951553", "0.78745633", "0.7869404", "0.78641176", "0.78237176", "0.7798591", "0.7773363", "0.7760482", "0.773167...
0.80104625
8
Crawl, parse and index IMDB to populate movies database
def get_imdb_movies(max_movies: int): from imdb.database import index_movie_to_database movie_count = 0 for url in crawl_imdb_listing_page(TOP_PAGE): if movie_count == max_movies: break movie_data = parse_movie_page(url) if index_movie_to_database(movie_data): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def movie_spider(self, movieTag):\n index = 0\n logging.info(\"Start crawling tag: %s\" % movieTag)\n while index < self.MAX_NUM:\n root = \"https://movie.douban.com/tag/%s?start=%d&type=T\" % (movieTag, index)\n result = {}\n try:\n html = reque...
[ "0.6891619", "0.6704189", "0.6427405", "0.6412079", "0.6192585", "0.61624694", "0.6147366", "0.6041188", "0.603387", "0.6014648", "0.59659547", "0.5929169", "0.5887383", "0.5861849", "0.58480793", "0.58408755", "0.58000845", "0.5786631", "0.57839924", "0.5770788", "0.57546777...
0.61675996
5
Generator function to keep crawling the listing pages, yielding the found movies urls.
def crawl_imdb_listing_page(url: str) -> Generator: next_url = url while next_url: print(f"CRAWLING URL {next_url}") listing_page = get_soup_for_page(next_url) for movies_element in listing_page.find_all("div", class_="lister-item mode-simple"): a_link = movies_element.find("...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _paginate(self) -> Iterable[List[str]]:\n req = self.html\n videos_lens = self._extractor(req)\n yield videos_lens # yielding doesn't mean that is the end\n\n # The above only returns 100 or fewer links\n # as Youtube loads 100 videos at a time\n # Simulating a browser...
[ "0.68248665", "0.65488493", "0.64052033", "0.63932663", "0.63698214", "0.6351879", "0.6219682", "0.61537457", "0.6130862", "0.60967785", "0.606942", "0.6053288", "0.6021266", "0.60047364", "0.5937592", "0.59219736", "0.5912077", "0.59039587", "0.5858203", "0.5830659", "0.5826...
0.76492673
0
Extract movie information from a imdb movie page
def parse_movie_page(movie_url: str) -> Dict[str, str]: movie_page = get_soup_for_page(movie_url) # title and id movie_id = movie_url.split("/")[-2] title = movie_page.find("div", class_="title_wrapper").find("h1").get_text(";", strip=True).split(";")[0] # director and stars credit_summary_ele...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_movie_info(page: str, verbose:bool = True):\n\n def add_scoreInfo(pattern, raw_text, keyName):\n \"\"\"inner helper function to help add score information\n :param pattern: pattern to match\n :param raw_text: html text\n :param keyName: key name to be append to the dict\n ...
[ "0.76029146", "0.72262806", "0.7224131", "0.7172252", "0.7171272", "0.6969435", "0.68959147", "0.68874156", "0.68652445", "0.67160463", "0.66835207", "0.6683043", "0.6645961", "0.66407657", "0.6620011", "0.6615919", "0.66005063", "0.657424", "0.65602005", "0.6502864", "0.6491...
0.7012838
5
Try to update existing line entrie, insert on fail.
def line_put(self, line): resp = None url = '{}line/'.format(self.epoint) body_json = json.dumps(self.fillter_dct(self.line_attrs_allowed, line)) try: resp = requests.put(url, timeout=self.to, headers=self.headers, data=body_json) r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insert_or_update(self, table, connection, row):\n\n # find line, if it exist\n dbrow = self.find(connection, table, row)\n\n # TODO XXX use actual database function instead of this stupid thing\n now = datetime.datetime.now()\n\n column_names = table.columns.keys()\n\n ...
[ "0.6385364", "0.62758267", "0.6274342", "0.58512753", "0.57817584", "0.5751034", "0.5662429", "0.5631501", "0.56202906", "0.5594066", "0.5534586", "0.5456755", "0.54238886", "0.5394362", "0.53629255", "0.5361207", "0.5347761", "0.5325351", "0.5315772", "0.5314964", "0.5313587...
0.57922137
4
Calculate methylation frequency at genomic CpG sites from the output of nanopolish callmethylation input_fn Path to a nanopolish call_methylation tsv output file fasta_index fasta index file obtained with samtools faidx. Required for coordinate sorting output_bed_fn Path to write a summary result file in BED format out...
def __init__ (self, input_fn:"str", fasta_index:"str"="", output_bed_fn:"str"="", output_tsv_fn:"str"="", min_depth:"int"=10, sample_id:"str"="", strand_specific:"bool"=False, min_llr:"float"=2, verbose:"bool"=False, quiet:"bool"=False): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n # files\n summary_file = sys.argv[1]\n pwms_to_tfs_file = sys.argv[2]\n expressed_tfs_file = sys.argv[3] # TODO\n\n # TODO pull in num regions to resize things? but complicated with overlaps etc\n # TODO edit edges with type of interaction\n # TODO may want to color by trajectory...
[ "0.5693103", "0.55067265", "0.5399869", "0.5296353", "0.52888024", "0.5262818", "0.5224499", "0.52202576", "0.5129552", "0.5099409", "0.5049172", "0.50478584", "0.5046293", "0.49877012", "0.49782598", "0.49623838", "0.495393", "0.49416703", "0.49218166", "0.49082747", "0.4904...
0.6483332
0
Use Dijkstra's algorithm on the given graph This constructor assumes the graph's edges are { GWeightedEdge}s. If not, you will likely encounter a { ClassCastException}. graph the graph
def __init__(self, graph: ghidra.graph.GImplicitDirectedGraph): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, graph):\n self.graph = graph\n self.distances = graph.distance\n self.links = graph.links\n self.weighted_edge_list = graph.weighted_edge_list\n self.G = graph.G\n self.sort = sorted(self.weighted_edge_list, key=lambda x: x[2])\n self.ordered_dist...
[ "0.6976169", "0.6888074", "0.66871184", "0.664122", "0.65760803", "0.65578073", "0.6497716", "0.6435038", "0.6405883", "0.6312871", "0.62896526", "0.6256009", "0.6212545", "0.6147363", "0.61346835", "0.6112303", "0.6074155", "0.60559005", "0.600402", "0.5996436", "0.5994674",...
0.60467774
18
Use Dijkstra's algorithm on the given graph with the given maximum distance This constructor assumes the graph's edges are { GWeightedEdge}s. If not, you will likely encounter a { ClassCastException}. graph the graph maxDistance the maximum distance, or null for no maximum
def __init__(self, graph: ghidra.graph.GImplicitDirectedGraph, maxDistance: float): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, graph: ghidra.graph.GImplicitDirectedGraph, maxDistance: float, metric: ghidra.graph.GEdgeWeightMetric):\n ...", "def max_dist(graph, source):\r\n q = queue.Queue()\r\n found = {}\r\n distance = {}\r\n for vertex in graph: \r\n found[vertex] = 0\r\n distance[ve...
[ "0.7105622", "0.65459585", "0.62205803", "0.6163052", "0.60579824", "0.59286", "0.5803024", "0.57847154", "0.5700605", "0.5692679", "0.5679294", "0.56565255", "0.5653247", "0.5653056", "0.5608242", "0.5604511", "0.55991817", "0.55969554", "0.55812794", "0.55636895", "0.555433...
0.71439725
0
Use Dijstra's algorithm on the given graph with a custom edge weight metric graph the graph metric the function to compute the weight of an edge
def __init__(self, graph: ghidra.graph.GImplicitDirectedGraph, metric: ghidra.graph.GEdgeWeightMetric): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_weight_func(G, weight):\n\n def weight_func(u, v):\n edge = G[u][v]\n\n if G.is_multigraph():\n return min(att.get(weight, 1) for att in edge.values())\n\n return edge.get(weight, 1)\n\n return weight_func", "def __djikstra(graph, node_name):\n predecessor...
[ "0.6703957", "0.66605234", "0.6631161", "0.652215", "0.6499373", "0.6461656", "0.64207816", "0.6279059", "0.61951953", "0.61626434", "0.6158406", "0.61564386", "0.6105164", "0.606558", "0.6053947", "0.6033951", "0.60229975", "0.59964764", "0.5994979", "0.5991522", "0.5975728"...
0.59975505
17
Use Dijstra's algorithm on the given graph with the given maximum distance and a custom edge weight metric graph the graph maxDistance the maximum distance, or null for no maximum metric the function to compute the weight of an edge
def __init__(self, graph: ghidra.graph.GImplicitDirectedGraph, maxDistance: float, metric: ghidra.graph.GEdgeWeightMetric): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __djikstra(graph, node_name):\n predecessors = {key: None for key in graph.keys()}\n distances = {key: inf for key in graph.keys()}\n distances[node_name] = 0\n nodes_set = set(graph.values()) # type : Set[Node]\n while len(nodes_set) != 0:\n min_node = min(nodes_...
[ "0.648706", "0.62402046", "0.62161565", "0.6197095", "0.6175136", "0.6040108", "0.59882283", "0.59803706", "0.59314615", "0.5915369", "0.59046775", "0.5885905", "0.58851326", "0.5882774", "0.58602697", "0.5838277", "0.58381146", "0.58340716", "0.58335596", "0.5828926", "0.581...
0.6478836
1
Returns an list of available location tuples neighboring an given position location.
def check_location(position: tuple, all_sites: np.matrix, busy_locations: List[tuple]) -> List[tuple]: N, M = all_sites.shape potential_sites = [(position[0], position[1] + 1), (position[0], position[1] - 1), (position[0] + 1, p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def locations_adjacent_to(loc):\n return [(loc[0] + direction[0], loc[1] + direction[1]) for direction in [(0,-1),(0,1),(-1,0),(1,0)]]", "def get_neighbors(loc):\n dim = len(loc)\n offsets = product((-1, 0, 1), repeat=dim)\n neighbors = set()\n for offset in offsets:\n if offset == (0,) * d...
[ "0.7041809", "0.7023418", "0.6892644", "0.6800793", "0.66838336", "0.66631275", "0.6643647", "0.6508145", "0.64983076", "0.6488335", "0.64640033", "0.63975555", "0.637684", "0.6343168", "0.62820834", "0.6256937", "0.6250964", "0.62331253", "0.6231511", "0.620172", "0.6126907"...
0.5996912
38
Gets an random free location neighboring an position. Returns False if there aren't any location available.
def get_free_location(position: tuple, all_sites: np.matrix, used_sites: List[tuple]) -> tuple: available_locations = check_location(position, all_sites, used_sites) if len(available_locations) > 0: return random.choice(available_locations) else: r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def random_location(self):\r\n\r\n while True:\r\n pt = (random.uniform(self.worldbox.tl[0], self.worldbox.br[0]),\r\n random.uniform(self.worldbox.tl[1], self.worldbox.br[1]))\r\n if not self.is_wall(pt) and not self.is_target(pt):\r\n return pt", "de...
[ "0.7155066", "0.68745834", "0.6822648", "0.6772478", "0.67044556", "0.667298", "0.65802073", "0.6535938", "0.62133676", "0.6199547", "0.6172247", "0.6147595", "0.61029494", "0.60941947", "0.60829973", "0.6078855", "0.6075617", "0.6019359", "0.60065395", "0.60025245", "0.60017...
0.7684889
0
Filter the nonnearby agents.
def nearby_agents(location: tuple, agents: Dict[str, dict]) -> Dict[str, dict]: neighbors = {label: agent for label, agent in agents.items() if is_neighbor(agent['location'], location)} return neighbors
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter_func(self, agents):\n return [\n agent for agent in agents\n if agent.energy < self.model.energy_threshold and not agent.pack\n ]", "def filter_wolves(self, agents):\n return [\n agent for agent in agents\n if agent.energy < self.model.e...
[ "0.7159476", "0.69750136", "0.5750282", "0.5655772", "0.5614072", "0.55095285", "0.5485843", "0.5468839", "0.54196733", "0.54196733", "0.5391832", "0.5282351", "0.5278059", "0.52467644", "0.5214163", "0.5196809", "0.51801443", "0.5167936", "0.5160934", "0.5160934", "0.5159122...
0.0
-1
This function posts data in order to get cookies and then get the results
def __init__(self, query, subcorpus='nkjp300', tag=False, write=False, kwic=True, occurrences=10): self.query = query self.tag = tag self.subcorpus = subcorpus self.page = None self.occurrences = occurrences self.write = write self.kwic = kwic
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def data_post(self, values, url, send_header):\n # Get the cookie into the urllib\n ckjar = self.mycookie.get_cookie()\n ckproc = urllib2.HTTPCookieProcessor(ckjar)\n opener = urllib2.build_opener(ckproc)\n \n # Post data and get return result\n post_data = urllib.u...
[ "0.663909", "0.64892554", "0.63949543", "0.6384258", "0.6377764", "0.6324452", "0.6231552", "0.61990243", "0.60470724", "0.6032849", "0.59616464", "0.5923095", "0.57920897", "0.57327276", "0.57303137", "0.57169217", "0.5696751", "0.56575346", "0.5654921", "0.56475824", "0.562...
0.0
-1
Select olny columns that are used in this hypohesis testing.
def chose_only_hypothesis_colums(df): lst = ['abv', 'ibu', 'gravity', 'abv_min', 'abv_max', 'ibu_min', 'ibu_max', 'srm_min', 'srm_max', 'og_min', 'fg_min', 'fg_max'] return df[lst]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_non_feature_columns():\n return ['teamid', 'op_teamid', 'matchid', 'competitionid', 'seasonid',\n 'goals', 'op_goals', 'points', 'timestamp', 'team_name', \n 'op_team_name']", "def _these_columns_cannot_annotate_exp_cons(self):\n _cols = set([]) #\n for param_name,...
[ "0.6092054", "0.5817742", "0.58053917", "0.57627535", "0.57148385", "0.5707492", "0.56815207", "0.5610355", "0.56015986", "0.559424", "0.5496665", "0.5475164", "0.54533297", "0.54247004", "0.5415999", "0.5400429", "0.538975", "0.53685564", "0.5365411", "0.535745", "0.5348751"...
0.6582166
0
Return the three beer vital stats.
def beer_vital_stats(beers): lst = ['abv', 'ibu', 'gravity'] beer_vital_stats = beers[lst] print('Dataset before removing null records:', beer_vital_stats.shape) idx = (beer_vital_stats.notnull()).all(axis=1) beer_vital = beer_vital_stats[idx] print('Dataset after removing all the null records:'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_top_weapons(self):\n try:\n top_weapon = self.page.find(\"div\", {\"class\": \"weapon\"}).text.split(\" \")\n\n top_weapon_informations = {\"Weapon\": top_weapon[1], \"Headshots\": top_weapon[-5],\"Bodyshot\": top_weapon[-4],\n \"Leg_shot\"...
[ "0.6124897", "0.6050427", "0.5764262", "0.57420075", "0.5681347", "0.56677866", "0.5628358", "0.5612648", "0.549786", "0.5495417", "0.54840124", "0.54730195", "0.5469649", "0.5461091", "0.5458093", "0.54551136", "0.5442368", "0.5427474", "0.5425743", "0.5402553", "0.5400585",...
0.5661414
6
check if the text contains "nonlatin" characters. If have non start char then return true.
def is_ascii_chars(text): is_ascii = True try: text.encode(encoding='utf-8').decode('ascii') except UnicodeDecodeError: is_ascii = False return is_ascii
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __contains_nonascii_characters(string):\n for c in string:\n if not ord(c) < 128:\n return True\n return False", "def isValid(text):\n return bool(re.search(r'\\bneustart\\b', text, re.IGNORECASE))", "def _has_non_ascii_characters(data_string):\r\n try:\r\n ...
[ "0.7155685", "0.69999903", "0.69006544", "0.6706573", "0.6596651", "0.6532213", "0.6509879", "0.64290476", "0.62984395", "0.6293036", "0.6249571", "0.61959845", "0.61623156", "0.6139", "0.61274207", "0.610891", "0.61056674", "0.6090147", "0.6076324", "0.60291994", "0.5996482"...
0.6273175
10
get the affiliate link or base url
def get_broker_affiliate_link(broker, what): return_data = '' affiliate_link = '' baseurl = '' connection = pymysql.connect(host=DB_SRV, user=DB_USR, password=DB_PWD, db=DB_NAME, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def link(self) -> Optional[str]:\n return pulumi.get(self, \"link\")", "def link(self) -> Optional[str]:\n return pulumi.get(self, \"link\")", "def get_full_url(self):\n full_url = home_page + self.source_link\n return full_url", "def getLink(self):", "def get_randori_base_url(s...
[ "0.6439041", "0.6439041", "0.64389956", "0.6433766", "0.6302267", "0.627821", "0.62526745", "0.622451", "0.6220857", "0.619734", "0.61872107", "0.6180173", "0.61750776", "0.6134218", "0.61053306", "0.604682", "0.6042037", "0.60369056", "0.6023366", "0.6022755", "0.6021405", ...
0.63485336
4
Encode a 'Default' message into bytes.
def encode(msg: Message) -> bytes: msg = cast(DefaultMessage, msg) default_msg = default_pb2.DefaultMessage() default_msg.message_id = msg.message_id dialogue_reference = msg.dialogue_reference default_msg.dialogue_starter_reference = dialogue_reference[0] default_msg.dia...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _encode(self, messages, encode_empty=False):\n serialized_messages = MessagePartSerializer().dumps(messages)\n return self._encode_parts(serialized_messages, encode_empty=encode_empty)", "def encode(self, message):\n return message.encode()", "def _encode_message(cls, message):\n ...
[ "0.59400874", "0.5875511", "0.5675387", "0.5622664", "0.5536103", "0.54758316", "0.54612595", "0.54244334", "0.5410007", "0.53619623", "0.53439385", "0.5328481", "0.53255683", "0.5325061", "0.5304176", "0.5303249", "0.5303249", "0.53005177", "0.52999735", "0.52936417", "0.528...
0.7586231
0
Decode bytes into a 'Default' message.
def decode(obj: bytes) -> Message: default_pb = default_pb2.DefaultMessage() default_pb.ParseFromString(obj) message_id = default_pb.message_id dialogue_reference = ( default_pb.dialogue_starter_reference, default_pb.dialogue_responder_reference, ) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decode_message(self, raw):\n return raw.decode('utf-8')", "def parse_and_decode(cls, data: bytes) -> \"Message\":\n if len(data) < cls.calc_size() + 1:\n raise NotEnoughData()\n if data[0] != cls.type:\n raise InvalidType()\n\n return cls(*unpack('<' + cls.fm...
[ "0.6460779", "0.62275463", "0.60233516", "0.5910059", "0.59061134", "0.58505297", "0.5774515", "0.57674026", "0.5714803", "0.56986344", "0.5683915", "0.5680897", "0.5660629", "0.5643898", "0.56417495", "0.5614412", "0.55841964", "0.55837613", "0.5563051", "0.55579466", "0.553...
0.6873543
0
Enabled types in a Collage as list of dicts.
def listEnabledTypes(self): actual_type = self.request.get('portal_type', None) collage_options = getCollageSiteOptions() ttool = getToolByName(self.context, 'portal_types', None) if ttool is None: return None return [ { 'id': pt.getId(), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_group_types(self):\r\n pass", "def etypes(self): # -> list[None]:\n ...", "def etypes(self): # -> list[str]:\n ...", "def listFeaturableContentTypes():", "def type_list():\n for type_ in orm.DataFlagType.select():\n click.echo(type_.name)", "def getFeatureDicts(self...
[ "0.56451094", "0.5577261", "0.555166", "0.5539778", "0.5523393", "0.5469926", "0.5433368", "0.5389394", "0.53685445", "0.53110236", "0.530126", "0.5217573", "0.5199076", "0.51909196", "0.5184929", "0.5160728", "0.51568127", "0.5147065", "0.51458454", "0.5136423", "0.51267034"...
0.6831915
0
Runs a corouting in the default event loop and retuns it result.
def run_coro(coro): return asyncio.get_event_loop().run_until_complete(coro)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _run(self, coro):\n return self.loop.run_until_complete(coro)", "def run(coroutine):\n\n return asyncio.get_event_loop().run_until_complete(coroutine)", "def _run(coro):\r\n return asyncio.get_event_loop().run_until_complete(coro)", "def _run(coro):\n return asyncio.get_event_loop().run_u...
[ "0.7456809", "0.7332577", "0.7127579", "0.7030047", "0.69046736", "0.67248267", "0.6559589", "0.6559589", "0.6548279", "0.64458126", "0.64395374", "0.64395374", "0.6435958", "0.6394516", "0.63917077", "0.63644034", "0.6340163", "0.6335593", "0.6296401", "0.6296183", "0.618239...
0.6475103
9
Helper method to get fixed set of nodes for integration tests.
def get_nodes(): return conf.config.get_nodes(RELATIVE_PATH_FIXTURES_HOST)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_nodes():\n nodes_config_file = Settings.CONF_NODES_FILE\n current_nodes = load_node_names(nodes_config_file)\n\n return current_nodes", "def get_nodes(self):\n pass", "def get_all_nodes(self):\n # NOTE: return copy, so no one will screw\n # our list?\n return self.n...
[ "0.68265736", "0.6614423", "0.6519299", "0.6489987", "0.64040446", "0.6392586", "0.6377646", "0.63355374", "0.6334925", "0.63303435", "0.6282876", "0.62619257", "0.62289566", "0.62216836", "0.6215375", "0.6202686", "0.62020046", "0.61830145", "0.61665314", "0.60890484", "0.60...
0.7349392
0
Sets up a HTTP session with a retry policy.
def session(): s = requests.Session() retries = Retry(total=5, backoff_factor=0.5) s.mount("http://", HTTPAdapter(max_retries=retries)) return s
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(\n self,\n retries=3,\n backoff_factor=0.3,\n status_forcelist=(500, 502, 504),\n **session_options,\n ):\n super().__init__(**session_options)\n retries = retries or 0\n\n self.retry_ = Retry(\n total=retries,\n read=ret...
[ "0.6857141", "0.66478163", "0.6571058", "0.6445937", "0.6355491", "0.6263917", "0.62212396", "0.612338", "0.61004585", "0.60772103", "0.6003747", "0.5973167", "0.5882813", "0.5876081", "0.58389", "0.5739965", "0.56961465", "0.5695593", "0.56927025", "0.5690914", "0.5681083", ...
0.6280598
5
GETs data from a nodes and returns the result to the caller.
async def GET(node_id, path): r = session().get(f"{HOST}:{BASE_PORT + node_id}{path}") if r.status_code != 200: raise ValueError(f"Got bad response {r.status_code} from " + f"node {node_id} on {path}.") return {"status_code": r.status_code, "data": r.json()}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_data(node):\n return node['data']", "def getNodes(self):\n data = self.connect('get','nodes',None)\n return data", "def getData(graph, request):\r\n results = list(graph.query(request))\r\n return results", "def callapi(uri: str, data=None):\n if data is not None:\n d...
[ "0.69283056", "0.670028", "0.64256525", "0.6367985", "0.6361035", "0.62616485", "0.62616485", "0.62616485", "0.6198814", "0.6081884", "0.60235053", "0.5962023", "0.59224427", "0.591304", "0.5902234", "0.5900502", "0.5876176", "0.584111", "0.5796484", "0.5789404", "0.5739313",...
0.62030166
8
Generates the hosts file to be used in the test.
def generate_hosts_file(n, path="./tests/fixtures"): if not os.path.isdir(path): os.mkdir(path) with open(f"{path}/hosts.txt", "w") as f: for i in range(n): f.write(f"{i},localhost,127.0.0.1,{5000+i}\n")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inject_hosts_files(self):\n self.log.info(\"Injecting host files\")\n hosts = dict()\n for i in self.all_nodes:\n hosts[i.name] = i.get_public_addr()\n #add the host names to etc/hosts\n orchestrator.inject_hostnames(hosts, delete=self.cluster_name)\n for i ...
[ "0.6459292", "0.6404605", "0.6283201", "0.6240932", "0.59802336", "0.5889246", "0.58163095", "0.5757817", "0.5732513", "0.5702952", "0.5698817", "0.5661061", "0.56472224", "0.56410384", "0.56334525", "0.56244177", "0.55663335", "0.5537021", "0.54996186", "0.5496365", "0.54960...
0.77438474
0
Launches BFTList for integration testing.
async def launch_bftlist(test_name="unknown test", n=N, f=F, args={}): generate_hosts_file(n) nodes = get_nodes() cmd = ". env/bin/activate && python3.7 main.py" cwd = os.path.abspath(".") pids = [] for node_id in nodes.keys(): env = os.environ.copy() env["ID"] = str(node_id) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(self):\n self.tp.launch_list()\n self.tp = None", "def run_datalab_fbs():\n\n appctxt = ApplicationContext()\n win = DataLab()\n # debug_setup(win)\n win.show()\n exit_code = appctxt.app.exec_()\n sys.exit(exit_code)", "def test_fixture_list_runs(tmp_sample_project):\n ...
[ "0.6644642", "0.59429514", "0.57962817", "0.57052195", "0.5684194", "0.5662194", "0.559709", "0.5505819", "0.5502295", "0.5478227", "0.5450164", "0.5444739", "0.5444739", "0.540122", "0.5357159", "0.53484774", "0.5345491", "0.5273711", "0.52669984", "0.526251", "0.5246604", ...
0.7411596
0
Kills all processes in the supplied list containing PIDs.
def kill(pids): for pid in pids: process = psutil.Process(pid) for proc in process.children(recursive=True): proc.kill() process.kill() return
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def kill(self,process_list,signal = 'TERM'):\n res = []\n pids = {}\n for process in process_list:\n if hasattr(process,'machine'):\n try:\n worker = self.worker_by_name[process.machine]\n except KeyError:\n worker ...
[ "0.71561825", "0.7016703", "0.69786996", "0.69770545", "0.68164593", "0.6671434", "0.66706276", "0.6646426", "0.65671927", "0.6468347", "0.64572406", "0.6416643", "0.6387647", "0.6351313", "0.6312249", "0.6208457", "0.61944294", "0.61545175", "0.61286503", "0.61021495", "0.60...
0.7777778
0
Removes all generated state files after test and cleans up.
def cleanup(): try: os.remove(start_state_file_path) except FileNotFoundError: pass time.sleep(1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tearDown():\n for output_file_path in Path(output_dir).glob(\"test_voting_learner_cross_validate*\"):\n output_file_path.unlink()\n\n for output_file_path in Path(\".\").glob(\"test_voting_learner_cross_validate*\"):\n output_file_path.unlink()\n\n config_file_path = Path(config_dir) / \...
[ "0.7663158", "0.7661129", "0.76429653", "0.76376575", "0.75846446", "0.7534873", "0.7493232", "0.74643505", "0.7433635", "0.74254453", "0.7356978", "0.73564607", "0.73222697", "0.7321115", "0.72945124", "0.7292109", "0.72868603", "0.72769874", "0.72742134", "0.7268443", "0.72...
0.7735382
0
Dumps a dict to a json file used to inject state to modules.
def write_state_conf_file(state): with open(f"{start_state_file_path}", "w") as outfile: outfile.write(jsonpickle.encode(state))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_to_json(dict, file):\n with open(file, 'w') as f:\n json.dump(dict, f, indent=2)\n return file", "def save_dict_as_json(dict, output_path):\n with open(output_path, \"w\") as f:\n json.dump(dict, f)", "def store(my_dict, filename):\n my_json = json.dumps(my_dict)\n f = ope...
[ "0.7407459", "0.7298913", "0.72519094", "0.72142816", "0.7062763", "0.7019053", "0.69570297", "0.69448113", "0.69421196", "0.69389653", "0.6888327", "0.68440145", "0.6828989", "0.68166786", "0.6766787", "0.6751799", "0.67456377", "0.67402554", "0.6674093", "0.6652525", "0.663...
0.63367057
45
Returns a dict used to match r_log entries returned through API.
def get_json_for_r_log_entry(req, x_set): return { "request": req.to_dct(), "x_set": x_set }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_logs(self) -> Dict[str, Any]:\n return self.maps[0]", "def getLogs():", "def getLogs():", "def _parse_logs_for_results(self, logs):\n results = {}\n for line in logs.split(\"\\n\"):\n split_line = line.split(\":\")\n if len(split_line) == 2:\n ...
[ "0.6572739", "0.6426629", "0.6426629", "0.6405125", "0.63875765", "0.63137525", "0.6173358", "0.6084505", "0.6070966", "0.60625744", "0.60134137", "0.59859174", "0.5974191", "0.591907", "0.59110576", "0.58960515", "0.5849622", "0.58303064", "0.5689816", "0.5686662", "0.568454...
0.5978461
12
numerotation arbitraire zero correspond a Y63, puis sens des aiguilles d'une montre jusqu'a 127 (X1)
def channelSelect (i): # assert(0<=i<128, "channel {} does not exist in [0-127]".format(i)) assert(0<=i<128) closeAll() #<== close all relays if i< 1*8 :# bank1 mask=shift8(i, 1) ; bus.write_byte_data(R1,off,mask) elif i< 2*8 : mask=shift8(i, 1) ; bus.write_byte_data(R1,mask,off) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def yy_int(self):\n return np.int32(np.round(self.yy))", "def normalize_m11(x):\n return x / 127.5 - 1", "def y(self) -> int:", "def NACA4digitsSym(self):\n self.ytu = self.NacaEquation(self.xu,self.t)\n self.ytl = -self.NacaEquation(self.xl,self.t)\n # Done for estitic reason...
[ "0.59162384", "0.5893357", "0.58206284", "0.58180404", "0.5816376", "0.5816376", "0.5804368", "0.5796267", "0.5787254", "0.57349116", "0.57158196", "0.5673351", "0.56491387", "0.564224", "0.56049657", "0.55999506", "0.55820304", "0.55820304", "0.5554622", "0.5536786", "0.5534...
0.0
-1
This function downloads data from a url
def downloadData(url): data = urllib2.urlopen(url) csvdata = data.read()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def downloadData(url):\n \n content = urllib2.urlopen(url)\n return content", "def download_from_url(url, output_path):\n\n print('Pulling data from {} to {}'.format(url, output_path))\n wget.download(url, output_path)\n print('done')", "def downloadData(url):\n response = urllib2.urlopen(url)\n...
[ "0.83661413", "0.7470643", "0.74026155", "0.7390855", "0.7340116", "0.7306004", "0.73024845", "0.7276593", "0.7246603", "0.72268397", "0.72114456", "0.7168293", "0.7165007", "0.7136254", "0.7117887", "0.70797074", "0.70289284", "0.70003897", "0.6997957", "0.698888", "0.698299...
0.74508363
2
Process the csv data
def parse_csv(csvdata): count_img = 0 count_rows = 0 reader = csv.reader(StringIO(csvdata)) count_msie = 0 count_safari = 0 count_firefox = 0 for row in reader: count_rows += 1 if re.search("jpg|png|gif", row[0], re.I): count_img += 1 if re....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_csv(self):\n try:\n reader = csv.reader(open(self.options.datafile, 'r'))\n except IOError:\n errormsg(_('Cannot read \"{}\"'.format(self.options.datafile)))\n raise Exception(_('Cannot read \"{}\"'.format(self.options.datafile)))\n if self.options.v...
[ "0.7532891", "0.7180946", "0.7067634", "0.69640505", "0.68721133", "0.6856139", "0.6799568", "0.6795377", "0.679071", "0.677996", "0.67743444", "0.6575626", "0.6555505", "0.652285", "0.65009964", "0.64762956", "0.6387756", "0.63765186", "0.63480973", "0.63436574", "0.6339822"...
0.57782686
63
Here we return the ContentType set to multipart/post, including the boundary.
def get_headers(self): return [('Content-Type', self.MULTIPART_HEADER % self.boundary)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_upload_content_type(self):\n if not hasattr(self, '_upload_content_type'):\n with self.get_storage().open(self.get_upload_path()) as upload:\n content_type = Magic(mime=True).from_buffer(upload.read(1024))\n self._upload_content_type = content_type\n retur...
[ "0.6813985", "0.6347326", "0.63283366", "0.6309365", "0.6252459", "0.6238954", "0.6197196", "0.61837476", "0.6173514", "0.6098867", "0.60858727", "0.60638916", "0.6038287", "0.6030141", "0.5975976", "0.59727657", "0.59586275", "0.5926298", "0.592216", "0.5911623", "0.58917755...
0.6207143
6
Boundaries in different instances make a trivial string comparison
def __eq__(self, other): return self.items() == other.items()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compare(self, p_str, p_str_1): # real signature unknown; restored from __doc__\n return 0", "def robust_string_compare(a, b):\n return a.strip().lower() == b.strip().lower()", "def test_strings_are_equal(self):\n string1 = 'this is the first string'\n string2 = 'this is the first st...
[ "0.7397645", "0.7271199", "0.72672033", "0.70249873", "0.7017144", "0.6887826", "0.67547894", "0.6682517", "0.66788507", "0.66543406", "0.66453964", "0.6640099", "0.66366297", "0.66350824", "0.6602779", "0.6599443", "0.65927", "0.65630746", "0.6548104", "0.6514335", "0.649689...
0.0
-1
Decode with custom models that implements ScorerInterface.
def recog_v2(args): logging.warning("experimental API for custom LMs is selected by --api v2") if args.batchsize > 1: raise NotImplementedError("multi-utt batch decoding is not implemented") if args.streaming_mode is not None: raise NotImplementedError("streaming mode is not implemented") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _dinamic_decode(self):\n raise NotImplementedError", "def decode(data):\n raise NotImplementedError", "def decoder(self):\n pass", "def decode(self, encoded):", "def decode(self, coded_set):", "def _decode(self, input_dict):\n pass", "def decode(self,m):\n raise N...
[ "0.57454574", "0.5658464", "0.56545657", "0.5621851", "0.53665817", "0.53629136", "0.5345945", "0.53054076", "0.52464706", "0.52410626", "0.5228534", "0.51994413", "0.51882124", "0.5154847", "0.5143546", "0.51136965", "0.50817126", "0.5078946", "0.50688785", "0.5066824", "0.5...
0.4764447
54
Decode with custom models that implements ScorerInterface.
def recog_ctconly_mask(args): logging.warning(f'RECOGCTCONLY') logging.warning("experimental API for custom LMs is selected by --api v2") if args.batchsize > 1: raise NotImplementedError("multi-utt batch decoding is not implemented") if args.streaming_mode is not None: raise NotImplemen...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _dinamic_decode(self):\n raise NotImplementedError", "def decode(data):\n raise NotImplementedError", "def decoder(self):\n pass", "def decode(self, encoded):", "def decode(self, coded_set):", "def _decode(self, input_dict):\n pass", "def decode(self,m):\n raise N...
[ "0.5745083", "0.56577194", "0.56540185", "0.5620804", "0.53662676", "0.53617454", "0.53452384", "0.53048366", "0.5246182", "0.5241065", "0.5227346", "0.51992446", "0.51879555", "0.5154097", "0.5142348", "0.5112504", "0.5081071", "0.50781465", "0.5067879", "0.50665134", "0.506...
0.0
-1
Decode with custom models that implements ScorerInterface.
def recog_ctconly(args): logging.warning(f'RECOGCTCONLY') logging.warning("experimental API for custom LMs is selected by --api v2") if args.batchsize > 1: raise NotImplementedError("multi-utt batch decoding is not implemented") if args.streaming_mode is not None: raise NotImplementedEr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _dinamic_decode(self):\n raise NotImplementedError", "def decode(data):\n raise NotImplementedError", "def decoder(self):\n pass", "def decode(self, encoded):", "def decode(self, coded_set):", "def _decode(self, input_dict):\n pass", "def decode(self,m):\n raise N...
[ "0.5747375", "0.56597084", "0.5655909", "0.56236535", "0.5367864", "0.536351", "0.53476655", "0.5307059", "0.5246623", "0.52407634", "0.5230552", "0.5200018", "0.5190512", "0.5155592", "0.5144635", "0.5112429", "0.50815314", "0.50798166", "0.50691396", "0.5068332", "0.5067991...
0.0
-1
Decode with custom models that implements ScorerInterface.
def recog_ctconly_lang(args): logging.warning(f'RECOGCTCONLYLANG') logging.warning(f'all_langs {args.train_langs}') logging.warning("experimental API for custom LMs is selected by --api v2") if args.batchsize > 1: raise NotImplementedError("multi-utt batch decoding is not implemented") if a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _dinamic_decode(self):\n raise NotImplementedError", "def decode(data):\n raise NotImplementedError", "def decoder(self):\n pass", "def decode(self, encoded):", "def decode(self, coded_set):", "def _decode(self, input_dict):\n pass", "def decode(self,m):\n raise N...
[ "0.57490647", "0.56625557", "0.565776", "0.56256276", "0.5369684", "0.53667426", "0.534932", "0.5308202", "0.5245853", "0.524281", "0.52324843", "0.52029294", "0.5190814", "0.5156386", "0.5142517", "0.51143783", "0.50833166", "0.5082138", "0.5071095", "0.5070238", "0.50698984...
0.0
-1
Decode with custom models that implements ScorerInterface.
def recog_seg(args): logging.warning(f'RECOGSEG') logging.warning("experimental API for custom LMs is selected by --api v2") if args.batchsize > 1: raise NotImplementedError("multi-utt batch decoding is not implemented") if args.streaming_mode is not None: raise NotImplementedError("str...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _dinamic_decode(self):\n raise NotImplementedError", "def decode(data):\n raise NotImplementedError", "def decoder(self):\n pass", "def decode(self, encoded):", "def decode(self, coded_set):", "def _decode(self, input_dict):\n pass", "def decode(self,m):\n raise N...
[ "0.57454574", "0.5658464", "0.56545657", "0.5621851", "0.53665817", "0.53629136", "0.5345945", "0.53054076", "0.52464706", "0.52410626", "0.5228534", "0.51994413", "0.51882124", "0.5154847", "0.5143546", "0.51136965", "0.50817126", "0.5078946", "0.50688785", "0.5066824", "0.5...
0.0
-1
Sends an HTTP request to 'player/status/'
def testSimple(self): self.getPage("player/status/", method = "GET") self.assertStatus(status = 200) print 'http headers:' for header in self.headers.items(): print header print 'body:' print simplejson.dumps(self.body,indent=1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_status():\n data = {\n 'status': 'up',\n }\n jsn = json.dumps(data)\n\n resp = Response(jsn, status=200, mimetype='application/json')\n\n return resp", "def get_player_status(self, player):\n # (title) : Song title\n # Requested Information\n # a (artist): Art...
[ "0.6598885", "0.65778875", "0.64045924", "0.6403228", "0.61674875", "0.6140377", "0.61286503", "0.6126103", "0.6078466", "0.60375863", "0.6030848", "0.5961892", "0.59506136", "0.5911843", "0.5906268", "0.58982503", "0.5829051", "0.58256584", "0.5812865", "0.5810653", "0.57865...
0.66533524
0
to print the dictionary
def print_dict(self): print(self.__dict__)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_dict(data):\n print data", "def printDict(self):\n print str(self)", "def print_dd_dict( self, ):\n print( self._dd_dict )", "def pprint(self):\r\n for i in self.items():\r\n print '%s => %r'%i", "def print(self):\n for fiction in self.fictions:\n ...
[ "0.83672595", "0.8356495", "0.81431854", "0.77898806", "0.7726312", "0.7603272", "0.75941074", "0.7590774", "0.74340075", "0.74219483", "0.74219483", "0.74031407", "0.73473185", "0.73427135", "0.7194816", "0.71855396", "0.71855396", "0.70921296", "0.70680887", "0.70650184", "...
0.76588094
5
convert class in a dictionary
def to_dict(self): return self.__dict__
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def class_hook(dct):\n if len(dct) == 1:\n class_name, value = next(iter(dct.items()))\n class_name = class_name.strip('_')\n if class_name == 'Dictionary':\n return Dictionary(*value)\n return dct", "def classToDict(obj=None):\n\tif obj == None:\n\t\treturn {}\n\n\t_obj = {...
[ "0.6955489", "0.6860669", "0.67955244", "0.664205", "0.65622425", "0.6513592", "0.648857", "0.647291", "0.6455078", "0.64094526", "0.639815", "0.6396973", "0.63957334", "0.6393332", "0.6371379", "0.6364921", "0.6351631", "0.63222235", "0.6319581", "0.63126314", "0.6300084", ...
0.0
-1
Ingresa una pareja llave,valor. Si la llave ya existe, se reemplaza el valor.
def put(rbt, key, value): try: rbt['root'] = insertNode(rbt['root'], key, value, rbt['cmpfunction']) rbt['root']['color'] = node.BLACK return rbt except Exception as exp: error.reraise(exp, 'Bst:Put')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def uvozi_vloge(cur):\n cur.execute(\"DELETE FROM nastopa;\")\n cur.execute(\"DELETE FROM vloga;\")\n vloge = {}\n with open('podatki/vloge.csv') as datoteka:\n podatki = csv.reader(datoteka)\n stolpci = next(podatki)\n v = stolpci.index('vloga')\n poizvedba = \"\"\"\n ...
[ "0.5734998", "0.5284927", "0.5232269", "0.50278807", "0.50093645", "0.49711245", "0.49478197", "0.492433", "0.48967597", "0.48840693", "0.48563296", "0.485054", "0.4845613", "0.48376054", "0.48344535", "0.47956264", "0.47834414", "0.4780183", "0.47569022", "0.47529238", "0.47...
0.0
-1
Retorna una lista con todas las llaves de la tabla
def keySet(rbt): try: klist = lt.newList('SINGLE_LINKED', rbt['cmpfunction']) klist = keySetTree(rbt['root'], klist) return klist except Exception as exp: error.reraise(exp, 'RBT:KeySet')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edges(self):\n table = []\n edge_index = self.lofted_car.edges\n edge_radius = np.array([0.04166667, 0., 0.01041667, 0., 0.04166667,\n 0.02083333, 0.01041667, 0.02083333, 0.02083333,\n 0.02083333,\n ...
[ "0.6086962", "0.58893", "0.5810594", "0.580533", "0.5781291", "0.566528", "0.5639058", "0.56260157", "0.553218", "0.55098706", "0.5497589", "0.5375082", "0.5357068", "0.53537947", "0.53397906", "0.5326713", "0.5291013", "0.528224", "0.5276992", "0.5270633", "0.52701193", "0...
0.0
-1
Construye una lista con los valores de la tabla
def valueSet(rbt): try: vlist = lt.newList('SINGLE_LINKED', rbt['cmpfunction']) vlist = valueSetTree(rbt['root'], vlist) return vlist except Exception as exp: error.reraise(exp, 'RBT:valueSet')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def values(self):\n return [entry.value for entry in self.table if entry.value is not None]", "def get_value_list(self, insupdel=0):\n #NOTE: statement = [record, {...}]\n result = []\n if insupdel == StatementType.INSERT:\n statements = self.statements_insert\n elif...
[ "0.67610854", "0.6587979", "0.6507621", "0.63637394", "0.6242996", "0.6207197", "0.61351895", "0.6094284", "0.60926175", "0.60862446", "0.60511637", "0.6019586", "0.6011023", "0.59827095", "0.5976031", "0.5965172", "0.59622747", "0.59427965", "0.59256226", "0.5921408", "0.591...
0.0
-1
Retorna la altura del arbol
def height(rbt): try: return heightTree(rbt['root']) except Exception as exp: error.reraise(exp, 'RBT:height')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_alt(self):\n p = self._get_sub_text('alt')\n if not p:\n return None\n else:\n try:\n return int(p)\n except ValueError:\n return None", "def getRestricaoPlacaFinal(self):\n import ast\n restricao_placa_fina...
[ "0.64514583", "0.6033798", "0.6007864", "0.5769737", "0.5769737", "0.5764125", "0.5623761", "0.5560028", "0.5551233", "0.55263346", "0.55175483", "0.54674464", "0.54409194", "0.5424623", "0.53518784", "0.53320485", "0.5271793", "0.52638614", "0.52592796", "0.52513933", "0.520...
0.0
-1
Retorna todas las llaves del arbol que se encuentren entre [keylo, keyhi]
def keys(rbt, keylo, keyhi): try: lstkeys = lt.newList('SINGLELINKED', rbt['cmpfunction']) lstkeys = keysRange(rbt['root'], keylo, keyhi, lstkeys, rbt['cmpfunction']) return lstkeys except Exception as exp: error.reraise(exp, 'RBT:keys')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def caesuras(k):\n caesuras = []\n for idx, i in enumerate(k):\n if i in k[idx + 1:]:\n caesuras.append(idx)\n return caesuras", "def keys():", "def keysAll():", "def triangulos_rectangulos(opcion,b,h):\n x1 =[0,0]\n ...
[ "0.54930055", "0.5466304", "0.54661936", "0.5365569", "0.53530455", "0.534807", "0.53398854", "0.53104085", "0.5282643", "0.5281222", "0.50924355", "0.50345254", "0.50326174", "0.5031676", "0.49859047", "0.49760678", "0.49699897", "0.49666688", "0.49497998", "0.49482527", "0....
0.56539536
0
Retorna todas los valores del arbol que se encuentren entre [keylo, keyhi]
def values(rbt, keylo, keyhi): try: lstvalues = lt.newList('SINGLELINKED', rbt['cmpfunction']) lstvalues = valuesRange(rbt['root'], keylo, keyhi, lstvalues, rbt['cmpfunction']) return lstvalues except Exception as exp: error.reraise(exp, 'RBT:Value...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getall(self, key):\n return self.values.get(key, [])", "def get_values():\n a1 = insert_data(\"a1\")\n r = insert_data(\"r\")\n n = insert_data(\"n\")\n return a1, r, n", "def get(con,key):\n # yy=atpic.log.setname(xx,'get')\n thecommand=\"get {key}\\r\\n\".format(key=key)\n # a...
[ "0.59552354", "0.5820003", "0.5759505", "0.5744926", "0.5744926", "0.5709699", "0.5685493", "0.5685493", "0.5669403", "0.5668395", "0.55271715", "0.55146015", "0.55090475", "0.54791063", "0.5465725", "0.5443579", "0.5428568", "0.5414096", "0.5408089", "0.5369653", "0.53522706...
0.6228335
0
Construye una lista con los valorers de la tabla
def valueSetTree(root, klist): try: if (root is not None): valueSetTree(root['left'], klist) lt.addLast(klist, root['value']) valueSetTree(root['right'], klist) return klist except Exception as exp: error.reraise(exp, 'RBT:valueSetTree')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def values(self):\n return [entry.value for entry in self.table if entry.value is not None]", "def values(self) -> List:\n pass", "def rows(self):\n return list(self)", "def values(self):\n return [row.values for row in self]", "def get_value_list(self, insupdel=0):\n #NOTE: ...
[ "0.6495255", "0.6341016", "0.62423235", "0.6214849", "0.6172965", "0.61069995", "0.6105375", "0.59903044", "0.5985913", "0.5955074", "0.5912254", "0.59120584", "0.5893518", "0.58875644", "0.5830432", "0.58080864", "0.579894", "0.578962", "0.5760287", "0.57566446", "0.5750182"...
0.0
-1
Construye una lista con las llaves de la tabla
def keySetTree(root, klist): try: if (root is not None): keySetTree(root['left'], klist) lt.addLast(klist, root['key']) keySetTree(root['right'], klist) return klist except Exception as exp: error.reraise(exp, 'BST:keySetTree')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def creaLados(vertices):\n\tlados = []\n\tfor i in range(len(vertices)-1):\n\t\tlados.append((i, i+1))\n\tlados.append((i+1,0))\n\treturn lados", "def edges(self):\n table = []\n edge_index = self.lofted_car.edges\n edge_radius = np.array([0.04166667, 0., 0.01041667, 0., 0.04166667,\n ...
[ "0.5661952", "0.5641655", "0.5280575", "0.5262452", "0.52430177", "0.52399147", "0.5239519", "0.52204", "0.52175784", "0.5199818", "0.5191856", "0.51906866", "0.5174329", "0.5166817", "0.51569086", "0.5131866", "0.5119306", "0.5115338", "0.5114313", "0.5112016", "0.5104501", ...
0.0
-1
Cambia el color de un nodo
def flipNodeColor(rbnode): try: if (rbnode is not None): if (rbnode['color'] == node.RED): rbnode['color'] = node.BLACK else: rbnode['color'] = node.RED except Exception as exp: error.reraise(exp, 'RBT:flipNodeColors')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _color(self, args):", "def changeColor( self ):\n\t\t\n\t\tx, y = self.position.xy\n\t\tself.color = ( int((x / WINDOW_X) * 128), int((x / WINDOW_X) * 128) + int((y / WINDOW_Y) * 128 ), int((y / WINDOW_Y) * 128))", "def get_color(self):\n return \"yellow\"", "def setColor(self,value):\n\t\tself.po...
[ "0.682446", "0.65651417", "0.6545235", "0.6535278", "0.6474425", "0.6446628", "0.6444653", "0.6423879", "0.641201", "0.640824", "0.6393506", "0.6391409", "0.63702685", "0.6338181", "0.6337946", "0.63358945", "0.63351315", "0.63111734", "0.63094306", "0.629957", "0.62433887", ...
0.0
-1
Indica si un nodo del arbol es rojo
def isRed(rbnode): try: if (rbnode is None): return False else: return (rbnode['color'] == node.RED) except Exception as exp: error.reraise(exp, 'RBT:isRed')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def posicion_libre(posicion, tablero):\n i, j = posiciones[posicion]\n return tablero[i][j] not in [\"X\", \"O\"]", "def larceny(x): \n for elem in x:\n if elem == 'Larceny':\n return 1\n return 0", "def rellena(self):\r\n for nodo in range(0, self.red['n']):\r\n ...
[ "0.575324", "0.5393571", "0.53649163", "0.534711", "0.52205145", "0.52030355", "0.5183418", "0.51602805", "0.5151644", "0.5145168", "0.51417536", "0.5134104", "0.5129342", "0.51212126", "0.511644", "0.50979215", "0.50649536", "0.5041791", "0.50302386", "0.5003249", "0.49886",...
0.0
-1
Retorna la altura del arbol
def heightTree(root): try: if (root is None): return -1 else: return 1 + max(heightTree(root['left']), heightTree(root['right'])) except Exception as exp: error.reraise(exp, 'RBT:heightTree')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_alt(self):\n p = self._get_sub_text('alt')\n if not p:\n return None\n else:\n try:\n return int(p)\n except ValueError:\n return None", "def getRestricaoPlacaFinal(self):\n import ast\n restricao_placa_fina...
[ "0.64514583", "0.6033798", "0.6007864", "0.5769737", "0.5769737", "0.5764125", "0.5623761", "0.5560028", "0.5551233", "0.55263346", "0.55175483", "0.54674464", "0.54409194", "0.5424623", "0.53518784", "0.53320485", "0.5271793", "0.52638614", "0.52592796", "0.52513933", "0.520...
0.0
-1
Retorna la menor llave de la tabla de simbolos
def minKeyTree(root): try: min = None if (root is not None): if (root['left'] is None): min = root else: min = minKeyTree(root['left']) return min except Exception as exp: error.reraise(exp, 'BST:minKeyNode')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def db_table(self):", "def _get_table(self):\n\t\treturn self._table", "def table(self):\n return self.t", "def table(self):\n return self.generator.table", "def table(self):\r\n return self._table", "def table(self):\n return self._table", "def table(self):\n return self...
[ "0.6278391", "0.62468314", "0.61417526", "0.59707", "0.5962698", "0.5889534", "0.5889534", "0.5727264", "0.56463814", "0.5611516", "0.55952156", "0.5588092", "0.5582471", "0.55522346", "0.5552013", "0.5538822", "0.5531865", "0.5525017", "0.5522536", "0.55203056", "0.5493766",...
0.0
-1
Retorna todas las llaves del arbol en un rango dado
def keysRange(root, keylo, keyhi, lstkeys, cmpfunction): try: if (root is not None): complo = cmpfunction(keylo, root['key']) comphi = cmpfunction(keyhi, root['key']) if (complo < 0): keysRange(root['left'], keylo, keyhi, lstkeys, cmpfunction) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getSlaves():", "def reemplaza_tildes(palabra):", "def arroba_letras(cadena, long_palabra, costo_palabra_corta, costo_palabra_larga):\n palabras = cadena.split(\" \")\n frase_final = \"\"\n costo_total = 0\n for i in range(len(palabras)):\n if len(palabras[i]) > long_palabra:#verificio si...
[ "0.61546427", "0.6092891", "0.60230464", "0.58362556", "0.5798641", "0.57370836", "0.5722869", "0.571663", "0.5704517", "0.5677203", "0.56217366", "0.5610547", "0.55886686", "0.557021", "0.5499204", "0.54892117", "0.548844", "0.5463902", "0.54591924", "0.5431312", "0.54289955...
0.0
-1
Retorna todas los valores del arbol en un rango dado por [keylo, keyhi]
def valuesRange(root, keylo, keyhi, lstvalues, cmpfunction): try: if (root is not None): complo = cmpfunction(keylo, root['key']) comphi = cmpfunction(keyhi, root['key']) if (complo < 0): valuesRange(root['left'], keylo, keyhi, lstvalues, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_values():\n a1 = insert_data(\"a1\")\n r = insert_data(\"r\")\n n = insert_data(\"n\")\n return a1, r, n", "def get(con,key):\n # yy=atpic.log.setname(xx,'get')\n thecommand=\"get {key}\\r\\n\".format(key=key)\n # atpic.log.debug(yy,'get command:',thecommand)\n con.send(thecommand...
[ "0.62296665", "0.60632324", "0.5898418", "0.5852337", "0.5796931", "0.56805223", "0.56805223", "0.5639313", "0.5617256", "0.5608096", "0.5608096", "0.56026095", "0.5602499", "0.5451546", "0.544361", "0.54403853", "0.54006344", "0.53979206", "0.5394816", "0.53846955", "0.53236...
0.0
-1
Encuentra y remueve la menor llave de la tabla de simbolos y su valor asociado
def deleteMinTree(root): try: if (root['left'] is None): return None if ((not isRed(root['left'])) and ((not isRed(root['left']['left'])))): root = moveRedLeft(root) root['left'] = deleteMinTree(root['left']) root = balance(root) return root excep...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def modificar_tablero(tablero, simbolo, posicion):\n i, j = posiciones[posicion]\n tablero[i][j] = simbolo\n return tablero", "def nuevaClave( self ) :\r\n liActual = [ columna.clave for columna in self.liColumnas if columna.siFormula ]\r\n numero = 1\r\n while True :\r\n ...
[ "0.6143716", "0.58006257", "0.5797941", "0.5714387", "0.5518073", "0.5369162", "0.52869046", "0.5189154", "0.5173144", "0.5153922", "0.51478547", "0.51395077", "0.51072294", "0.5099724", "0.50643224", "0.50595075", "0.503407", "0.5029785", "0.5025654", "0.5010453", "0.5002896...
0.0
-1
Encuentra y remueve la mayor llave de la tabla de simbolos y su valor asociado
def deleteMaxTree(root): try: if (isRed(root['left'])): root = rotateRight(root) if (root['right'] is None): return None if ((not isRed(root['right'])) and ((not isRed(root['right']['left'])))): root = moveRedRight(root) root['right'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def modificar_tablero(tablero, simbolo, posicion):\n i, j = posiciones[posicion]\n tablero[i][j] = simbolo\n return tablero", "def nuevaClave( self ) :\r\n liActual = [ columna.clave for columna in self.liColumnas if columna.siFormula ]\r\n numero = 1\r\n while True :\r\n ...
[ "0.589483", "0.57015175", "0.55293685", "0.5401105", "0.53825414", "0.53142506", "0.52072495", "0.51530755", "0.5059754", "0.50572884", "0.50099957", "0.49965996", "0.4982538", "0.49711207", "0.49506447", "0.4936919", "0.48996902", "0.488858", "0.48815435", "0.48732385", "0.4...
0.0
-1
Cambio de color durante el proceso de eliminacion
def moveRedRight(root): try: flipColors(root) if (isRed(root['left']['left'])): root = rotateRight(root) flipColors(root) return root except Exception as exp: error.reraise(exp, 'RBT:moveRedLeft')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gradationredWipe(strip, wait_ms=10):\n color=Color(0,255,0)\n for i in range(strip.numPixels()/2):\n strip.setPixelColor(strip.numPixels()/2-i-1, color+256*256*7*i)\n strip.setPixelColor(i+strip.numPixels()/2, color+256*256*7*i)\n #print(color)\n strip.show()\n time.sle...
[ "0.6761813", "0.67576456", "0.67344", "0.67042047", "0.6687209", "0.6645029", "0.66438633", "0.6641287", "0.6637732", "0.6637732", "0.6611666", "0.66003597", "0.655025", "0.65240425", "0.6520002", "0.6475826", "0.64448905", "0.6416703", "0.635901", "0.62895775", "0.6284867", ...
0.0
-1
Cambio de color durante el proceso de eliminacion
def moveRedLeft(root): try: flipColors(root) if (isRed(root['right']['left'])): root['right'] = rotateRight(root['right']) root = rotateLeft(root) flipColors(root) return root except Exception as exp: error.reraise(exp, 'RBT:moveRedLeft')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gradationredWipe(strip, wait_ms=10):\n color=Color(0,255,0)\n for i in range(strip.numPixels()/2):\n strip.setPixelColor(strip.numPixels()/2-i-1, color+256*256*7*i)\n strip.setPixelColor(i+strip.numPixels()/2, color+256*256*7*i)\n #print(color)\n strip.show()\n time.sle...
[ "0.67647237", "0.6760774", "0.67350554", "0.6705116", "0.66866803", "0.6648157", "0.6644682", "0.6642168", "0.6638548", "0.6638548", "0.66126376", "0.6601241", "0.65508455", "0.6524975", "0.6522062", "0.64751035", "0.6446706", "0.6417296", "0.6358701", "0.6290268", "0.6286963...
0.0
-1
Computes Bjs matrix for a defect in a given anisotropic medium
def bjs(l, c): if len(l) == 4: l = mbvector(l) elif len(l) == 3: pass else: return 0 v = np.array([1, pi, e]) r = l / np.linalg.norm(l) m = np.cross(r, v) n = np.cross(r, m) m = m / np.linalg.norm(m) n = n / np.linalg.norm(n) w = np.arange(0, 2 * pi, 0.001...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _getBMat(self):\n\n \"\"\"B matrix is just a mass matrix, can be easily assembled\n through fenics. However, the ordering in Fenics is not the\n mesh ordering. So we build a temp matrix and then use the\n vertex to dof map to get the right ordering interms of our\n mesh nodes...
[ "0.6278779", "0.5816178", "0.5799315", "0.57437575", "0.565044", "0.55140615", "0.5501549", "0.5437091", "0.53895843", "0.53818303", "0.5353231", "0.5322105", "0.5305896", "0.529486", "0.5269439", "0.52539384", "0.525364", "0.5223441", "0.5220368", "0.5218853", "0.51902485", ...
0.53015864
13
Populates 4D elastic tensor from 6x6 elastic tensor
def Cijkl(C): c = np.zeros(shape=(3, 3, 3, 3)) CC = np.zeros(shape=(9, 9)) CC[0:6, 0:6] = C[0:6, 0:6] CC[6:9, 6:9] = C[3:6, 3:6] CC[0:6, 6:9] = C[0:6, 3:6] CC[6:9, 0:6] = C[3:6, 0:6] c[0, 0, 0, 0] = CC[0, 0] c[0, 0, 1, 1] = CC[0, 1] c[0, 0, 2, 2] = CC[0, 2] c[0, 0, 1, 2] = CC[0,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _4d_tensor(self, name, tensor, **kwargs):\r\n h, w, c, num_tensor = tensor.shape.as_list()\r\n\r\n # Try to visualise convolutional filters or feature maps\r\n # See: https://gist.github.com/kukuruza/03731dc494603ceab0c5\r\n # input shape: (Y, X, C, N)\r\n if c != 1 and c != ...
[ "0.645886", "0.56280047", "0.55941963", "0.55898535", "0.55519897", "0.55153", "0.54828554", "0.5457415", "0.5443727", "0.5424891", "0.5404391", "0.53744656", "0.53711516", "0.53519404", "0.5349043", "0.53421223", "0.53419113", "0.53325886", "0.53046644", "0.5291646", "0.5277...
0.0
-1
Populates 6x6 elastic tensor for cubic crystals
def cubeCij(c11, c13, c44): C = np.zeros(shape=(6, 6)) C[0, 0] = C[1, 1] = C[2, 2] = c11 C[0, 1] = C[0, 2] = C[1, 0] = C[1, 2] = C[2, 0] = C[2, 1] = c13 C[3, 3] = C[4, 4] = C[5, 5] = c44 S = np.linalg.inv(C) return {"C": C, "S": S}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_sc(self):\n sc = []\n a = np.array([1, 0, 0], dtype=np.float32)\n b = np.array([0, 1, 0], dtype=np.float32)\n c = np.array([0, 0, 1], dtype=np.float32)\n # order z -> y -> x\n for i, j, k in itertools.product(*itertools.repeat(range(-(self.nsc//2),self.nsc//2+1), 3...
[ "0.6207161", "0.6204961", "0.5940996", "0.5841021", "0.5796941", "0.56329495", "0.56159425", "0.56084204", "0.5568752", "0.5554606", "0.55243033", "0.55191934", "0.5518823", "0.5498849", "0.5498104", "0.54870147", "0.54841", "0.54828954", "0.5440627", "0.54392284", "0.5436503...
0.0
-1
Converts MillerBravais plane indices to cartesian normal vectors
def mbplane(A, c=sqrt(8 / 3)): # for Sun Mg Potential: c=1.6281689374348 if A[0] == 0 and A[1] == 0 and A[2] == 0: B = np.array([0, 0, 1]) else: if A[0] == 0: p1 = np.array([-0.5 / A[1], 0.5 * sqrt(3) / A[1], 0]) p2 = np.array([-0.5 / A[2], -0.5 * sqrt(3) / A[2], 0])...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plane_equation(point_a, point_b, point_c):\n v1 = np.subtract(point_a, point_c)\n v2 = np.subtract(point_a, point_b)\n normal = np.cross(v1, v2)\n # print 'b4 norm', normal\n unit_normal = norm_vect(normal)\n # print 'unityyy', unit_normal\n return unit_normal", "def get_normal_vector_of...
[ "0.65218204", "0.6503691", "0.645618", "0.640167", "0.6362043", "0.633903", "0.6333386", "0.62251955", "0.61807", "0.5980656", "0.5965315", "0.58766127", "0.5865005", "0.5738643", "0.5692937", "0.5692491", "0.5678418", "0.5664199", "0.5654711", "0.5653635", "0.5626195", "0....
0.0
-1
Converts noncubic crystal indices to cartesiancoordinate vectors whilst preserving vector length.
def mbvector(A, c=sqrt(8 / 3)): la = len(A) sa = A.size if la == sa: B = np.array([0.0, 0.0, 0.0]) a1 = A[0] * np.array([1.0, 0.0]) a2 = A[1] * np.array([-0.5, 0.5 * sqrt(3)]) a3 = A[2] * np.array([-0.5, -0.5 * sqrt(3)]) B[0] = a1[0] + a2[0] + a3[0] B[1] = a1[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cxvec(self):\n return np.array([self.cx, self.cy])", "def get_cartesian_coords(self):\n r = 1\n dec = self.dec + 90\n x = r * math.sin(np.deg2rad(dec)) * math.cos(np.deg2rad(self.ra))\n y = r * math.sin(np.deg2rad(dec)) * math.sin(np.deg2rad(self.ra))\n z = r * math.cos(...
[ "0.64601624", "0.6313934", "0.6292211", "0.618065", "0.61797065", "0.6153555", "0.6128813", "0.6096424", "0.60606337", "0.5981715", "0.5911841", "0.5836146", "0.5835889", "0.5830214", "0.5827372", "0.58222485", "0.5816691", "0.58102924", "0.5799981", "0.5760489", "0.5751354",...
0.0
-1
Converts cartesian normal vectors into MillerBravais plane indices
def mvector(B, c): # for Sun Mg Potential: c=1.6281689374348 A = np.zeros(shape=4) A[0] = (2 / 3) * B[0] A[1] = 0.5 * ((2 / sqrt(3)) * B[1] - A[0]) A[2] = -A[0] - A[1] A[3] = B[2] / c return A
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plane_equation(point_a, point_b, point_c):\n v1 = np.subtract(point_a, point_c)\n v2 = np.subtract(point_a, point_b)\n normal = np.cross(v1, v2)\n # print 'b4 norm', normal\n unit_normal = norm_vect(normal)\n # print 'unityyy', unit_normal\n return unit_normal", "def normal_vector(origin...
[ "0.6565002", "0.65067965", "0.64226294", "0.62855655", "0.6252082", "0.6249797", "0.62446517", "0.6125102", "0.60917956", "0.5859786", "0.58306587", "0.57857585", "0.5702033", "0.5697134", "0.5696204", "0.56910414", "0.56821984", "0.5681735", "0.5674337", "0.56567013", "0.565...
0.5339138
68
Converts cartesian vectors into MillerBravais vector indices
def mplane(B, c): # for Sun Mg Potential: c=1.6281689374348 A = np.zeros(shape=4) s = A.shape phi = 0 l = 0 b = 0 for i in range(s[0]): A[0] = (2 / 3) * B[0] A[1] = 0.5 * ((2 / sqrt(3)) * B[1] - A[0]) A[2] = -A[0] - A[1] phi = atan(B[1] / B[0]) b = 0.5...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cartesian2bary(self, x):\n lam = np.zeros((x.shape[0], 3))\n lam[:,:2] = np.einsum('ij,kj->ki', self.Tinv, x - self.xv[2])\n lam[:,2] = 1. - lam[:,0] - lam[:,1]\n return lam", "def project_vectors(self, vectors):\n return np.dot(vectors, self.components.T)", "def cxvec(se...
[ "0.60982597", "0.6096606", "0.5928866", "0.5878671", "0.5862804", "0.5852861", "0.57384753", "0.5711407", "0.56912196", "0.5668883", "0.5655643", "0.56316304", "0.55861735", "0.5576225", "0.5573143", "0.5563656", "0.5560922", "0.5555036", "0.5547608", "0.55325174", "0.5528160...
0.0
-1
Rotates coordinate system from x1,z1 to x2,z2
def rotation(x1, z1, x2, z2): e1 = np.zeros(shape=(3, 3)) e2 = np.zeros(shape=(3, 3)) e1[0, :] = x1 / np.linalg.norm(x1) e1[2, :] = z1 / np.linalg.norm(z1) e1[1, :] = np.cross(e1[2, :], e1[0, :]) e2[0, :] = x2 / np.linalg.norm(x2) e2[2, :] = z2 / np.linalg.norm(z2) e2[1, :] = np.cross(e2...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rotateZ(self, *args, **kwargs):\n ...", "def rotation(x,y,z):\r\n phi = np.arctan(z/sqrt(x**2+y**2))\r\n lamb = np.arctan2(y,x)\r\n G = np.array([[-sin(lamb), cos(lamb), 0],\r\n [-sin(phi) * cos(lamb), -sin(phi) * sin(lamb), cos(phi)],\r\n [cos(phi) * cos(lam...
[ "0.72137934", "0.6789719", "0.66737", "0.6606905", "0.6600858", "0.65760684", "0.65532327", "0.65532327", "0.65532327", "0.65532327", "0.6507178", "0.64992857", "0.64870286", "0.6475885", "0.6472012", "0.6458319", "0.6445637", "0.6438456", "0.6432099", "0.643071", "0.6415745"...
0.77712363
0
Converts strain state to displacements With the convention that ux=f(x,y), uy=f(y,z), uz=f(z,x)
def strain2disp(e, A): l = A.shape u = np.zeros(shape=l) for i in range(l[0]): u[i, 0] = e[0, 0] * A[i, 0] + e[0, 1] * A[i, 1] u[i, 1] = e[1, 1] * A[i, 1] + e[1, 2] * A[i, 2] u[i, 2] = e[2, 2] * A[i, 2] + e[0, 2] * A[i, 0] return u
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reverse_state(self):\n state = np.array(self.get_reverse_state_arr())\n om = utils.build_occupancy_maps(utils.build_humans(state))\n # print(\"OM: \", om.size())\n # We only have a batch of one so just get the first element of\n # transform and rotate\n state = utils.t...
[ "0.5913096", "0.574097", "0.5734477", "0.5705467", "0.5608403", "0.55807066", "0.5495976", "0.5495976", "0.5495976", "0.5444154", "0.53824127", "0.53726685", "0.53664255", "0.5356983", "0.53183407", "0.5317279", "0.53069645", "0.52513015", "0.5239924", "0.5210715", "0.5183561...
0.0
-1
Converts stress state to strain state
def stress2strain(sigma, S): s6 = voigt(sigma) e6 = np.dot(S, s6) e6[3] = 0.5 * e6[3] e6[4] = 0.5 * e6[4] e6[5] = 0.5 * e6[5] e = unvoigt(e6) return e
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize_state(self):\n self.state = 2 * (self.state - 0.5)", "def get_state_s(self, lower = True):\r\n\r\n state_s = STATE_STRINGS[self._state - 1]\r\n state_s = state_s.lower() if lower else state_s\r\n return state_s", "def _state_convert(self, raw_state):\n variables...
[ "0.6264138", "0.59735096", "0.5917664", "0.5915843", "0.58080965", "0.57078695", "0.5452941", "0.544726", "0.5424653", "0.53956044", "0.5375939", "0.53561866", "0.5349646", "0.5337765", "0.5305472", "0.52900547", "0.5284307", "0.52565426", "0.52550626", "0.5244411", "0.523709...
0.5284506
16
Converts from 6x1 to 3x3
def unvoigt(A): a = np.zeros(shape=(3, 3)) a[0, 0] = A[0] a[0, 1] = A[5] a[0, 2] = A[4] a[1, 0] = A[5] a[1, 1] = A[1] a[1, 2] = A[3] a[2, 0] = A[4] a[2, 1] = A[3] a[2, 2] = A[2] return a
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make8UC3(mat):\n mat_8UC = make8UC(mat)\n mat_8UC3 = np.stack((mat_8UC,)*3, axis = -1)\n \n return mat_8UC3", "def dti6to33(dt6):\n dt33 = numpy.zeros(dt6.shape[:-1] + (3, 3), dtype=dt6.dtype)\n dt33[..., 0, 0] = dt6[..., 5] # dxx\n dt33[..., 0, 1] = dt33[..., 1, 0] = dt6[..., 4] / 2 #...
[ "0.6342387", "0.62157285", "0.61090064", "0.6037838", "0.58831704", "0.5652443", "0.5637152", "0.5616307", "0.5598152", "0.5570862", "0.554038", "0.552032", "0.550749", "0.5502176", "0.5461463", "0.5430975", "0.542803", "0.54076666", "0.54068506", "0.54068506", "0.54051447", ...
0.49841478
95
Performs vector contraction in the form of m C n
def vect_contract(m, c, n): a = np.tensordot(m, c, (0, 0)) mn = np.tensordot(a, n, (2, 0)) return mn
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getVector(c1, c2):\n return [c1[0] - c2[0], c1[1] - c2[1], c1[2] - c2[2]]", "def mvector(B, c):\n # for Sun Mg Potential: c=1.6281689374348\n A = np.zeros(shape=4)\n A[0] = (2 / 3) * B[0]\n A[1] = 0.5 * ((2 / sqrt(3)) * B[1] - A[0])\n A[2] = -A[0] - A[1]\n A[3] = B[2] / c\n return A",...
[ "0.6204063", "0.6118313", "0.6027351", "0.59437466", "0.5920729", "0.58891094", "0.58567584", "0.58476985", "0.58374596", "0.58282095", "0.5810846", "0.5797152", "0.5795684", "0.5795684", "0.5795684", "0.5773497", "0.5768829", "0.56864727", "0.5681027", "0.56669194", "0.56448...
0.709335
0
Converts from 3x3 to 6x1
def voigt(a): A = np.zeros(shape=(6, 1)) A[0] = a[0, 0] A[1] = a[1, 1] A[2] = a[2, 2] A[3] = a[1, 2] A[4] = a[0, 2] A[5] = a[0, 1] return A
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make8UC3(mat):\n mat_8UC = make8UC(mat)\n mat_8UC3 = np.stack((mat_8UC,)*3, axis = -1)\n \n return mat_8UC3", "def dti6to33(dt6):\n dt33 = numpy.zeros(dt6.shape[:-1] + (3, 3), dtype=dt6.dtype)\n dt33[..., 0, 0] = dt6[..., 5] # dxx\n dt33[..., 0, 1] = dt33[..., 1, 0] = dt6[..., 4] / 2 #...
[ "0.61705595", "0.59333605", "0.56910497", "0.56123316", "0.5608155", "0.55314213", "0.5478484", "0.5430528", "0.54113424", "0.5405368", "0.5405368", "0.5388583", "0.5362073", "0.5334513", "0.53329366", "0.53061944", "0.5296388", "0.5294149", "0.52797616", "0.5278745", "0.5270...
0.54071677
9
Query memory given an input embedding
def query(self, query, n_neighbours): if self.added_memories == 0: return None # TODO: possibly L2-normalize query vector? # allow single queries as well, not only batches if query.dim() == 1: query.unsqueeze_(0) idx, distances = self.get_nearest_entries_i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_embed(input_data, vocab_size, embed_dim):\n embedding = tf.Variable(tf.random_uniform((vocab_size,embed_dim), -1, 1))\n embed = tf.nn.embedding_lookup(embedding, input_data)\n #print (\"embed_dim: \",embed_dim) # 向量表达维度为 256\n #print (\"input_data.shape: \",input_data.shape) # (50, 5)\n #p...
[ "0.63078344", "0.63063365", "0.5960762", "0.5928939", "0.58945125", "0.58742183", "0.58714825", "0.5823085", "0.5794332", "0.5751944", "0.56750214", "0.5587403", "0.55768526", "0.557125", "0.5565566", "0.5550268", "0.5541789", "0.5470685", "0.5447556", "0.54236406", "0.540829...
0.6070764
3
Add entries to the memory module.
def add_entry(self, embeddings, labels, query_result=None): n_added = embeddings.shape[0] if self.added_memories + n_added <= self.memory_size: start = self.write_pointer + 1 end = start + n_added self.update_ixs(range(start, end), embeddings, labels, query_result) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_memory(self, **kwarg):\n for name, obs in kwarg.items():\n self.buffers[name] = np.concatenate((self.buffers[name], obs), axis=0)\n # get recent memory\n return self", "def record_memory_map(self):\n memory_map = self.get_memory_map()\n self._memory_map_r...
[ "0.65852726", "0.6368498", "0.62108815", "0.62035614", "0.6151291", "0.6102449", "0.60953045", "0.6070591", "0.58292973", "0.580414", "0.5742335", "0.57391006", "0.5659953", "0.56543183", "0.5636044", "0.56220376", "0.56029516", "0.55805933", "0.55668706", "0.5543858", "0.553...
0.5632198
15
Update specific memory slots If query_result is not supplied, relevance scores are not updated.
def update_ixs(self, ixs, embeddings, labels, query_result=None, global_update=True): self.memory_embeddings[ixs] = embeddings self.memory_labels[ixs] = labels self.memory_age[ixs] = 0 self.memory_relevance[ixs] = 0 if global_update: self.memory_age[self.memory_age !=...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _update(self, nbrs, nbrs_y, query, query_y):\n\n # Set up the graph for our shared memory variables\n new_K, new_A, new_V = self.K, self.A, self.V\n\n # Condition (1): First returned neighbour shares the same query label\n correct_query = T.eq(nbrs_y[:, 0], query_y).nonzero()[0]\n ...
[ "0.61297095", "0.5953453", "0.5922591", "0.5553142", "0.544283", "0.5403002", "0.5356434", "0.5338803", "0.5331692", "0.5323351", "0.5294844", "0.5292601", "0.5231745", "0.52154356", "0.51240927", "0.50593865", "0.5058139", "0.5054779", "0.50533724", "0.5042255", "0.50057137"...
0.620225
0
Query memory given an input embedding
def query(self, query, n_neighbours): if self.added_memories == 0: return None # TODO: possibly L2-normalize query vector? # allow single queries as well, not only batches if query.dim() == 1: query.unsqueeze_(0) idx, distances = self.get_nearest_entries_i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_embed(input_data, vocab_size, embed_dim):\n embedding = tf.Variable(tf.random_uniform((vocab_size,embed_dim), -1, 1))\n embed = tf.nn.embedding_lookup(embedding, input_data)\n #print (\"embed_dim: \",embed_dim) # 向量表达维度为 256\n #print (\"input_data.shape: \",input_data.shape) # (50, 5)\n #p...
[ "0.63078344", "0.63063365", "0.5960762", "0.5928939", "0.58945125", "0.58742183", "0.58714825", "0.5823085", "0.5794332", "0.5751944", "0.56750214", "0.5587403", "0.55768526", "0.557125", "0.5565566", "0.5550268", "0.5541789", "0.5470685", "0.5447556", "0.54236406", "0.540829...
0.6070764
2
Add entries to the memory module.
def add_entry(self, embeddings, labels, query_result=None): n_added = embeddings.shape[0] class_discount = self.class_discount for embedding, label in zip(embeddings, labels): n = self.n_class_embeddings[label] if self.class_discount_method == "mean": clas...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_memory(self, **kwarg):\n for name, obs in kwarg.items():\n self.buffers[name] = np.concatenate((self.buffers[name], obs), axis=0)\n # get recent memory\n return self", "def record_memory_map(self):\n memory_map = self.get_memory_map()\n self._memory_map_r...
[ "0.65852726", "0.6368498", "0.62108815", "0.62035614", "0.6151291", "0.6102449", "0.60953045", "0.6070591", "0.58292973", "0.580414", "0.5742335", "0.57391006", "0.5659953", "0.56543183", "0.5636044", "0.5632198", "0.56220376", "0.56029516", "0.55805933", "0.55668706", "0.554...
0.0
-1
Update class representations with new class means.
def update(self, class_means, unique_labels, logger=None): n_added = class_means.shape[0] class_discount = self.class_discount to_update = unique_labels normalized_class_means = None normalized_class_representations = None self.update_last_updated(unique_labels) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_class_records():\n logger.info('Fetching class ids and labels for '\n 'classes with direct instances')\n timestamp = statistics.get_current_timestamp()\n results = sparql.sparql_query(queries.QUERY_CLASSES,\n fallback=queries.QUERY_CLASSSES_FALLBA...
[ "0.6709953", "0.61785007", "0.6076284", "0.595551", "0.58957285", "0.5783457", "0.5720336", "0.57154924", "0.5688674", "0.56453985", "0.5566248", "0.5520287", "0.55193", "0.5472117", "0.5463804", "0.5440467", "0.541637", "0.53849554", "0.53834957", "0.53764176", "0.53638923",...
0.76716536
0
Update specific memory slots If query_result is not supplied, relevance scores are not updated.
def update_ixs(self, ixs, embeddings, labels, query_result=None, global_update=True): self.memory_embeddings[ixs] = embeddings self.memory_labels[ixs] = labels self.memory_age[ixs] = 0 self.memory_relevance[ixs] = 0 if global_update: self.memory_age[self.memory_age !=...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _update(self, nbrs, nbrs_y, query, query_y):\n\n # Set up the graph for our shared memory variables\n new_K, new_A, new_V = self.K, self.A, self.V\n\n # Condition (1): First returned neighbour shares the same query label\n correct_query = T.eq(nbrs_y[:, 0], query_y).nonzero()[0]\n ...
[ "0.61297095", "0.5953453", "0.5922591", "0.5553142", "0.544283", "0.5403002", "0.5356434", "0.5338803", "0.5331692", "0.5323351", "0.5294844", "0.5292601", "0.5231745", "0.52154356", "0.51240927", "0.50593865", "0.5058139", "0.5054779", "0.50533724", "0.5042255", "0.50057137"...
0.620225
1
a decorator to add backing off retry symantics to any a method that does a database transaction. When using this decorator, it is vital that any exception within the 'exceptions_eligible_for_retry' tuple above must not be handled within the wrapped function. This means that exception handlers that handle 'Exception' mu...
def db_transaction_retry_wrapper(fn): @ft.wraps(fn) def f(self, *args, **kwargs): backoffGenerator = util.backoffSecondsGenerator() try: while True: try: result = fn(self, *args, **kwargs) return result except exceptions_eligible_for_retry: waitInSeconds =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def retry(func, *args, **kwargs):\n @functools.wraps(func)\n def wrapper(*w_args, **w_kwargs):\n w_kwargs.update(kwargs)\n return retry_function_on_deadlock(func, *w_args, **w_kwargs)\n\n return wrapper", "def _retry(func):\n @wraps(func)\n def _retry_wrapper(self, *args, **k...
[ "0.67783445", "0.6644641", "0.6623299", "0.6539066", "0.6512475", "0.6476035", "0.6465493", "0.64365405", "0.6360299", "0.6348828", "0.6344524", "0.6313005", "0.62655896", "0.6242453", "0.6222092", "0.62088233", "0.6180234", "0.6120076", "0.60964835", "0.6095427", "0.60853565...
0.7249463
0
Try to reuse this named connection, else create one and use that
def connection(self, name=None): if not name: name = threading.currentThread().getName() if name in self: return self[name] self[name] = self.database.connection() return self[name]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __get_database_connection(self, reuse=True):\n if not self.__database_connection or not reuse:\n if self.__database_connection:\n self.__database_connection.close()\n self.__database_connection = None\n\n self.__database_connection = http.client.HTTPCo...
[ "0.6629559", "0.6570917", "0.6535228", "0.6433502", "0.6412028", "0.63429385", "0.6253376", "0.62532514", "0.6220175", "0.6215806", "0.6163777", "0.6153525", "0.6101365", "0.60986865", "0.6085492", "0.6082639", "0.60321325", "0.6022872", "0.6020028", "0.60199386", "0.60167944...
0.6910743
0
Just like connection, but returns a tuple with a connection and a cursor
def connectionCursorPair(self, name=None): connection = self.connection(name) return (connection, connection.cursor())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def conn_curs():\n dbname = \"abcdefgh\"\n password = \"Acka-1jfue4-snYmkall\"\n host = \"db.elephantsql.com\"\n\n connection = psycopg2.connect(dbname=dbname, user=dbname,\n password=password, host=host)\n cursor = connection.cursor()\n return connection, cursor"...
[ "0.782685", "0.74926525", "0.7455024", "0.7442478", "0.7405349", "0.73643297", "0.7351544", "0.73470646", "0.73046917", "0.72976387", "0.7228983", "0.7228983", "0.72195446", "0.7198042", "0.7187905", "0.71860284", "0.71206516", "0.70670146", "0.70400053", "0.700089", "0.69696...
0.81536436
0