query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Look through pixel_spectra noting all nonzero values.
def check_none_zero_values(self): hits = -1 if (len(self.data.shape) == 3): hits = 0 frames = self.data.shape[0] pixels = self.data.shape[1] bins = self.data.shape[2] for i in range(frames): for j in range(pixels): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_negative_pixels(spectra, verbose = True):\n cuenta=0\n\n output=copy.deepcopy(spectra) \n for fibre in range(len(spectra)):\n vector_ = spectra[fibre] \n stats_=basic_statistics(vector_, return_data=True, verbose=False)\n #rss.low_cut.append(stats_[1])\n if ...
[ "0.72292304", "0.632424", "0.625102", "0.60701907", "0.60613877", "0.5994225", "0.59258825", "0.590057", "0.58719677", "0.585764", "0.5806997", "0.57927483", "0.5754944", "0.57386583", "0.5706801", "0.5636686", "0.5628105", "0.5623597", "0.5616616", "0.5611829", "0.5599769", ...
0.58195806
10
functions to get the driver with options
def get_driver(_os, _browser): if _os == "mac": if _browser == "chrome": return webdriver.Chrome(executable_path="./Binary/mac/chromedriver") elif _browser == "firefox": return webdriver.Firefox(executable_path="./Binary/mac/geckodriver") elif _browser == "opera": ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_driver_with_options():\n #options = get_driver_options()\n #return webdriver.Chrome(options=options)\n return webdriver.Chrome()", "def list_opts():\n return [(constants.MLNX_BAREMETAL_DRIVER_GROUP_NAME, DRIVER_OPTS)]", "def get_driver_options():\n # Define Browser Options\n chrome_op...
[ "0.7450546", "0.6638406", "0.6583799", "0.6456858", "0.6425095", "0.6371442", "0.6370781", "0.6365004", "0.6288674", "0.6213574", "0.6142099", "0.6134546", "0.61211777", "0.6050944", "0.60396", "0.60331774", "0.6014136", "0.6009702", "0.60090196", "0.5995527", "0.5993491", ...
0.0
-1
functions for closing the web driver
def close(_driver): _driver.close() # closing the driver
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def i_close_the_browser():\n driver.close()\n driver.quit()", "def close_browser():\n driver.close()", "def close_driver(driver):\n driver.close()", "def close_driver(driver):\n driver.close()", "def close(self):\n self.driver.close()", "def closeBrowser(driver):\n driver.quit()"...
[ "0.8464193", "0.8462174", "0.84392726", "0.84392726", "0.8269169", "0.8190368", "0.8172863", "0.8059055", "0.8020362", "0.7966291", "0.78736454", "0.7838759", "0.7675496", "0.7636829", "0.7614526", "0.7567526", "0.74978864", "0.744248", "0.7439046", "0.7410245", "0.7337146", ...
0.8178299
6
functions for locating See more button
def more_locator(_driver): try: return _driver.find_element_by_xpath("//*[contains(text(), 'See more…')]") except NoSuchElementException: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_more(self):\r\n delay = WebDriverWait(driver, 5)\r\n try:\r\n ReadMore = delay.until(EC.element_to_be_clickable((By.XPATH, \".//div[@id='see_more_pager']//a[.= 'Lihat Hasil Selanjutnya'] \")))\r\n ReadMore.click()\r\n except:\r\n try:\r\n ...
[ "0.6972957", "0.6555716", "0.6488462", "0.6173499", "0.59232634", "0.5862868", "0.57194096", "0.5612491", "0.5565677", "0.55015326", "0.5480151", "0.5463297", "0.545471", "0.53935736", "0.536783", "0.5345891", "0.5345891", "0.5345747", "0.5338047", "0.53297263", "0.5320559", ...
0.6985485
0
functions for locating view previous comments button
def get_view_previous_locator(_driver): try: return _driver.find_element_by_xpath("[//*contains(text(), 'View previous comments…')]") # click on the all likes button except NoSuchElementException: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_newerButton_clicked(self):\n self.emit(SIGNAL(\"RT_PREVIOUS_PAGE\"))\n self.recordings_table.previous_page()", "def goToPrevLink():\n if wikiPageStackTrace[-2].getUrl() != \"\":\n oldpage = wikiPageStackTrace[-2]\n print(\"going back to \", oldpage.getUrl())\n titleSt...
[ "0.63999635", "0.6229458", "0.6188741", "0.61624897", "0.6152052", "0.61115634", "0.61050904", "0.6056724", "0.6038701", "0.60287166", "0.6002199", "0.59552276", "0.59492135", "0.5937468", "0.5932675", "0.5875313", "0.58588034", "0.57771254", "0.57758397", "0.57466596", "0.56...
0.8138847
0
functions for scrolling the page fast
def fast_scroll(_driver, _element="document.body"): time.sleep(1.0) last_height = _driver.execute_script(f"return {_element}.scrollHeight") # Get scroll height while True: time.sleep(1.0) _driver.execute_script(f"window.scrollTo(0, {_element}.scrollHeight);") # Scroll down to bottom ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scroll(*args):", "def _on_scroll(self, event):", "def __navigate_scroll(self):\n try:\n _title = self.browser.title\n _body = self.browser.find_element_by_tag_name('body')\n\n i = 0\n while i < 3:\n _html = str(self.browser.page_source)\n ...
[ "0.7538082", "0.68427545", "0.67603", "0.673896", "0.6634497", "0.66014194", "0.6590946", "0.65066415", "0.64982045", "0.64657027", "0.64197034", "0.6350991", "0.63470334", "0.630973", "0.6290786", "0.6239378", "0.62272036", "0.61797726", "0.61302036", "0.6110633", "0.6104865...
0.6201381
17
functions for login to facebook
def login(_driver, _username, _password): _driver.get(LOGIN_URL) # get the login page time.sleep(1.0) # wait for the page to load username = _driver.find_element_by_id("m_login_email") # find the username input username.send_keys(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def facebook_login():\n if not facebook.authorized:\n return redirect(url_for('facebook.login'))\n account_info = facebook.get('me?fields=id,name,email')\n# print(account_info)\n if account_info.ok:\n account_info_json = account_info.json()\n user = {}\n user['email'] = acco...
[ "0.8155576", "0.7645644", "0.7535127", "0.752457", "0.7443896", "0.7402997", "0.73936564", "0.7254547", "0.7175901", "0.7175901", "0.71632814", "0.7085888", "0.7031917", "0.6982877", "0.6934555", "0.6919955", "0.68536484", "0.6846095", "0.6834449", "0.681326", "0.68086517", ...
0.0
-1
functions for getting the likers of a post
def get_likers(_driver): _likers_name_list = [] # the first list of names that will be returned _likers_profile_list = [] # the second list of profile links that will be returned _driver.find_element_by_class_name("_1g06").click() # click on the all likes button time.sleep...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calc_likes_from_post(self, post):\n postlikes = len(post['likes'])\n comments = post['comments']\n commentslikes = 0\n if comments: # not empty\n # DataFrame to avoid iterating over each comment\n commentsdf = pd.DataFrame(comments)\n commentslikes ...
[ "0.69477886", "0.6925271", "0.6924874", "0.6818487", "0.67815083", "0.6629329", "0.661216", "0.64815545", "0.6408341", "0.63687795", "0.6326322", "0.6326322", "0.6324054", "0.6267979", "0.6264189", "0.61798346", "0.6174755", "0.6149348", "0.61280775", "0.6101417", "0.6098555"...
0.66238743
6
functions to get all likes from a profile
def get_profile_like(_driver, _list, _url_list): _profile_likes = {} # the dictionary that will be returned _profile_likes_link = {} # the dictionary that will be returned _iterator = 0 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_likes_list(self, username):\n api = self.api\n api.searchUsername(username) \n result = api.LastJson\n username_id = result['user']['pk'] #Gets the user ID\n user_posts = api.getUserFeed(username_id) # gets the user feed\n result = api.LastJ...
[ "0.74523973", "0.71441996", "0.70038176", "0.69108814", "0.65068454", "0.6474756", "0.6470523", "0.6401759", "0.6154338", "0.60858333", "0.6062518", "0.60425067", "0.6031918", "0.6021784", "0.6018701", "0.6011559", "0.5982903", "0.59462446", "0.59377456", "0.5909088", "0.5864...
0.74887204
0
ONEVSALL trains multiple logistic regression classifiers and returns all %the classifiers in a matrix all_theta, where the ith row of all_theta %corresponds to the classifier for label i % [all_theta] = ONEVSALL(X, y, num_labels, lambda) trains num_labels % logistic regression classifiers and returns each of these clas...
def oneVsAll(X, y, num_labels, lbd): m, n = X.shape y = y.ravel() # You need to return the following variables correctly all_theta = np.zeros((num_labels, n + 1)) print(all_theta.shape) # Add ones to the X data matrix X = np.column_stack((np.ones((m,1)), X)) print(X.shape) # ====...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def oneVsAll(X, y, num_labels, Lambda):\n\n# Some useful variables\n m, n = X.shape\n\n# You need to return the following variables correctly \n all_theta = [None] * num_labels\n\n# Add ones to the X data matrix\n X = np.column_stack((np.ones((m, 1)), X))\n\n# ====================== YOUR CODE HERE =======...
[ "0.7995681", "0.76888627", "0.7195071", "0.702582", "0.6938876", "0.6674962", "0.60844755", "0.5900924", "0.5658967", "0.5624243", "0.5508036", "0.53999805", "0.53747135", "0.5259571", "0.52347606", "0.51846915", "0.51729476", "0.51723987", "0.5146043", "0.5140953", "0.513965...
0.7640745
2
Obtain an already existing role by name.
def get_role(self, name): role = Role.query.filter_by(name=name).first() return role
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_role(self, name):\n return self.get_session.query(self.role_model).filter_by(name=name).one_or_none()", "def add_role(self, name: str) -> Role:\n role = self.find_role(name)\n if role is None:\n try:\n role = self.role_model()\n role.name = n...
[ "0.7971437", "0.7701981", "0.7430029", "0.703435", "0.70338243", "0.69480044", "0.69093156", "0.6837286", "0.681024", "0.6779084", "0.6697857", "0.66930133", "0.6656174", "0.6632345", "0.66156006", "0.65896815", "0.6546114", "0.64989406", "0.6493643", "0.6383804", "0.63724315...
0.8464865
0
Obtain an already existing user by username.
def get_by_username(self, username): user = User.query.filter_by(username=username).first() return user
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_user(username):\n user, created = User.objects.get_or_create(username=username)\n return user", "def get_or_create_user(self, username):\n try:\n return self.users[username.upper()]\n except KeyError:\n self.users[username.upper()] = User(display_name=username, u...
[ "0.8075946", "0.80617356", "0.79049903", "0.7793007", "0.7743133", "0.7737891", "0.77025217", "0.7699975", "0.7684301", "0.7671127", "0.7662574", "0.7656349", "0.76255405", "0.76143676", "0.75926673", "0.7590464", "0.75729513", "0.7538498", "0.7517759", "0.7503997", "0.749861...
0.74186885
26
Obtain an already existing user by name.
def get_by_name(self, course_name): course = Course.query.filter_by(name=course_name).first() return course
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_user(name):\n try:\n return User.objects.get(name=name)\n except ObjectDoesNotExist:\n raise ObjectDoesNotFound(\"There is no user '{}'.\".format(name))", "def get_user(self, instance, name):\n return instance.get_user(name)", "def get_user(self, name):\n try:\n ...
[ "0.80743754", "0.76843566", "0.7612651", "0.75815064", "0.75544095", "0.74709123", "0.74192166", "0.73823035", "0.73480666", "0.72751105", "0.7269578", "0.7224984", "0.70947605", "0.7015203", "0.69879484", "0.69766366", "0.6973733", "0.6970104", "0.69472903", "0.6945038", "0....
0.0
-1
Obtain an already existing user by name.
def get_by_name(self, name): category = Category.query.filter_by(name=name).first() return category
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_user(name):\n try:\n return User.objects.get(name=name)\n except ObjectDoesNotExist:\n raise ObjectDoesNotFound(\"There is no user '{}'.\".format(name))", "def get_user(self, instance, name):\n return instance.get_user(name)", "def get_user(self, name):\n try:\n ...
[ "0.80745035", "0.76863086", "0.7613882", "0.7581351", "0.75557286", "0.747316", "0.7420202", "0.7382139", "0.7351129", "0.7277303", "0.7272003", "0.72264296", "0.709747", "0.7015134", "0.69902563", "0.697775", "0.6976358", "0.69681054", "0.6949752", "0.69464743", "0.6925892",...
0.0
-1
Obtain an already existing specaliast by name.
def get_specialist(self, name): specialist = Specialist.query.filter_by(name=name).first() return specialist
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getSpecie(name):\n for spec in Species:\n if spec.name == name:\n return spec\n return None", "def find_by_name(self, name):\n return self.get(name)", "def get_by_name(self, name):\n ksat = Ksat.query.filter_by(name=name).first()\n\n return ksat", "def getbyna...
[ "0.81296074", "0.6324976", "0.61969244", "0.6122271", "0.61152214", "0.6078112", "0.5998471", "0.5994677", "0.58648056", "0.5854915", "0.58231914", "0.576764", "0.5766664", "0.5741011", "0.5731502", "0.5724771", "0.5708642", "0.5708642", "0.57076585", "0.5689137", "0.56863534...
0.55983555
29
Obtain an already existing work_role by name.
def get_by_name(self, wk_name): work_role = WorkRole.query.filter_by(name=wk_name).first() return work_role
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_role(self, name):\n role = Role.query.filter_by(name=name).first()\n\n return role", "def find_role(self, name):\n return self.get_session.query(self.role_model).filter_by(name=name).one_or_none()", "def getRole(self, desired=None):\n strDes = str(desired)\n logging.d...
[ "0.7431634", "0.6837368", "0.67848325", "0.6762558", "0.660631", "0.62866944", "0.62622374", "0.62396514", "0.6143732", "0.6113006", "0.6096055", "0.6083803", "0.6011852", "0.6007633", "0.6004311", "0.5992287", "0.59689313", "0.59653145", "0.59629005", "0.59433794", "0.588360...
0.84311515
0
Obtain an already existing user by name.
def get_by_name(self, name): ksat = Ksat.query.filter_by(name=name).first() return ksat
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_user(name):\n try:\n return User.objects.get(name=name)\n except ObjectDoesNotExist:\n raise ObjectDoesNotFound(\"There is no user '{}'.\".format(name))", "def get_user(self, instance, name):\n return instance.get_user(name)", "def get_user(self, name):\n try:\n ...
[ "0.80743754", "0.76843566", "0.7612651", "0.75815064", "0.75544095", "0.74709123", "0.74192166", "0.73823035", "0.73480666", "0.72751105", "0.7269578", "0.7224984", "0.70947605", "0.7015203", "0.69879484", "0.69766366", "0.6973733", "0.6970104", "0.69472903", "0.6945038", "0....
0.0
-1
Produces the best item from the terminal's dataset given the key
def produce(self, key=lambda x: 1.0): return max(self.data[0], key=key)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getBestOption(self):\n if len(self.Data) < 1:\n return None\n else:\n bestR = max(self.Data.items(), key=lambda x: x[1]['SPat'].I)\n return bestR[1]", "def first(data, key):\n for i in data:\n if key(i):\n return i\n retur...
[ "0.6069039", "0.6051349", "0.5977497", "0.5920712", "0.57706976", "0.57336473", "0.57303154", "0.56741154", "0.5671316", "0.5663628", "0.56417745", "0.5634074", "0.55637413", "0.55497956", "0.5549681", "0.5530699", "0.54983586", "0.5494704", "0.5494382", "0.5476488", "0.54667...
0.5647621
10
Returns a random terminal from the dataset as a weighted choice given the key.
def produce(self,key=lambda x: 1.0): i = weighted_choice(range(len(self.data)), key=lambda i: key(self.data[i])) self._update(i) return self.data[i]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def weighted_choice(self, probabilities, key):\n\n total = sum(x[0] for x in probabilities)\n choice = total * self._random(key)\n\n for probability, option in probabilities:\n choice -= probability\n if choice <= 0:\n return option", "def weightedRandFro...
[ "0.7326999", "0.72728956", "0.6830445", "0.6709102", "0.65681624", "0.6475248", "0.64244974", "0.637222", "0.6351968", "0.6293701", "0.62722015", "0.61438787", "0.60592264", "0.6040887", "0.60260594", "0.60189867", "0.60181504", "0.60111153", "0.6000856", "0.5998717", "0.5971...
0.66165197
4
Reset the internal state of the object
def reset(self): self._weights.clear()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset(self):\n self.__init__()", "def reset(self):\n self.__init__()", "def reset(self):\n self.__init__()", "def reset(self) -> None:", "def reset(self) -> None:", "def reset(self) -> None:", "def reset(self):\n \n pass", "def reset(self):\n raise NotImpleme...
[ "0.85075724", "0.85075724", "0.85075724", "0.84771633", "0.84771633", "0.84771633", "0.8463776", "0.84451026", "0.84451026", "0.84451026", "0.84451026", "0.84451026", "0.8437801", "0.8437801", "0.8437801", "0.8437801", "0.8437801", "0.8437801", "0.8437801", "0.8437801", "0.84...
0.0
-1
Add a prodution rule to the CFG. You must specify the variable 'S' at least once to generate text
def add_production(self, var, *outputs): self._grammar[var].append(outputs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_production(g, prod):\n prods = list(g.productions())\n prods.append(prod)\n\n return CFG(prods)", "def demo():\n # Create some nonterminals\n S, NP, VP, PP = nonterminals('S, NP, VP, PP')\n N, V, P, Det = nonterminals('N, V, P, Det')\n VP_slash_NP = VP/NP\n\n print 'Some nontermin...
[ "0.6064673", "0.6012317", "0.5797692", "0.52168924", "0.5214485", "0.5155329", "0.5122912", "0.5083188", "0.49953794", "0.49938613", "0.49796668", "0.49796668", "0.49536997", "0.49464285", "0.4933528", "0.48656225", "0.48361298", "0.4835409", "0.48162463", "0.4814083", "0.480...
0.53842664
3
Generate a random batch of sample text
def generate_batch(self, cfactor, nsamples, terminals=True): weights = defaultdict(lambda: 1.0) return [self._generate(cfactor,'S',weights, terms=terminals) for _ in range(nsamples)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_random_text(word_count=10):\n sample_text_lst = TEXT_BASE_RUS.replace('\\n', '').split(' ')\n generate_text_lst = []\n for i in range(word_count):\n generate_text_lst.append(random.choice(sample_text_lst))\n generate_text = ' '.join(generate_text_lst)\n return generate_text", "de...
[ "0.6940479", "0.66194695", "0.65438795", "0.6526061", "0.6513839", "0.64924395", "0.64894", "0.6449272", "0.64450514", "0.6420072", "0.6407332", "0.63838613", "0.63818294", "0.6371222", "0.6371222", "0.6360231", "0.6325006", "0.63236076", "0.6310706", "0.62450105", "0.6215517...
0.0
-1
Generates random data from the grammar
def generate(self, cfactor=0.5, print_tree=False, terminals=True): weights = defaultdict(lambda: 1.0) return self._generate(cfactor, 'S', weights, output=print_tree, terms=terminals)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_synth_data(n):", "def generate():", "def generate(self, count=15):\n\n sentence = []\n print(\"self.word_dict\", self.word_dict)\n for i in range(count):\n first_tuple = random.choice(list(self.word_dict.keys())) # first word for our sentence\n first_word...
[ "0.6483964", "0.6351281", "0.6122108", "0.6076934", "0.6026619", "0.59887093", "0.5957506", "0.5910469", "0.5885876", "0.5885876", "0.57883155", "0.5781999", "0.57806695", "0.5775946", "0.5708163", "0.5689935", "0.5686513", "0.56764895", "0.56472695", "0.56445867", "0.5642785...
0.0
-1
Convert a tree object into a string, using key to produce values from Terminals
def to_sentence(tree, key=lambda s,x: 1.0): s = [''] for terminal in flatten_tree(tree): if isinstance(terminal, str): s.append(terminal) else: s.append(terminal.produce(key=lambda x: key(s,x))) s.pop(0) return ' '.join(s)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tree_str(self, depth_index=0, recursive_dict=None):\r\n if not hasattr(self,'iteritems'): return ''\r\n if recursive_dict is not None: self = TreeMap(recursive_dict)\r\n buff_str = ''\r\n \r\n for item in self.iteritems():\r\n # Starts working now.\r\n k...
[ "0.7552488", "0.71264887", "0.6939536", "0.6894938", "0.68826926", "0.6821605", "0.6815631", "0.67464596", "0.67415917", "0.66989464", "0.66989464", "0.66621864", "0.66483873", "0.65406024", "0.65075916", "0.6500214", "0.64816684", "0.6464506", "0.6438206", "0.6428665", "0.64...
0.7018491
2
Given a tree, produces only its leaf nodes
def flatten_tree(tree): if isinstance(tree[1],str): return [tree[1]] if isinstance(tree[1],Terminal): return [tree[1]] s = [] for subtree in tree[1]: s += flatten_tree(subtree) return s
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_nodes(tree: tree_mod.Tree):\n if isinstance(tree, tree_mod.Tree):\n return tree_mod.Tree(tree.label(), [all_nodes(child) for child in tree])\n else:\n return tree_mod.Tree(tree, [])", "def leaves(tree):\n for subtree in tree.subtrees(filter = lambda t: t.node=='NP'):\n yield...
[ "0.71870345", "0.71196705", "0.70777303", "0.6974671", "0.6940172", "0.6906725", "0.6819521", "0.6795652", "0.67752254", "0.6758936", "0.6746931", "0.66662055", "0.6664883", "0.66517955", "0.66445225", "0.6579895", "0.6549478", "0.6466321", "0.646349", "0.6460313", "0.6414969...
0.6141357
39
Print the given tree and its structure
def print_tree(tree, depth=0): print('+','--'*depth,tree[0]) if isinstance(tree[1], str): print('|',' '*depth,'->',tree[1]) return if isinstance(tree[1],Terminal): print('|',' '*depth,'->',repr(tree[1])) return for subtree in tree[1]: print_tree(subtree, depth+1...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_tree(self):\n\t\tprint(self.__print_tree('', True, ''))", "def print_tree(node):\n print tree(node)", "def printTree(self):\n print(printTreeF(self, 0, self))", "def print_output(tree):\n print_value(tree)\n print_tree(tree)", "def print_tree(self):\n\t\tself.root.print_recursive(...
[ "0.87516445", "0.8733312", "0.8395688", "0.82669926", "0.8219886", "0.8210825", "0.8199108", "0.8140436", "0.80698293", "0.80206144", "0.80009586", "0.7985825", "0.7967936", "0.79507333", "0.7945708", "0.79225856", "0.7906461", "0.7883658", "0.78800994", "0.78531593", "0.7845...
0.83271277
3
Returns a uniform random choice weighted by the given key. By default, returns a uniform random choice. Setting a key function allows you to make values more or less probable of being selected. key must be a function that takes a value as an input and produces a number.
def weighted_choice(*values, **kwargs): key = kwargs.get('key', lambda x: 1.0) if len(values) == 1: values = values[0] if len(values) == 0: raise TypeError('weighted_choice expected 1 arguments, got 0') weights = [key(v) for v in values] s = sum(weights) r = random.random() * s ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def weighted_choice(self, probabilities, key):\n\n total = sum(x[0] for x in probabilities)\n choice = total * self._random(key)\n\n for probability, option in probabilities:\n choice -= probability\n if choice <= 0:\n return option", "def produce(self,ke...
[ "0.73207504", "0.7023441", "0.6776325", "0.64262414", "0.62520885", "0.622769", "0.62076044", "0.6154212", "0.5923212", "0.59212774", "0.5869574", "0.5830715", "0.58210284", "0.5804789", "0.56895596", "0.56779647", "0.56489563", "0.5636762", "0.56251335", "0.5617317", "0.5609...
0.7385043
0
Get a nested named attribute from an object by a `.` separated name. rgetattr(x, 'y.z') is equivalent to getattr(getattr(x, 'y'), 'z') and x.y.z.
def get_nested_attr(__o: object, __name: str, *args) -> Any: def _getattr(__o, __name): return getattr(__o, __name, *args) return reduce(_getattr, [__o] + __name.split('.')) # type: ignore
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getattr_nested(obj, name):\n dots = name.count('.')\n if dots == 0:\n return getattr(obj, name)\n else:\n first, rest = name.split('.', 1)\n return getattr_nested(getattr(obj, first), rest)", "def deepgetattr(obj, attr):\n\t\treturn reduce(getattr, attr.split('.'), obj)", "def...
[ "0.81038344", "0.7947371", "0.7722779", "0.75723994", "0.75492746", "0.73875433", "0.7224347", "0.71812946", "0.7162733", "0.6960191", "0.6960191", "0.6921507", "0.6830315", "0.6812168", "0.679382", "0.6680367", "0.6502294", "0.64958435", "0.6349795", "0.63452977", "0.6267382...
0.7539796
5
Set the nested named attribute on the given object to the specified value by a `.` separated name. set_nested_attr(x, 'y.z', v) is equivalent to setattr(getattr(x, 'y'), 'z', v) x.y.z = v.
def set_nested_attr(__obj: object, __name: str, __value: Any): pre, _, post = __name.rpartition('.') return setattr(get_nested_attr(__obj, pre) if pre else __obj, post, __value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setattr_nested(obj, attributes, value):\n pre, _, post = attributes.rpartition(\".\")\n setattr(getattr_nested(obj, pre) if pre else obj, post, value)", "def set_attribute(obj, path, value):\n names = path.split('.')\n if len(names) > 1:\n set_attribute(getattr(obj, names[0]), '.'.join(nam...
[ "0.7939716", "0.7406594", "0.67989147", "0.6734785", "0.630299", "0.6169416", "0.6052236", "0.60253316", "0.59769595", "0.5970289", "0.59285486", "0.59023386", "0.58718103", "0.5871102", "0.5867811", "0.579595", "0.5765958", "0.57328546", "0.57027525", "0.5693478", "0.5652854...
0.8307797
0
Determine whether a given object has an attribute with a `.` separated name.
def has_nested_attr(__obj: object, __name: str) -> bool: pre, _, post = __name.rpartition('.') if pre: if has_nested_attr(__obj, pre): return has_nested_attr(get_nested_attr(__obj, pre), post) else: return False else: return hasattr(__obj, post)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hasAttribute(self, p_str, p_str_1=None): # real signature unknown; restored from __doc__ with multiple overloads\n return False", "def has_attr_with_name(self, name):\n for attr in self:\n if attr.name == name:\n return True\n\n return False", "def checkattr(n...
[ "0.66628057", "0.65822", "0.6533159", "0.6528582", "0.65005475", "0.650034", "0.6358487", "0.6358487", "0.6206753", "0.613546", "0.61350113", "0.6089718", "0.6087438", "0.6077114", "0.6077114", "0.59296495", "0.59146595", "0.58616424", "0.58221674", "0.58221674", "0.5815346",...
0.6836234
0
Advect covariant xwind on Dgrid using contravariant xwind on cell corners. Named xtp_u in the original Fortran code. In the Fortran, dt is folded in to ub_contra and called "courant".
def advect_u_along_x( u: FloatField, ub_contra: FloatField, rdx: FloatFieldIJ, dx: FloatFieldIJ, dxa: FloatFieldIJ, dt: float, ): # Could try merging this with xppm version. from __externals__ import iord bl, br = get_bl_br(u, dx, dxa) b0 = bl + br cfl = ub_contra * dt * rd...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upwind_x(self, func, u):\n f_dx = np.zeros_like(func)\n roll_left = np.roll(func, -1, axis=1)\n roll_right = np.roll(func, 1, axis=1)\n f1 = (func - roll_right) / self.dx\n f2 = (roll_left - func) / self.dx\n f_dx[np.where(u >= 0)] = f1[np.where(u >= 0)]\n f_dx[...
[ "0.5812223", "0.5578057", "0.54327404", "0.5389594", "0.5371789", "0.5341696", "0.5303356", "0.53026146", "0.5282954", "0.5260006", "0.523463", "0.5228892", "0.522116", "0.522116", "0.5175521", "0.51724285", "0.51552135", "0.51455253", "0.51426756", "0.5137509", "0.5133099", ...
0.6606841
0
Estimates total number of combinations. This does not account for the permutations of "forced" characters, so the real number of combinations will be higher than this estimate.
def estimateCombinations(self): # Note: We use floating point, not exact arithmetic. allCharsCount = 0.0 combinations = 1.0 # Count combinations for the forced characters. for chars in self.categories: combinations *= len(chars) allCharsCount += len(char...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def number_of_permutations(self) -> int:\n perms = math.factorial(len(self._word))\n for v in self._char_counts.values():\n if v > 1:\n perms /= math.factorial(v)\n return perms", "def calulate_total_permutations(value):\n if len(value) == len(set(value)):\n ...
[ "0.7253553", "0.66454095", "0.6605841", "0.6605841", "0.6418367", "0.63323903", "0.6286042", "0.626837", "0.61481637", "0.61261785", "0.61043525", "0.6093982", "0.6053244", "0.6052588", "0.60336816", "0.6016115", "0.59903944", "0.5989238", "0.5986413", "0.59780264", "0.594201...
0.7635501
0
Returns a role matching the id in a server
def get_role(guild: discord.Guild, role_id: int = None, role_name: str = None) -> Optional[discord.Role]: if guild is None: raise ValueError("guild is None") if role_id is None and role_name is None: raise ValueError("Either role_id or role_name must be specified") for role in guild.roles: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def role_from_id(self, guild: discord.Guild, role_id: int):\n\n return discord.utils.get(guild.roles, id=role_id)", "async def role_from_config(self, guild: discord.Guild, iden: str):\n\n id_ = await getattr(self.config.guild(guild), iden)()\n\n return discord.utils.get(guild.roles, id...
[ "0.72197443", "0.71131504", "0.68009543", "0.66279536", "0.66040444", "0.6552568", "0.64326566", "0.6420487", "0.6407466", "0.63646775", "0.6349853", "0.628922", "0.6273173", "0.6263608", "0.62502223", "0.6206643", "0.6200145", "0.61291444", "0.607887", "0.606088", "0.6052877...
0.64218366
7
Lists all role within the discord server and returns to caller.
def get_role_list(guild: discord.Guild) -> List[discord.Role]: roles = [] for role in guild.roles: # Ignore @everyone and NabBot if role.name not in ["@everyone", "Nab Bot"]: roles.append(role) return roles
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list(self):\n return self.client.find_all_roles()", "def list(self, **kwargs):\n params = {}\n url = '/openstack/roles?%(params)s' % {\n 'params': parse.urlencode(params, True)\n }\n return self._list(url, 'roles')", "async def list_roles(self, ctx: commands.Co...
[ "0.7555014", "0.7496884", "0.74602515", "0.7404831", "0.7381645", "0.7341999", "0.72515357", "0.7236257", "0.7186877", "0.7168529", "0.70967084", "0.70272154", "0.69973403", "0.69679123", "0.6958893", "0.6907703", "0.68876255", "0.6827944", "0.67824525", "0.6758495", "0.67579...
0.6307623
33
Gets the user's color based on the highest role with a color
def get_user_color(user: discord.Member, guild: discord.Guild) -> discord.Colour: # If it's a PM, server will be none if guild is None: return discord.Colour.default() member = guild.get_member(user.id) # type: discord.Member if member is not None: return member.colour return discor...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def color(self):\n role_ids = self.role_ids\n if (role_ids is not None):\n for role in sorted((create_partial_role_from_id(role_id) for role_id in self.role_ids), reverse=True):\n color = role.color\n if color:\n return color\n \n ...
[ "0.72899514", "0.63540584", "0.63388276", "0.6273984", "0.6127805", "0.6099515", "0.6074041", "0.5978563", "0.5909255", "0.5873021", "0.57682693", "0.57585555", "0.57545954", "0.57352877", "0.57330096", "0.5710368", "0.56947976", "0.5676722", "0.5676663", "0.5672378", "0.5671...
0.5847438
10
Gets the user's avatar url If they don't have an avatar set, the default avatar is returned
def get_user_avatar(user: Union[discord.User, discord.Member]) -> str: return user.avatar_url if user.avatar_url is not None else user.default_avatar_url
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def avatar_url(self):\n if self.avatar and hasattr(self.avatar, 'url'):\n return self.avatar.url\n else:\n return '/static/defaults/!default_user_avatar/user.gif'", "def avatar_url(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"avatar_url\")", "def ...
[ "0.8292266", "0.80095345", "0.7952628", "0.7803622", "0.7747004", "0.76800925", "0.76762736", "0.7574685", "0.75729907", "0.753483", "0.7381511", "0.7338893", "0.72537446", "0.72216076", "0.7147984", "0.7058666", "0.70262045", "0.697657", "0.69477373", "0.6854028", "0.6850498...
0.8577179
0
Returns a formatted string for a given VoiceRegion
def get_region_string(region: discord.VoiceRegion) -> str: regions = {"us-west": EMOJI[":flag_us:"]+"US West", "us-east": EMOJI[":flag_us:"]+"US East", "us-central": EMOJI[":flag_us:"]+"US Central", "us-south": EMOJI[":flag_us:"]+"US South", "eu-west": EMO...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def region_str(self):\n return \"%s:%s-%s\" % (self.seqid, self.start, self.end)", "def __repr__(self: RcnRegion) -> str:\n return f\"RcnRegion.{self.name}\"", "def __str__(self):\n return \"Region: \" + self.name + \" with parent \" + self.parent + \" and self code \" + self.FHIRCode", ...
[ "0.7035844", "0.66859514", "0.6469942", "0.5972443", "0.59704596", "0.59704596", "0.59704596", "0.59704596", "0.59704596", "0.59704596", "0.59587413", "0.5879044", "0.58671993", "0.5835131", "0.5792081", "0.57604825", "0.57604825", "0.57604825", "0.57604825", "0.57604825", "0...
0.7548803
0
Turns mentions into plain text
def clean_string(ctx: commands.Context, string: str) -> str: def repl_channel(match): channel_id = match.group(0).replace("<", "").replace("#", "").replace(">", "") channel = ctx.message.guild.get_channel(int(channel_id)) return "#deleted_channel" if channel is None else "#"+channel.name ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def replace_user_mentions(text):\n text = re.sub('\\B@\\w*[a-zA-Z]+\\w*', 'USERMENTION', text)\n return text", "def remove_mentions(text):\n return ' '.join(re.sub(r'(?i)\\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,}\\b', ' ', text).split())", "def remove_mentions(self,text):\n return re.sub...
[ "0.7305522", "0.72066224", "0.7128925", "0.7073211", "0.70568365", "0.67589766", "0.63395077", "0.63395077", "0.6323752", "0.63101906", "0.62906474", "0.6247481", "0.6208186", "0.6199177", "0.61898404", "0.6165574", "0.61449516", "0.61366653", "0.6131315", "0.6131315", "0.613...
0.0
-1
Checks if the current command context is limited to lite mode. If the guild is in the lite_guilds list, the context is in lite mode. If the guild is in private message, and the message author is in at least ONE guild that is not in lite_guilds, then context is not lite
def is_lite_mode(ctx: commands.Context) -> bool: if is_private(ctx.message.channel): for g in ctx.bot.get_user_guilds(ctx.message.author.id): if g.id not in config.lite_servers: return False else: return ctx.message.guild in config.lite_servers
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def guild_only():\n\n async def check(ctx):\n if ctx.guild: # In a server\n return True\n await ctx.send('This command is only available in servers!')\n return False\n\n return commands.check(check)", "def is_democraciv_guild():\n\n def check(ctx):\n if not isinst...
[ "0.5691053", "0.5537149", "0.53771347", "0.5297926", "0.5295333", "0.527921", "0.52316976", "0.51805806", "0.51805806", "0.51479936", "0.51479936", "0.51479936", "0.5136715", "0.5086459", "0.50851494", "0.50851494", "0.50851494", "0.50693166", "0.50535107", "0.50369704", "0.4...
0.74545246
0
create a directory with new dataset based on specs
def generateDataset(self): if self.outdir[-1] != "/": self.outdir += "/" self.outdir += "dataset_trackml" i = 1 while os.path.exists(self.outdir): self.outdir.replace("_"+str(i-1), "") self.outdir += ("_"+str(i)) i += 1 cmd = "mkdi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_data_directory(self):\n self.src_data_dir.mkdir(exist_ok=True, parents=True)", "def create_dataset_folder_structure():\n\n path = Path(f'{DATASETS}/{FEATURES_DATASET}')\n if not os.path.exists(path):\n print(f'\\nWARNING: The path does not exist. Creating new directory...\\n{path}...
[ "0.7183818", "0.7127848", "0.7122496", "0.70144254", "0.69302595", "0.68885463", "0.68832844", "0.6875965", "0.68716687", "0.68550783", "0.6820326", "0.67120254", "0.66522723", "0.6605917", "0.65769935", "0.6572282", "0.6517507", "0.6495983", "0.64841866", "0.6477367", "0.643...
0.7010239
4
generates the hits.csv file
def generateHits(self, cont): hitf = self.outdir + "/hits.csv" old = os.dup(1) sys.stdout.flush() os.close(1) os.open(hitf, os.O_WRONLY | os.O_CREAT) cont.printallHits() sys.stdout.flush() os.close(1) os.dup(old) os.close(old) line...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_to_file(self, results):\n with open(self.outputFilename, \"w\") as csvFile:\n csvWriter = csv.writer(csvFile, delimiter=',') \n title_row = ('asset_id', 'component_id', 'latitude', 'longitude', 'installation_date', 'commissioning_date', 'street_name', 'cabinet_id', 'nominal...
[ "0.67682934", "0.66243416", "0.6588335", "0.6579417", "0.6573188", "0.655248", "0.6531506", "0.649992", "0.6460926", "0.64463776", "0.64165014", "0.6397637", "0.6396447", "0.6391759", "0.6360784", "0.6323576", "0.630485", "0.6303919", "0.6269347", "0.6267382", "0.62662333", ...
0.72992617
0
generates the tracks.csv file
def generateTruths(self, cont): truthf = self.outdir + "/tracks.csv" old = os.dup(1) sys.stdout.flush() os.close(1) os.open(truthf, os.O_WRONLY | os.O_CREAT) cont.printallTruths() sys.stdout.flush() os.close(1) os.dup(old) os.close(old)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_csv(self) -> None:\n csvData = ['Followers', 'Time']\n\n # Create our CSV file header\n with open(self.graphfile, 'w') as csvFile:\n writer = csv.writer(csvFile)\n writer.writerow(csvData)\n csvFile.close()", "def export_csv(self, csvfileobject):\n ...
[ "0.69881463", "0.6790697", "0.655824", "0.64800984", "0.6437634", "0.63966143", "0.6372148", "0.63682956", "0.6363678", "0.63325256", "0.6321618", "0.6250655", "0.6243557", "0.62408864", "0.623884", "0.6227081", "0.62265164", "0.6221201", "0.6196985", "0.6186828", "0.61633295...
0.59437996
46
generates the tracks_soln.csv file
def generateSolution(self, cont): solnf = self.outdir + "/tracks_soln.csv" old = os.dup(1) sys.stdout.flush() os.close(1) os.open(solnf, os.O_WRONLY | os.O_CREAT) cont.printallSolutions(yetkin=self.yetkin) sys.stdout.flush() os.close(1) os.dup(old)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_as_csv(self, DBNs):\n with open(\"output.csv\", \"w\") as outfile:\n # create the headers\n for i in range(0, 5):\n outfile.write(self._headers[i] + \",\") # delimits header names\n\n # moves to next line\n outfile.write(self._headers[5] + ...
[ "0.6413816", "0.6202554", "0.61280864", "0.60623825", "0.6045779", "0.60358655", "0.60163105", "0.5974259", "0.5932496", "0.59315294", "0.5917941", "0.5906362", "0.58827895", "0.5874377", "0.58609545", "0.5804449", "0.5797106", "0.57886565", "0.577884", "0.5775092", "0.577278...
0.6703463
0
Stabilny > O(nlogn) > O(nlogn) Divide and Concure
def Merge_sort(tab): if len(tab) == 1: return tab if len(tab) > 1: med = len(tab)//2 return merge(Merge_sort(tab[:med]), Merge_sort(tab[med:]))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getDivisors(n):", "def C(n,k):\n if 0 <= k <= n:\n ntok = 1\n ktok = 1\n for t in xrange(1, min(k, n - k) + 1):\n ntok *= n\n ktok *= t\n n -= 1\n return ntok // ktok\n else:\n return 0", "def time_complexities():\n return \"Best ...
[ "0.6852487", "0.6590542", "0.62178206", "0.6080809", "0.6053293", "0.60434043", "0.60197663", "0.5964565", "0.5939481", "0.59273285", "0.5913591", "0.59073526", "0.5906234", "0.5879902", "0.5877166", "0.5870401", "0.5867973", "0.58662426", "0.5858731", "0.58286893", "0.582393...
0.0
-1
Reads the pyslice.ini file.
def read_config(self, min_sections, max_sections, req_sections_list): # Can we find pyslice.ini? pyslice_ini = Path.cwd() / input_file if not os.access(pyslice_ini, os.F_OK | os.R_OK): raise ConfigFileNotFoundError( f"{input_file} was not found or not readable ***" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_ini_file (path):\n # TODO write a code to read data from ini-file to dictionary\n\n\n pass", "def read_settings(self):\n config = ConfigParser.SafeConfigParser()\n config.read(os.path.dirname(os.path.realpath(__file__)) + '/linode.ini')\n\n # Cache related\n ...
[ "0.68838066", "0.5825334", "0.5796054", "0.5694025", "0.56902796", "0.56393313", "0.5617711", "0.5588793", "0.5566551", "0.5517896", "0.5480258", "0.54781944", "0.54656595", "0.546321", "0.5453065", "0.5446662", "0.5444972", "0.54166657", "0.54001963", "0.53971964", "0.538356...
0.681543
1
Removes quotes around strings in the configuration file. This corrects a mistake that I would commonly make.
def dequote(self, in_str): in_str = in_str.replace("'", "") in_str = in_str.replace('"', "") return in_str
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _strip_quotes(file_arg):\n return re.sub(\"^[\\'\\\"]|[\\'\\\"]$\", \"\", file_arg)", "def sanitize_config(config):\n\tif not 'dbfile' in config.keys():\n\t\tconfig['dbfile'] = DEFAULTCONFIG['dbfile']\n\tfor path in ['dbfile']:\n\t\tconfig[path]=os.path.expanduser(config[path])\n\treturn config", "def r...
[ "0.68329805", "0.68006986", "0.65280825", "0.65278786", "0.6518556", "0.6518556", "0.6489833", "0.6375597", "0.6018542", "0.59424645", "0.5836385", "0.5736247", "0.5684351", "0.5662936", "0.5557374", "0.5547892", "0.55176866", "0.5515342", "0.54930264", "0.549034", "0.5484338...
0.6102709
8
Show homepage with map
def homepage(): return render_template("home_map.html")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def home():\n m = Map() # Create map html\n return render_template('index.html') # pulls map html using jinja2", "def map_page():\n m = Map() # Create map html\n return render_template('index.html') # pulls map html using jinja2", "def index():\n\n return render_template('index.html', title='Fin...
[ "0.8233349", "0.7650102", "0.74863607", "0.71886957", "0.7183427", "0.70794034", "0.69313073", "0.67315274", "0.6701228", "0.6691717", "0.6683785", "0.6635678", "0.6629475", "0.66146296", "0.66142416", "0.6591016", "0.657642", "0.65759116", "0.65759116", "0.654038", "0.653809...
0.8362454
0
JSON information about artpieces.
def return_pieces(): artpieces = Artpiece.query.all() art = [] # list of all the artpieces # going through each row returned from the query for ap in artpieces: info = {} names = [] artists = ap.artists #retrieve instance attribute for artist in artists: na...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_art_info(self):\n pass", "def json(self):\n if self.valid:\n return {\n 'articleID': self._id,\n 'ticker_symbol': self.ticker,\n 'published_date': self.pub_date,\n 'author_name': self.author,\n 'title...
[ "0.58331066", "0.5729847", "0.5689649", "0.5680672", "0.5643192", "0.55842716", "0.5492196", "0.5448909", "0.54035735", "0.53987575", "0.53871316", "0.5363308", "0.5358226", "0.5332384", "0.52659905", "0.52439654", "0.52317476", "0.5211706", "0.5207297", "0.52043325", "0.5193...
0.71255416
0
Return artist names from Artist table
def return_artistnames(): names = [] #list for artist names rows = db.session.query(Artist.name).all() for row in rows: names.append(row[0]) return jsonify(names)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getArtistsofArtwork(catalog, codes):\n return model.getArtistname(catalog,codes)", "def _query_artist_by_song(self, entities: List[str]):\n artists = []\n for e in entities:\n artists += [\n song.get('artist_name')\n for song\n in self....
[ "0.75284284", "0.7455255", "0.72220886", "0.72075844", "0.7096281", "0.6996076", "0.6992781", "0.69900787", "0.6963519", "0.6913999", "0.6889986", "0.68679404", "0.686422", "0.68333566", "0.68197393", "0.67820144", "0.67633814", "0.6721457", "0.671918", "0.6701573", "0.664013...
0.721746
3
Populate the netlist dictionary from an input file.
def parse_netlist(netlist, netfile): assert isinstance(netlist, dict) assert isinstance(netfile, str) gate_strlist = [] with open(netfile) as f: for line in f: # Clean up gate string so it can be formatted for netlist addition gate_strlist.append(line.replace(' ', ''...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, netlist_file):\n with open(netlist_file, 'r') as f:\n self.netlist = _parse_netlist(f)\n self.G = _create_graph(self.netlist)", "def read_netlist(filename):\n # Read the netlist\n try:\n netlist = pickle.load(open(filename, \"rb\"))\n except IOError:\n ...
[ "0.67228043", "0.6169035", "0.59672666", "0.59671926", "0.59454536", "0.592354", "0.5899697", "0.5889439", "0.58555084", "0.57734287", "0.57713634", "0.577122", "0.57562", "0.573317", "0.57282305", "0.5713149", "0.5706788", "0.57051605", "0.5701739", "0.5670819", "0.5619518",...
0.6111998
2
Populate the timing stimulus dictionary from and input file.
def parse_stimulus(stimulus, infile): assert isinstance(stimulus, dict) # Get timing information from file, being sure to ignore whitespace timing = '' with open(infile) as f: for line in f: timing += line.replace(' ', '').strip() # Split input into a list and convert the one a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_file(self):\n file_time = ''\n num_dir = 0\n num_freq = 0\n freq_w_band = 0.0\n freq_0 = 0.0\n start_dir = 0.0\n\n dspec_matrix = []\n\n # Extract the file time from the file name\n input_file_name = self._stream_handle.name\n\n match ...
[ "0.6077571", "0.6002726", "0.59120965", "0.58933383", "0.5866309", "0.5783808", "0.5738685", "0.5733202", "0.57041675", "0.5686597", "0.56748617", "0.5671476", "0.5664493", "0.5632346", "0.56183684", "0.5618066", "0.5594966", "0.55831385", "0.5580403", "0.5569692", "0.5538701...
0.6104276
0
Carry out the user command.
def execute(cmd, net, timing, kb, tp): assert isinstance(cmd, str) assert isinstance(net, dict) assert isinstance(timing, dict) assert isinstance(kb, logic.PropKB) cmd = cmd.split(' ') if not cmd[0]: return if cmd[0] == 'list': print get_nodes(net, timing) return ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cmd_user(args):", "def as_user(self, cmd):\n self.show(cmd, prefix=f'{self.user}$', )\n if self.dryrun:\n return None, b'', b''\n return self._as_user(cmd)", "async def sudo(self, ctx, user: discord.Member, *, command):\n new_msg = deepcopy(ctx.message)\n new_m...
[ "0.73793316", "0.6847807", "0.65027463", "0.6325972", "0.6297489", "0.6286786", "0.627779", "0.62396646", "0.61968416", "0.61724967", "0.6136661", "0.6108702", "0.60569113", "0.604115", "0.6039139", "0.60212886", "0.5955934", "0.59446704", "0.59435403", "0.5932843", "0.592839...
0.0
-1
Return a SQLAlchemy session.
def get_session(): return scoped_session(sessionmaker(autocommit=False, autoflush=False, bind=engine))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_session():\n session = scoped_session(sessionmaker(bind=engine))\n return session", "def get_session(self):\n # Create the session\n kwargs = self._get_database_specific_session_args()\n session_factory = orm.sessionmaker(\n bind=self._engine, expire_on_commit=False,...
[ "0.8613249", "0.8455852", "0.82382464", "0.81438994", "0.80603933", "0.8053609", "0.7956509", "0.7910294", "0.7899938", "0.7893864", "0.7799984", "0.7765756", "0.7758646", "0.7723484", "0.7690281", "0.76200527", "0.76080185", "0.7596541", "0.75943327", "0.7565893", "0.755834"...
0.8555524
1
Initialize your data structure here.
def __init__(self): self.cont = [[[] for _ in range(101)] for _ in range(101)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _init_empty(self):\n self._data = []", "def __init__(self):\n self._data = []", "def __init__(self):\n self._data = []", "def __init__(self):\n self._data = []", "def __init__(self):\n self._data = []", "def __init__(self):\n self._data = []", "def __init__...
[ "0.7766177", "0.76439977", "0.76439977", "0.76439977", "0.76439977", "0.76439977", "0.76439977", "0.75935495", "0.7584544", "0.75573236", "0.752992", "0.752992", "0.752992", "0.752992", "0.752992", "0.7496274", "0.7496274", "0.7478493", "0.7476544", "0.7476544", "0.7476544", ...
0.0
-1
Returns true if this set contains the specified element
def contains(self, key: int) -> bool: lv1, lv2 = self.hashing(key) for item in self.cont[lv1][lv2]: if item==key: return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _contains(self, element):\n if not isinstance(element, Tuple) or len(element) != 2:\n return S.false\n\n if not element[1].is_Integer:\n return S.false\n\n if element[1] >= len(self.sets) or element[1] < 0:\n return S.false\n\n return self.sets[eleme...
[ "0.82382053", "0.8139018", "0.8021213", "0.7980947", "0.7624437", "0.7380427", "0.7340941", "0.73253036", "0.73253036", "0.72923195", "0.7264266", "0.72581017", "0.72581017", "0.72305566", "0.7199636", "0.7197795", "0.7190712", "0.7190527", "0.7183691", "0.71733046", "0.71513...
0.65601635
95
Initialize. It is assumed that the concatenation of the event streams in persistent_event_store and transient_event_queue contain all events in which this repository has an interest.
def __init__(self, transient_event_queue, persistent_event_store, mutator, **kwargs): super().__init__(**kwargs) self._transient_event_queue = transient_event_queue self._persistent_event_store = persistent_event_store self._mutator = mutator self._tracking_aggregate_ids = defaul...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, event_queue, connection_options):\n super(GerritEventsStream, self).__init__()\n self._event_queue = event_queue\n self._connection_options = connection_options\n self._running = True", "def __init__(self):\n self.event_list = []\n self._subscribers = ...
[ "0.65101635", "0.6472584", "0.63085324", "0.61220205", "0.60210586", "0.60031444", "0.5962241", "0.59133726", "0.5910087", "0.59036", "0.5888597", "0.58803743", "0.58543456", "0.58367807", "0.5748189", "0.5720812", "0.57003045", "0.5646513", "0.5646513", "0.56442", "0.564108"...
0.6756937
0
Register an aggregate with this repository. Once an aggregate is registered with the repository, the aggregate is retrievable from the repository via _aggregate_with_id(), _aggregates_with_ids(), and _extant_aggregate_ids()
def _register(self, aggregate_root_entity): if not isinstance(aggregate_root_entity, self._aggregate_root_entity_class()): raise TypeError("{!r} is not of type {} therefore cannot be store in a {}" .format(aggregate_root_entity, self._aggregate_root_entity_class().__name_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def register_aggregation(\n self,\n f: dd.Aggregation,\n name: str,\n parameters: List[Tuple[str, type]],\n return_type: type,\n replace: bool = False,\n ):\n self._register_callable(\n f,\n name,\n aggregation=True,\n ...
[ "0.6493154", "0.6390233", "0.5721717", "0.5695466", "0.5640757", "0.5489287", "0.5478946", "0.5319596", "0.5287735", "0.5268721", "0.52365905", "0.5200469", "0.5123038", "0.5114808", "0.51092464", "0.50671554", "0.5062453", "0.49744803", "0.4961004", "0.4954799", "0.49456868"...
0.65265906
0
Lazily register aggregate root entities as they are yielded by the iterable.
def _register_iter(self, iterable): for aggregate_root_entity in iterable: self._track(aggregate_root_entity) self._intern(aggregate_root_entity) yield aggregate_root_entity
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _register(self, aggregate_root_entity):\n if not isinstance(aggregate_root_entity, self._aggregate_root_entity_class()):\n raise TypeError(\"{!r} is not of type {} therefore cannot be store in a {}\"\n .format(aggregate_root_entity, self._aggregate_root_entity_class...
[ "0.63130754", "0.60614014", "0.59806603", "0.5934126", "0.5915763", "0.5909096", "0.5894328", "0.5859315", "0.58264387", "0.5809056", "0.5741137", "0.5738972", "0.57183206", "0.56957173", "0.56778264", "0.561123", "0.56023943", "0.5597782", "0.55625147", "0.55021703", "0.5498...
0.8712843
0
Save all pending changes from tracked aggregates into the persistent eventstore.
def save_changes(self): change_events = self._transient_event_queue.separate_out(self.is_from_tracked_aggregate) for event in change_events: self._persistent_event_store.append(event)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def saveAll(self, event=None):\n self.s.end()", "def flush(self):\n self.save()\n for obs in self.observation_set.all():\n obs.flush();", "def save(self, event_stream: List[DomainEvent], aggregate_root_id: str):\n\n \"\"\" overwriting the event stream is not ok \"\"\"...
[ "0.6874553", "0.63277054", "0.6269933", "0.61518925", "0.61511207", "0.6101591", "0.6036419", "0.5988059", "0.5949367", "0.5917159", "0.58930194", "0.5871131", "0.58382297", "0.5813014", "0.58026534", "0.57893187", "0.5785584", "0.574921", "0.5748524", "0.57327044", "0.572578...
0.8218231
0
Obtain an aggregate by aggregate root entity ID.
def _aggregate_with_id(self, entity_id): try: entity = self._instance(entity_id) except ValueError: entity = self._load_aggregate_with_id(entity_id) self._register(entity) return entity
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def aggregate(self, agpath):\n return data.Aggregate(self, agpath)", "def load(self, aggregate_root_id: str):\n raise NotImplementedError('Every repository must have an load method.')", "def _get_full_aggregate(self,\n instance: models.Model,\n ...
[ "0.64862907", "0.602317", "0.55756664", "0.5573993", "0.5437499", "0.5332272", "0.5325919", "0.5284718", "0.52684903", "0.52564347", "0.521178", "0.52116036", "0.52116036", "0.52116036", "0.5122449", "0.50652647", "0.5036824", "0.50247365", "0.49847212", "0.49812022", "0.4975...
0.7186072
0
Obtain a series of aggregates by root entity id.
def _aggregates_with_ids(self, entity_ids=None): entity_ids = tuple(entity_ids) if entity_ids is not None else entity_ids return self._register_iter( deferred_chain(lambda: self._instantiated_aggregates(entity_ids), lambda: self._persisted_aggregates(entity_ids)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _aggregate_with_id(self, entity_id):\n try:\n entity = self._instance(entity_id)\n except ValueError:\n entity = self._load_aggregate_with_id(entity_id)\n self._register(entity)\n return entity", "def aggregate(self, agpath):\n return data.Aggregate(se...
[ "0.618295", "0.6173365", "0.61160237", "0.59488845", "0.5519509", "0.548135", "0.5451497", "0.54363096", "0.53930974", "0.5385839", "0.5360858", "0.53516644", "0.5310921", "0.52382666", "0.5175398", "0.51556855", "0.51529413", "0.51376027", "0.5125247", "0.50757545", "0.50753...
0.6054674
3
Obtain an iterable series of entity ids.
def _instantiated_ids(self): return self._identity_map.keys()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def identities(self, generator=False, **kwargs):\n g = self._iter(body=self._identities_iter(), **kwargs)\n if generator:\n return g\n\n return list(g)", "def ids(self):\n return list(self._id_generator())", "def ids(self):\n return list(self._id_generator())", "...
[ "0.70956826", "0.7061975", "0.7061975", "0.68173486", "0.6787532", "0.676337", "0.67260486", "0.67260486", "0.6688406", "0.6678895", "0.66712475", "0.6649754", "0.6582323", "0.6534067", "0.65272325", "0.65266484", "0.64362466", "0.6421854", "0.63464284", "0.63428295", "0.6334...
0.58131033
65
An iterable series of instantiated (inmemory) aggregates.
def _instantiated_aggregates(self, aggregate_ids=None): instantiated_work_item_ids = (self._instantiated_ids() if aggregate_ids is None else set(self._instantiated_ids()).intersection(aggregate_ids)) return map(self._instance, instantiated_work...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_aggr(self, attribute, aggregator=None, smooth=0., **kwargs):\n if aggregator is None:\n aggregator = np.mean\n data = self.get_all()\n itrs = {row['Iteration'] for row in data}\n itrs = sorted(list(itrs))\n vals = []\n running_avg = 0\n for itr in...
[ "0.63252145", "0.6149966", "0.60993874", "0.60860616", "0.60501015", "0.60235465", "0.60215694", "0.59717214", "0.58986205", "0.5892919", "0.58819073", "0.5839542", "0.58330685", "0.5810136", "0.5778904", "0.5745278", "0.57366496", "0.5719375", "0.5706598", "0.56811416", "0.5...
0.520499
65
An iterable series of persisted (not inmemory) aggregates.
def _persisted_aggregates(self, aggregate_ids=None): aggregate_ids = set(aggregate_ids) if aggregate_ids is not None else self._extant_aggregate_ids() persisted_entity_ids = aggregate_ids.difference(self._instantiated_ids()) return self._load_aggregates_with_ids(persisted_entity_ids)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def persistence_model(series):\n return [x for x in series]", "def get_aggr(self, attribute, aggregator=None, smooth=0., **kwargs):\n if aggregator is None:\n aggregator = np.mean\n data = self.get_all()\n itrs = {row['Iteration'] for row in data}\n itrs = sorted(list(it...
[ "0.6351666", "0.5879706", "0.5795679", "0.57920545", "0.5769972", "0.5736621", "0.57287455", "0.57263637", "0.5720817", "0.5684569", "0.5653115", "0.55981994", "0.553467", "0.5520698", "0.55060714", "0.5500458", "0.5477508", "0.5458524", "0.54387695", "0.53825915", "0.537757"...
0.5831572
2
A set of IDs for aggregates managed by this repository which have not been discarded.
def _extant_aggregate_ids(self): events = chain( self._persistent_event_store, filter(self.is_from_tracked_aggregate, self._transient_event_queue)) return extant_persisted_aggregate_ids(events, self._aggregate_root_entity_class)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _persisted_aggregates(self, aggregate_ids=None):\n aggregate_ids = set(aggregate_ids) if aggregate_ids is not None else self._extant_aggregate_ids()\n persisted_entity_ids = aggregate_ids.difference(self._instantiated_ids())\n return self._load_aggregates_with_ids(persisted_entity_ids)", ...
[ "0.626336", "0.6241536", "0.6196094", "0.617768", "0.6158783", "0.61520046", "0.6139966", "0.61024576", "0.60693914", "0.6003579", "0.5943484", "0.5917557", "0.5890295", "0.5887773", "0.58694875", "0.5868544", "0.58400965", "0.58400965", "0.5835411", "0.5756231", "0.5730896",...
0.6847186
0
Scan all events in an event store to find extant aggregates of a specified type. Use this function to find those aggregates which have been created, but not yet discarded by the end of the event stream. Such entities are still 'extant'.
def extant_persisted_aggregate_ids(events, entity_class): created_event_class = getattr(entity_class(), 'Created', None) discarded_event_class = getattr(entity_class(), 'Discarded', None) aggregate_ids = set() for event in events: if isinstance(event, created_event_class): aggregate...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def batch_events_by_type(session, type_name):\n subquery = latest_batch_events(session).subquery()\n query = session.query(subquery).filter(subquery.c.event_type == type_name)\n return query", "def _extant_aggregate_ids(self):\n events = chain(\n self._persistent_event_store,\n ...
[ "0.6039117", "0.58931744", "0.54684293", "0.539638", "0.518237", "0.5122139", "0.51058996", "0.5071825", "0.497937", "0.49677515", "0.49257928", "0.49091417", "0.49018097", "0.49003607", "0.4893016", "0.48543817", "0.48396337", "0.48304117", "0.48218137", "0.47894958", "0.478...
0.50925976
7
return the same with argument
def __call__(self, input_patch): input_patch = self._reshape_patch_to_5d(input_patch) output_patch = input_patch.astype(np.float32) #if np.issubdtype(patch.dtype, np.integer): # # normalize to 0-1 value range # output /= np.iinfo(patch.dtype).max output_patch = se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def non_pythranizable(arg):\n return arg", "def _take_other(cls, arg1, arg2):\n return arg2", "def identity( arg ):\n return arg", "def func(arg1, arg2):\n\n return arg", "def apply(self, *args: _Data) -> _Data:", "def second(a, b):", "def f_onearg(self, arg1) :\n pass", "def o...
[ "0.6461839", "0.6320902", "0.63206273", "0.624683", "0.6146164", "0.61355376", "0.6050552", "0.6030019", "0.6029986", "0.59960824", "0.5972557", "0.5954946", "0.5922485", "0.589836", "0.589836", "0.58776206", "0.58592206", "0.5851192", "0.5851192", "0.58380234", "0.5837794", ...
0.0
-1
Decorator that added idempotency key processing logic to a view.
def require_idempotency_key(view_func): @wraps(view_func) def wrapped_view(*args, **kwargs): # args can contain either (HttpRequest,) or (ViewSet, HttpRequest). view_set, request = args if len(args) > 1 else (None, *args) # If a method in SAFE_METHODS just return a response. if...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def api_key_required(func):\n\t@wraps(func)\n\tdef decorated_view(*args, **kwargs):\n\t\treturn func(*args,**kwargs)\n\treturn decorated_view", "def manipulative(function):\n @functools.wraps(function)\n def marked(self, *args, **kwargs):\n self.session.mark_manipulative([self.key] if hasattr(self, ...
[ "0.65538377", "0.60099995", "0.5886012", "0.55957586", "0.5564601", "0.55555874", "0.55474406", "0.5454455", "0.54204446", "0.5417398", "0.5344656", "0.534291", "0.5315597", "0.5308435", "0.52835524", "0.5283243", "0.5276676", "0.5223224", "0.51900303", "0.51898897", "0.51864...
0.7475548
0
Return with boolen if the object is an instance of the class
def is_same_class(obj, a_class): return (type(obj) == a_class)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __instancecheck__(self, instance):\n\n if isinstance(instance, ObjCInstance):\n return bool(instance.isKindOfClass(self))\n else:\n return False", "def isclassinstance(object):\n if not hasattr(object, \"__class__\"):\n return False\n if isbuiltin(object.__cla...
[ "0.81178784", "0.80528265", "0.79027194", "0.77327365", "0.7720832", "0.7706594", "0.76211834", "0.7617837", "0.7615193", "0.75302887", "0.75302887", "0.7526448", "0.7510782", "0.7493831", "0.74901634", "0.74751526", "0.74582803", "0.74582803", "0.74582803", "0.74582803", "0....
0.6968852
58
Get weather for location
def get_weather(location): url = "https://api.openweathermap.org/data/2.5/weather?q={}&units=imperial&appid={}".format(location, get_api_key()) r = requests.get(url) return r.json()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetWeatherByLocation():\n Location = GetLocation()\n WeatherUrl =\"http://api.openweathermap.org/data/2.5/weather?\"+ Location +\"&appid=b4bacbe2dc824431289800439f1ec3df&units=metric\"\n WeatherRequest = requests.get(WeatherUrl)\n WeatherInfo = WeatherRequest.json()\n pprint(WeatherInfo)\n Wi...
[ "0.78710467", "0.7833643", "0.77243173", "0.7427846", "0.7419594", "0.7398626", "0.7392885", "0.7328156", "0.72383773", "0.7135582", "0.7130604", "0.7127247", "0.71153015", "0.71008724", "0.70546454", "0.705146", "0.7041656", "0.6961758", "0.69597834", "0.6956381", "0.6948398...
0.76792526
3
Gets the current weather and parses the json result
def weather_helper(): weather = get_weather('Chicago') conditions = weather['weather'][0]['description'] temperature = weather['main']['temp'] location = weather['name'] curr_weather = 'It is currently %s degrees with %s in %s' % (temperature, conditions, location) return curr_weather
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_weather(self):\n with urllib.request.urlopen(self.url) as response:\n json_data = response.read().decode('utf-8')\n\n data = json.loads(json_data)\n\n weather = {}\n weather['current'] = {\n 'temp': round(data['current']['temp_f']),\n 'humidity':...
[ "0.8052646", "0.74523056", "0.7423413", "0.725587", "0.72396773", "0.70997745", "0.7053287", "0.69802815", "0.697174", "0.6922131", "0.6921299", "0.6914106", "0.6865227", "0.6863648", "0.68427294", "0.6820453", "0.6809343", "0.67647815", "0.67547256", "0.67067647", "0.6665215...
0.61776656
50
Plot upper and lower bounds on current axis.
def fill_bounds(x, upper, lower, axis, c = 'k', alpha = 0.2): axis.fill_between( x, upper[:, 0], lower[:, 0], facecolor = c, alpha = alpha )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def xylim(xmin=None, xmax=None, ymin=None, ymax=None):\n plt.axis(xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax)", "def plot(self, aVals, bVals):\n with self.pt as sp:\n # Top subplot: The range of interest\n X = np.linspace(self.xMin, self.xMax, self.N)\n self.subplot(sp,...
[ "0.6574244", "0.64996564", "0.64005095", "0.63759154", "0.635066", "0.6302019", "0.6288338", "0.6279053", "0.6270668", "0.6138086", "0.6098544", "0.6042692", "0.6039208", "0.6036063", "0.6001224", "0.5999706", "0.59967214", "0.5989359", "0.59342587", "0.5918528", "0.5908918",...
0.58135307
27
Check if an operation can be paginated.
def can_paginate(self, operation_name: str = None): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_paginate(operation_name=None):\n pass", "def can_paginate(operation_name=None):\n pass", "def can_paginate(operation_name=None):\n pass", "def can_paginate(operation_name=None):\n pass", "def can_paginate(operation_name=None):\n pass", "def can_paginate(operation_name=None):\n p...
[ "0.86066496", "0.86066496", "0.86066496", "0.86066496", "0.86066496", "0.86066496", "0.86066496", "0.86066496", "0.86066496", "0.86066496", "0.86066496", "0.86066496", "0.86066496", "0.86066496", "0.86066496", "0.86066496", "0.86066496", "0.7462813", "0.73898345", "0.70055825",...
0.84119326
19
Generate a presigned url given a client, its method, and arguments
def generate_presigned_url(self, ClientMethod: str = None, Params: Dict = None, ExpiresIn: int = None, HttpMethod: str = None): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_presigned_url(ClientMethod=None, Params=None, ExpiresIn=None, HttpMethod=None):\n pass", "def generate_presigned_url(ClientMethod=None, Params=None, ExpiresIn=None, HttpMethod=None):\n pass", "def generate_presigned_url(ClientMethod=None, Params=None, ExpiresIn=None, HttpMethod=None):\n p...
[ "0.8490327", "0.8490327", "0.8490327", "0.8490327", "0.8490327", "0.8490327", "0.8490327", "0.8490327", "0.8490327", "0.8490327", "0.8490327", "0.8490327", "0.8490327", "0.8490327", "0.8490327", "0.8490327", "0.8490327", "0.6350565", "0.63343436", "0.6285767", "0.6178866", ...
0.8300066
19
Create a paginator for an operation.
def get_paginator(self, operation_name: str = None) -> Paginator: pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_paginator(operation_name=None):\n pass", "def get_paginator(operation_name=None):\n pass", "def get_paginator(operation_name=None):\n pass", "def get_paginator(operation_name=None):\n pass", "def get_paginator(operation_name=None):\n pass", "def get_paginator(operation_name=None):\...
[ "0.77266794", "0.77266794", "0.77266794", "0.77266794", "0.77266794", "0.77266794", "0.77266794", "0.77266794", "0.77266794", "0.77266794", "0.77266794", "0.77266794", "0.77266794", "0.77266794", "0.77266794", "0.77266794", "0.77266794", "0.70318013", "0.6699028", "0.6333945", ...
0.7638169
19
Generates a random password of the specified complexity. This operation is intended for use in the Lambda rotation function. Per best practice, we recommend that you specify the maximum length and include every character type that the system you are generating a password for can support. Minimum permissions
def get_random_password(self, PasswordLength: int = None, ExcludeCharacters: str = None, ExcludeNumbers: bool = None, ExcludePunctuation: bool = None, ExcludeUppercase: bool = None, ExcludeLowercase: bool = None, IncludeSpace: bool = None, RequireEachIncludedType: bool = None) -> Dict: pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_password(self, length):\n items = [\"a\", \"e\", \"i\", \"o\", \"u\", \"1\", \"2\", \"4\", \"5\", \"7\", \"8\", \"9\"]\n\n new_password = \"\"\n while(len(new_password) < length):\n item = items[randint(0, len(items) - 1)]\n new_password += item\n retu...
[ "0.79462117", "0.794125", "0.78882504", "0.7872147", "0.78551763", "0.7803957", "0.7779306", "0.7765161", "0.7667654", "0.7642821", "0.75945395", "0.7505739", "0.74817866", "0.74190784", "0.74171126", "0.74082935", "0.74069756", "0.7404962", "0.73642737", "0.73635584", "0.735...
0.6740536
54
Returns an object that can wait for some condition.
def get_waiter(self, waiter_name: str = None) -> Waiter: pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _wait_until(self, condition, timeout: TimeoutType = DEFAULT_TIMEOUT):\n if not timeout:\n timeout = 0\n return wait.WebDriverWait(self._webdriver, timeout).until(condition)", "def wait_condition(cond, timeout=1, sleeptime=.01):\n # NOTE Increasing sleeptime can dramatically increa...
[ "0.7239466", "0.71939754", "0.71939754", "0.7187199", "0.7066341", "0.69937223", "0.6971929", "0.6961102", "0.6874536", "0.67702746", "0.6736504", "0.6727936", "0.6710583", "0.6639147", "0.6542321", "0.6540615", "0.6468605", "0.6409403", "0.6396809", "0.6369615", "0.63636947"...
0.0
-1
Lists all of the secrets that are stored by Secrets Manager in the AWS account. To list the versions currently stored for a specific secret, use ListSecretVersionIds . The encrypted fields ``SecretString`` and ``SecretBinary`` are not included in the output. To get that information, call the GetSecretValue operation.
def list_secrets(self, MaxResults: int = None, NextToken: str = None) -> Dict: pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def list_secrets(self):\n pass", "def _all_secrets(cls, *, secretsmanager_client):\n return secretsmanager_client.list_secrets()['SecretList']", "def list_secrets_command(client: KeyVaultClient, args: dict[str, Any]) -> CommandResults:\n vault_name = args['vault_name']\n limit = arg_t...
[ "0.8024093", "0.78251266", "0.7289144", "0.7109478", "0.70714676", "0.6983011", "0.69202316", "0.68090004", "0.6796193", "0.6637247", "0.6608851", "0.65818655", "0.6547432", "0.6445355", "0.64339757", "0.63733447", "0.6365531", "0.63488114", "0.6301166", "0.6298797", "0.62746...
0.69495285
6
Returns the default config (see parent class for full docstring).
def get_default_config() -> Dict[Text, Any]: # please make sure to update the docs when changing a default parameter return { # ## Architecture of the used neural network # Hidden layer sizes for layers before the embedding layers for user message # and labels. ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_default_config(self):\n return config.read(pathlib.Path(__file__).parent / \"ext.conf\")", "def default(cls) -> 'Config':\n parser: configparser.ConfigParser = configparser.ConfigParser()\n parser.read_dict(dict(wpwatcher=Config.DEFAULT_CONFIG))\n return cls.fromparser(parser)...
[ "0.857237", "0.8296643", "0.8086456", "0.7969869", "0.7921342", "0.78670275", "0.7778315", "0.7736277", "0.771808", "0.761196", "0.7611108", "0.7588063", "0.7546006", "0.75447714", "0.7536708", "0.7524585", "0.7514965", "0.7514965", "0.7502165", "0.7352819", "0.7343861", "0...
0.0
-1
Declares instance variables with default values.
def __init__( self, config: Dict[Text, Any], model_storage: ModelStorage, resource: Resource, execution_context: ExecutionContext, model: Optional[RasaModel] = None, featurizer: Optional[TrackerFeaturizer] = None, fake_features: Optional[Dict[Text, List[Fe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_vars(self):\n # type: () -> None\n raise NotImplementedError", "def __init__(self):\n\n self.var = None", "def set_defaults(self):\n\n for k, v in self.DEFAULTS.items():\n if not getattr(self, k, None):\n setattr(self, k, v)", "def __init__(self)...
[ "0.723309", "0.65402156", "0.65281314", "0.6524752", "0.65219414", "0.6505511", "0.6468855", "0.64198077", "0.641733", "0.6414224", "0.64120364", "0.63588", "0.63588", "0.63588", "0.6348853", "0.6342154", "0.63421226", "0.63403565", "0.6336337", "0.63095146", "0.62944084", ...
0.0
-1
Gets the class of the model architecture to be used by the policy.
def model_class() -> Type[TED]: return TED
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_class(self):\n return self.meta_model.get_class()", "def get_class(klass, kind):\n return getattr(sys.modules['model'], kind, None)", "def get_class(self):\n return devices.get_class(self.type)", "def model_class(self):\n model_name = self.model_name()\n\n if not mo...
[ "0.7116173", "0.677923", "0.66405445", "0.6557279", "0.65536994", "0.6553188", "0.65347636", "0.65245426", "0.65077186", "0.6503116", "0.6470646", "0.6470646", "0.6466409", "0.6439735", "0.64174634", "0.6342661", "0.6315126", "0.6307546", "0.6289622", "0.62059706", "0.6175988...
0.0
-1
Takes care of deprecations and compatibility of parameters.
def _auto_update_configuration(self) -> None: self.config = rasa.utils.train_utils.update_confidence_type(self.config) rasa.utils.train_utils.validate_configuration_settings(self.config) self.config = rasa.utils.train_utils.update_similarity_type(self.config) self.config = rasa.utils.tra...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_params(self):\n raise NotImplementedError", "def _check_params(self):\n pass", "def Parameters():\n\n raise NotImplementedError()", "def define_parameters(self):", "def params():\n raise NotImplementedError", "def _setParameterValue(self, name, value, typeString = ''):\n ...
[ "0.6790173", "0.6602024", "0.65320545", "0.6495532", "0.645688", "0.61364514", "0.6100258", "0.6096798", "0.60831714", "0.6065438", "0.6055547", "0.60080636", "0.59355706", "0.5897997", "0.5890233", "0.58886147", "0.5876689", "0.5873085", "0.58344173", "0.583228", "0.5791995"...
0.0
-1
Constructs data regarding labels to be fed to the model. The resultant model data can possibly contain one or both of the keys [`label_action_name`, `label_action_text`] but will definitely contain the `label` key. `label_action_` will contain the sequence, sentence and mask features for corresponding labels and `label...
def _assemble_label_data( self, attribute_data: Data, domain: Domain ) -> RasaModelData: label_data = RasaModelData() label_data.add_data(attribute_data, key_prefix=f"{LABEL_KEY}_") label_data.add_lengths( f"{LABEL}_{ACTION_TEXT}", SEQUENCE_LENGTH, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_label_data(\n self,\n training_data: \"TrainingData\",\n label_id_dict: Dict[Text, int],\n attribute: Text,\n ) -> \"SessionDataType\":\n\n # Collect one example for each label\n labels_idx_example = []\n for label_name, idx in label_id_dict.items():\...
[ "0.63809144", "0.6255888", "0.6199803", "0.6131158", "0.6065041", "0.6064807", "0.60307", "0.6029416", "0.602556", "0.60010827", "0.5991813", "0.59754205", "0.59728646", "0.5949336", "0.5948533", "0.5946974", "0.59452814", "0.5914314", "0.58943677", "0.5868118", "0.58675945",...
0.67797244
0
Combine all model related data into RasaModelData.
def _create_model_data( self, tracker_state_features: List[List[Dict[Text, List[Features]]]], label_ids: Optional[np.ndarray] = None, entity_tags: Optional[List[List[Dict[Text, List[Features]]]]] = None, encoded_all_labels: Optional[List[Dict[Text, List[Features]]]] = None, )...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def import_data(self):\n self.models = []\n for o in self.loader.load():\n klass = self.type_for(o)\n if hasattr(klass, \"from_api\"):\n self.models.append(klass.from_api(o))\n else:\n self.models.append(klass(o))\n return self.mod...
[ "0.59886765", "0.5974466", "0.5916681", "0.5743959", "0.56779295", "0.5614999", "0.552294", "0.552294", "0.5495761", "0.546526", "0.5450156", "0.5412401", "0.53948516", "0.5367407", "0.5365219", "0.5354953", "0.5354169", "0.53396356", "0.5335859", "0.528528", "0.5280338", "...
0.5872148
3
Filters out the list of trackers which should not be used for training.
def _get_trackers_for_training( trackers: List[TrackerWithCachedStates], ) -> List[TrackerWithCachedStates]: # By default, we train on all available trackers. return trackers
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filterduplicates(client, repeatfactor, tracks): # {{{1\n trackstofilter = client.playlist()\n if len(trackstofilter) < repeatfactor:\n repeatfactor = len(trackstofilter)\n trackstofilter = trackstofilter[-repeatfactor : -1]\n return [t for t in tracks if not t[1]['file'] in trackstofilter]", "de...
[ "0.582376", "0.5782622", "0.5729195", "0.5623313", "0.56115806", "0.5579064", "0.5547851", "0.54678303", "0.5451969", "0.54394054", "0.54235125", "0.5365223", "0.5362807", "0.53606004", "0.5312667", "0.52957827", "0.52803254", "0.527003", "0.5226352", "0.5221089", "0.5210202"...
0.66072863
0
Prepares data to be fed into the model.
def _prepare_for_training( self, trackers: List[TrackerWithCachedStates], domain: Domain, precomputations: MessageContainerForCoreFeaturization, **kwargs: Any, ) -> Tuple[RasaModelData, np.ndarray]: training_trackers = self._get_trackers_for_training(trackers) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prepare_data(self):", "def _prepare_data(self):\n #TODO hardcoded values need to change\n print_info(\"Preprocessing the train data...\")\n self._place_dataset(os.path.join(self._hparams[\"temp-data\"], \"train\"),\n self.TRAIN_OUT_PATH)\n\n print_info(\"...
[ "0.8046266", "0.7127935", "0.6874451", "0.67898524", "0.678912", "0.678912", "0.678912", "0.67133814", "0.6672943", "0.6672943", "0.65071124", "0.6472145", "0.64491314", "0.6442195", "0.64261943", "0.63925534", "0.6372952", "0.6368179", "0.6364355", "0.6321005", "0.63124764",...
0.0
-1
Feeds the featurized training data to the model.
def run_training( self, model_data: RasaModelData, label_ids: Optional[np.ndarray] = None ) -> None: if not self.finetune_mode: # This means the model wasn't loaded from a # previously trained model and hence needs # to be instantiated. self.model = se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train(self):\n\t\tself.model.fit(self.training_data, self.training_labels)", "def training(self):\n self.model.fit(self.train_x, self.train_y)", "def run(self) -> None:\n self.model = self.trainer.train_model(self.model, self.data)", "def train(self, training_data):\n pass", "def t...
[ "0.73157805", "0.706855", "0.69862926", "0.6975206", "0.68651426", "0.68398654", "0.6796677", "0.6730004", "0.66785765", "0.66579765", "0.6617296", "0.6609397", "0.6605348", "0.65840536", "0.6569871", "0.6566162", "0.65638673", "0.655276", "0.65381336", "0.65381336", "0.65381...
0.0
-1
Trains the policy (see parent class for full docstring).
def train( self, training_trackers: List[TrackerWithCachedStates], domain: Domain, precomputations: Optional[MessageContainerForCoreFeaturization] = None, **kwargs: Any, ) -> Resource: if not training_trackers: rasa.shared.utils.io.raise_warning( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start(self, policy):\n self._policy = policy\n self._gen = self._generator()", "def __init__(self, policy):\n super().__init__(policy=policy, sess=policy.sess)", "def update_policy(self):\n pass", "def run_begin(self, policy, profile):\n raise NotImplementedError('Agent...
[ "0.6989661", "0.6665408", "0.66004956", "0.66003674", "0.6395795", "0.6331661", "0.59991735", "0.59392864", "0.5933792", "0.5860591", "0.5853578", "0.58118445", "0.5792852", "0.56713444", "0.564351", "0.563017", "0.5609589", "0.56068635", "0.5580811", "0.55767864", "0.5561428...
0.0
-1
Predicts the next action (see parent class for full docstring).
def predict_action_probabilities( self, tracker: DialogueStateTracker, domain: Domain, rule_only_data: Optional[Dict[Text, Any]] = None, precomputations: Optional[MessageContainerForCoreFeaturization] = None, **kwargs: Any, ) -> PolicyPrediction: if self.model...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def predict_fn(future_action, state):\n model = get_model()\n rewards = model((state, future_action))\n return {\"reward\": rewards}", "def step(self, action):\n # Action indicates the position of a datapoint in self.indeces_unknown \n # that we want to sample in unknown_data\n # Th...
[ "0.67779714", "0.6735676", "0.6731073", "0.6596335", "0.65423447", "0.65370566", "0.6475679", "0.6443836", "0.6417625", "0.63804555", "0.63311464", "0.6311346", "0.6284846", "0.6262275", "0.62071246", "0.6200687", "0.61905575", "0.618747", "0.6179343", "0.61750376", "0.616289...
0.0
-1
Persists the policy to a storage.
def persist(self) -> None: if self.model is None: logger.debug( "Method `persist(...)` was called without a trained model present. " "Nothing to persist then!" ) return with self._model_storage.write_to(self._resource) as model_path: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save(self):\r\n if self._storage:\r\n self._storage.store(self, *self._storage_args)\r\n else:\r\n raise StorageNotSetError()", "def save(self, storage, name, meta):\n with closing(self.open()) as handle:\n storage.save(name, handle)", "def _save_policy...
[ "0.6539426", "0.6335001", "0.6203709", "0.61191976", "0.60124207", "0.60124207", "0.5986824", "0.58744806", "0.58744806", "0.58744806", "0.57665414", "0.57639647", "0.5738777", "0.5690177", "0.5677944", "0.5637437", "0.5635236", "0.56063575", "0.55488265", "0.5538749", "0.552...
0.5323519
39
Persists model's utility attributes like model weights, etc.
def persist_model_utilities(self, model_path: Path) -> None: model_filename = self._metadata_filename() rasa.utils.io.json_pickle( model_path / f"{model_filename}.priority.pkl", self.priority ) rasa.utils.io.pickle_dump( model_path / f"{model_filename}.meta.pkl", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _save(self):\n for attrib in self.attribs:\n setattr(self, attrib, getattr(self.obj, attrib))", "def save_model(self):\n pass", "def save_model(self):\r\n jeff = self.name + '_words'\r\n f = open(jeff, 'w')\r\n f.write(str(self.words))\r\n f.close()\r\n ...
[ "0.6227181", "0.60620934", "0.60294247", "0.60267735", "0.59857696", "0.5937814", "0.59068686", "0.58973426", "0.5887841", "0.58811957", "0.5874724", "0.58660245", "0.5830758", "0.58219177", "0.57765204", "0.5774643", "0.57661456", "0.570737", "0.57017636", "0.5693476", "0.56...
0.646969
0
Loads model's utility attributes.
def _load_model_utilities(cls, model_path: Path) -> Dict[Text, Any]: tf_model_file = model_path / f"{cls._metadata_filename()}.tf_model" loaded_data = rasa.utils.io.pickle_load( model_path / f"{cls._metadata_filename()}.data_example.pkl" ) label_data = rasa.utils.io.pickle_lo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_attrs(self):\n return loads(self.get_attr().GetObject()) or {}", "def load(self):\r\n self.domain.get_attributes(self.name, item=self)", "def load_model(self) -> Any:", "def __load_model(self):\n loaded = load(self.__file_name)\n self.__model = loaded['model']\n se...
[ "0.62773275", "0.5929779", "0.58147556", "0.57882833", "0.57533455", "0.5680287", "0.5619402", "0.558293", "0.557524", "0.5558272", "0.55419886", "0.5456396", "0.5431608", "0.5423141", "0.54016536", "0.5373685", "0.534725", "0.53354573", "0.53228474", "0.5286284", "0.5259679"...
0.5673607
6
Loads a policy from the storage (see parent class for full docstring).
def load( cls, config: Dict[Text, Any], model_storage: ModelStorage, resource: Resource, execution_context: ExecutionContext, **kwargs: Any, ) -> TEDPolicy: try: with model_storage.read_from(resource) as model_path: return cls._load...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_policy(self, policy_path, tracker):\r\n if not os.path.exists(policy_path):\r\n return {}\r\n try:\r\n with open(policy_path) as f:\r\n return json.load(f)\r\n except (IOError, ValueError) as err:\r\n msg = \"ERROR: loading course policy...
[ "0.7527114", "0.6853302", "0.6738557", "0.67252105", "0.62512743", "0.6236352", "0.6154913", "0.61448526", "0.61282647", "0.6120836", "0.6100583", "0.60317343", "0.5986494", "0.5941951", "0.59372", "0.5917416", "0.5890665", "0.5828857", "0.57957846", "0.57303697", "0.572185",...
0.66870177
4
Initializes the TED model.
def __init__( self, data_signature: Dict[Text, Dict[Text, List[FeatureSignature]]], config: Dict[Text, Any], max_history_featurizer_is_used: bool, label_data: RasaModelData, entity_tag_specs: Optional[List[EntityTagSpec]], ) -> None: super().__init__("TED", co...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self) -> None:\n\n self.config = TbSETConfig()\n self.session = PromptSession()\n self.commands = WordCompleter([\n \"train\",\n \"translate\"\n ])\n\n # Check if saved model is present for inference\n saved_path = self.config.TRN_HYPERP[...
[ "0.65957266", "0.6435193", "0.643313", "0.6430804", "0.6410668", "0.6336052", "0.6318363", "0.6273956", "0.62168884", "0.61311847", "0.6127738", "0.6045974", "0.60284543", "0.6025553", "0.6006997", "0.60063857", "0.6005734", "0.598878", "0.5986645", "0.59816444", "0.5979635",...
0.0
-1
Prepares feature processing layers for sentence/sequencelevel features. Distinguishes between label features and other features, not applying input dropout to the label ones.
def _prepare_input_layers( self, attribute_name: Text, attribute_signature: Dict[Text, List[FeatureSignature]], is_label_attribute: bool = False, ) -> None: # Disable input dropout in the config to be used if this is a label attribute. if is_label_attribute: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _preprocess(self, features, labels):\n with tf.variable_scope('preprocess'):\n with tf.variable_scope('image'):\n features['image_orig'] = features['image']\n image = tf.image.convert_image_dtype(features['image_orig'],\n dtype=tf.float32)\n ...
[ "0.69295466", "0.6483784", "0.63460076", "0.6109631", "0.60992074", "0.60830235", "0.6049522", "0.60157263", "0.59498656", "0.5916046", "0.58773404", "0.5860252", "0.58540595", "0.57909906", "0.5782207", "0.5763886", "0.5735246", "0.57137746", "0.5677478", "0.5673067", "0.564...
0.65997046
1
Create Ffnn encoding layer used just before combining all dialogue features.
def _prepare_encoding_layers(self, name: Text) -> None: # create encoding layers only for the features which should be encoded; if name not in SENTENCE_FEATURES_TO_ENCODE + LABEL_FEATURES_TO_ENCODE: return # check that there are SENTENCE features for the attribute name in data ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ResNet18_FPN():\n return FPN(BasicBlock, [2, 2, 2, 2])", "def stack_fc_layers(self, embedding):\n for hid_layer_index, hid_width in enumerate(self.hps.hid_widths, start=1):\n hid_layer_id = \"fc{}\".format(hid_layer_index)\n # Add hidden layer\n embedding = snt.Line...
[ "0.59051806", "0.5812008", "0.5646092", "0.55884403", "0.5407039", "0.5347434", "0.5329573", "0.5308371", "0.52979565", "0.5262869", "0.5208671", "0.5203288", "0.518843", "0.5165848", "0.5163469", "0.51527315", "0.5120998", "0.51082456", "0.5084984", "0.50726366", "0.50719935...
0.60444176
0
Creates dialogue level embedding and mask.
def _embed_dialogue( self, dialogue_in: tf.Tensor, tf_batch_data: Dict[Text, Dict[Text, List[tf.Tensor]]], ) -> Tuple[tf.Tensor, tf.Tensor, tf.Tensor, Optional[tf.Tensor]]: dialogue_lengths = tf.cast(tf_batch_data[DIALOGUE][LENGTH][0], tf.int32) mask = rasa_layers.compute_mas...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_level_3() -> object:\n #create level object\n level = Level()\n\n #create vertical walls for level\n create_and_add_vertical_walls_to_list(4, settings.HEIGHT, 4, level.wall_list)\n create_and_add_vertical_walls_to_list(0, 4, 23, level.wall_list)\n create_and_add_vertical_walls_to_list(0...
[ "0.5517969", "0.5366459", "0.51758546", "0.51389164", "0.51388985", "0.51237273", "0.5083113", "0.50532836", "0.50501406", "0.50461537", "0.5015259", "0.49981084", "0.4954645", "0.49205762", "0.49074012", "0.48939097", "0.48932412", "0.4892486", "0.48798233", "0.48640698", "0...
0.4589937
61
Returns dummy outputs for fake features of a given attribute. Needs to match the outputs of `_encode_real_features_per_attribute` in shape but these outputs will be filled with zeros.
def _encode_fake_features_per_attribute( self, tf_batch_data: Dict[Text, Dict[Text, List[tf.Tensor]]], attribute: Text ) -> Tuple[tf.Tensor, tf.Tensor, tf.Tensor]: # we need to create real zero tensors with appropriate batch and dialogue dim # because they are passed to dialogue transformer ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _encode_real_features_per_attribute(\n self, tf_batch_data: Dict[Text, Dict[Text, List[tf.Tensor]]], attribute: Text\n ) -> Tuple[tf.Tensor, tf.Tensor, tf.Tensor]:\n # simulate None with empty tensor of zeros\n text_output = tf.zeros((0,))\n text_sequence_lengths = tf.zeros((0,))...
[ "0.587372", "0.5797445", "0.576873", "0.5565397", "0.5370014", "0.53538173", "0.5337671", "0.5238035", "0.52018607", "0.52018607", "0.5196231", "0.51418465", "0.5113956", "0.5092495", "0.50854206", "0.50819504", "0.5080352", "0.50598264", "0.50205827", "0.50076437", "0.499448...
0.65818167
0
Encodes features for a given attribute.
def _encode_real_features_per_attribute( self, tf_batch_data: Dict[Text, Dict[Text, List[tf.Tensor]]], attribute: Text ) -> Tuple[tf.Tensor, tf.Tensor, tf.Tensor]: # simulate None with empty tensor of zeros text_output = tf.zeros((0,)) text_sequence_lengths = tf.zeros((0,)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _encode_fake_features_per_attribute(\n self, tf_batch_data: Dict[Text, Dict[Text, List[tf.Tensor]]], attribute: Text\n ) -> Tuple[tf.Tensor, tf.Tensor, tf.Tensor]:\n # we need to create real zero tensors with appropriate batch and dialogue dim\n # because they are passed to dialogue tra...
[ "0.600946", "0.5869573", "0.57661927", "0.5674518", "0.55876416", "0.55306697", "0.5516972", "0.5468131", "0.53927004", "0.5384611", "0.53662974", "0.5352", "0.53481185", "0.5295472", "0.52805203", "0.52525", "0.5242336", "0.52219915", "0.521495", "0.5211165", "0.5211165", ...
0.5803029
2
Transform attribute features back to original shape.
def _convert_to_original_shape( attribute_features: tf.Tensor, tf_batch_data: Dict[Text, Dict[Text, List[tf.Tensor]]], attribute: Text, ) -> tf.Tensor: # in order to convert the attribute features with shape # (combined batch-size and dialogue length x 1 x units) # to...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _scale_features(self, features):\n assert isinstance(features, np.ndarray), \"Input is not a numpy array!\"\n\n return self.scaler.transform(features.reshape(1, -1))", "def transform(self, data, attr):\n data['point'] = torch.from_numpy(data['point'])\n data['feat'] = torch.from_n...
[ "0.6315303", "0.6261348", "0.61837447", "0.6082442", "0.6080309", "0.5897296", "0.5893695", "0.5841158", "0.5838216", "0.58333164", "0.5826695", "0.58231807", "0.57957655", "0.5775941", "0.57753253", "0.57684076", "0.5755802", "0.5755802", "0.5737896", "0.57243645", "0.572091...
0.64016074
0