query
stringlengths
9
9.05k
document
stringlengths
10
222k
metadata
dict
negatives
listlengths
30
30
negative_scores
listlengths
30
30
document_score
stringlengths
4
10
document_rank
stringclasses
2 values
Return whether Index supports a specific attribute.
def supports_index_feature(attr_name): return supports_indexes and hasattr(_test_index, attr_name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_attribute(self):\r\n return conf.lib.clang_isAttribute(self)", "def has_attribute(self, name):\n return name in self.schema", "def exists(self, index):\n return self._node.attributes.has_public_attribute(index)", "def has_attribute(self, attribute):\n return (attribute in s...
[ "0.7082171", "0.671865", "0.67019475", "0.6647597", "0.6562679", "0.65566695", "0.65162414", "0.6499327", "0.6332971", "0.6257881", "0.62174255", "0.6215965", "0.6213659", "0.62081057", "0.6135819", "0.6025148", "0.60145885", "0.5995824", "0.59782404", "0.5945429", "0.5937009...
0.7971018
0
Takes given filename containing version, optionally updates the version and saves it, and returns the version.
def ReadAndUpdateVersion(version_filename, update_position=None): if os.path.exists(version_filename): current_version = open(version_filename).readlines()[0] numbers = current_version.split('.') if update_position: numbers[update_position] = '%02d' % (int(numbers[update_position]) + 1) if upd...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def versioned(filename, version, force_version=False, full_path=True):\n if not '.' in filename:\n return None\n\n if USE_VERSIONING or force_version:\n dotindex = filename.rindex('.')\n filename = u'%s.%s%s' % (filename[:dotindex], version, filename[dotindex:])\n\n if full_path:\n ...
[ "0.7239123", "0.6710091", "0.6640225", "0.6498644", "0.63722545", "0.634427", "0.6290618", "0.62780464", "0.6245203", "0.6243732", "0.6232061", "0.62206507", "0.6211574", "0.6179349", "0.6108471", "0.6086702", "0.60851413", "0.6081705", "0.5965097", "0.5928732", "0.5923892", ...
0.72257257
1
This method updates the calculated rating of a review. It takes the currently assigned ratings for each property, adds them up, then divides by the total points to calculate the percentage of points given. Once that value is calculated, it is divided by 0.2 to the value into a "5 star" rating.
def calculate(self): rating = 0 props = ['aroma', 'appearance', 'taste', 'palate', 'bottle_style'] for item in props: rating += getattr(self, item, 0) self.overall = (rating / self.total) / .2
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_rating_average(self, rating):\n self.num_ratings += 1\n self.rating_total += rating\n self.save(update_fields=[\"num_ratings\", \"rating_total\"])\n self.average_rating = int(round(self.rating_total/self.num_ratings))\n self.save(update_fields=[\"average_rating\"])\n ...
[ "0.68534154", "0.66318846", "0.6197724", "0.61154777", "0.60824764", "0.6031516", "0.59556174", "0.59047467", "0.58960396", "0.588009", "0.5867817", "0.582206", "0.5821888", "0.58122706", "0.580732", "0.57773197", "0.5774083", "0.57408386", "0.5719941", "0.5719647", "0.569974...
0.69563735
0
Creates a new review for the given beer
def post(id): try: beer = Beer.objects.get(id=id) except mongoengine.DoesNotExist: return flask.Response('No beer with id {} found'.format(id), 404) except: return flask.Response('Invalid id {}'.format(id), 400) data = flask.request.get_json() # check to see if a review wa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addreview(self, name, year, genre, rating, review, reviewer):\n pass", "def post_review(recipe_id=None):\n\n if not storage.get(Recipe, recipe_id):\n abort(404)\n data = request.get_json()\n if not data:\n abort(400, 'Not a JSON')\n if 'user_id' not in data.keys():\n a...
[ "0.6573553", "0.6502498", "0.6285934", "0.6278751", "0.62220836", "0.62138295", "0.6156375", "0.61320794", "0.6116113", "0.609118", "0.60615915", "0.6058494", "0.6015865", "0.6005575", "0.6003493", "0.59815794", "0.5904925", "0.5881915", "0.58576345", "0.58488315", "0.5848608...
0.7248955
0
Convert a sequence of key accesses into a path string representing a path below the top level key in redis
def key_sequence_to_path(sequence: List[str]): return Path.rootPath() + ".".join(sequence)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sub_key(dirname):\n return SUB_PREFIX + dirname", "def GetKeyByPath(self, key_path):", "def path_to_key_sequence(path: str):\n if path == Path.rootPath():\n return []\n return path.split(\".\")[1:]", "def GetSubkeyByPath(self, key_path):", "def as_key(key):\n return key.lstrip('/').r...
[ "0.6561175", "0.646753", "0.63690233", "0.6362882", "0.6326689", "0.6214568", "0.6203694", "0.61824983", "0.6133761", "0.596251", "0.5954664", "0.59117234", "0.58686566", "0.58153015", "0.5785836", "0.5785692", "0.57508826", "0.5740406", "0.57283944", "0.571764", "0.56980115"...
0.67574036
0
Return a copy of dictionary with the paths formed by key_sequences removed
def copy_dictionary_without_paths(dictionary: Dict, key_sequence: List[List[str]]): ret = {} possibles = [ks for ks in key_sequence if len(ks) == 1] possibles = set(reduce(lambda x, y: x + y, possibles, [])) for k, v in dictionary.items(): if k in possibles: continue if type(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_keys_from_dict(dictionary, keys):\n\n # Copy dictionary\n dictionary_updated = dictionary.copy()\n try:\n [dictionary_updated.pop(key) for key in keys]\n except:\n print(\"Error: No ratio and sampling strategy parameters\")\n return dictionary_updated", "def _clean_paths(p...
[ "0.6578352", "0.6472215", "0.616475", "0.6164459", "0.61450326", "0.6133661", "0.60783386", "0.60522205", "0.6036807", "0.6010666", "0.5991608", "0.59915197", "0.598256", "0.59222156", "0.59201723", "0.5909378", "0.5890413", "0.5851687", "0.5850681", "0.5796644", "0.5791199",...
0.72551376
0
Given a list of paths and a prefix, return the paths that
def filter_paths_by_prefix(paths: Iterable[str], prefix: str): if prefix == Path.rootPath(): return paths, paths full_paths, suffixes = [], [] for p in paths: if p.startswith(prefix): suffixes.append(p[len(prefix):]) full_paths.append(p) return full_paths, suffixe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_prefixes(buildout):\n\n prefixes = parse_list(buildout.get('prefixes', ''))\n return [os.path.abspath(k) for k in prefixes if os.path.exists(k)]", "def get_files_prefix(prefixes, dirname, Lshow=None, Ldir=None):\n matched_files=[]\n for pref in prefixes:\n print(f\"prefix: {pref} in {where...
[ "0.70755565", "0.70603555", "0.7013892", "0.6863514", "0.6859876", "0.6569287", "0.65553904", "0.6512858", "0.650851", "0.6486868", "0.6460788", "0.6330737", "0.62926936", "0.6262605", "0.6248747", "0.6228626", "0.6223441", "0.61959684", "0.6190801", "0.6190228", "0.6180863",...
0.8435369
0
Insert value into dictionary at path specified by key_sequence. If the sequence of keys does not exist, it will be made
def insert_into_dictionary(dictionary: Dict, key_sequence: List[str], value): parent = dictionary for key in key_sequence[:-1]: if key not in parent.keys(): parent[key] = {} parent = parent[key] parent[key_sequence[-1]] = value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _set_by_path(dic, keys, value, create_missing=True):\n d = dic\n i = 0\n n_key = len(keys) - 1\n while i < n_key:\n k = keys[i]\n if isinstance(k, int):\n assert isinstance(d, list), \"Internal Error: %s is Expected as a list for %s.\" % (d, k)\n\n while len(d) <...
[ "0.6372905", "0.61910766", "0.60806626", "0.6001647", "0.58221465", "0.58184624", "0.5739152", "0.5730706", "0.57285595", "0.5695364", "0.5618897", "0.56144315", "0.55202925", "0.5516547", "0.54848045", "0.5456877", "0.5423328", "0.5423068", "0.53977156", "0.538743", "0.53754...
0.7882464
0
Ensure the key name provided is legal
def check_valid_key_name(name): if type(name) not in [str]: return False bad_chars = ["*", ".", "&&&&"] for k in bad_chars: if k in name: return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_key_name(cls, name):\n return (isinstance(name, basestring) and\n re.match('^[A-Za-z][A-Za-z0-9_]*$', name) and\n not hasattr(cls, name))", "def isValidKey(key):\n return True", "def _check_key(key): # type: (str) -> None\n if not key:\n raise...
[ "0.78318816", "0.71168035", "0.70732856", "0.70552856", "0.7041611", "0.6899042", "0.67258614", "0.6718385", "0.64835036", "0.64728975", "0.64275926", "0.63844997", "0.633739", "0.6335194", "0.6309751", "0.63031626", "0.62937796", "0.6276736", "0.6256404", "0.62518495", "0.62...
0.7321008
1
It reduces all buffers across network copies
def average_buffers(network): size = int(dist.get_world_size()) with torch.no_grad(): for buf in network.buffers(): dist.all_reduce(buf, op=dist.ReduceOp.SUM) buf.div_(size)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _refresh_buffers(self) -> None:", "def Allreduce(\n self,\n sendbuf: Union[DNDarray, torch.Tensor, Any],\n recvbuf: Union[DNDarray, torch.Tensor, Any],\n op: MPI.Op = MPI.SUM,\n ):\n ret, sbuf, rbuf, buf = self.__reduce_like(self.handle.Allreduce, sendbuf, recvbuf, op)\n...
[ "0.6124415", "0.598823", "0.5967219", "0.5920144", "0.5800446", "0.5794461", "0.576535", "0.5741834", "0.57155806", "0.56905043", "0.5683074", "0.5683074", "0.56442", "0.5642326", "0.5638489", "0.56378144", "0.56323874", "0.5623122", "0.5610344", "0.56079584", "0.56079584", ...
0.62437236
0
Permet de poser la question correspondant aux infos manquante pour le voyage
def question_generator(self): self.status_conv = 'yes_no_question_asked' questions = config.questions if not self.voyage.get('voyageurs') and 'voyageur_add' not in self.infos_needed: self.infos_needed.append('voyageur_add') if self.infos_needed: if self.is_hotel_n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ask_question(index, attributes):\n \n print(\"ask_question, index: \", str(index))\n\n curr_question = quiz.list_fragen[attributes[\"sess_questions\"][index]].get_frage()\n print(\"@ask_question: \", curr_question)\n\n print(\"@ask_question before if \")\n if len(attributes[\"scores\"]) > 1:\...
[ "0.6656517", "0.64856565", "0.6297228", "0.61885995", "0.6117319", "0.6103682", "0.60901123", "0.607107", "0.60502553", "0.59895825", "0.5979764", "0.5957236", "0.5946883", "0.5912476", "0.5895169", "0.58443356", "0.5833472", "0.58222497", "0.58212095", "0.5807978", "0.580511...
0.64970094
1
Read the data file into dicts.
def get_data(fname: str) -> dict: with open(fname) as f: return [rec.split() for rec in f.read().split("\n\n")]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_data(self, file_name):\n test_data_dict = {}\n i = 0\n file_handler = open(file_name)\n for data in file_handler.readlines():\n if i == 0:\n pass\n else:\n if data[len(data) - 1] == '\\n':\n data = data[:len...
[ "0.7438967", "0.7316724", "0.69993526", "0.69232804", "0.6786655", "0.67822355", "0.67553395", "0.6743297", "0.66417485", "0.660935", "0.657544", "0.6519889", "0.646409", "0.64569414", "0.64356375", "0.6424636", "0.6400758", "0.6400161", "0.637106", "0.6336366", "0.63237756",...
0.734245
1
opens the info window
def open_info_dialog(self): info_dialog = InfoDialog() info_dialog.exec_()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def showInfoWindow():\n\treturn 0", "def on_info_click(self, event):\n def on_close(event, wind):\n wind.Close()\n wind.Destroy()\n event.Skip()\n wind = wx.PopupTransientWindow(self, wx.RAISED_BORDER)\n if self.auto_save.GetValue():\n info = \"'auto-s...
[ "0.8189632", "0.71575576", "0.6955355", "0.6811716", "0.67940843", "0.67372173", "0.6709553", "0.6677812", "0.66064024", "0.6605875", "0.6594258", "0.65664667", "0.6501804", "0.6482363", "0.6466345", "0.64624065", "0.6458878", "0.6444091", "0.6436782", "0.6403368", "0.6362251...
0.8544418
0
returns a list of unique datasets in a directory
def list_unique_datasets(root, type ='roi'): import os lst_dir = os.listdir(root) lst_datasets = [] for item in lst_dir: if f".{type}.hdf5" in item: rt,camera_name,dataset_name,chunk,extension = split_raw_filename(item) if dataset_name not in lst_datasets: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_dataset_ids(clean_folder):\n files = os.listdir(clean_folder)\n\n datasets = list(set([i.split('.')[0] for i in files]))\n\n return [d for d in datasets if d + '.otu_table.clean.feather' in files and d + '.metadata.clean.feather' in files]", "def _list_datasets_from_dir(path: github_api.GithubPa...
[ "0.7031487", "0.6984933", "0.67306", "0.66171193", "0.6566382", "0.64591396", "0.64051497", "0.6381419", "0.63651735", "0.6338045", "0.63201356", "0.626137", "0.625739", "0.6252171", "0.6217978", "0.61235845", "0.6122705", "0.61049205", "0.60466945", "0.6039118", "0.603777", ...
0.77526206
0
Test the primes under 10 and 100
def test_primes_under_10(self): self.assertEqual(sieve(10), [2, 3, 5, 7]) self.assertEqual(sieve(100), [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_with_10_prime_numbers(self):\n numbers = [3,5,7,11,13,17,19,23,29,31]\n for number in numbers:\n self.assertFalse(has_divisors(number, int(math.sqrt(number) // 1) + 1), \"Number {} is a prime number.\".format(number))", "def test_prime_10(self):\n\t self.assertTrue(prime_genera...
[ "0.80114126", "0.7838949", "0.7714869", "0.7712949", "0.7498481", "0.74840343", "0.74631464", "0.7443868", "0.74101394", "0.73933285", "0.7363734", "0.7359168", "0.7355548", "0.7354168", "0.7318888", "0.7302952", "0.72974956", "0.72494286", "0.7239387", "0.722427", "0.7209835...
0.79695326
1
Check the lengths of the list of primes up to 1000000
def test_primes_under_1000000(self): self.assertEqual(len(sieve(100)), 25) self.assertEqual(len(sieve(1000)), 168) self.assertEqual(len(sieve(10000)), 1229) self.assertEqual(len(sieve(100000)), 9592) self.assertEqual(len(sieve(1000000)), 78498)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_prime():\n nums = []\n for i in range(2, 10000):\n if is_prime(i):\n nums.append(i)\n return nums", "def main() -> int:\n\n a = None\n for n, g in enumerate(gen_primes(100000, 1000000)):\n repeat, indices = check_if_has_3_repeated_digits(str(g))\n if repea...
[ "0.72410476", "0.70842636", "0.70530206", "0.7051215", "0.70129216", "0.698902", "0.6978667", "0.6943401", "0.6928235", "0.6921163", "0.689601", "0.68873644", "0.68835855", "0.6882051", "0.6874404", "0.6851525", "0.6791846", "0.678916", "0.67570394", "0.67552835", "0.6745485"...
0.84035337
0
Kill any active children, returning any that were not terminated within timeout.
def kill_children(timeout=1) -> List[psutil.Process]: procs = child_manager.children_pop_all() for p in procs: try: p.terminate() except psutil.NoSuchProcess: pass gone, alive = psutil.wait_procs(procs, timeout=timeout) for p in alive: logger.warning("Clea...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wait_children(self, timeout=None):\n self.join_children(timeout=timeout)\n return [x.get() for x in self.children]", "def join_children(self, timeout=None):\n\n time_start = time.time()\n child_count = len(self.children)\n\n for proc in self.children:\n\n # if a ...
[ "0.69803846", "0.69150037", "0.681604", "0.6730367", "0.66708744", "0.65329", "0.6406285", "0.64052707", "0.62206906", "0.61242473", "0.610742", "0.60288936", "0.59727114", "0.58997834", "0.58517337", "0.58473897", "0.5846386", "0.58226556", "0.5820407", "0.579071", "0.577955...
0.83679694
0
Returns the total for the given tenant.
def get_total(self, **kwargs): LOG.warning('WARNING: /v1/report/total/ endpoint is deprecated, ' 'please use /v1/report/summary instead.') authorized_args = [ 'begin', 'end', 'tenant_id', 'service', 'all_tenants'] url = self.get_url('total', kwargs, authorized_arg...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def table_total(self):\n total = 0.00\n\n for customer in self.customers:\n total = total + customer.get_total()\n\n return total", "def get_total_paid(self):\n return sum(self.paid)", "def get_total(self):\n\n base_price = 5\n total = (1 + int(self.tax)) * ...
[ "0.62531126", "0.6162233", "0.61108077", "0.60956305", "0.6016143", "0.5912477", "0.5870869", "0.5847878", "0.5786993", "0.57543814", "0.57539463", "0.5750175", "0.57361287", "0.57264996", "0.5717916", "0.5709568", "0.5695177", "0.5694699", "0.5693841", "0.56890893", "0.56671...
0.6835537
0
Sets the ssc id (default is sscmainnet1)
def set_id(self, ssc_id): self.ssc_id = ssc_id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def srs_id(self, srs_id):\n self.logger.debug(\"In 'srs_id' setter.\")\n\n if len(srs_id) < 3:\n raise Exception(\"SRS ID is too short, must be more than 3 characters.\")\n\n self._srs_id = srs_id", "def nucleus_security_id(self, nucleus_security_id):\n\n self._nucleus_secu...
[ "0.6161884", "0.6093355", "0.6029974", "0.6004457", "0.5978946", "0.5875039", "0.58659774", "0.5729421", "0.56342816", "0.56043476", "0.55065644", "0.55062157", "0.55062157", "0.5500351", "0.54839903", "0.5438406", "0.5390628", "0.53811723", "0.53690624", "0.5362894", "0.5361...
0.8160854
0
Changes the wallet account
def change_account(self, account): check_account = Account(account, steem_instance=self.steem) self.account = check_account["name"] self.refresh()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setaccount(self, vergeaddress, account):\n return self.proxy.setaccount(vergeaddress, account)", "def set_account(self, account: str):\n ret = self._call_txtrader_api('set_account', {'account': account})\n if ret:\n self.account = account\n return ret", "def put_accou...
[ "0.71350896", "0.7134241", "0.6935623", "0.6772499", "0.67456084", "0.6619017", "0.6619017", "0.6619017", "0.6619017", "0.6570755", "0.6416708", "0.6350566", "0.6350566", "0.63418996", "0.63365614", "0.6236376", "0.62000555", "0.61877316", "0.61869353", "0.61869353", "0.61117...
0.7437371
0
Transfer a token to another account.
def transfer(self, to, amount, symbol, memo=""): token_in_wallet = self.get_token(symbol) if token_in_wallet is None: raise TokenNotInWallet("%s is not in wallet." % symbol) if float(token_in_wallet["balance"]) < float(amount): raise InsufficientTokenAmount("Only %.3...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def token_transfer(ctx, amount, to):\n ocean = ctx.obj['ocean']\n account = ocean.account\n ocean.tokens.transfer(to, int(amount), account)\n echo({\n 'amount': amount,\n 'from': {\n 'address': account.address,\n 'balance': Token.get_instance().get_token_balance(acco...
[ "0.7828118", "0.61128455", "0.60857874", "0.60298026", "0.60056615", "0.597364", "0.59008574", "0.5854642", "0.5806969", "0.5676092", "0.55882776", "0.5564915", "0.5542804", "0.55134624", "0.548216", "0.54781884", "0.54602224", "0.5428062", "0.54226655", "0.5394105", "0.53359...
0.6379537
1
Issues a specific token amount.
def issue(self, to, amount, symbol): token = Token(symbol, api=self.api) if token["issuer"] != self.account: raise TokenIssueNotPermitted("%s is not the issuer of token %s" % (self.account, symbol)) if token["maxSupply"] == token["supply"]: raise MaxSupplyR...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_token(self, amount):\n self.M += amount", "def token_transfer(ctx, amount, to):\n ocean = ctx.obj['ocean']\n account = ocean.account\n ocean.tokens.transfer(to, int(amount), account)\n echo({\n 'amount': amount,\n 'from': {\n 'address': account.address,\n ...
[ "0.7084912", "0.60524404", "0.5868739", "0.5844773", "0.5841103", "0.5838695", "0.5806996", "0.5803967", "0.5790781", "0.5707415", "0.56977123", "0.55994946", "0.5595049", "0.5540172", "0.5540172", "0.5540172", "0.5540172", "0.5540172", "0.5540172", "0.5540172", "0.5540172", ...
0.7078184
1
Returns the buy book for the wallet account. When symbol is set, the order book from the given token is shown.
def get_buy_book(self, symbol=None, limit=100, offset=0): if symbol is None: buy_book = self.api.find("market", "buyBook", query={"account": self.account}, limit=limit, offset=offset) else: buy_book = self.api.find("market", "buyBook", query={"symbol": symbol, "account": self...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_ticker_book(self, symbol: Symbol):\n api_params = {\n \"symbol\": symbol.value\n }\n\n return self.request.get(path='/ticker/book', params=api_params)", "def book_ticker(self, symbol=''):\n params = {\n 'symbol': symbol,\n }\n return self._q...
[ "0.66823006", "0.65527743", "0.6475742", "0.6460369", "0.62905794", "0.62434053", "0.62104696", "0.62011075", "0.6194737", "0.6161263", "0.61371", "0.6124734", "0.6092546", "0.5844744", "0.58292174", "0.5801955", "0.57990044", "0.57884", "0.5781246", "0.55208474", "0.5463246"...
0.7860041
0
Returns the sell book for the wallet account. When symbol is set, the order book from the given token is shown.
def get_sell_book(self, symbol=None, limit=100, offset=0): if symbol is None: sell_book = self.api.find("market", "sellBook", query={"account": self.account}, limit=limit, offset=offset) else: sell_book = self.api.find("market", "sellBook", query={"symbol": symbol, "a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_buy_book(self, symbol=None, limit=100, offset=0):\r\n if symbol is None:\r\n buy_book = self.api.find(\"market\", \"buyBook\", query={\"account\": self.account}, limit=limit, offset=offset)\r\n else:\r\n buy_book = self.api.find(\"market\", \"buyBook\", query={\"symbol\"...
[ "0.71708095", "0.6858757", "0.6845278", "0.6777183", "0.6576272", "0.64677733", "0.64433914", "0.6294736", "0.62651837", "0.6260835", "0.59918576", "0.5936571", "0.5870502", "0.5838228", "0.58012784", "0.57994854", "0.57797", "0.57177216", "0.57014185", "0.56959134", "0.56795...
0.782693
0
List a folder. Return a dict mapping unicode filenames to FileMetadata|FolderMetadata entries.
def list_folder(dbx, folder, subfolder): path = '/%s/%s' % (folder, subfolder.replace(os.path.sep, '/')) while '//' in path: path = path.replace('//', '/') path = path.rstrip('/') try: with stopwatch('list_folder'): res = dbx.files_list_folder(path) except dropbox...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filelist(folder):\n file_dict={}\n folderlist = glob.glob(os.getcwd()+\"/\"+folder+\"/*\")\n for i in tqdm(folderlist):\n filelist = glob.glob(i+\"/*\")\n filename = i.rsplit(\"/\")[-1]\n file_dict[filename]= filelist\n\n return file_dict", "def ListFolder(self, path): # real...
[ "0.7113107", "0.6950174", "0.68306595", "0.68007314", "0.65157694", "0.6244095", "0.6208136", "0.6185927", "0.61017084", "0.606622", "0.6065129", "0.60376316", "0.6015897", "0.601543", "0.6008996", "0.60082483", "0.5999453", "0.58966297", "0.58930933", "0.58663845", "0.586465...
0.71694803
0
Checks if this operator is a comparison operator.
def is_comparison_op(self): return self.value in ["=", "!=", "<", "<=", ">", ">="]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isOperator(self):\n return _libsbml.ASTNode_isOperator(self)", "def isOperator(self, *args):\n return _libsbml.ASTBasePlugin_isOperator(self, *args)", "def is_comparison(node):\n return isinstance(node, Comparison)", "def __eq__(self, other: 'OperatorConfig'):\n operator_name = se...
[ "0.7321015", "0.72628", "0.68260705", "0.66146785", "0.65818447", "0.6483728", "0.6332287", "0.62300766", "0.61627215", "0.6155684", "0.61439794", "0.6050088", "0.5994527", "0.5971696", "0.5937225", "0.59370035", "0.5907571", "0.58884007", "0.5831833", "0.58108664", "0.580764...
0.7520363
0
Checks if this operator is an arithmetic operator.
def is_arithmetic_op(self): return self.value in ["+", "-"]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isOperator(self):\n return _libsbml.ASTNode_isOperator(self)", "def is_operator(operator):\n\t\tlist_of_operators = [\"+\", \"-\", \"*\", \"/\"]\n\t\treturn operator in list_of_operators", "def isOperator(self, *args):\n return _libsbml.ASTBasePlugin_isOperator(self, *args)", "def isoperato...
[ "0.72987086", "0.7168655", "0.70389915", "0.6944585", "0.6697497", "0.66260475", "0.6606036", "0.6585253", "0.65331554", "0.6493527", "0.64781654", "0.6464818", "0.64532834", "0.64515954", "0.63138485", "0.6309521", "0.6233353", "0.6156094", "0.6153355", "0.61440074", "0.6018...
0.8123092
0
La funcion recibe el servicio, la ciudad y la fecha.
def get_precio_de_servicio(**kwargs): servicio = kwargs.get("servicio") ciudad = kwargs.get("ciudad") if ciudad and servicio: fecha = kwargs.get("fecha") if 'fecha' in kwargs else datetime.date.today() precios = [precio for precio in PrecioDeServicio.objects.filter(servic...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getIntervenciones():", "def getStatVentesJour(self, in_data):\n try:\n date_jour = in_data['date_jour']\n dt = dateutil.parser.parse(date_jour)\n except:\n out_data = {\n 'success': False\n }\n return out_data\n localt...
[ "0.5977341", "0.56048363", "0.55636686", "0.55508226", "0.5490343", "0.5456728", "0.5362048", "0.5352262", "0.5350753", "0.5344096", "0.53391474", "0.53209996", "0.5319985", "0.53018814", "0.52821594", "0.5279239", "0.52485096", "0.52485096", "0.52485096", "0.52485096", "0.52...
0.6173133
0
Transform PoseStamped detection into base_link frame. Returns PoseStamped in base_link frame.
def _transform_to_base_link(self, detection, timeout=3.0): self.swarmie.xform.waitForTransform( self.rovername + '/base_link', detection.pose.header.frame_id, detection.pose.header.stamp, rospy.Duration(timeout) ) return self.swarmie.xform.transfo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def makePoseStampedFromGraspFrame(self, graspFrame):\n iiwaLinkEEFrame = self.getIiwaLinkEEFrameFromGraspFrame(graspFrame)\n poseDict = spartanUtils.poseFromTransform(iiwaLinkEEFrame)\n poseMsg = rosUtils.ROSPoseMsgFromPose(poseDict)\n poseStamped = geometry_msgs.msg.PoseStamped()\n ...
[ "0.56539935", "0.53922534", "0.5311693", "0.5271331", "0.52625394", "0.5036834", "0.49239218", "0.4911125", "0.4782191", "0.47520468", "0.4737187", "0.47025004", "0.4676885", "0.46542126", "0.46408707", "0.45992538", "0.45896745", "0.4587845", "0.457565", "0.45676693", "0.455...
0.6804362
0
Transform PoseStamped detection into /odom frame. Returns PoseStamped in /odom frame.
def _transform_to_odom(self, detection, timeout=3.0): self.swarmie.xform.waitForTransform( self.rovername + '/odom', detection.pose.header.frame_id, detection.pose.header.stamp, rospy.Duration(timeout) ) return self.swarmie.xform.transformPose(sel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fix_map_to_odom_transform(self, msg):\n (translation, rotation) = convert_pose_inverse_transform(self.robot_pose)\n p = PoseStamped(pose=convert_translation_rotation_to_pose(translation, rotation),\n header=Header(stamp=msg.header.stamp, frame_id=self.base_frame))\n ...
[ "0.61992025", "0.5914986", "0.5914425", "0.583971", "0.58341193", "0.5548618", "0.553005", "0.5486628", "0.5481845", "0.54486555", "0.5400877", "0.52915186", "0.52890486", "0.526186", "0.5221597", "0.51837945", "0.51579654", "0.515357", "0.5136488", "0.5136463", "0.50342727",...
0.678048
0
Returns True if it looks like the rover is inside the ring of home tags and needs to get out! Returns False if no home tags in view.
def is_inside_home_ring(self, detections): YAW_THRESHOLD = 1.3 # radians see_home_tag = False good_orientations = 0 bad_orientations = 0 for detection in detections: if detection.id == 256: see_home_tag = True home_detection = self._t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sees_home_tag(self):\n detections = self.swarmie.get_latest_targets().detections\n\n for detection in detections:\n if detection.id == 256:\n return True\n\n return False", "def goal_occupied(self, view):\n for line in view.obstacles:\n if line...
[ "0.6877612", "0.6524369", "0.6232681", "0.62293905", "0.6129121", "0.5960962", "0.5907052", "0.58036876", "0.5741693", "0.57036555", "0.56856495", "0.5676682", "0.56460345", "0.5643292", "0.56271076", "0.5600498", "0.5594986", "0.55924743", "0.5587293", "0.55797714", "0.55694...
0.70185405
0
The safe driving pathway is defined to be the space between two lines running parallel to the rover's xaxis, at y=0.33m and y=0.33m. Driving between these lines gives the wheels about 10cm of clearance on either side. These lines also conveniently intersect the upperleft and upperright corners of the camera's field of ...
def _get_angle_and_dist_to_avoid(self, detection, direction='left'): OVERSHOOT_DIST = 0.20 # meters, distance to overshoot target by base_link_pose = self._transform_to_base_link(detection) radius = math.sqrt(base_link_pose.pose.position.x ** 2 + base_link_pose.pose.p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _compute_connection(current_waypoint, next_waypoint, threshold=35):\n n = next_waypoint.transform.rotation.yaw\n n = n % 360.0\n\n c = current_waypoint.transform.rotation.yaw\n c = c % 360.0\n\n diff_angle = (n - c) % 180.0\n if diff_angle < threshold or diff_angle > (180 - threshold):\n ...
[ "0.6105278", "0.6062355", "0.5997403", "0.59659237", "0.5943051", "0.590268", "0.5894837", "0.5735727", "0.5719809", "0.56404775", "0.56403416", "0.55594426", "0.5553458", "0.55498064", "0.5519736", "0.54981464", "0.5494342", "0.54870874", "0.54864216", "0.54541856", "0.54369...
0.6467077
0
Get the angle required to turn and face a detection to put it in the center of the camera's field of view.
def get_angle_to_face_detection(self, detection): base_link_pose = self._transform_to_base_link(detection) radius = math.sqrt(base_link_pose.pose.position.x ** 2 + base_link_pose.pose.position.y ** 2) tag_point = Point(x=base_link_pose.pose.position.x, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def angle(self) -> float:\n ...", "def angle(self) -> int:", "def get_angle_to_face_point(self, point):\n start = self.swarmie.get_odom_location().get_pose()\n return angles.shortest_angular_distance(\n start.theta,\n math.atan2(point.y - start.y, point.x - start.x)\n...
[ "0.694608", "0.6675294", "0.6667947", "0.65525675", "0.65257376", "0.65173125", "0.649658", "0.64952534", "0.64086175", "0.64077455", "0.6364776", "0.63421", "0.63389915", "0.6318293", "0.6277705", "0.6262226", "0.625976", "0.6244727", "0.6241997", "0.62134", "0.6200563", "...
0.7480732
0
Turn and face the home tag nearest the center of view if we see one. Does nothing if no home tag is seen.
def face_home_tag(self): home_detections = self._sort_home_tags_nearest_center( self.swarmie.get_latest_targets().detections ) if len(home_detections) > 0: angle = self.get_angle_to_face_detection(home_detections[0]) current_heading = self.swarmie.get_odom_loc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def go_home(self):\n self.set_all_positions([0]*self.nleaflets)", "def home(self):\n self.goto(0, 0)\n self.setheading(0)", "def set_home_position(self, lat, lon, alt):\n pass", "def set_home_locations(self):\n self.swarmie.set_home_gps_location(self.swarmie.get_gps_locatio...
[ "0.6119827", "0.5982294", "0.5946176", "0.5887", "0.5835729", "0.5829487", "0.58237636", "0.56908655", "0.5689949", "0.5625944", "0.56022465", "0.55240464", "0.5506971", "0.54984504", "0.5482635", "0.54312795", "0.52614295", "0.5238637", "0.522511", "0.5208262", "0.51757735",...
0.78024226
0
Returns true if the rover can see a home tag. Returns false otherwise.
def sees_home_tag(self): detections = self.swarmie.get_latest_targets().detections for detection in detections: if detection.id == 256: return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ishome(self) -> bool:\n pass", "def someone_home(self) -> bool:\n return self._someone_home", "def ishome(self):\n return self._plrevgeoloc.isHome", "def is_home(self):\n return bool([\n device for device in self.devices\n if device.is_home and device.is_...
[ "0.7205497", "0.70651335", "0.69522494", "0.65864754", "0.656828", "0.6561121", "0.64363885", "0.63901484", "0.6355829", "0.62823164", "0.6169507", "0.6133922", "0.604066", "0.6013944", "0.58709437", "0.5862436", "0.58027184", "0.57587904", "0.5700835", "0.5693258", "0.564646...
0.75401014
0
Sort home tags (id == 256) in view by their distance from the center of the camera's field of view.
def _sort_home_tags_nearest_center(self, detections): sorted_detections = [] for detection in detections: if detection.id == 256: sorted_detections.append(detection) return sorted(sorted_detections, key=lambda x: abs(x.pose.pose.position.x))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def face_home_tag(self):\n home_detections = self._sort_home_tags_nearest_center(\n self.swarmie.get_latest_targets().detections\n )\n if len(home_detections) > 0:\n angle = self.get_angle_to_face_detection(home_detections[0])\n current_heading = self.swarmie.g...
[ "0.5568948", "0.54662734", "0.5292728", "0.51869404", "0.5136833", "0.49867502", "0.49770924", "0.4963197", "0.49262795", "0.492238", "0.49045837", "0.48945516", "0.48619252", "0.48006356", "0.47847188", "0.478009", "0.4780042", "0.47667208", "0.47607234", "0.47496408", "0.47...
0.74201065
0
Sort tags in view from left to right (by their x position in the camera frame). Removes/ignores tags close enough in the camera to likely be a block in the claw.
def _sort_tags_left_to_right(self, detections, id=0): BLOCK_IN_CLAW_DIST = 0.22 # meters sorted_detections = [] for detection in detections: if (detection.id == id and detection.pose.pose.position.z > BLOCK_IN_CLAW_DIST): sorted_detections.append...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _sort_home_tags_nearest_center(self, detections):\n sorted_detections = []\n\n for detection in detections:\n if detection.id == 256:\n sorted_detections.append(detection)\n\n return sorted(sorted_detections,\n key=lambda x: abs(x.pose.pose.po...
[ "0.5948881", "0.59211606", "0.5505296", "0.54796255", "0.5224809", "0.51409453", "0.51296383", "0.51185745", "0.507329", "0.5059373", "0.50522685", "0.5020326", "0.49868953", "0.4957405", "0.4956648", "0.4945304", "0.49099445", "0.49099445", "0.49007258", "0.48856413", "0.488...
0.68595314
0
Turn by 'angle' and then drive 'dist'.
def _go_around(self, angle, dist): ignore = Obstacle.IS_SONAR if self.avoid_targets is True: ignore |= Obstacle.TAG_TARGET elif self.avoid_home is True: # Need to ignore both for this because target tags are likely to # be in view inside the home nest. ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def turn(orient, order, dist):\n offset = dist//90\n if order == \"L\":\n offset = -offset\n return cardinals[(cardinals.index(orient) + offset) %\n len(cardinals)]", "def rot(wx, wy, order, dist):\n for _ in range(dist//90):\n if order == \"R\":\n wx, wy ...
[ "0.6508124", "0.62017006", "0.6161366", "0.6018408", "0.6000472", "0.59441423", "0.594048", "0.5903337", "0.58467317", "0.58111876", "0.5799023", "0.57754487", "0.57551074", "0.57502764", "0.57444197", "0.5687021", "0.5685811", "0.56826", "0.5680098", "0.5659688", "0.5634794"...
0.64250773
1
Returns the angle you should turn in order to face a point.
def get_angle_to_face_point(self, point): start = self.swarmie.get_odom_location().get_pose() return angles.shortest_angular_distance( start.theta, math.atan2(point.y - start.y, point.x - start.x) )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def angle(self) -> float:\n ...", "def angle(self) -> int:", "def get_angle(self, point_x, point_y):\n angle = atan2(point_y - self.player_y, point_x - self.player_x)\n # print(f\"point_x {point_x} point_y {point_x} angle {angle}\")\n return angle", "def angle(self):\n v = ...
[ "0.7816527", "0.7762613", "0.7670193", "0.75328827", "0.7400363", "0.73841375", "0.73469996", "0.7288011", "0.72033334", "0.72033334", "0.7117065", "0.7116469", "0.70479256", "0.7037837", "0.7037837", "0.7037837", "0.7018325", "0.7009219", "0.6985138", "0.6954646", "0.6939814...
0.81196034
0
Have the rover turn to face the nearest block to it. Useful when exiting gohome (when going home without a block) or search. Does nothing if no blocks are seen, if there is a home tag closer to the rover than the nearest block, or if a sonar obstacle prevents the rover from making the turn. Catches any transform except...
def face_nearest_block(self): try: block = self.swarmie.get_nearest_block_location( use_targets_buffer=True ) except tf.Exception: # The caller should be about to exit with a normal exit code # after this call anyway, so the pickup behavior...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def best_last_option(self):\n \n # get essential values\n board = self.get_game_space()\n affinity = self.get_affinity()\n \n # pick the right check for the game we are playing\n if isinstance(board, Gomoku):\n \n # get all possible blocks to m...
[ "0.5944293", "0.57909685", "0.57898897", "0.57172054", "0.57123226", "0.5624876", "0.55736315", "0.55671346", "0.55591387", "0.55555564", "0.54708856", "0.5432141", "0.53805804", "0.5367929", "0.533513", "0.5331298", "0.5309979", "0.5303084", "0.52709633", "0.5264895", "0.526...
0.8221664
0
Get another nav plan and return the first waypoint. Try three times, incrementing self.tolerance by tolerance_step after a failure.
def _get_next_waypoint(self, tolerance_step): print('\nGetting new nav plan.') for i in range(4): try: self.plan = self.swarmie.get_plan( self.goal, tolerance=self.tolerance, use_home_layer=self.avoid_home ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_find_closest_waypoints_nearest(self):\n planner = WaypointPlanner(make_example_base_waypoints())\n\n planner.position = Vector3(0, 0, 0)\n waypoints = planner.find_closest_waypoints(1)\n self.assertEqual(1, len(waypoints))\n self.assertEqual(0, waypoints[0].pose.pose.pos...
[ "0.64032876", "0.61642146", "0.6126271", "0.6093539", "0.6021183", "0.5997461", "0.5867292", "0.5816609", "0.5783162", "0.57300097", "0.5674514", "0.56579065", "0.5624059", "0.556312", "0.5558917", "0.5478584", "0.54468936", "0.5426313", "0.53970754", "0.5375155", "0.53722984...
0.7916811
0
Check sonar obstacles over a short period of time, hopefully to weed out some of the noise and let us continue driving if we stopped for a 'fake' obstacle.
def _check_sonar_obstacles(self): # TODO: what's a good number? BLOCKED_THRESHOLD = 0.7 rate = rospy.Rate(10) # 10 hz count = 10 left = 0 center = 0 right = 0 for i in range(count): obstacle = self.swarmie.get_obstacle_condition() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_for_obstacles(self):\n obs = False\n obs_p = []\n for point in self.obstacles:\n if -0.15 <= point[1] <= 0.15: # robot is 178mm wide\n # Obstacles should be less than or equal to 0.2 m away before being detected\n if 0 <= point[0] <= .2:\n ...
[ "0.69928783", "0.6701212", "0.62877244", "0.6276357", "0.6274189", "0.61626023", "0.6113274", "0.61114275", "0.60970694", "0.6059443", "0.5980487", "0.5887921", "0.5880834", "0.58741724", "0.58602977", "0.58327454", "0.58186597", "0.58019084", "0.5795218", "0.5789762", "0.578...
0.6939739
1
Helper to Planner.drive_to(). Make one attempt to get around a home or target tag.
def _avoid_tag(self, id=0, ignore=Obstacle.IS_SONAR): sorted_detections = self._sort_tags_left_to_right( self.swarmie.get_latest_targets().detections, id=id ) # if count == 3: # last resort # self.current_state = Planner.STATE_DRIVE # angle = sel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def target_tag(self):\n raise NotImplementedError", "def findTarget(self, initial_call):\n if self.vision.hasTarget():\n self.next_state(\"driveToTarget\")\n else:\n self.chassis.setOutput(self.SEARCH_SPEED, -self.SEARCH_SPEED)", "def become_target(self):\n\t\traise N...
[ "0.5209827", "0.51571554", "0.4894787", "0.47458228", "0.4700009", "0.4642209", "0.46304765", "0.458315", "0.45454666", "0.45043343", "0.4478969", "0.44567552", "0.44558376", "0.44286126", "0.44133204", "0.43926364", "0.4371317", "0.4370641", "0.43651053", "0.43491682", "0.43...
0.51685894
1
Returns True if it's safe for the rover to back up. It is safe to back up if the rover is further than 1.5 meters from the current home location, or if the rover is within 1.5 meters from home, but is facing home. In other words, it's not safe to back up if the rover is close to home and has it's back to home.
def _is_safe_to_back_up(self): # Only back up if we're far enough away from home for it # to be safe. Don't want to back up into the nest! home_loc = self.swarmie.get_home_odom_location() current_loc = self.swarmie.get_odom_location().get_pose() dist = math.sqrt((home_loc.x - cur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_home(self):\n return self.last_seen.seconds / 60 <= 2 and self.last_seen.days == 0", "def one_step_back(self):\n if (self.row -1<0):\n return False\n elif (self.battery == 0):\n return False\n elif (self.maze[self.row - 1][self.column] == False):\n ...
[ "0.6026265", "0.58931726", "0.5807826", "0.5787228", "0.57717633", "0.5766224", "0.5710147", "0.5660825", "0.56111115", "0.5610963", "0.5589869", "0.55510205", "0.553162", "0.5524561", "0.5508406", "0.548923", "0.54795265", "0.5445605", "0.54263294", "0.5425697", "0.53875643"...
0.8233782
0
Turn to face a point in the odometry frame. Rover will attempt to turn the shortest angle to face the point, and if it fails (sonar detects something in the way, or the rover saw a type of tag it wants to stop for), it will possibly back up and try to turn in the opposite direction to face the point.
def _face_point(self, point, ignore=Obstacle.PATH_IS_CLEAR): print('Facing next point...') # Make sure all sonar sensors are never ignored together here if ignore & Obstacle.IS_SONAR == Obstacle.IS_SONAR: ignore ^= Obstacle.IS_SONAR ignore |= Obstacle.SONAR_BLOCK # T...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_angle_to_face_point(self, point):\n start = self.swarmie.get_odom_location().get_pose()\n return angles.shortest_angular_distance(\n start.theta,\n math.atan2(point.y - start.y, point.x - start.x)\n )", "def look_at(self, point, connector):\n\n\n try:\n ...
[ "0.5929196", "0.58939385", "0.5709615", "0.5670963", "0.5666145", "0.564073", "0.562725", "0.5587449", "0.5580974", "0.55736095", "0.55411446", "0.55125284", "0.5490269", "0.5477188", "0.5470099", "0.54675", "0.54084307", "0.53805107", "0.5369936", "0.5335595", "0.53157187", ...
0.7282826
0
Try to get the rover to goal location. Returns when at goal or if home target is found. !! avoid_targets and avoid_home shouldn't both be set to True. avoid_home will be set to False in this case. !!
def drive_to(self, goal, tolerance=0.0, tolerance_step=0.5, max_attempts=10, avoid_targets=True, avoid_home=False, use_waypoints=True, start_location=None, distance_threshold=None): print('\nRequest received') self.fail_count = 0 self.tolerance ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _move_home_strategy(self):\n\n if self.last_status == \"Fail\":\n result = \"turnRight\"\n else:\n result = self.move_toward(self._home)\n if result is None:\n result = \"drop\"\n\n assert result is not None\n return result", "def se...
[ "0.61134183", "0.59638315", "0.59265476", "0.5922117", "0.59131104", "0.5848963", "0.5831249", "0.58035004", "0.57902896", "0.57676834", "0.56982106", "0.56882787", "0.564525", "0.5587234", "0.5555771", "0.5531212", "0.5528642", "0.5487979", "0.5486528", "0.54817724", "0.5475...
0.61140513
0
Convenience wrapper to drive_to(). Drive the given distance, while avoiding sonar and target obstacles. !! avoid_targets and avoid_home shouldn't both be set to True. avoid_home will be set to False in this case. !!
def drive(self, distance, tolerance=0.0, tolerance_step=0.5, max_attempts=10, avoid_targets=True, avoid_home=False, use_waypoints=True): self.cur_loc = self.swarmie.get_odom_location() start = self.cur_loc.get_pose() goal = Point() goal.x = start.x + distance...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def drive_to(self, goal, tolerance=0.0, tolerance_step=0.5,\n max_attempts=10, avoid_targets=True, avoid_home=False,\n use_waypoints=True, start_location=None,\n distance_threshold=None):\n print('\\nRequest received')\n self.fail_count = 0\n sel...
[ "0.655253", "0.63666767", "0.63183516", "0.6304355", "0.62158734", "0.555457", "0.55458516", "0.5532839", "0.55063546", "0.5494884", "0.5476724", "0.5402915", "0.5317474", "0.5294457", "0.5273561", "0.5236973", "0.5223151", "0.51784474", "0.5162055", "0.5136079", "0.5125034",...
0.7307606
0
Set the rover's home locations in the /odom and /map frames. Can be called manually, but is also called from Planner.drive_to() when a home tag is seen.
def set_home_locations(self): self.swarmie.set_home_gps_location(self.swarmie.get_gps_location()) current_location = self.swarmie.get_odom_location() current_pose = current_location.get_pose() home_odom = Location(current_location.Odometry) detections = self.swarmie.get_latest_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_home_position(self, lat, lon, alt):\n pass", "def set_current_location_as_home(self):\n response = False\n while (not response) and (not rospy.is_shutdown()):\n response = self._set_home_proxy(True, 0., 0., 0., 0.).success\n self._rate.sleep()\n if respon...
[ "0.7108816", "0.65008163", "0.63759106", "0.633259", "0.6307917", "0.6304005", "0.62762004", "0.6232992", "0.61337197", "0.6027151", "0.60225916", "0.6018789", "0.5885093", "0.5872494", "0.58659697", "0.58089083", "0.5792628", "0.57654065", "0.5707072", "0.5704166", "0.567731...
0.75460696
0
Get a list of waypoints for the spiral search pattern. Waypoints will be used as goals to planner.drive_to()
def _get_spiral_points(self, start_distance, distance_step, num_legs=10): start_loc = self.swarmie.get_odom_location().get_pose() points = [] distance = start_distance angle = math.pi / 2 prev_point = Point() prev_point.x = start_loc.x + distance * math.cos(start_loc.the...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def waypoints(self):\n\t\treturn [Star(star_id, galaxy=self.galaxy) for delay, star_id, order, num_ships in self.data.o]", "def spiral_search(self, start_distance, distance_step=0.5, num_legs=10,\n tolerance=0.0, tolerance_step=0.5, max_attempts=5,\n avoid_targets=True, ...
[ "0.6662182", "0.6237596", "0.61242783", "0.60184735", "0.60100424", "0.595016", "0.5893749", "0.57909155", "0.5759986", "0.5754108", "0.5719062", "0.5698987", "0.56761587", "0.5652236", "0.5621764", "0.5616944", "0.56052303", "0.5590701", "0.5576818", "0.55699253", "0.5550650...
0.6771642
0
Render a mesh by casting an array of rays from an origin point, finding where they hit the mesh, and using the combination of a color texture function and the normal of the ray collision to color the resulting pixel.
def ray_cast( mesh: jnp.ndarray, origin: jnp.ndarray, directions: jnp.ndarray, color_fn: Callable[[jnp.ndarray], jnp.ndarray], batch_size: int = 128, bg_color: jnp.ndarray = None, ambient_light: float = 0.0, ) -> jnp.ndarray: # Normalize the directions so that dot products are meaningful...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def batch_mesh_contains_points(\n ray_origins, # point cloud as origin of rays\n obj_triangles,\n direction=torch.Tensor([0.4395064455, 0.617598629942, 0.652231566745]),\n):\n tol_thresh = 0.0000001\n batch_size = obj_triangles.shape[0]\n triangle_nb = obj_triangles.shape[1]\n point_nb = ray_o...
[ "0.6239282", "0.62272376", "0.6221398", "0.6195056", "0.619256", "0.6127605", "0.60318893", "0.59569705", "0.5896775", "0.58099455", "0.5767439", "0.5720655", "0.57185787", "0.5693293", "0.5657191", "0.56316084", "0.5596479", "0.5596469", "0.5510855", "0.5493783", "0.54878277...
0.6649916
0
Produce a grid of ray directions to use for ray_cast().
def ray_grid( x: jnp.ndarray, y: jnp.ndarray, z: jnp.ndarray, resolution: int, ): scales = jnp.linspace(-1.0, 1.0, num=resolution) x_vecs = x * scales[None, :, None] y_vecs = y * scales[:, None, None] results = (x_vecs + y_vecs + z).reshape([-1, x.shape[0]]) return jax.vmap(_normaliz...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def direct(sun_pos, grid):\n\n # for each pixel at top of grid pass sun rays in\n for i in xrange(grid.gr.shape[0]):\n \"\"\"\n Make an array starting at loc\n \"\"\"\n xpos = i * grid.xres\n ypos = grid.zres * grid.zsize\n pos = np.array(xpos, ypos)\n directi...
[ "0.62193435", "0.594625", "0.5943372", "0.58991474", "0.5760594", "0.575585", "0.574361", "0.5715618", "0.5703676", "0.56958956", "0.5657632", "0.5629972", "0.55971795", "0.55454016", "0.5531384", "0.55228245", "0.5484227", "0.5473436", "0.5425375", "0.54226977", "0.5401635",...
0.62440854
0
Shoot a ray from an origin point in a given direction and find the first place it intersects a mesh, if anywhere.
def mesh_ray_collision(mesh: jnp.ndarray, origin: jnp.ndarray, direction: jnp.ndarray): collides, positions, distances = jax.vmap( lambda t: _triangle_ray_collision(t, origin, direction) )(mesh) idx = jnp.argmin(jnp.where(collides, distances, jnp.inf)) return ( jnp.any(collides), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def intersects(self, ray):\n theta = 45\n H = 512\n W = 512\n A = self.origin\n B = Point(W, A.y, A.z)\n C = Point(B.x, (int)(H * math.sin(theta * math.pi / 180)), (int)(H * math.cos(math.pi * theta / 180)))\n D = Point(A.x, (int)(H * math.sin(theta * math.pi / 180)...
[ "0.6328977", "0.6311272", "0.63029695", "0.61903316", "0.6177152", "0.61375874", "0.60943496", "0.60207874", "0.59388417", "0.5893612", "0.58412987", "0.57528913", "0.5724966", "0.5704529", "0.5689389", "0.567179", "0.56663096", "0.56171393", "0.5606271", "0.5578516", "0.5575...
0.7033451
0
Reads in a .haml file and outputs a list.
def readHaml(fileName: str) -> List[Tuple[str, float]]: outList = list() with open(fileName, 'r') as fileIn: for line in fileIn: val = (line.split()[0], float(line.split()[1])) outList.append(val) return outList
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_yaml(yfile):\n try:\n f0 = get_fileobj(yfile)\n context_items = [ConTextItem(literal=d[\"Lex\"],\n category=d[\"Type\"],\n re=r\"%s\"%d[\"Regex\"],\n rule=d[\"Direction\"],\n comments=d[\"Comments\"]) for d in ...
[ "0.6141074", "0.61266136", "0.59853286", "0.59826833", "0.59287184", "0.5864094", "0.58362484", "0.5695049", "0.5677694", "0.5672521", "0.5662456", "0.56329674", "0.5599225", "0.5592709", "0.55906165", "0.55665773", "0.5560554", "0.5542891", "0.5525169", "0.55054325", "0.5500...
0.6980631
0
Given the path to the root directory of the KITTI road dataset, it creates a dictionary of the data as numpy arrays. data_dir = directory containing `testing` and `training` subdirectories
def create_data_dict(data_dir, img_size=[25, 83]): print("Creating data dictionary") print("- Using data at:", data_dir) # Directories imgs_dir = os.path.join(data_dir, "training/image_2") labels_dir = os.path.join(data_dir, "training/gt_image_2") print("- Getting list of files") # Only ge...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def buildDataMap(dataDir,trDir=None,trExt=None):\n \n dataMap = {}\n \n if not trDir:\n trDir = 'TrainingObjects/'\n if not trExt:\n trExt = 'TrainingObject.h5'\n\n dataMap['object'] = {'{}{}'.format(dataDir,trDir): trExt}\n\n dataMap['midline'] = {'{}Midlines/'.format(dataDir) :...
[ "0.6833727", "0.66777116", "0.6587898", "0.653809", "0.64276856", "0.64088523", "0.6406939", "0.6266207", "0.62603366", "0.62525475", "0.61507684", "0.61411524", "0.61401844", "0.61256236", "0.6117592", "0.6111499", "0.61099344", "0.6104643", "0.60664076", "0.60528195", "0.60...
0.7099108
0
Reject the indent form.
def reject(self): print "This form has been rejected. Current state:", self.state
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def leave(self):\n assert(self.indent > 0)\n self.indent -= 1", "def reject(self):\n pass", "def check_indent_allowed(self) -> bool:\n return False", "def check_indent_allowed(self) -> bool:\n return False", "def dedent(self):\n self.indent_level -= self.INDENT_STEP", "d...
[ "0.6469292", "0.6420912", "0.6316097", "0.6316097", "0.62897295", "0.62897295", "0.62538606", "0.61956406", "0.61297977", "0.61183536", "0.57835186", "0.5754162", "0.5709012", "0.5672997", "0.56495655", "0.5631409", "0.56085104", "0.5585363", "0.5583762", "0.54932153", "0.549...
0.65557706
0
scale crop the image to make every image of the same square size, H = W = crop_size
def _scale_and_crop(self, img, seg, crop_size): h, w = img.shape[0], img.shape[1] # if train: # # random scale # scale = random.random() + 0.5 # 0.5-1.5 # scale = max(scale, 1. * crop_size / (min(h, w) - 1)) # ?? # else: # # scale to crop size ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def crop_resize_image(image: np.ndarray, size) -> np.ndarray:\n width, height = image.size\n if width > height:\n left = (width - height) / 2\n right = width - left\n top = 0\n bottom = height\n else:\n top = (height - width) / 2\n bottom = height - top\n l...
[ "0.72518253", "0.6984718", "0.6963812", "0.69593316", "0.6905565", "0.6862499", "0.68332845", "0.6787975", "0.6712533", "0.6682308", "0.6665915", "0.6658133", "0.6653898", "0.66323924", "0.6628663", "0.65988785", "0.658876", "0.65857023", "0.6571572", "0.65532595", "0.6509419...
0.74396914
0
Create props suitable for plot panel
def create_plot_panel_props(prop_map): props = {} for k1, v in prop_map.items(): v = {'edgecolor' : v.get('color', None), 'facecolor' : 'none', 'linewidth' : v.get('width', None), 'alpha' : v.get('alpha', None)} for k2, _ in prop_map.items(): if...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def properties(self,prop):\n # The particulars of how they are stored and manipulated (e.g., do \n # we want an inventory internally) is not settled. I've used a\n # property dictionary for now.\n #\n # How these properties interact with a user defined style file is\n # e...
[ "0.70406014", "0.68956393", "0.6670936", "0.6096693", "0.58572286", "0.5833185", "0.5764093", "0.5739885", "0.57278633", "0.5661469", "0.5661469", "0.5661469", "0.5646869", "0.56404614", "0.5576788", "0.55621576", "0.5479379", "0.54632115", "0.5435002", "0.5430637", "0.540221...
0.75269026
0
Retrieve a logo from a local or GCS path
def get_logo(img_or_path): if not isinstance(img_or_path, str): return np.asarray(img_or_path) path = img_or_path if path.startswith('gs://') or path.startswith('gcs://'): _, path = path.split('//', 1) local_path = logo_dir / os.path.basename(path) if not local_path.exists():...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetch_logo_url(organization):\n return fetch_json(image_url, organization)", "def logo_url(self):\n return self.get_url(\"logo\", \"images/logo.png\")", "def logo_url(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"logo_url\")", "def logo_url(self) -> pulumi.Output[str]:\n ...
[ "0.6691665", "0.6475753", "0.6403558", "0.6403558", "0.6366166", "0.63505644", "0.6318142", "0.62636507", "0.62400687", "0.62400687", "0.6232606", "0.6190907", "0.616848", "0.6159693", "0.6108644", "0.6108644", "0.6095098", "0.60842156", "0.60796607", "0.60796607", "0.6079660...
0.79727423
0
Set the default logos to use with add_logo Either the light logo, the dark logo, or both may be specified. If both, then scale_adj and alpha applies to both. If neither is specified, nothing is done.
def set_default_logos(light_logo=None, dark_logo=None, scale_adj=1, alpha=None): if light_logo is not None: light['pyseas.logo'] = get_logo(light_logo) light['pyseas.logo.scale_adj'] = scale_adj if alpha is not None: light['pyseas.logo.alpha'] = alpha if dark_logo is not None...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setHRLogo(self,**kwargs):\n self.baxter.display.setImage(self.baxter.datapath + \"logo1024.jpg\")", "def logger_defaults(logger=logger, stdout_handler=stdout_handler, stderr_handler=stderr_handler):\n\n\t# Reset the handlers.\n\thandler_defaults(stdout_handler=stdout_handler, stderr_handler=stderr_han...
[ "0.53248173", "0.51411086", "0.5043229", "0.4793573", "0.47474614", "0.46436262", "0.46433628", "0.46111944", "0.45401514", "0.45374775", "0.45321664", "0.45314044", "0.45231867", "0.45038435", "0.44638675", "0.4455084", "0.44441357", "0.44238073", "0.43850133", "0.43424165", ...
0.8421516
0
Delete node and all respective relationships
def delete_node(tx, node_value, node_type): cql = "MATCH(n:" + node_type + "{name:$node_value}) DETACH DELETE(n);" try: tx.run(cql, node_value=node_value) except Exception as e: print(str(e))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_node(self, node_id, connection=None):\n\n connection = connection or self.engine.connect()\n\n # delete the paths associated with this node\n connection.execute(\n self.paths.delete().where(\n self.paths.c.descendant.in_(\n select(\n ...
[ "0.7315839", "0.7264437", "0.7173346", "0.71137744", "0.7031798", "0.6985995", "0.69757694", "0.69397056", "0.6935024", "0.6907919", "0.68684053", "0.6862054", "0.6849799", "0.68376833", "0.6835751", "0.681058", "0.68090886", "0.6793854", "0.6739512", "0.6716", "0.66446584", ...
0.7336805
0
Delete Utterance Relationship, based on input nodes
def delete_relationship(tx, node_value_1=None, node_value_2=None, node_type_1=None, node_type_2=None, relationship=None): if node_value_1 is None and node_type_1 is None: cql = "MATCH ()-[u:" + relationship + "]-(w:" + node_type_2 + "{name:$node_value_2}) " \ "DELETE u;" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_relation(wn, source, target, change_list=None):\n delete_rel(source, target, change_list)\n delete_rel(target, source, change_list)", "def delete_sense_relation(wn, source, target, change_list=None):\n delete_sense_rel(wn, source, target, change_list)\n delete_sense_rel(wn, target, source,...
[ "0.6832094", "0.6719297", "0.6620328", "0.65294105", "0.65291214", "0.63991565", "0.6309279", "0.62979054", "0.6252702", "0.6207111", "0.6170153", "0.61654645", "0.6164246", "0.6163437", "0.6113204", "0.609971", "0.6099355", "0.6099355", "0.6099355", "0.6099355", "0.6099355",...
0.70461917
0
Compute the tight bounding box of a binary mask.
def mask_to_bbox(mask): xs = np.where(np.sum(mask, axis=0) > 0)[0] ys = np.where(np.sum(mask, axis=1) > 0)[0] if len(xs) == 0 or len(ys) == 0: return None x0 = xs[0] x1 = xs[-1] y0 = ys[0] y1 = ys[-1] return np.array((x0, y0, x1, y1), dtype=np.float32)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_bboxes(mask):\r\n boxes = np.zeros([mask.shape[-1], 4], dtype=np.int32)\r\n for i in range(mask.shape[-1]):\r\n m = mask[:, :, i]\r\n # Bounding box.\r\n horizontal_indicies = np.where(np.any(m, axis=0))[0]\r\n vertical_indicies = np.where(np.any(m, axis=1))[0]\r\n ...
[ "0.6920042", "0.68922883", "0.6874152", "0.6871232", "0.68570936", "0.67880124", "0.6712782", "0.65961045", "0.6540863", "0.64311737", "0.63427234", "0.63425565", "0.6330978", "0.6330978", "0.62618804", "0.62499213", "0.62219423", "0.6137984", "0.6137984", "0.6115428", "0.610...
0.7192502
0
Convert from the COCO polygon segmentation format to a binary mask encoded as a 2D array of data type numpy.float32. The polygon segmentation is understood to be enclosed in the given box and rasterized to an M x M mask. The resulting mask is therefore of shape (M, M).
def polys_to_mask_wrt_box(polygons, box, M): w = box[2] - box[0] h = box[3] - box[1] w = np.maximum(w, 1) h = np.maximum(h, 1) polygons_norm = [] for poly in polygons: p = np.array(poly, dtype=np.float32) p[0::2] = (p[0::2] - box[0]) * M / w p[1::2] = (p[1::2] - box[1])...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def binary_mask_to_polygon(binary_mask, tolerance=0):\r\n\r\n polygons = []\r\n if isinstance(binary_mask, torch.Tensor):\r\n binary_mask = binary_mask.cpu().numpy()\r\n # pad mask to close contours of shapes which start and end at an edge\r\n padded_binary_mask = np.pad(binary_mask, pad_width=1...
[ "0.6484304", "0.6433804", "0.6404158", "0.63878393", "0.63706", "0.6336888", "0.62718064", "0.62076074", "0.6202123", "0.6174527", "0.61689824", "0.61581665", "0.61225784", "0.6116983", "0.610723", "0.6053304", "0.60233164", "0.5974742", "0.5972378", "0.5969232", "0.5961104",...
0.65987563
0
Performs greedy nonmaximum suppression based on an overlap measurement between masks. The type of measurement is determined by `mode` and can be either 'IOU' (standard intersection over union) or 'IOMA' (intersection over mininum area).
def rle_mask_nms(masks, dets, thresh, mode='IOU'): if len(masks) == 0: return [] if len(masks) == 1: return [0] if mode == 'IOU': # Computes ious[m1, m2] = area(intersect(m1, m2)) / area(union(m1, m2)) all_not_crowds = [False] * len(masks) ious = mask_util.iou(masks,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nms(dets, thresh=0.5, mode=\"Union\"):\n x1 = dets[:, 0]\n y1 = dets[:, 1]\n x2 = dets[:, 2]\n y2 = dets[:, 3]\n scores = dets[:, 4]\n\n areas = (x2 - x1 + 1) * (y2 - y1 + 1)\n order = scores.argsort()[::-1]\n\n keep = []\n while order.size > 0:\n i = order[0]\n keep.ap...
[ "0.5926733", "0.55196464", "0.5387993", "0.53370196", "0.53234637", "0.52802104", "0.5256077", "0.5233371", "0.5185825", "0.5180145", "0.5169495", "0.5125346", "0.50940484", "0.5078901", "0.5071394", "0.5042755", "0.5040507", "0.50296456", "0.5021151", "0.5018777", "0.5015462...
0.6313439
0
Computes the bounding box of each mask in a list of RLE encoded masks.
def rle_masks_to_boxes(masks): if len(masks) == 0: return [] decoded_masks = [ np.array(mask_util.decode(rle), dtype=np.float32) for rle in masks ] def get_bounds(flat_mask): inds = np.where(flat_mask > 0)[0] return inds.min(), inds.max() boxes = np.zeros((len(deco...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_bboxes(mask):\r\n boxes = np.zeros([mask.shape[-1], 4], dtype=np.int32)\r\n for i in range(mask.shape[-1]):\r\n m = mask[:, :, i]\r\n # Bounding box.\r\n horizontal_indicies = np.where(np.any(m, axis=0))[0]\r\n vertical_indicies = np.where(np.any(m, axis=1))[0]\r\n ...
[ "0.7248413", "0.7208978", "0.7207902", "0.71380645", "0.67405194", "0.664477", "0.6614984", "0.65787214", "0.6552082", "0.6529659", "0.65243286", "0.6360303", "0.6339058", "0.6239182", "0.62314016", "0.620707", "0.61381495", "0.6109044", "0.6088461", "0.60875016", "0.6082529"...
0.7486755
0
Home redirects to /register
def home_page(): return redirect('/register')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def home():\n\n if not current_user.is_authenticated:\n return redirect(url_for('login'))\n else:\n return redirect(url_for('show_registrations'))", "def home_page():\n return redirect('/users')", "def welcome(self):\n if self.user:\n return self.render('welcome.html')\...
[ "0.7688918", "0.7417969", "0.71906203", "0.70102954", "0.69529814", "0.6927726", "0.6917957", "0.68358433", "0.6789156", "0.67626184", "0.67475903", "0.67112434", "0.67056745", "0.670232", "0.6696272", "0.6661629", "0.66303813", "0.66194004", "0.6612684", "0.6611185", "0.6606...
0.8752239
0
Add feedback for a user
def add_feedback(username): if 'username' in session: form = FeedbackForm() if form.validate_on_submit(): feedback_data = generate_feedback_data(form, username) new_feedback = Feedback.make_feedback(feedback_data) db.session.add(new_feedback) db.sessio...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_feedback(username):\n form = addFeedback()\n\n if \"user\" not in session: \n flash(\"Not logged in\")\n return redirect('/login')\n \n elif form.validate_on_submit():\n title = form.title.data\n content = form.content.data\n recipient = username\n us...
[ "0.75064313", "0.73097485", "0.72848845", "0.7062981", "0.7040209", "0.6944699", "0.68973976", "0.6821135", "0.6812384", "0.62886703", "0.6259805", "0.61126626", "0.59743065", "0.59662056", "0.59238136", "0.5827477", "0.5825752", "0.5822465", "0.58078146", "0.5737781", "0.568...
0.73722345
1
Delete feedback and return to user page
def delete_feedback(feedback_id): if 'username' in session: # Get username username = session['username'] # Remove feedback Feedback.query.filter_by(id=feedback_id).delete() db.session.commit() flash('Feedback Deleted!', 'success') return redirect(f'/users...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def feedback_delete(request, feedback_id):\n store = SESSION.get_store(request.session)\n \n # get the feedback from the messages_received_list in session cache\n messages_received_list = SESSION.get_messages_received_list(\\\n request.session)\n i_remove, feedback = 0, None\n for ind, m i...
[ "0.7626995", "0.752246", "0.7413773", "0.7310091", "0.66966355", "0.6507985", "0.6378763", "0.6378238", "0.63614917", "0.63230973", "0.63185835", "0.6307736", "0.630549", "0.6293602", "0.6273581", "0.6273581", "0.6273581", "0.62598974", "0.62179583", "0.61881214", "0.61778986...
0.77901316
0
Displays a custom error page when returning a 404 error
def display_404(error): return render_template('/error.html'), 404
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def error():\n return render_template(\"404.html\")", "def not_found(e):\n return render_template(\"errors/404.html\"), 404", "def error_404(error):\n return '404 Error'", "def not_found_error(error):\n return render_template('errors/404.html'), 404", "def page_not_found():\n return render_t...
[ "0.86492556", "0.85913444", "0.8580295", "0.854521", "0.85064226", "0.8480788", "0.8473789", "0.84674686", "0.8443625", "0.8435984", "0.8434157", "0.8430222", "0.84054524", "0.8401293", "0.8397243", "0.8393867", "0.839259", "0.839259", "0.83886766", "0.83642703", "0.83563656"...
0.8704343
0
expands the volume to new_size specified.
def expand_volume(self, vol, new_size): self.authenticate_user() volume_name = self._get_vipr_volume_name(vol) size_in_bytes = vipr_utils.to_bytes(str(new_size) + "G") try: self.volume_obj.expand( self.configuration.vipr_tenant + "/" + ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extend_volume(self, volume, new_size):\n spdk_name = self._get_spdk_volume_name(volume.name)\n params = {'name': spdk_name, 'size': new_size * units.Gi}\n self._rpc_call('bdev_lvol_resize', params)", "def extend_volume(self, volume, new_size):\n LOG.info('Extending volume: %(id)s ...
[ "0.7807558", "0.76771975", "0.7514389", "0.7189748", "0.7182422", "0.7124434", "0.70722014", "0.68315697", "0.6571997", "0.65215564", "0.6489591", "0.64570886", "0.63780797", "0.6323964", "0.63189167", "0.6287346", "0.6242331", "0.6234601", "0.6156915", "0.61034304", "0.60954...
0.7985611
0
Creates volume from given snapshot ( snapshot clone to volume ).
def create_volume_from_snapshot(self, snapshot, volume, volume_db): self.authenticate_user() if self.configuration.vipr_emulate_snapshot == 'True': self.create_cloned_volume(volume, snapshot) return ctxt = context.get_admin_context() src_snapshot_name = None ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_volume_from_snapshot(self, volume, snapshot):\n self._ensure_shares_mounted()\n\n snapshot_vol = self._get_snapshot_volume(snapshot)\n nfs_share = snapshot_vol['provider_location']\n volume['provider_location'] = nfs_share\n nms = self.share2nms[nfs_share]\n\n v...
[ "0.81089157", "0.79880166", "0.7807846", "0.7783433", "0.7662862", "0.7652661", "0.7525891", "0.75196546", "0.74478763", "0.7440903", "0.73937786", "0.73604554", "0.7312219", "0.71355873", "0.7077416", "0.7056985", "0.7022125", "0.7012366", "0.69805145", "0.6944935", "0.68883...
0.837259
0
Find the export group to which the given initiator ports are the same as the initiators in the group
def _find_exportgroup(self, initiator_ports): foundgroupname = None grouplist = self.exportgroup_obj.exportgroup_list( self.configuration.vipr_project, self.configuration.vipr_tenant) for groupid in grouplist: groupdetails = self.exportgroup_obj.exportgroup_sh...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_port_group_list(self):\n pass", "def get_group_out_ports(self, dp, dstip):\n pass", "def _find_matching_ports(i, j):\n\n i_ports = i.available_ports()\n j_ports = j.available_ports()\n i_port_names = [p.name for p in i.available_ports()]\n j_port_names = [p.name for p in ...
[ "0.5692042", "0.56847864", "0.5607452", "0.55505884", "0.54425293", "0.53261787", "0.53103065", "0.5302931", "0.5264498", "0.52638507", "0.5077104", "0.50555277", "0.50555277", "0.50547683", "0.50547683", "0.49056864", "0.48782742", "0.48782742", "0.48311147", "0.4830629", "0...
0.8118215
0
changes the vpool type
def retype(self, ctxt, volume, new_type, diff, host): self.authenticate_user() volume_name = self._get_vipr_volume_name(volume) vpool_name = new_type['extra_specs']['ViPR:VPOOL'] try: task = self.volume_obj.update( self.configuration.vipr_tenant + ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_type(self, new_value):\n\n self.vax_type = new_value\n self.save()", "def setType(self,newtype):\n\t\tself.type = newtype;", "def pool_selected( self, object ):\n\t\tud.debug( ud.ADMIN, ud.INFO, 'UVMM.DW.ps(node_uri=%s)' % self.node_uri)\n\t\tpool_name = object.options.get('pool-name')\n\...
[ "0.5848784", "0.57391757", "0.5723897", "0.561624", "0.5591289", "0.5518067", "0.5517167", "0.546704", "0.54359967", "0.54287094", "0.54124904", "0.53810906", "0.53711545", "0.52850056", "0.52722555", "0.52722555", "0.52640766", "0.5241069", "0.5206191", "0.51765263", "0.5163...
0.64140636
0
Will itterate through data to find the index of the oldest and youngest people.
def find_people(data): youngest_idx = 0 oldest_idx = 0 for index, item in enumerate(data): if item['age'] < data[youngest_idx]['age'] and item['age'] > 0: youngest_idx = index if item['age'] > data[oldest_idx]['age'] and item['age'] < 80: oldest_idx = index retur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def youngest():\n def get_age(person_list):\n return person_list['age']\n return sorted(PEOPLE_LIST, key = get_age)", "def get_youngest_student(students):\n youngest_index = 0 \n youngest = students[0][3]\n for counter, row in enumerate(students[1:], 1):\n if int(row[3]) > int(younge...
[ "0.6441285", "0.643465", "0.6179866", "0.6166724", "0.616368", "0.61431545", "0.60194755", "0.5788272", "0.57452214", "0.56919736", "0.5552204", "0.55210495", "0.5455431", "0.5422648", "0.5338053", "0.5331254", "0.52707314", "0.524333", "0.5236064", "0.5232713", "0.519718", ...
0.78464746
0
Collapses a directed multigraph into a networkx directed graph. In the output directed graph, each node is a number, which contains itself as node_data['node'], while each edge contains a list of the data from the original edges as its attribute (edge_data[0...N]).
def collapse_multigraph_to_nx(graph: Union[gr.MultiDiGraph, gr.OrderedMultiDiGraph]) -> nx.DiGraph: # Create the digraph nodes. digraph_nodes: List[Tuple[int, Dict[str, nd.Node]]] = ([None] * graph.number_of_nodes()) node_id = {} for i, node in enumerate(graph.nodes()): digraph_nodes[i] = (i, {...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reconstruct_network_from_dgraph_json(data):\n G = nx.MultiDiGraph(crs=ox.settings.default_crs)\n for node in data:\n if \"location\" in node:\n attributes = node.copy()\n attributes[\"x\"] = attributes[\"location\"][\"coordinates\"][0]\n attributes[\"y\"] = attribu...
[ "0.6554219", "0.641795", "0.6140745", "0.5753671", "0.5641915", "0.559664", "0.5504024", "0.54336166", "0.5385011", "0.53718996", "0.5364176", "0.53571475", "0.53153133", "0.531101", "0.5291452", "0.52877784", "0.5240004", "0.52247584", "0.5210389", "0.51955575", "0.5184813",...
0.6853212
0
Checks whether `node_a` is an instance of the same type as `node_b`, or if either `node_a`/`node_b` is a type and the other is an instance of that type. This is used in subgraph matching to allow the subgraph pattern to be either a graph of instantiated nodes, or node types.
def type_or_class_match(node_a, node_b): if isinstance(node_b['node'], type): return issubclass(type(node_a['node']), node_b['node']) elif isinstance(node_a['node'], type): return issubclass(type(node_b['node']), node_a['node']) elif isinstance(node_b['node'], xf.PatternNode): return...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def same_type(one, two):\n\n return isinstance(one, type(two))", "def type_match(graph_node, pattern_node):\n if isinstance(pattern_node['node'], xf.PatternNode):\n return isinstance(graph_node['node'], pattern_node['node'].node)\n return isinstance(graph_node['node'], type(pattern_node['node']))...
[ "0.7246985", "0.6875418", "0.6746393", "0.66509914", "0.6645413", "0.64153445", "0.63544613", "0.6354311", "0.6345268", "0.6345268", "0.6300346", "0.6269791", "0.6268452", "0.6268452", "0.626733", "0.62422216", "0.62378544", "0.623251", "0.6231513", "0.62188184", "0.62145805"...
0.8616503
0
Helper function that tries to instantiate a pattern match into a transformation object.
def _try_to_match_transformation(graph: Union[SDFG, SDFGState], collapsed_graph: nx.DiGraph, subgraph: Dict[int, int], sdfg: SDFG, xform: Union[xf.PatternTransformation, Type[xf.PatternTransformation]], expr_idx: int, nxpattern: nx.DiGraph, state_id: int...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pattern_from_transform(\n step_structure: tree.Structure[Any],\n transform: Callable[[ReferenceStep], Pattern]) -> Pattern:\n return transform(create_reference_step(step_structure))", "def from_re_match(cls, match):\n kwargs = match.groupdict()\n location = kwargs['location'].split()\n ...
[ "0.62242067", "0.59924597", "0.5892394", "0.58774453", "0.5842749", "0.57457894", "0.57445747", "0.57260877", "0.5663162", "0.5640416", "0.55747616", "0.55739737", "0.5535943", "0.54877406", "0.54796714", "0.54767984", "0.5468489", "0.54371476", "0.5349981", "0.53497803", "0....
0.61571854
1
Returns a generator of Transformations that match the input SDFG. Ordered by SDFG ID.
def match_patterns(sdfg: SDFG, patterns: Union[Type[xf.PatternTransformation], List[Type[xf.PatternTransformation]]], node_match: Callable[[Any, Any], bool] = type_match, edge_match: Optional[Callable[[Any, Any], bool]] = None, permissive: bool...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tss_generator(gtf):\n\tfor transcript in db.features_of_type('transcript'):\n\t\tyield TSS(asinterval(transcript), upstream=1000, downstream=1000)", "def get_bfs_seq(G, start_id):\n successors_dict = dict(nx.bfs_successors(G, start_id))\n start = [start_id]\n output = [start_id]\n while len(start...
[ "0.5767118", "0.53664094", "0.51615536", "0.51071537", "0.5089572", "0.5014163", "0.49915856", "0.49313155", "0.4886499", "0.48748744", "0.4865992", "0.4863112", "0.48612818", "0.48256567", "0.48142615", "0.4807478", "0.47889474", "0.47657067", "0.47569597", "0.47207323", "0....
0.5467522
1
Dwell Time Compute the dwell time for the given symbolic, 1d time series.
def dwell_time(x): data = x symbols = np.unique(data) dwell = {} dwell_mean = {} dwell_std = {} for symbol in symbols: r = np.where(data == symbol)[0] r_diff = np.diff(r) r_diff_without_one = np.where(r_diff != 1) x = r[r_diff_without_one] segments = le...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dydt(t,S):\n Scl = S[0]\n Swb = S[1]\n \n Seff_cl = (Scl - Sclmin)/(Sclmax - Sclmin)\n Lcl = acl * Seff_cl**bcl\n \n Seff_wb = (Swb - Swbmin)/(Swbmax - Swbmin)\n Lwb = awb * Seff_wb**bwb\n \n E = pE * Cf *fred\n Beta = Beta0 * Seff_cl\n \n # Equations\n dScldt = Jrf - Lcl - E\n ...
[ "0.65580326", "0.61233747", "0.610152", "0.60596985", "0.5993235", "0.5960062", "0.59412473", "0.5851181", "0.5830028", "0.5748378", "0.57329965", "0.5726178", "0.5721409", "0.5717818", "0.5668342", "0.5655372", "0.5641321", "0.5618273", "0.56117505", "0.5595713", "0.5545355"...
0.6985884
0
Given the URL and directory, download the image page's html for parsing. Parse the full html to find the important bit concerning the image's actual host location but looking in the 'leftside' content div wrapper. Extract the image name and description to be used as the image's name. Download the image and save to the ...
def get_image_qm(html_src, todir): #print url img_url, title = img_details(html_src) r = requests.get(img_url) with open(todir+title+'.jpg','wb') as f: f.write(r.content)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_image(page_html, family_url, folder):\n image_extractor = Extractor(page_html, family_url)\n for url in image_extractor.get_image_table():\n image_page_url = urljoin(family_url, url)\n # print(image_page_url)\n imres = requests.get(image_page_url)\n image_page_extracto...
[ "0.694661", "0.6541669", "0.63542134", "0.6328814", "0.6266402", "0.62424034", "0.6190662", "0.6182079", "0.6157415", "0.6123659", "0.6086594", "0.60814106", "0.6049556", "0.6047241", "0.6015702", "0.6006452", "0.5921177", "0.5914483", "0.58915526", "0.5884733", "0.5876298", ...
0.6868128
1
Add vectors to table Should be implemented
def add_vectors(self, table_name, records, ids, timeout, **kwargs): _abstract()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def register_vectors(self, vectors):\n\n self.vectors.extend(vectors)", "def put_vector(self, term, vector):\n self.terms.append(term)\n self.vectors.append(vector.vector)\n self.real_vectors.append(vector)\n return self.dict.update({term: vector})", "def add(self, keys: List...
[ "0.675615", "0.634529", "0.61804163", "0.6127101", "0.61153644", "0.60995406", "0.6077289", "0.60696733", "0.6050394", "0.60191166", "0.5878969", "0.587209", "0.5812719", "0.5787769", "0.57723516", "0.576734", "0.5764154", "0.57554567", "0.5741254", "0.57369924", "0.5715069",...
0.6852637
1
Query vectors in a table Should be implemented
def search_vectors(self, table_name, top_k, nprobe, query_records, query_ranges, **kwargs): _abstract()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def query(_from, _select, _geomselect=None, _where=None, _groupby=None, _limit=None):\n # INSTEAD MAKE INTO CLASS\n # WITH .fields attr\n # AND .__iter__()\n # AND .get_vectordata()\n # AND MAKE EACH YIELDED ROW A VECTOR FEATURE CLASS\n # THIS WAY ALLOWING CHAINED QUERIES\n\n # parse args\n ...
[ "0.6033002", "0.5755397", "0.57263374", "0.5559812", "0.5555392", "0.55485225", "0.5512064", "0.54893804", "0.5469456", "0.5459995", "0.5443791", "0.54426426", "0.54426426", "0.53633827", "0.5357214", "0.53425556", "0.5329374", "0.5324857", "0.53152955", "0.5296956", "0.52969...
0.6481918
1
Query vectors in a table, query vector in specified files Should be implemented
def search_vectors_in_files(self, table_name, file_ids, query_records, top_k, nprobe, query_ranges, **kwargs): _abstract()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search_vectors(self, table_name, top_k, nprobe, query_records, query_ranges, **kwargs):\n _abstract()", "def search_vectors(self, table_name, top_k, nprobe, query_records, query_ranges, **kwargs):\n _abstract()", "def search_from_sqlite():\n key = request.args.get('key')\n graph = FileS...
[ "0.6183722", "0.6183722", "0.58732986", "0.58360183", "0.574578", "0.56998706", "0.5665273", "0.56031334", "0.56000257", "0.54932994", "0.5461923", "0.54583454", "0.5440742", "0.5416554", "0.54097044", "0.5398005", "0.5373472", "0.5369907", "0.5323089", "0.53185755", "0.52975...
0.74628633
1
Provide server version should be implemented
def server_version(self, timeout): _abstract()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_server_version(self):\n return self.__aceQLHttpApi.get_server_version()", "def get_server_version(self):\n return self.client.getServerVersion().decode('utf-8')\n return self.client.getServerVersion().decode('utf-8')", "def server_version(self) -> Optional[pulumi.Input[str]]:\n ...
[ "0.72736466", "0.72201157", "0.72106344", "0.72106344", "0.7147017", "0.7114719", "0.70159096", "0.6988763", "0.6958514", "0.6958514", "0.6958514", "0.6958514", "0.6935772", "0.6924782", "0.69026643", "0.69026643", "0.69026643", "0.6858275", "0.6853175", "0.6825424", "0.68251...
0.7665297
1
Get latitude and longitude from cities in data.
def get_lat_lon(data): from time import sleep from geopy import geocoders from geopy.exc import GeocoderTimedOut gn = geocoders.GeoNames(username='foobar') cities = get_cities(data).keys() coords = {} for city in cities: while True: try: loc = gn.geocod...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_city_points(city):\n for item in coordinate_list:\n if item[0] == city:\n return (item[1], item[2])", "def get_coordinates_from_city(self, city):\n return self.cities_dict.get(city)", "def get_lat_lon():\r\n\r\n # Columns: dt,AverageTemperature,AverageTemperatureUncertain...
[ "0.6921667", "0.68246377", "0.67158616", "0.66107935", "0.6552043", "0.65011436", "0.6473308", "0.6398875", "0.63900644", "0.6264114", "0.624961", "0.62353706", "0.62113905", "0.61969936", "0.6188648", "0.6156948", "0.6132603", "0.61280274", "0.61232203", "0.61097056", "0.609...
0.7427571
0
Evaluate the MNIST model
def evaluate(model, iterations, use_cuda=False): logger.debug("Allocating input and target tensors on GPU : %r", use_cuda) # create the instance of data loader data_loader = DataLoaderMnist(cuda=use_cuda, seed=1, shuffle=False, train_batch_size=64, test_batch_size=100) model.eval() total = 0 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def MNIST_experiment():\n tsetlin_machine = TsetlinMachine(number_clauses=1000,\n number_action_states=1000,\n precision=3.0,\n threshold=10)\n\n X, y, val_X, val_y = MNIST()\n\n tsetlin_machine.fit...
[ "0.7296402", "0.69910675", "0.68859035", "0.68567264", "0.68049806", "0.6793459", "0.6782096", "0.6699586", "0.6637153", "0.66119355", "0.6607346", "0.66001266", "0.65700907", "0.65339303", "0.6532473", "0.63975126", "0.6392527", "0.63610214", "0.63309705", "0.6328554", "0.63...
0.70785034
1
This function returns a dataframe containing all the FOVs available on LabKey for a particular cell line.
def query_data_from_labkey(cell_line_id): # Query for labkey data db = LabKey(contexts.PROD) # Get production data for cell line data = db.dataset.get_pipeline_4_production_cells([("CellLine", cell_line_id)]) data = pd.DataFrame(data) # Because we are querying the `cells` dataset and not the ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_camfiber_table(date, exp_id):\n filename = '/exposures/nightwatch/{}/{:08d}/qa-{:08d}.fits'.format(date, exp_id, exp_id)\n\n tab = None\n if os.path.isfile(filename):\n tab = Table.read(filename, hdu='PER_CAMFIBER')\n tab = tab['FIBER', 'MEDIAN_CALIB_SNR', 'CAM']\n return tab", ...
[ "0.5467637", "0.5411353", "0.534373", "0.52416754", "0.51579815", "0.5038548", "0.49567586", "0.49512663", "0.49279827", "0.4913724", "0.48375818", "0.4798654", "0.47906682", "0.47762877", "0.4746946", "0.4743379", "0.4731285", "0.47206524", "0.47060516", "0.46962562", "0.466...
0.6620065
0
This function returns a cropped area around an object of interest given the raw data and its corresponding segmentation.
def crop_object(raw, seg, obj_label, isotropic=None): offset = 16 raw = np.pad(raw, ((0, 0), (offset, offset), (offset, offset)), "constant") seg = np.pad(seg, ((0, 0), (offset, offset), (offset, offset)), "constant") _, y, x = np.where(seg == obj_label) if x.shape[0] > 0: xmin = x.min()...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_image_area_to_sample(img):\n\n #TODO: In the paper 'Deep Interactive Object Selection', they calculate g_c first based on the original object instead\n # of the dilated one.\n\n # Dilate the object by d_margin pixels to extend the object boundary\n img_area = np.copy(img)\n img_area = morphology.binar...
[ "0.6491899", "0.6448897", "0.64305854", "0.63968277", "0.6331116", "0.62781453", "0.625253", "0.6224297", "0.6217467", "0.61932373", "0.6190705", "0.61787575", "0.61554366", "0.61271375", "0.6112032", "0.61013305", "0.60321337", "0.5992562", "0.5986119", "0.5948971", "0.59186...
0.67294097
0
Get an existing AdminRoleCustom resource's state with the given name, id, and optional extra properties used to qualify the lookup.
def get(resource_name: str, id: pulumi.Input[str], opts: Optional[pulumi.ResourceOptions] = None, description: Optional[pulumi.Input[str]] = None, label: Optional[pulumi.Input[str]] = None, permissions: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = Non...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(self, uuid):\n logger.info(\"Get a specific role by Id\", data=uuid)\n\n role = Role.query.get(uuid)\n return role_schema.jsonify(role)", "def get_custom_states(self, *args, **kwargs):\n pass", "def get_role(self, role_id):\n raise exception.NotImplemented() # pragma...
[ "0.5382666", "0.5352287", "0.5249233", "0.5131461", "0.5116712", "0.50955945", "0.5094461", "0.50409466", "0.5030529", "0.4976748", "0.4898603", "0.4892735", "0.48872188", "0.4849793", "0.48462057", "0.4844067", "0.48259544", "0.48186347", "0.4816291", "0.47465008", "0.473041...
0.72646344
0
Check wether loss is NaN
def _check_loss(self, loss): assert not np.isnan(loss), "Model diverged with loss = NaN"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assert_no_nans(x):\n assert not torch.isnan(x).any()", "def is_nan(self):\n \n return self.coeff.is_nan()", "def isNan(x: float) -> bool:\n return x != x", "def pd_isnan(val):\n return val is None or val != val", "def _no_nan(self, feature: np.array) -> bool:\n if not np.a...
[ "0.7288243", "0.7142308", "0.7045204", "0.7011775", "0.696748", "0.68836856", "0.6839107", "0.6837337", "0.68135375", "0.67958283", "0.6794594", "0.67176294", "0.6694199", "0.66769093", "0.66244996", "0.6558433", "0.65426934", "0.65074795", "0.647086", "0.64383054", "0.641443...
0.8565298
0
Add weight decay to the variable
def _add_weight_decay(self, var, wd): wd_loss = tf.multiply(tf.nn.l2_loss(var), wd, name='weight_loss') tf.add_to_collection(GKeys.LOSSES, wd_loss)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _variable_with_weight_decay(name, shape, stddev, wd):\n\n #var = _variable_on_cpu(name, shape, tf.truncated_normal_initializer(stddev=stddev))\n var = weight_variable(shape)\n if wd is not None:\n weight_decay = tf.mul(tf.nn.l2_loss(var), wd, name='weight_loss')\n tf.add_to_collection('losses', weigh...
[ "0.73574615", "0.7281516", "0.72360826", "0.7235467", "0.7189649", "0.7180601", "0.716254", "0.7162298", "0.7158315", "0.71548766", "0.7137905", "0.7137743", "0.71284556", "0.708134", "0.708134", "0.70520884", "0.7029988", "0.6992265", "0.6888524", "0.6865175", "0.6782144", ...
0.7537218
0
Compute total loss value in the collections
def _total_loss(self, collections=None, name=None): if collections is None: collections = [GKeys.LOSSES] loss_vars = [] for key in collections: loss_vars.extend(tf.get_collection(GKeys.LOSSES)) total_loss = tf.add_n(loss_vars, name=name) return total_l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_loss(self):", "def loss_total(self):\r\n def loss(y_true, y_pred):\r\n l2 = 1/2*K.sum(K.square(y_true-y_pred))\r\n\r\n return l2\r\n return loss", "def get_loss(self):\n return self.loss / self.cnt", "def sum_factors(self) -> float:\n return sum([x fo...
[ "0.7515837", "0.74702716", "0.72111726", "0.71222854", "0.7107367", "0.6941016", "0.6920439", "0.6903721", "0.6892803", "0.6834876", "0.6811724", "0.680063", "0.67770433", "0.6751744", "0.67042065", "0.66952884", "0.6648413", "0.661181", "0.6596353", "0.65950805", "0.6591228"...
0.7766601
0
Flatten tensor to shape [1, size]
def _flatten(self, inputT, size): return tf.reshape(inputT, (-1, size))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flatten(x_tensor):\n # TODO: Implement Function\n b, w, h, d = x_tensor.get_shape().as_list()\n img_size = w * h * d\n return tf.reshape(x_tensor, [-1, img_size])", "def flatten(x):\n all_dims_exc_first = np.prod([v.value for v in x.get_shape()[1:]])\n o = tf.reshape(x, [-1, all_dims_exc_fi...
[ "0.80815935", "0.80499464", "0.802613", "0.802613", "0.79824466", "0.796515", "0.7958361", "0.79401034", "0.79401034", "0.79224795", "0.7860755", "0.7819301", "0.7798498", "0.7773259", "0.7763785", "0.7733254", "0.7664588", "0.76089823", "0.7535897", "0.7423828", "0.73723274"...
0.86480945
0
String representation for Dice.
def __str__( self ): return "Die1: %s\nDie2: %s" % ( str(self.die1), str(self.die2) )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n out_string = ''\n for die in self.dice:\n out_string = out_string + str(die) + ', '\n return out_string[:-2]", "def str(self):\n if self.num_dice is not None and self.dice_type is not None:\n descr = \"{}D{}\".format(self.num_dice, self.dice_...
[ "0.7938284", "0.68876106", "0.6755719", "0.6654932", "0.6594377", "0.64787066", "0.6398786", "0.6361623", "0.635217", "0.63273734", "0.6259721", "0.62585074", "0.6243883", "0.62208056", "0.6196698", "0.6190639", "0.61750054", "0.6167577", "0.6157307", "0.61312824", "0.6118187...
0.7110353
1
Sets the value of a register chosen by its index
def set_register(self, index, value): if index < 0 or index > 32: raise Exception('Register out of index') self.register[index].set_value(str(value))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_reg_to_val(self):\n register = (self.opcode & 0x0F00) >> 8\n value = self.opcode & 0x00FF\n self.registers[register] = value\n logger.info(\"Set register V{} to {}\".format(register, value))", "def setData(self, index, value):\n \n self.state[index.row()][index.c...
[ "0.7115892", "0.68625295", "0.68161756", "0.68078434", "0.67504513", "0.6697386", "0.666284", "0.6620759", "0.6548634", "0.6545254", "0.65339446", "0.6529928", "0.65193087", "0.650311", "0.64888734", "0.6484818", "0.6483465", "0.6436545", "0.635332", "0.63366884", "0.63226175...
0.78160965
0
Sets the value of the program counter
def set_pc(self, value): self.program_counter.set_value(str(value))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_counter_increase(self, val=1):\r\n return self._arm.set_counter_increase(val)", "def set_count(c):\n global count\n count = c", "def increment_pc(self):\n self.program_counter[-1] += 1", "def increment_counter(self) -> None:", "def setCount(self, num):\n self.count=num", ...
[ "0.68771935", "0.67240435", "0.6649765", "0.6593157", "0.65347755", "0.64093655", "0.63686216", "0.6187651", "0.6128649", "0.6124087", "0.6109218", "0.6085519", "0.6061288", "0.59808475", "0.5976789", "0.59526414", "0.59166974", "0.5915294", "0.5915294", "0.5910445", "0.58844...
0.7705855
0
Sets the value of the storage
def set_storage(self, value): self.storage.setPlainText(str(value))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set(self, value):\n self._storage.set(self._item, value)", "def value(self, value):\n self.set_data(value)", "def assignValue(self,value):\n self.itemset(value)", "def assignValue(self,value):\n self.itemset(value)", "def set_storage(self):\n pass", "def set_Value(s...
[ "0.82022053", "0.7120909", "0.7109629", "0.7109629", "0.70900124", "0.7048648", "0.70038307", "0.6964936", "0.696448", "0.6918625", "0.6916776", "0.68932664", "0.689154", "0.6870634", "0.6795299", "0.67443794", "0.67187697", "0.6685269", "0.6677824", "0.66491085", "0.6641952"...
0.7936727
1
Fills the symboltable with parsed labels and addresses
def set_symbols(self, symboltable: dict): for index in range(1, self.symbol_layout.rowCount()): self.symbol_layout.removeRow(index) font = QFont('Fira Code', 8, QFont.Medium) for entry in symboltable: symbol = QLineEdit() symbol.setReadOnly(True) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __generate_symboltable(self, code):\n\n code_without_lables = []\n address = 0\n for line in code:\n label_code = line.split(':')\n label = label_code[0]\n if len(label) != len(line):\n self.__symboltable[label] = address\n add...
[ "0.6294537", "0.6035416", "0.5964839", "0.57555133", "0.5608731", "0.5571357", "0.5532071", "0.546508", "0.54362375", "0.539975", "0.53911436", "0.53900325", "0.5384787", "0.5346625", "0.52863693", "0.5274382", "0.52723765", "0.5272353", "0.5223648", "0.5216137", "0.52151185"...
0.61611015
1
Turn on the scene.
def run(self) -> None: self._hass.turn_on('scene.{0}'.format(self._args['scene']))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def turn_on(self) -> None:\n self._state = self._player.turn_on()", "def turnOn(self):\n self.off = False\n self.turnOnAnimation()", "def turn_on(self, **kwargs: Any) -> None:\n self._set_light(ON_STATE)", "def turn_on(self, **kwargs):\n self._state = True\n\n # Make...
[ "0.71402043", "0.71132696", "0.70279604", "0.6954936", "0.68721765", "0.68652636", "0.68229365", "0.67939657", "0.67710656", "0.6735029", "0.6730508", "0.6596266", "0.65804565", "0.6536582", "0.6518706", "0.6516858", "0.64804995", "0.64552146", "0.6397112", "0.63840973", "0.6...
0.7613048
0
print header from fits file to either stdout or to a file
def print_header(fitsfile, ext=0, ofileh=sys.stdout): hdr = fitsio.read_header(fitsfile, ext=ext) ofileh.write(f"{hdr}") ofileh.write("\n")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_header(name, texfile):\n texfile.write('\\n')\n texfile.write('%--------------------\\n')\n texfile.write('%---' + name.upper() + ('-' * (17 - len(name))) + '\\n')\n texfile.write('%--------------------\\n')", "def print_header():\n \n print_from_file(\"html/header.html\")", "def he...
[ "0.7188707", "0.69402814", "0.67326516", "0.66753113", "0.6652564", "0.6571709", "0.6567003", "0.65550375", "0.64363533", "0.6409678", "0.6390028", "0.63504195", "0.6322972", "0.63169914", "0.6312098", "0.6295499", "0.6233899", "0.62321246", "0.6227358", "0.6210287", "0.61959...
0.86701775
0