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
Remove chain if zero var.
def RemoveZeroVar(chain): return chain[:, np.invert((np.sum(np.var(chain, axis=0), axis=1)<1e-10)), :]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def RemoveZeroVar(chain):\n\treturn chain[:, np.invert((np.sum(np.var(chain, axis=0), axis=1)<1e-10)), :]", "def remove_causal_chain_from_local_Q(self, trial_name, chain_idx):\n for state in range(self.local_Q[trial_name].shape[0]):\n self.local_Q[trial_name][state][chain_idx] = 0", "def remo...
[ "0.75237256", "0.65207744", "0.61948866", "0.5943889", "0.5856726", "0.579234", "0.55565387", "0.55563855", "0.5513278", "0.5393509", "0.53831285", "0.5355641", "0.53278524", "0.52536255", "0.52277136", "0.5119385", "0.5117619", "0.50989103", "0.50953203", "0.50734174", "0.50...
0.72741723
1
>>> soup = BeautifulSoup(open("../../data/share/posts/1009.html").read()) >>> ifValidSERP(soup) True >>> soup2 = BeautifulSoup(open("../../data/share/posts/2406.html").read()) >>> ifValidSERP(soup2) False
def ifValidSERP(soupObject): return soupObject.find("p", class_="noresult_tit") is None and soupObject.title is not None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_format_wrong(soup):\n a = soup.find('a')\n if a.has_attr('faire'):\n return True\n return False", "def broken_page(soup):\n ps = soup.find_all(\"p\")\n ps = map(lambda x: x.text, ps)\n unexpected_error = True in map(lambda x: \"unexpected error\" in x, ps)\n \n no_grades = s...
[ "0.6150946", "0.6123322", "0.57974476", "0.56922346", "0.5682742", "0.5637584", "0.5608051", "0.55979985", "0.5595201", "0.55802923", "0.55608934", "0.5534084", "0.55069125", "0.54980284", "0.54980284", "0.54980284", "0.54980284", "0.54954755", "0.5489522", "0.5457203", "0.54...
0.67786336
0
Which queue to execute in
def queue_name(is_parallel): return QUEUE_NAMES[int(bool(is_parallel))]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def curr_queue(self):\n pass", "def get_queue(self):\n if self.queue is not None:\n return self.queue\n state = self.get_state()\n self.queue = state.get_queue()\n # print(\"IQ\", self.queue)\n return self.queue", "def _get_queue(self):\n return self.__qu...
[ "0.77458423", "0.73086584", "0.729819", "0.729819", "0.729819", "0.729819", "0.729819", "0.729819", "0.729819", "0.729819", "0.729819", "0.729819", "0.729819", "0.729819", "0.729819", "0.729819", "0.729819", "0.71492094", "0.71492094", "0.69831365", "0.69831365", "0.6983136...
0.62823564
59
Call simulation's in run_background with run_dir
def start_simulation(cmd, run_dir): # Avoid circular import from sirepo import simulation_db run_dir = py.path.local(run_dir) simulation_db.hack_nfs_write_status('running', run_dir) with pkio.save_chdir(run_dir): pksubprocess.check_call_with_signals( cmd, msg=pkdlog, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_simulation(run):\n # Write the argument file used by metrosim.\n simulation = run.simulation\n metrosim_dir = settings.BASE_DIR + '/metrosim_files/'\n metrosim_file = '{0}execs/metrosim'.format(metrosim_dir)\n arg_file = (\n '{0}arg_files/simulation_{1!s}_run_{2!s}.txt'.format(metrosi...
[ "0.6785062", "0.6433013", "0.636961", "0.6257974", "0.62099516", "0.6203374", "0.61503863", "0.6149338", "0.61456555", "0.6127702", "0.6124985", "0.60598016", "0.60587966", "0.60583586", "0.59858763", "0.59568614", "0.5947441", "0.59464675", "0.5935185", "0.59265864", "0.5924...
0.6317826
3
Returns number of books read
def get_books_read(self): return len(self.books)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count(self):\n return Library.functions.count(self._book)", "def book_count(self):\n\n try:\n cur = self._db.cursor()\n cur.execute('SELECT COUNT(*) FROM books')\n return cur.fetchone()[0]\n except sqlite3.Error as e:\n ...
[ "0.7992762", "0.7731883", "0.7612036", "0.6803979", "0.6539564", "0.65282", "0.6519381", "0.6475682", "0.6453176", "0.6382742", "0.6382742", "0.6382742", "0.6382742", "0.6376332", "0.6367946", "0.6364944", "0.6364356", "0.63492286", "0.6307586", "0.63016653", "0.62689745", ...
0.8106499
0
Add read book to dict
def read_book(self, book, rating=None): if isinstance(book, Book): self.books.update({book: rating}) else: print("{book} does not appear to be a Book object.".format(book=book))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_book(name, author):\n BOOKS.append({'name': name, 'author': author, 'read': False})", "def addBook(self, book):\n self._books[book.getTitle()] = book", "def get_book_details(book_id, key):\n\n # call goodreads search method with book id here\n payload = {\"key\": key}\n\n query = req...
[ "0.70027494", "0.6613055", "0.61070997", "0.5929484", "0.5909699", "0.58513135", "0.58490425", "0.5800447", "0.57466835", "0.5695358", "0.5646428", "0.5639521", "0.5612244", "0.55981535", "0.5580011", "0.55505365", "0.5531264", "0.550869", "0.54914147", "0.5406447", "0.536724...
0.63098526
2
Calculate and return average rating
def get_average_rating(self): count = 0 total = 0 num_books = len(self.books) if num_books > 0: for rating in self.books.values(): if rating: count += 1 total += rating average = total / count if coun...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def average_rating(self):\n return ( self.rating_1 + self.rating_2 + self.rating_3) / 3", "def average_rating(self):\n ratings = AttractionRating.objects.filter(attraction=self)\n total_rating = 0\n for rating in ratings:\n total_rating += rating.rating\n\n # If ther...
[ "0.8740609", "0.8564026", "0.8496057", "0.84087116", "0.831127", "0.8271486", "0.8252964", "0.81941754", "0.7935517", "0.7797809", "0.7769728", "0.7713802", "0.76922464", "0.76497185", "0.75058794", "0.74698275", "0.74556196", "0.739389", "0.73206496", "0.7304481", "0.7226037...
0.7991875
8
Returns name, email, read count, and average rating
def __repr__(self): count=0 for item in self.books.keys(): count += 1 return "User {name} with email address {email} has read {count} book(s) with an average rating of {rating}".format(name=self.name, email=self.email, count=count, rating=self.get_average_rating())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_average_rating(self):\n count = 0\n total = 0\n num_books = len(self.books)\n if num_books > 0:\n for rating in self.books.values():\n if rating:\n count += 1\n total += rating\n average = total / count\n...
[ "0.67255265", "0.6498956", "0.6255957", "0.6089639", "0.6080379", "0.6029295", "0.6007349", "0.5960972", "0.5883649", "0.584985", "0.5846773", "0.58460647", "0.5828495", "0.5820474", "0.57930464", "0.5786282", "0.57826287", "0.57763314", "0.5750481", "0.5746483", "0.57452625"...
0.60270447
6
Is one of these items not like the other?
def __eq__(self, other_user): if isinstance(other_user, User): return self.name == other_user.name and self.email == other_user.get_email() else: other_user_type = type(other_user) print("{other_user} is not a User object, it is of type: {type}".format(other_user=othe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def monkey_trouble(a_smile, b_smile):\r\n return a_smile == b_smile", "def got_both(self):\r\n if Item.A in self.items and Item.B in self.items:\r\n return True", "def monkey_trouble(a_smile, b_smile):\n if (a_smile and b_smile) or (not(a_smile) and not(b_smile)):\n return True\n...
[ "0.6570952", "0.6535601", "0.6506679", "0.6503425", "0.6453794", "0.6407242", "0.63862014", "0.63140756", "0.62963206", "0.62380195", "0.62060326", "0.6189615", "0.6150055", "0.6142019", "0.610952", "0.6098643", "0.60957783", "0.6089502", "0.6085284", "0.60772216", "0.6075057...
0.0
-1
Book Parent Class constructor
def __init__(self, title, isbn): self.title = title self.isbn = isbn self.ratings = []
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n\n\t\tsuper().__init__(child_class = self.Book)", "def __init__(self, name, isbn, author, tags=None):\n super().__init__(name, isbn, tags)\n self.author = author\n self.resource_type = \"Book\"", "def __init__(self, bookAuthor, ISBN, numPurchased, bookTitle, numChecked...
[ "0.8750904", "0.7605091", "0.6969576", "0.6868256", "0.6854031", "0.67320985", "0.67320985", "0.67320985", "0.6729849", "0.6729849", "0.66908675", "0.6662483", "0.65881366", "0.65264964", "0.64747626", "0.64687496", "0.6450625", "0.6415018", "0.63792264", "0.63792264", "0.637...
0.6014829
89
Adds a rating if it meets criteria
def add_rating(self, rating): if not rating or rating < 0 or rating > 4: return "Rating {rating} is not valid. Valid ratings are between 0 and 4".format(rating=rating) else: self.ratings.append(rating)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_rating(self, rating):\n if rating >= 0 and rating <= 4:\n self.ratings.append(rating)\n else:\n print(\"Invalid Rating\")", "def add_rating(user, item, rating):\n users.append(user)\n items.append(item)\n ratings.append(rating)", "def add_rating(self):\n ...
[ "0.78625226", "0.63722396", "0.6271171", "0.60921353", "0.6090529", "0.6087433", "0.6034467", "0.5894537", "0.58583003", "0.58511144", "0.5834168", "0.580135", "0.5800364", "0.57674557", "0.57537365", "0.57537365", "0.5751292", "0.57333684", "0.5727925", "0.5715088", "0.57114...
0.7357697
1
Returns average rating or prints none available
def get_average_rating(self): count = 0 total = 0 ratings_length = len(self.ratings) if ratings_length > 0: for rating in self.ratings: count += 1 total += rating average = total / count return average else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_average_rating(self):\n count = 0\n total = 0\n num_books = len(self.books)\n if num_books > 0:\n for rating in self.books.values():\n if rating:\n count += 1\n total += rating\n average = total / count\n...
[ "0.78994644", "0.77764827", "0.76753175", "0.76248264", "0.75925076", "0.75614244", "0.748261", "0.7427136", "0.71799606", "0.717904", "0.71507555", "0.7121672", "0.6946089", "0.6856904", "0.68340194", "0.6830731", "0.67425144", "0.67189294", "0.66959345", "0.668871", "0.6650...
0.8252819
0
Is one of these items not like the other?
def __eq__(self): if isinstance(other_book, Book): return self.title == other_book.title and self.isbn == other_book.isbn else: book_type=type(other_book) print("{other_book} is of type: {type}, and should be a User type".format(other_book=other_book, type=book_type))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def monkey_trouble(a_smile, b_smile):\r\n return a_smile == b_smile", "def got_both(self):\r\n if Item.A in self.items and Item.B in self.items:\r\n return True", "def monkey_trouble(a_smile, b_smile):\n if (a_smile and b_smile) or (not(a_smile) and not(b_smile)):\n return True\n...
[ "0.6570952", "0.6535601", "0.6506679", "0.6503425", "0.6453794", "0.6407242", "0.63862014", "0.63140756", "0.62963206", "0.62380195", "0.62060326", "0.6189615", "0.6150055", "0.6142019", "0.610952", "0.6098643", "0.60957783", "0.6089502", "0.6085284", "0.60772216", "0.6075057...
0.0
-1
Returns hash of book
def __hash__(self): return hash((self.title, self.isbn))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hash(self) -> bytes:", "def hash(self) -> str:\r\n ...", "def get_hash(self):\r\n return", "def hash(self) -> str:\n return pulumi.get(self, \"hash\")", "def get_hash(self):\n source = \"\"\n for cell in self.original_cells:\n source += \"\\n\".join(get_sou...
[ "0.72355944", "0.7082014", "0.7071481", "0.7000493", "0.6883297", "0.6867283", "0.67737263", "0.67702335", "0.67687285", "0.6761425", "0.67514795", "0.6711301", "0.66213644", "0.66213644", "0.6589381", "0.65639246", "0.6561698", "0.65491515", "0.6539704", "0.65378046", "0.651...
0.7334127
0
Returns a book instance
def create_book(self, title, isbn): isbn_list = [book.get_isbn() for book in self.books.keys()] if isbn in isbn_list: print("ISBN {isbn} already exists. Please provide a unique ISBN.".format(isbn=isbn)) else: return Book(title, isbn)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_book():\n soup = Soup(CONTENT)\n dotd = soup.find(id='deal-of-the-day')\n image_base = dotd.find(class_='dotd-main-book-image')\n title_base = dotd.find(class_='dotd-title')\n\n title = title_base.find('h2').text.strip()\n description = title_base.parent.find_all('div')[2].text.strip()\n ...
[ "0.74620706", "0.7454659", "0.7390694", "0.73847526", "0.730507", "0.7147083", "0.6957809", "0.67317843", "0.67173606", "0.66938126", "0.66826653", "0.66736996", "0.6550934", "0.6543831", "0.6543831", "0.6543831", "0.64776856", "0.6468723", "0.6286811", "0.6248327", "0.618378...
0.62817115
19
Returns Fiction Book instance
def create_novel(self, title, author, isbn): isbn_list = [book.get_isbn() for book in self.books.keys()] if isbn in isbn_list: print("ISBN {isbn} already exists. Please provide a unique ISBN.".format(isbn=isbn)) else: return Fiction(title, author, isbn)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_book():\n soup = Soup(CONTENT)\n dotd = soup.find(id='deal-of-the-day')\n image_base = dotd.find(class_='dotd-main-book-image')\n title_base = dotd.find(class_='dotd-title')\n\n title = title_base.find('h2').text.strip()\n description = title_base.parent.find_all('div')[2].text.strip()\n ...
[ "0.6196444", "0.6091821", "0.60510933", "0.60232943", "0.59225523", "0.58122814", "0.58122814", "0.5743209", "0.5696704", "0.56678516", "0.56678516", "0.56678516", "0.56304383", "0.552855", "0.5503822", "0.54369086", "0.5419088", "0.53848004", "0.5366238", "0.53569156", "0.53...
0.54304785
16
Adds book and rating if exists
def add_book_to_user(self, book, email, rating=None): if self.users.get(email): self.users[email].read_book(book, rating) self.books[book] = self.books.get(book, 0) + 1 if rating: book.add_rating(rating) else: print("{email} address not fou...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_book(self, data):\n exists = self.check_if_exists(data['isbn'])\n\n if exists:\n query = f\"\"\"UPDATE {TABLE} SET quantity = quantity + 10 WHERE bookID = '{data[\"isbn\"]}'\"\"\"\n else:\n query = f\"\"\"INSERT INTO {TABLE}(bookID, title, authors, avg_rating, rat...
[ "0.6787978", "0.6579681", "0.6568055", "0.6551944", "0.6508678", "0.6425218", "0.6392102", "0.6381456", "0.61407083", "0.61249", "0.6027362", "0.59443843", "0.59425426", "0.59305996", "0.58900917", "0.584182", "0.5823926", "0.5782583", "0.57586634", "0.57273984", "0.57060885"...
0.67295533
1
Prints books in dictionary
def print_catalog(self): for book in self.books.keys(): print(book)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display_book(self):\r\n print(\"Available Books are:\")\r\n for item in self.books:\r\n print(f\"{self.books.index(item)+1}. {item}\")", "def display_book(self):\n print(\"List of books available is: \")\n for book in books_list :\n print(\"- \",book)", "de...
[ "0.7210097", "0.70254695", "0.6883923", "0.6709422", "0.6676588", "0.66465443", "0.65207547", "0.65199316", "0.64732736", "0.63754284", "0.62558043", "0.6226128", "0.6200351", "0.61736345", "0.6163209", "0.61529285", "0.61524075", "0.608258", "0.60664874", "0.59934986", "0.59...
0.79404205
1
Prints users in dictionary
def print_users(self): for user in self.users.values(): print(user)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_users(self):\n for i, item in enumerate(self.users):\n print(\"{}. {}\".format(i, item.name))", "def users_view():\n data = get_data()\n return [{'user_id': i, 'name': 'User {0}'.format(str(i))}\n for i in data.keys()]", "def display_users():\n users = storage.al...
[ "0.765939", "0.72263163", "0.70733106", "0.6875003", "0.6696791", "0.66603804", "0.6646293", "0.6608518", "0.6589131", "0.65826404", "0.65524274", "0.6548652", "0.6523387", "0.6450315", "0.6441693", "0.6434259", "0.64076483", "0.63903874", "0.6368943", "0.63630533", "0.635990...
0.8323811
0
Returns most read book
def most_read_book(self): reading_max = 0 most_reads = "" for book in self.books.keys(): rating = book.get_average_rating() if rating > reading_max: most_reads = book reading_max = rating else: continue r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def highest_rated_book(self):\n rating_max = 0\n best_rated_book = \"\"\n for book in self.books.keys():\n rating = book.get_average_rating()\n if rating > rating_max:\n rating_max = rating\n best_rated_book = book\n else:\n ...
[ "0.7724168", "0.7483818", "0.71411234", "0.6562405", "0.63577133", "0.62896013", "0.62841135", "0.6251964", "0.62414163", "0.6132677", "0.6107795", "0.6106943", "0.6083038", "0.607377", "0.60098064", "0.6000276", "0.5960912", "0.59562415", "0.59394085", "0.5935878", "0.592481...
0.8725137
0
Returns highest rated book
def highest_rated_book(self): rating_max = 0 best_rated_book = "" for book in self.books.keys(): rating = book.get_average_rating() if rating > rating_max: rating_max = rating best_rated_book = book else: continu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def highest_rated_book(self):\n highest_rated = 0.0\n top_rated_book = \"\"\n\n for book in self.books.keys():\n book_rating = book.get_average_rating()\n if book_rating > highest_rated:\n highest_rated = book_rating\n top_rated_book = book.t...
[ "0.83557385", "0.7634373", "0.64668053", "0.646497", "0.64457583", "0.6311305", "0.62297416", "0.6174505", "0.6174505", "0.60736984", "0.6066756", "0.6059369", "0.6034711", "0.6018782", "0.6013541", "0.59976643", "0.5940475", "0.59375906", "0.5909446", "0.5899124", "0.5861581...
0.8604043
0
Returns user with highest average rating
def most_positive_user(self): rating_max = 0 rating_max_user = "" for user in self.users.values(): rating = user.get_average_rating() if rating > rating_max: rating_max = rating rating_max_user = user else: conti...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_average_rating(self):\n count = 0\n total = 0\n num_books = len(self.books)\n if num_books > 0:\n for rating in self.books.values():\n if rating:\n count += 1\n total += rating\n average = total / count\n...
[ "0.70983166", "0.6912731", "0.68344504", "0.6794513", "0.67550117", "0.6752274", "0.6622795", "0.6618791", "0.657425", "0.655887", "0.6550182", "0.65312135", "0.6514526", "0.65007603", "0.64462924", "0.64313", "0.6414315", "0.6395596", "0.638889", "0.6372267", "0.63228005", ...
0.7960793
0
Returns the number of most read books
def get_n_most_read_books(self, n): if type(n) != int: print("The argument n = {n} is not an integer. Try again with an integer".format(n=n)) else: sorted_books = [ book for book in sorted(self.books, key=self.books.get, reverse=True)] return sorted_books
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def most_read_book(self):\n reading_max = 0\n most_reads = \"\"\n for book in self.books.keys():\n rating = book.get_average_rating()\n if rating > reading_max:\n most_reads = book\n reading_max = rating\n else:\n co...
[ "0.8219369", "0.71462387", "0.66454923", "0.6578928", "0.65045106", "0.64410865", "0.6415552", "0.63523734", "0.63387", "0.63387", "0.62491214", "0.6203123", "0.61888176", "0.6156324", "0.6140114", "0.6134548", "0.6096439", "0.60852206", "0.60635096", "0.6039976", "0.6030021"...
0.7380969
1
Sends a message to each recipient in recipient list.
def send_email(subject, message, recipient_list, from_email=None, fail_silently=False, connection=None): if not from_email: from_email = _s('SERVER_EMAIL') or _s('DEFAULT_FROM_EMAIL') try: subj = unicode(subject) except UnicodeDecodeError: subj = subject.decode('utf8')...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_mass_messages(self, recipient_list, sender, message=\"\", subject=\"\"):\n try:\n for s in recipient_list:\n self.send_message(to=s, sender=sender, message=message, subject=subject)\n except TypeError:\n return -1\n return 1", "def send_to_all(se...
[ "0.7732485", "0.6727123", "0.6595336", "0.65631413", "0.65069544", "0.6475225", "0.631243", "0.63047963", "0.62675667", "0.62623197", "0.62423515", "0.6212081", "0.6170951", "0.61361974", "0.6125608", "0.6124741", "0.61145", "0.6103919", "0.6092619", "0.60910547", "0.6080257"...
0.59426886
34
Send debug email to admins.
def send_debug_email(subject, message): if not subject: site = get_current_site() subj = _s('DEBUG_MSG_SUBJECT') or _msg('subject_debug_msg') subject = '%s: %s' % (site.name, subj) mail_admins(subject, message, fail_silently=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def email_admins(subject, message):\n mail_admins(subject, message=message)", "def mail_admins(subject, message, fail_silently=False):\n _mail_group(settings.ADMINS, subject, message, fail_silently)", "def sendadminlog( override=0 ):\n\n global admin_notify_time\n global adminlog\n\n if override...
[ "0.700624", "0.69679296", "0.66619134", "0.66101164", "0.6536322", "0.6381845", "0.6261297", "0.62524307", "0.6221707", "0.6198986", "0.6173385", "0.6040536", "0.6029444", "0.5963833", "0.58713526", "0.58485705", "0.5809431", "0.5787586", "0.5785166", "0.5740776", "0.5717475"...
0.71638185
0
Send emails to a group.
def send_email_to_group(group, subject, message, fail_silently=False): if isinstance(group, basestring): members = get_users_in_group(group) recipients = [user.email for user in members if user.email] elif isinstance(group, (list, tuple)): recipients = group try: assert recip...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _mail_group(group, subject, message, fail_silently=False):\n if group:\n mail.send_mail(settings.EMAIL_SUBJECT_PREFIX + subject, message,\n settings.SERVER_EMAIL, [a[1] for a in group],\n fail_silently)\n return\n # If the group had no recipients defined,...
[ "0.80707854", "0.6781871", "0.65694135", "0.63916755", "0.63060516", "0.6281303", "0.62803423", "0.62803423", "0.62693524", "0.6259856", "0.6252528", "0.62140393", "0.6206107", "0.618567", "0.6172113", "0.61584634", "0.6157868", "0.6145838", "0.61180377", "0.6111764", "0.6086...
0.72258323
1
Send email with text and html versions.
def send_html_email(subject, recipient_list, template, context, from_email=None, text_content=None): if not from_email: from_email = _s('SERVER_EMAIL') or _s('DEFAULT_FROM_EMAIL') try: subj = unic...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_email(subject, sender, recipients, text_body, html_body):\n msg = Message(subject=subject, sender=sender, recipients=recipients)\n msg.body = text_body\n msg.html = html_body\n mail.send(msg)", "def send_email(subject, sender, recipients, text_body, html_body):\n\t\tmsg = Message(subject, se...
[ "0.8020456", "0.8002626", "0.75018513", "0.7394364", "0.73103356", "0.72513235", "0.72427714", "0.7189764", "0.70869297", "0.7059591", "0.6988997", "0.6967605", "0.6927166", "0.68253386", "0.67581195", "0.6730767", "0.6715298", "0.6687154", "0.6687154", "0.66812897", "0.66779...
0.70089954
10
Private helper to convert results in dict format to CSV file.
def __save_aggregate_scores(self): results = pd.DataFrame( columns=self.results[list(self.results.keys())[0]], index=self.results.keys(), ) for row_name, time_bins in self.results.items(): for column_name, value in time_bins.items(): results.lo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_results(results):\n fields = results[0].keys()\n with open('results.csv', 'w') as f:\n dw = csv.DictWriter(f, fieldnames=fields, delimiter='|')\n dw.writer.writerow(list(dw.fieldnames))\n dw.writerows(results)", "def dict_to_csv(filename, dictionary, paramdict=True):\n if ...
[ "0.7583564", "0.6895519", "0.68203294", "0.68120426", "0.67319053", "0.66475886", "0.6629474", "0.66274077", "0.6614341", "0.6597433", "0.6587587", "0.6584862", "0.65786135", "0.6501687", "0.6476363", "0.6458015", "0.6393849", "0.63806397", "0.6377519", "0.6320072", "0.631364...
0.0
-1
Private helper to aggregate SHAP values into bins of related features.
def __calculate_agg_shap_scores(self): self.agg_stats_timer = SimbaTimer(start=True) for clf_state, clf_state_name in zip(range(2), ["ABSENT", "PRESENT"]): self.results = {} self.df_save_path = os.path.join( self.shap_logs_path, "SHAP_summary_{}_{}...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transform_bins(self, X):\n binner = self.binner_\n if hasattr(binner, \"tree_\"):\n dec_path = self.binner_.decision_path(X)\n association = numpy.zeros((X.shape[0],))\n association[:] = -1\n for j in self.leaves_:\n ind = dec_path[:, j] ...
[ "0.536685", "0.53028756", "0.5297548", "0.52773046", "0.527647", "0.52717435", "0.52448034", "0.5239028", "0.52265066", "0.51943", "0.5178747", "0.51728415", "0.516949", "0.5167684", "0.51604414", "0.5151585", "0.5139538", "0.51359856", "0.5125312", "0.5120589", "0.51111573",...
0.62239313
0
Private helper to create the base (axes, icons ticks etc) of the aggregate shap value visualization.
def __create_base_shap_img(self): self.img = 255 * np.ones([1680, 1680, 3], dtype=np.uint8) self.baseline_scale_img = cv2.imread(self.scale_img_dict["baseline_scale"]) self.baseline_scale_top_left = (100, 800) baseline_scale_bottom_right = ( self.baseline_scale_top_left[0] +...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _handle_axes(self, drawable, option):\n # If we already have an axes object, ignore this one\n if self._axes_object is not None:\n return\n\n # Grab the histogram used for axes style/range manipulation\n if is_stack(drawable) or is_graph(drawable):\n axes_histo...
[ "0.60737693", "0.5814595", "0.56521565", "0.562601", "0.557705", "0.5575706", "0.5516756", "0.54805434", "0.5476639", "0.543038", "0.54277986", "0.5423361", "0.5419598", "0.53922915", "0.5385813", "0.5385489", "0.5379207", "0.5366411", "0.53519034", "0.5343925", "0.5336223", ...
0.57938874
2
Private helper to insert the data (i.e., colored arrows, text etc.) into the aggregate shap value visualization and save the results.
def __insert_data_in_img(self): data_df = pd.read_csv( os.path.join( self.shap_logs_path, "SHAP_summary_{}_{}_{}.csv".format( self.classifier_name, "PRESENT", self.datetime ), ), index_col=0, ) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def processData(self):\n recordSet = AresChartsService.toMultiSeries(self.vals, self.chartKeys, self.selectedX , self.chartVals, extKeys=self.extKeys)\n self.aresObj.jsGlobal.add(\"data_%s = %s\" % (self.htmlId, json.dumps(recordSet)))", "def visualise(self):\n\n scores, education = self.get_data()\...
[ "0.56197286", "0.55523324", "0.55266005", "0.5514512", "0.548664", "0.54803073", "0.54062796", "0.5351485", "0.5340591", "0.5303771", "0.5253525", "0.52418655", "0.52133983", "0.5205377", "0.5180938", "0.51616275", "0.51548773", "0.5126836", "0.5116849", "0.5104162", "0.50907...
0.6141829
0
Randomized n questions from the test set and evaluates each of them
def evaluate(encoder, decoder, input_tokenizer, output_tokenizer, test_pairs, max_len, n=None, verbose=False): y_true = [] y_pred = [] if n is not None: data = [random.choice(test_pairs) for i in range(n)] else: data = test_pairs for question, equation in data: y_true.appen...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gen_questions(self, number_of_questions):", "def evaluate_questions(self):\n for question in self.question_list:\n question.evaluate_question()", "def q_v_random(n=1000):\n for i in range(5):\n p1_strategy = strategies.QStrategy('X')\n p2_strategy = strategies.RandomStrat...
[ "0.722723", "0.6895135", "0.67801404", "0.6731325", "0.6563463", "0.64386594", "0.63654375", "0.6347008", "0.6347008", "0.6347008", "0.6347008", "0.6344698", "0.6344698", "0.6344698", "0.63365906", "0.6287557", "0.62312144", "0.6226248", "0.62173843", "0.62171423", "0.6210546...
0.5719189
53
Given a sample question, evaluates it and plot the attention of each parts
def evaluate_and_show_attention(approach, encoder, decoder, input_tokenizer, output_tokenizer, max_len, input_sentence): output_words, attentions = evaluate_sample(encoder, decoder, input_tokenizer, output_tokenizer, input_sentence, max_len) print('input =', input_sentence) print('output =', ' '.join(output...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_attention( img, result, attention_plot,fn='plot_att.png'):\n # denormalize\n img[0] = img[0] * 0.229\n img[1] = img[1] * 0.224\n img[2] = img[2] * 0.225\n img[0] += 0.485\n img[1] += 0.456\n img[2] += 0.456\n\n image = img.cpu().numpy().transpose((1,...
[ "0.6325219", "0.59655464", "0.57061", "0.5688024", "0.5606901", "0.5603356", "0.5569556", "0.5539447", "0.5482672", "0.5480325", "0.5478518", "0.54607755", "0.54607034", "0.54592013", "0.54525006", "0.54242206", "0.5423777", "0.5415969", "0.54118747", "0.5401263", "0.53908634...
0.56990063
3
Extract features from a sentence represented as a list of words. Includes a flag add_to_indexer to
def extract_features(self, ex_words: List[str], add_to_indexer: bool) -> List[int]: raise Exception("Don't call me, call my subclasses")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_features(self, ex_words: List[str], add_to_indexer: bool=False) -> List[int]:\n raise Exception(\"Don't call me, call my subclasses\")", "def _sentence_to_features(self,sentence):\n\n configured_features = self.configFeatures\n sentence_features = []\n\n for word_idx in ra...
[ "0.73790205", "0.70586795", "0.6696932", "0.66269016", "0.66092473", "0.6585194", "0.65552074", "0.65417784", "0.65111244", "0.64883614", "0.64856535", "0.647473", "0.64737093", "0.6448127", "0.64132744", "0.63529783", "0.631795", "0.63178784", "0.62807816", "0.62771124", "0....
0.739767
0
Train a classifier with the perceptron.
def train_perceptron(train_exs: List[SentimentExample], feat_extractor: FeatureExtractor) -> PerceptronClassifier: raise Exception("Must be implemented")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train(self):\n sys.stderr.write(\"Training Multi-layer Perceptron classifier...\")\n self.clf.fit(self.m_features,self.target)\n sys.stderr.write(\"\\n\")\n \n # save the trained model to file\n with open(os.path.join(self.conf[\"paths\"][\"dir\"],self.conf[\"paths\"][...
[ "0.7362925", "0.72427166", "0.7166918", "0.6913629", "0.6894902", "0.6865036", "0.6854908", "0.6839923", "0.6704421", "0.6680698", "0.66646695", "0.66574335", "0.6651779", "0.66505635", "0.6620633", "0.659549", "0.65892136", "0.6542741", "0.6473617", "0.64566743", "0.64548427...
0.80276585
0
Train a logistic regression model.
def train_logistic_regression(train_exs: List[SentimentExample], feat_extractor: FeatureExtractor) -> LogisticRegressionClassifier: indexer = feat_extractor.get_indexer() weights = np.transpose(np.zeros(indexer.__len__(), dtype=int)) learning_rate = 0.1 for i in range(15): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train_logistic_regression(train_x, train_y):\n\n logistic_regression_model = LogisticRegression(penalty='l2', C=1.0)\n logistic_regression_model.fit(train_x, train_y)\n return logistic_regression_model", "def train_model(self):\r\n alpha, accuracy_rate = self.select_model()\r\n # Initi...
[ "0.8386761", "0.81879395", "0.7966216", "0.76690257", "0.7537518", "0.74895674", "0.73374444", "0.7324982", "0.7299413", "0.7291719", "0.7240203", "0.7221663", "0.7200861", "0.71392286", "0.7133594", "0.710384", "0.7097528", "0.70433974", "0.6994356", "0.69783026", "0.6971683...
0.67574
29
Main entry point for your modifications. Trains and returns one of several models depending on the args passed in from the main method. You may modify this function, but probably will not need to.
def train_model(args, train_exs: List[SentimentExample]) -> SentimentClassifier: indexer = Indexer() stop_words = set(stopwords.words('english')) punkt = (',', '.', '...', '?', '\'', '\'\'', '!', ':', ';') # Initialize feature extractor if args.model == "TRIVIAL": feat_extractor = None e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main(argv):\n cfg = defaults(argv)\n repo = create_repository(cfg)\n model = Model()\n developer_gen = next_member(cfg)\n for git_date in commit_datetime_string_gen(cfg):\n repo, model = add_commit(repo, cfg, model, developer_gen, git_date)\n if model.ticket is not None and model.c...
[ "0.6445336", "0.62378997", "0.6103279", "0.6101256", "0.5988604", "0.598683", "0.59613985", "0.5912522", "0.5882124", "0.58568376", "0.5845838", "0.5844697", "0.58185214", "0.5818334", "0.5796767", "0.5793016", "0.57815635", "0.5752345", "0.5737359", "0.5714961", "0.57074076"...
0.0
-1
Create a board with goal at position 100 and checks that goal is
def test_goal_reached(self): board = ss.Board(goal=100) assert board.goal_reached(5) is False assert board.goal_reached(90) is False assert board.goal_reached(100) is True board = ss.Board() assert board.goal_reached(90) is True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __generate_goal_board(self):\n element = 1\n array = []\n\n for row in range(self._n):\n row_to_append = []\n for col in range(self._n):\n row_to_append.append(element)\n element += 1\n array.append(row_to_append)\n\n ar...
[ "0.7304421", "0.69853777", "0.67523277", "0.6653536", "0.6625291", "0.65876365", "0.65181404", "0.6511576", "0.65101814", "0.6355516", "0.6329743", "0.6316789", "0.62672085", "0.6259777", "0.62528485", "0.6251963", "0.6240587", "0.6193472", "0.6187519", "0.6186028", "0.617878...
0.6914275
2
Checks that position_adjustment returns the correct number of steps to be subtracted or added when the position is on the top of a snake or the bottom of a ladder. Checks that position_adjustment returns 0 when the position is elsewhere.
def test_position_adjustment(self): board = ss.Board() assert board.position_adjustment(8) == 10-8 assert board.position_adjustment(56) == 37-56 assert board.position_adjustment(63) == 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def position_adjustment(self, position):\n changed_position = 0\n if position in self.ladders:\n return self.ladders[position] - position\n elif position in self.snakes:\n return self.snakes[position] - position\n return changed_position", "def move(self): # A...
[ "0.7006407", "0.57940966", "0.5752311", "0.5737879", "0.5507167", "0.5448012", "0.5397324", "0.53276736", "0.53084916", "0.5283515", "0.51824796", "0.5147287", "0.5136505", "0.50920564", "0.5078422", "0.50565064", "0.50441754", "0.50383854", "0.50056046", "0.49715185", "0.494...
0.6700563
1
Test that ResilientPlayer takes one extra step after sliding down a snake
def test_move_default_extra_steps(self): player = ss.ResilientPlayer() random.seed(2) player.move() random.seed(1) player.move() random.seed(2) player.move() assert player.position == 32
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_move_dropped_steps_greater_than_move(self):\n player = ss.LazyPlayer(dropped_steps=3)\n random.seed(2)\n player.move()\n random.seed(2)\n player.move()\n assert player.position == 40", "def test_move_default_dropped_steps(self):\n player = ss.LazyPlayer()...
[ "0.70096105", "0.68935305", "0.6807493", "0.6662498", "0.6447271", "0.64209694", "0.6270427", "0.62414765", "0.62204564", "0.615403", "0.6151527", "0.6132511", "0.6118273", "0.6114965", "0.609501", "0.6090467", "0.6063974", "0.6044024", "0.59939027", "0.59865755", "0.5981301"...
0.69973004
1
Test that LazyPlayer takes one step less after going up a ladders.
def test_move_default_dropped_steps(self): player = ss.LazyPlayer() random.seed(2) player.move() random.seed(5) player.move() assert player.position == 44
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_move_dropped_steps_greater_than_move(self):\n player = ss.LazyPlayer(dropped_steps=3)\n random.seed(2)\n player.move()\n random.seed(2)\n player.move()\n assert player.position == 40", "def test_move_default_extra_steps(self):\n player = ss.ResilientPlaye...
[ "0.75017583", "0.6730324", "0.66294205", "0.63773066", "0.6272609", "0.6240576", "0.61570513", "0.60627896", "0.60356265", "0.5989407", "0.59687805", "0.5958815", "0.5957419", "0.5949568", "0.5922356", "0.59057784", "0.5904189", "0.58874583", "0.58812684", "0.58393806", "0.58...
0.7022837
1
Tests that LazyPlayer dont move backwards when dropped steps are greater than the next move
def test_move_dropped_steps_greater_than_move(self): player = ss.LazyPlayer(dropped_steps=3) random.seed(2) player.move() random.seed(2) player.move() assert player.position == 40
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_move_default_dropped_steps(self):\n player = ss.LazyPlayer()\n random.seed(2)\n player.move()\n random.seed(5)\n player.move()\n assert player.position == 44", "def test_move_default_extra_steps(self):\n player = ss.ResilientPlayer()\n random.seed(...
[ "0.7334365", "0.6641269", "0.6475652", "0.61387503", "0.6134772", "0.61291", "0.61152625", "0.61019933", "0.60483176", "0.6041911", "0.60396975", "0.6018119", "0.59843713", "0.59796757", "0.59768015", "0.59652007", "0.5950277", "0.5939433", "0.59343606", "0.58857846", "0.5875...
0.8197672
0
Tests that single_game returns a tuple.
def test_single_game_returns_tuple(self): sim = ss.Simulation() assert type(sim.single_game()) == tuple, 'single_game should return ' \ 'tuple'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_single_tuple(self):\n conn = self.connect()\n c = conn.cursor()\n self.safe_create_table(\n conn, \"mystuff\", \"create table mystuff (id integer primary key)\"\n )\n c.execute(\"insert into mystuff (id) values (1)\")\n c.execute(\"insert into mystuff (...
[ "0.6713088", "0.6669579", "0.66490626", "0.6488279", "0.638762", "0.6362186", "0.63546574", "0.62094206", "0.6190039", "0.6178856", "0.6135326", "0.6129589", "0.60323733", "0.59669423", "0.5964204", "0.5952256", "0.593679", "0.590705", "0.58496106", "0.58379227", "0.5782221",...
0.89493525
0
Tests that two games of single_game is different from each other, when the seed is different.
def test_single_game_works(self): sim = ss.Simulation(seed=154) game1 = sim.single_game() sim = ss.Simulation(seed=79) game2 = sim.single_game() assert game1 != game2, 'Your method single_game is not working.'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_single_game_seed_works(self):\n sim = ss.Simulation(seed=23)\n game1 = sim.single_game()\n sim = ss.Simulation(seed=23)\n game2 = sim.single_game()\n assert game1 == game2, 'Your seed in Simulation class is not working.'", "def test_equal(self):\r\n\r\n a_players = ...
[ "0.81157404", "0.7059727", "0.69203585", "0.66897315", "0.6630781", "0.66151136", "0.6483109", "0.64159", "0.64131045", "0.6410941", "0.6346281", "0.6270911", "0.62650096", "0.6246768", "0.6201503", "0.6187887", "0.617865", "0.6160666", "0.6155558", "0.615349", "0.61270845", ...
0.8136826
0
Tests that two games of single_game is equal, when the seed is the same.
def test_single_game_seed_works(self): sim = ss.Simulation(seed=23) game1 = sim.single_game() sim = ss.Simulation(seed=23) game2 = sim.single_game() assert game1 == game2, 'Your seed in Simulation class is not working.'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_single_game_works(self):\n sim = ss.Simulation(seed=154)\n game1 = sim.single_game()\n sim = ss.Simulation(seed=79)\n game2 = sim.single_game()\n assert game1 != game2, 'Your method single_game is not working.'", "def test_equal(self):\r\n\r\n a_players = [ZeroPlaye...
[ "0.81622756", "0.7525932", "0.67783153", "0.6768772", "0.6753167", "0.65783197", "0.6494036", "0.63991237", "0.6323125", "0.63176376", "0.6263558", "0.6230478", "0.6161638", "0.6111521", "0.60287315", "0.6027688", "0.60109663", "0.60015196", "0.5999746", "0.5993655", "0.59832...
0.84178203
0
Tests that run_simulation returns nothing
def test_run_simulation_returns_nothing(self): sim = ss.Simulation() assert sim.run_simulation(10) is None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_empty_simulation(self):\n config = {\n 'network_params': {\n 'path': join(ROOT, 'test.gexf')\n },\n 'agent_type': 'BaseAgent',\n 'environment_params': {\n }\n }\n s = simulation.from_config(config)\n s.run_si...
[ "0.77626854", "0.77274764", "0.74112415", "0.7303463", "0.7178668", "0.71074367", "0.7069148", "0.70681214", "0.69160265", "0.6719179", "0.667552", "0.6662267", "0.6497731", "0.6358623", "0.6342628", "0.63359886", "0.63049287", "0.6286854", "0.62855214", "0.62635136", "0.6245...
0.89247197
0
Tests that run_simulation stores the results
def test_run_simulation_stores_result(self): sim = ss.Simulation() assert sim.results == [] sim.run_simulation(10) assert sim.results != [] assert len(sim.results) == 10
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_results_returns_all_results(self):\n sim = ss.Simulation()\n sim.run_simulation(7)\n assert len(sim.get_results()) == 7", "def test_simulation(self):\n\t\tprint \"Simulation is being tested\"\n\n\t\tif toggles.DEBUG_FLAG:\n\t\t\tprint \"Debug Flag Set!\"\n\t\t\tprint self.getCon...
[ "0.72314996", "0.7085128", "0.6999844", "0.6956875", "0.69383395", "0.69112194", "0.6830327", "0.667656", "0.6667437", "0.6664308", "0.66560996", "0.66404295", "0.66325206", "0.6628107", "0.6608726", "0.6588195", "0.65533656", "0.6500293", "0.6482116", "0.6476763", "0.6472531...
0.86449283
0
Tests that get_results returns a list consisting of tuples.
def test_get_results_returns_list_of_tuples(self): sim = ss.Simulation() sim.run_simulation(5) assert type(sim.get_results()) == list assert type(sim.get_results()[0]) == tuple
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_results(self):\n result = self.test_client._results\n\n assert isinstance(result, list)\n assert len(result) == 1", "def test_get_results(self):\n pass", "def getResults():", "def assertManyResults(self, function, args, results):\r\n for arg, result in zip(args, re...
[ "0.738146", "0.7208044", "0.69072825", "0.6727127", "0.65326715", "0.650097", "0.64806813", "0.6463932", "0.6344955", "0.6324502", "0.63131404", "0.6305193", "0.6211632", "0.6172891", "0.613735", "0.6124938", "0.61014163", "0.6091535", "0.6090757", "0.6073068", "0.60141456", ...
0.8084668
0
Tests that get_results contains the same number of winners as games played.
def test_get_results_returns_all_results(self): sim = ss.Simulation() sim.run_simulation(7) assert len(sim.get_results()) == 7
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def number_results(self):\n pass", "def test_update_results(self, count_key, hand_key, net_winnings, overall_bet, increment, expected):\n s = SimulationStats()\n s.create_count_key(count_key=0)\n s.update_results(\n count_key=count_key,\n hand_key=hand_key,\n ...
[ "0.6485536", "0.64334744", "0.63969475", "0.63891816", "0.63779795", "0.6332883", "0.63238555", "0.62757146", "0.625677", "0.6246163", "0.6239472", "0.62343186", "0.62041014", "0.61753535", "0.6164736", "0.61493677", "0.61451954", "0.6142789", "0.6133456", "0.6119115", "0.610...
0.6243277
10
Tests that winners_per_type returns a dictionary
def test_winners_per_type_returns_dict(self): sim = ss.Simulation() assert type(sim.winners_per_type()) == dict
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_players_per_type(self):\n sim = ss.Simulation()\n assert type(sim.players_per_type()) == dict", "def test_winners_per_type_num_players(self):\n type_of_player = [ss.Player, ss.LazyPlayer, ss.ResilientPlayer]\n sim = ss.Simulation(player_field=type_of_player)\n run = si...
[ "0.7460475", "0.73244834", "0.7059976", "0.7026087", "0.68466777", "0.6143772", "0.5960847", "0.5940492", "0.5801115", "0.57970756", "0.57904345", "0.57599425", "0.5712648", "0.56462806", "0.5638244", "0.56253624", "0.56001174", "0.5587972", "0.5526351", "0.54692185", "0.5445...
0.85515326
0
Tests that all types of players are present
def test_winners_per_type_num_players(self): type_of_player = [ss.Player, ss.LazyPlayer, ss.ResilientPlayer] sim = ss.Simulation(player_field=type_of_player) run = sim.winners_per_type() assert list(run.keys()) == ['Player', 'LazyPlayer', 'ResilientPlayer']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_players_per_type_num_players(self):\n type_of_player = [ss.Player, ss.LazyPlayer, ss.ResilientPlayer]\n sim = ss.Simulation(player_field=type_of_player)\n run = sim.players_per_type()\n assert list(run.keys()) == ['Player', 'LazyPlayer', 'ResilientPlayer']", "def test_players...
[ "0.7568893", "0.74713135", "0.7188392", "0.7174332", "0.6631124", "0.6494987", "0.6482031", "0.63635993", "0.6339381", "0.631974", "0.6221002", "0.62074506", "0.6085961", "0.60554427", "0.6048676", "0.60445374", "0.6012698", "0.5990195", "0.5984317", "0.5971757", "0.5967089",...
0.72397536
2
Tests that all types of players that are playing are present, but not those who aren't.
def test_winners_per_type_num_players_less(self): type_of_player = [ss.Player, ss.LazyPlayer, ss.Player] sim = ss.Simulation(player_field=type_of_player) run = sim.winners_per_type() assert list(run.keys()) == ['Player', 'LazyPlayer']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_players_per_type_num_players_less(self):\n type_of_player = [ss.Player, ss.LazyPlayer, ss.Player]\n sim = ss.Simulation(player_field=type_of_player)\n run = sim.players_per_type()\n assert list(run.keys()) == ['Player', 'LazyPlayer']", "def test_players_per_type_num_players(s...
[ "0.6836289", "0.66635007", "0.6472525", "0.64168954", "0.6361755", "0.6325538", "0.6318714", "0.6308488", "0.62345076", "0.6177351", "0.61126137", "0.6100637", "0.60837114", "0.6056955", "0.6039496", "0.5998204", "0.5997768", "0.5993413", "0.59918576", "0.5989119", "0.5974849...
0.6529068
2
Tests that total wins are equal to numbers of simulation.
def test_winners_per_type_sum(self): sim = ss.Simulation() sim.run_simulation(14) winners = sim.winners_per_type() assert sum(winners.values()) == 14
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_play_game_hard(self):\r\n wins = [0,0,0]\r\n\r\n for i in range(1,10):\r\n a_player_1_id = 1\r\n a_player_2_id = 2\r\n a_players = [RandomPlayer(a_player_1_id), RandomPlayer(a_player_2_id)]\r\n a_x_dist = i\r\n a_y_dist = i\r\n a_num_to_win = 3\r\n a_game = Game(a_...
[ "0.66540855", "0.6641283", "0.651022", "0.6439688", "0.6402664", "0.639706", "0.63893235", "0.6287492", "0.62694687", "0.62559384", "0.6249074", "0.6247421", "0.62210906", "0.62149644", "0.6180857", "0.6174532", "0.6166144", "0.61484927", "0.6138867", "0.6131443", "0.6127531"...
0.6798297
0
Tests that durations_per_type returns a dictionary
def test_durations_per_type(self): sim = ss.Simulation() assert type(sim.durations_per_type()) == dict
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def durations_per_type(self):\n pass", "def test_durations_per_type_num_players(self):\n type_of_player = [ss.Player, ss.LazyPlayer, ss.ResilientPlayer]\n sim = ss.Simulation(player_field=type_of_player)\n run = sim.durations_per_type()\n assert list(run.keys()) == ['Player', '...
[ "0.76126635", "0.69130933", "0.6763132", "0.64169866", "0.6288302", "0.62874055", "0.6248118", "0.6223497", "0.61402684", "0.60638607", "0.60624653", "0.5815379", "0.58149046", "0.5737329", "0.572361", "0.57040614", "0.56947976", "0.56464267", "0.56448644", "0.56156546", "0.5...
0.87039316
0
Tests that all types of players are present
def test_durations_per_type_num_players(self): type_of_player = [ss.Player, ss.LazyPlayer, ss.ResilientPlayer] sim = ss.Simulation(player_field=type_of_player) run = sim.durations_per_type() assert list(run.keys()) == ['Player', 'LazyPlayer', 'ResilientPlayer']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_players_per_type_num_players(self):\n type_of_player = [ss.Player, ss.LazyPlayer, ss.ResilientPlayer]\n sim = ss.Simulation(player_field=type_of_player)\n run = sim.players_per_type()\n assert list(run.keys()) == ['Player', 'LazyPlayer', 'ResilientPlayer']", "def test_players...
[ "0.7568893", "0.74713135", "0.72397536", "0.7188392", "0.7174332", "0.6631124", "0.6482031", "0.63635993", "0.6339381", "0.631974", "0.6221002", "0.62074506", "0.6085961", "0.60554427", "0.6048676", "0.60445374", "0.6012698", "0.5990195", "0.5984317", "0.5971757", "0.5967089"...
0.6494987
6
Tests that all types of players that are playing are present, but not those who aren't.
def test_durations_per_type_num_players_less(self): type_of_player = [ss.Player, ss.LazyPlayer, ss.Player] sim = ss.Simulation(player_field=type_of_player) run = sim.durations_per_type() assert list(run.keys()) == ['Player', 'LazyPlayer']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_players_per_type_num_players_less(self):\n type_of_player = [ss.Player, ss.LazyPlayer, ss.Player]\n sim = ss.Simulation(player_field=type_of_player)\n run = sim.players_per_type()\n assert list(run.keys()) == ['Player', 'LazyPlayer']", "def test_players_per_type_num_players(s...
[ "0.6836289", "0.66635007", "0.6529068", "0.6472525", "0.64168954", "0.6361755", "0.6325538", "0.6318714", "0.6308488", "0.62345076", "0.61126137", "0.6100637", "0.60837114", "0.6056955", "0.6039496", "0.5998204", "0.5997768", "0.5993413", "0.59918576", "0.5989119", "0.5974849...
0.6177351
10
Tests that players_per_type returns dictionary
def test_players_per_type(self): sim = ss.Simulation() assert type(sim.players_per_type()) == dict
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_players_per_type_num_players(self):\n type_of_player = [ss.Player, ss.LazyPlayer, ss.ResilientPlayer]\n sim = ss.Simulation(player_field=type_of_player)\n run = sim.players_per_type()\n assert list(run.keys()) == ['Player', 'LazyPlayer', 'ResilientPlayer']", "def test_winners...
[ "0.75420964", "0.74724466", "0.7354364", "0.7230678", "0.7132466", "0.7039844", "0.6974464", "0.6378547", "0.6147127", "0.61053926", "0.60057855", "0.59874344", "0.5845814", "0.5840158", "0.58341056", "0.58270174", "0.5779566", "0.56687707", "0.56667966", "0.56376815", "0.563...
0.86458623
0
Tests that all types of players are present
def test_players_per_type_num_players(self): type_of_player = [ss.Player, ss.LazyPlayer, ss.ResilientPlayer] sim = ss.Simulation(player_field=type_of_player) run = sim.players_per_type() assert list(run.keys()) == ['Player', 'LazyPlayer', 'ResilientPlayer']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_players_per_type_num_players_less(self):\n type_of_player = [ss.Player, ss.LazyPlayer, ss.Player]\n sim = ss.Simulation(player_field=type_of_player)\n run = sim.players_per_type()\n assert list(run.keys()) == ['Player', 'LazyPlayer']", "def test_winners_per_type_num_players(s...
[ "0.747361", "0.72424835", "0.71909654", "0.7176628", "0.66306865", "0.6498127", "0.6485009", "0.6362596", "0.63391715", "0.6321425", "0.62221444", "0.62081015", "0.6085177", "0.6054983", "0.604946", "0.60428005", "0.60109454", "0.5990627", "0.598319", "0.59704417", "0.5966648...
0.7571244
0
Tests that all types of players are present, but not those who aren't
def test_players_per_type_num_players_less(self): type_of_player = [ss.Player, ss.LazyPlayer, ss.Player] sim = ss.Simulation(player_field=type_of_player) run = sim.players_per_type() assert list(run.keys()) == ['Player', 'LazyPlayer']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_players_per_type_num_players(self):\n type_of_player = [ss.Player, ss.LazyPlayer, ss.ResilientPlayer]\n sim = ss.Simulation(player_field=type_of_player)\n run = sim.players_per_type()\n assert list(run.keys()) == ['Player', 'LazyPlayer', 'ResilientPlayer']", "def test_winners...
[ "0.69676596", "0.6959566", "0.66561633", "0.6559737", "0.6464441", "0.6401887", "0.63817614", "0.61773103", "0.6123407", "0.61129445", "0.6079212", "0.6024275", "0.60000664", "0.5969238", "0.59636134", "0.5949633", "0.5917091", "0.5904456", "0.58702326", "0.5864484", "0.58623...
0.72699636
0
have to reimplement as there is an import loop when using __init__
def get_dataset(name): if name == 'cityscapes': return Cityscapes
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__():", "def _init(self):\n pass", "def __init__(object):", "def __init__(__self__):\n pass", "def __init__(__self__):\n pass", "def __init__(__self__):\n pass", "def __init__(__self__):\n pass", "def __init__(__self__):\n pass", "def __init__(__s...
[ "0.8456002", "0.79643214", "0.7935814", "0.79343504", "0.79343504", "0.79343504", "0.79343504", "0.79343504", "0.79343504", "0.79343504", "0.79343504", "0.79343504", "0.79343504", "0.77920854", "0.77789736", "0.77660185", "0.77537453", "0.77537453", "0.77537453", "0.77537453", ...
0.0
-1
Monkey patches Project.Basecamp for testing.
def _mock_basecamp_access(self, klass=TestBasecampProject): self._real_Basecamp = Project.BasecampProject Project.BasecampProject = klass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _unmock_basecamp_access(self):\n Project.BasecampProject = self._real_Basecamp", "def test_patch_project(self):\n pass", "def test_4_4_1_1(self):\n pass", "def test_replace_project(self):\n pass", "def _setup(self):", "def _setup(self):", "def __upgrade(self):", "def t...
[ "0.69486105", "0.66815156", "0.5994686", "0.58670104", "0.58383346", "0.58383346", "0.5837995", "0.5779714", "0.5716145", "0.5716145", "0.5716145", "0.56978476", "0.5674083", "0.56722325", "0.56632423", "0.56433165", "0.5641671", "0.5641671", "0.5641671", "0.5641671", "0.5632...
0.66815084
2
Undoes the Project.Basecamp monkeypatching.
def _unmock_basecamp_access(self): Project.BasecampProject = self._real_Basecamp
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tearDown(self):\n builtins.__import__ = self.original_imports", "def monkeymodule():\n from _pytest.monkeypatch import MonkeyPatch\n\n mpatch = MonkeyPatch()\n yield mpatch\n mpatch.undo()", "def _mock_basecamp_access(self, klass=TestBasecampProject):\n self._real_Basecamp = Proje...
[ "0.59395653", "0.58390504", "0.58148414", "0.5738623", "0.566452", "0.5581741", "0.55454665", "0.5515342", "0.5504153", "0.5504153", "0.5504153", "0.5504153", "0.5504153", "0.5504153", "0.5504153", "0.5504153", "0.5504153", "0.5504153", "0.5496307", "0.5442506", "0.54260296",...
0.75654894
0
Creates a Project instance, using valid test defaults unless overridden in kwargs.
def create_project(self, **kwargs): save = kwargs.get('save', True) if kwargs.has_key('save'): del(kwargs['save']) index = self.object_index() defaults = dict(slug = "test-project-%s" % index, basecamp_url = "https://foo.basecamphq.com/projects/%s/log" % index) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_project(self):\n pass", "def test_create_project(self):\n pass", "def test_create_project(self):\n pass", "def make_instance(self, include_optional):\n # model = openapi_client.models.project.Project() # noqa: E501\n if include_optional :\n retur...
[ "0.67377275", "0.67377275", "0.67377275", "0.6733338", "0.6641121", "0.6638232", "0.65400493", "0.6437412", "0.6354441", "0.6295501", "0.6262486", "0.6259553", "0.6158875", "0.6155135", "0.6154907", "0.6152247", "0.613277", "0.6126964", "0.6112704", "0.60817903", "0.6050086",...
0.76378614
0
Create a Dashboard object, using the optional kwargs. If save=False the object is returned without saving.
def create_dashboard(self, save=True, **kwargs): index = self.object_index() if not kwargs: kwargs = dict(name="Test Dashboard %s" % index, slug="test-dashboard-%s" % index) d = Dashboard(**kwargs) if not save: return d d.save() self.assert_(d.id) #Cheap validit...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def createNewDashboard(userId, name):\n if Dashboard.objects(analystId=userId,name=name):\n return\n newDash = Dashboard()\n newDash.name = name\n newDash.analystId = userId\n newDash.save()\n return newDash", "def create_dashboard_for_model(self, model_id, model_version=None):\r\n ...
[ "0.6506736", "0.594477", "0.59374374", "0.59303516", "0.5777631", "0.57741624", "0.57482916", "0.5740831", "0.56932694", "0.56458133", "0.5591037", "0.5591037", "0.5591037", "0.5546158", "0.55446786", "0.55230343", "0.5511173", "0.5475626", "0.54752666", "0.54465854", "0.5432...
0.8463067
0
When given a proper URL it should be able to set it's project_id field.
def test_project_id_detection(self): tests = { 2907852: self.url_parsing_tests['valid'], None: self.url_parsing_tests['invalid'], } for basecamp_id, test_cases in tests.items(): for case in test_cases: actual = Project.extract_basecamp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_project_id(self, request):\n project_id = request.environ[\"masakari.context\"].project_id\n if project_id in request.url:\n return project_id\n return ''", "def update_url(self, project: str, new_url: str) -> dict:\n assert self.exists(project), f'Project {project...
[ "0.65453565", "0.6395679", "0.62130207", "0.6121916", "0.60963386", "0.60863894", "0.60863894", "0.6049931", "0.6032225", "0.59363747", "0.58792937", "0.58767974", "0.5826079", "0.5822284", "0.5744862", "0.5708999", "0.5691837", "0.5643602", "0.56158346", "0.5602425", "0.5601...
0.5393246
53
If no name is provided, it should be loaded from Basecamp.
def test_name_detection(self): self.project.name = '' self.project.detect_name() self.assertEqual("Kobol's Last Gleaming", self.project.name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __load__(self, name):\n raise KeyError(name)", "def __init__(self, name: Optional[str] = None):\n self.name = name", "def __init__(self, name: str):\n self.name = name", "def __init__(self, name= None):\n self.name = name", "def __init__(self, name: str) -> None:\n se...
[ "0.6246043", "0.6124254", "0.60217863", "0.599673", "0.5958792", "0.59133345", "0.5857884", "0.5857884", "0.5857884", "0.5857884", "0.5857884", "0.5857884", "0.5857884", "0.5857884", "0.5857884", "0.5857884", "0.5857884", "0.5857884", "0.58452326", "0.5831441", "0.58216715", ...
0.5314611
70
Name and basecamp_id should be populated if URL provided.
def test_save(self): p = self.create_project(save=False, basecamp_url='https://foo.basecamphq.com/projects/1701/log/', basecamp_id=None, name='') p.save() self.assertEqual(1701, p.basecamp_id) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def barbican_url(self):", "def test_campers(self):\n response = self.app.get(\"/campers\")\n self.assertTrue(response.status_code, 200)", "def Url(self) -> str:", "def _parsing_url(self, base_url):\n url2 = f\"{self.location}?apikey={self.api_key}&details=true\"\n absolute_url = u...
[ "0.57726336", "0.5522064", "0.54583406", "0.54573566", "0.544681", "0.53497696", "0.53304684", "0.52976954", "0.52683765", "0.52449167", "0.52449167", "0.523963", "0.52159864", "0.52159864", "0.52159864", "0.52123135", "0.52078366", "0.5205166", "0.51757467", "0.5121823", "0....
0.50372845
25
When fetched a summary should be present and the record should show that it is updated.
def test_summary_updates(self): self.project.update_summary() self.project = Project.objects.get(id=self.project.id) #Reload from db self.assertNotEqual(None, self.project.basecamp_updated_at) self.assert_(self.project.summary, "There should be a populated project summary.") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _update_if_summmary(self):\n if self._is_summary:\n self.update(True)", "def test_update_summary(cards_db):\n i = cards_db.add_card(Card(\"foo\", owner=\"me\", state=\"done\"))\n cards_db.update_card(i, Card(summary=\"bar\", state=None))\n\n mod = cards_db.get_card(i)\n assert m...
[ "0.7387756", "0.71113634", "0.7079997", "0.6472972", "0.613627", "0.613627", "0.613627", "0.6046484", "0.59644055", "0.59561294", "0.5894259", "0.58534086", "0.5850773", "0.58299714", "0.58195233", "0.5780534", "0.57665604", "0.5760335", "0.5735073", "0.5711779", "0.56743854"...
0.6777138
3
Returns new proposed values of position and momentum
def get_proposed_values(self): return self.new_position, self.new_momentum, self.new_grad_logp
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_proposed_values(self):\n # Take half step in time for updating momentum\n momentum_bar = self.momentum + 0.5*self.stepsize*self.model.grad_logp(self.position)\n\n # Take full step in time for updating position position\n position_bar = self.position + self.stepsize * momentum_bar\n\n grad_l...
[ "0.7411179", "0.666384", "0.6383803", "0.62856805", "0.6269769", "0.6232472", "0.62020135", "0.602636", "0.6011399", "0.5948838", "0.59457713", "0.591209", "0.5779166", "0.57611746", "0.5720674", "0.5699017", "0.5695794", "0.56951565", "0.5688441", "0.5683125", "0.566046", ...
0.7505171
0
Method to perform time splitting using leapfrog
def _get_proposed_values(self): # Take half step in time for updating momentum momentum_bar = self.momentum + 0.5*self.stepsize*self.model.grad_logp(self.position) # Take full step in time for updating position position position_bar = self.position + self.stepsize * momentum_bar grad_log = self.mo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split(self, time: float) -> Tuple['Trajectory','Trajectory']:\n if time <= self.times[0]:\n #split before start of trajectory\n return self.constructor()([time],[self.milestones[0]]),self.constructor()([time]+self.times,[self.milestones[0]]+self.milestones)\n elif time >= se...
[ "0.6121401", "0.59868795", "0.5886748", "0.57120126", "0.55018634", "0.5468108", "0.5431289", "0.5370495", "0.5326395", "0.53052074", "0.52659476", "0.5264801", "0.52602696", "0.5259747", "0.5254812", "0.52509403", "0.5225097", "0.5220186", "0.5172791", "0.5167863", "0.516074...
0.0
-1
Control and query info about VDI sessions
def cli(ctx, host, user, no_ask): from ._ssh import open_ssh from .vdi import vdi_ctl try: ssh, ssh_cfg = open_ssh(host, user, no_ask=no_ask) except: click.echo('Failed to connect to "{}{}"'.format(user+'@' if user else '', host)) ctx.exit() ctl = vdi_ctl(ssh) ctx.obj ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_session_info():\n query = {\"type\": \"op\", \"cmd\": \"<show><session><info></info></session></show>\"}\n\n return __proxy__[\"panos.call\"](query)", "def __init__(self):\r\n # create a session id\r\n self.session = ViSession()", "def describe_sessions(StackName=None, FleetName=Non...
[ "0.6748842", "0.63345075", "0.6210047", "0.61612386", "0.6086457", "0.594069", "0.59307086", "0.588004", "0.5864997", "0.58546567", "0.5853752", "0.5852688", "0.5827602", "0.5821524", "0.58095425", "0.57243055", "0.568249", "0.5674089", "0.566321", "0.5642942", "0.5619833", ...
0.0
-1
Launch session if not running
def launch(ctx, force): ctl = ctx.ctl jobs = ctl('list-avail', '--partition', 'main', flatten=False) if len(jobs) != 0 and not force: click.echo('Job already running', err=True) sys.exit(1) job = ctl('launch', '--partition', 'main') click.echo(job.get('id')) return 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n\n run_manual_session()\n # run_automated_session()", "async def start_session(self):\n\t\t...", "def _start_stop(self):\n if not self.running:\n #get configuration from gui\n self._start_session()\n else:\n self._stop_session()", "def start_s...
[ "0.6921677", "0.691715", "0.68208355", "0.6514407", "0.6453011", "0.6448769", "0.63575375", "0.6351494", "0.63205147", "0.6289441", "0.6273304", "0.6238755", "0.6238755", "0.6238755", "0.6238755", "0.6220544", "0.6208992", "0.61791897", "0.61247176", "0.6105644", "0.6075375",...
0.0
-1
Shutdown session (all sessions actually)
def terminate(ctx): ctl = ctx.ctl jobs = ctl('list-avail', '--partition', 'main', flatten=False) for job in jobs: jobid = job['id'] click.echo('Terminating {}'.format(jobid)) ctl('terminate', '--jobid', jobid)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shutdown(self) -> None:\n logger.info(\"shutting down all sessions\")\n while self.sessions:\n _, session = self.sessions.popitem()\n session.shutdown()", "def session_shutdown(self, session):\n self.remove_session(session)", "def shutdown(self):\n logging....
[ "0.8046575", "0.80323315", "0.7747297", "0.766137", "0.76423067", "0.75125694", "0.75125694", "0.7350594", "0.73483306", "0.7274264", "0.7265721", "0.72521734", "0.72521734", "0.72521734", "0.7211544", "0.71438706", "0.71430176", "0.7135877", "0.7103759", "0.7096072", "0.7091...
0.0
-1
Print hostname for every active session
def hostname(ctx): ctl = ctx.ctl jobs = ctl('list-avail', '--partition', 'main', flatten=False) if len(jobs) == 0: click.echo('No jobs running', err=True) sys.exit(1) for job in jobs: host = ctl('get-host', '--jobid', job['id']).get('host') click.echo(host) return...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_hosts():\n host_str = \"\"\n data = parse(\"/tmp/cc/calls.log\")\n for ip in data:\n ln = \"{}: {}\".format(ip, data[ip]) + \"\\n\"\n host_str += ln\n return host_str", "def show_hostname(self):\n if self.hostname is None:\n self.get_version()\n print s...
[ "0.713286", "0.70321065", "0.67711055", "0.6726317", "0.64537567", "0.6428883", "0.63933355", "0.6332168", "0.6319371", "0.63166237", "0.63104427", "0.6284228", "0.625256", "0.6224729", "0.6186821", "0.6157728", "0.6157728", "0.61485595", "0.6127928", "0.6109017", "0.61058676...
0.6160609
15
Print display number for active session (s)
def display_nbr(ctx, as_port=False): ctl = ctx.ctl jobs = ctl('list-avail', '--partition', 'main', flatten=False) if len(jobs) == 0: click.echo('No jobs running', err=True) sys.exit(1) for job in jobs: info = collect_vnc_info(ctl, job['id'], ctx.ssh_cfg) if as_port: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def showlinuxsession():\n print('\\nAPI-KEY: {0}'.format(middleware.ixn.apiKey))\n print('Session ID: {0}'.format(middleware.ixn.sessionId.split('/')[-1]))\n print()", "def nice_output(self):\n return 'Inning {0}'.format(self.num)", "def display_number(com,count):\n print \"NUM: ...
[ "0.67021835", "0.62630767", "0.6156052", "0.58835924", "0.5844819", "0.58337957", "0.58275574", "0.5784338", "0.5745291", "0.5731504", "0.5729567", "0.5720762", "0.57092357", "0.5697654", "0.5697105", "0.569234", "0.56872183", "0.5678447", "0.5677368", "0.5674415", "0.5670849...
0.67820513
0
Print port forwarding command
def vnc_tunnel_cmd(ctx, local_port=0): ctl = ctx.ctl jobs = ctl('list-avail', '--partition', 'main', flatten=False) if len(jobs) == 0: click.echo('No jobs running', err=True) sys.exit(1) local_port = local_port or randint(10000, 65000) for job in jobs: cmd = get_vnc_tunne...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cmd_port(args):", "def port_show(switch, port):\n print client.port.show(switch, port)", "def port(self, arguments):\n instance_name = arguments['<instance>']\n instance_name = self.activate(instance_name)\n\n vmrun = VMrun(self.vmx, user=self.user, password=self.password)\n ...
[ "0.7035356", "0.6920912", "0.64945924", "0.6319031", "0.6299037", "0.6251619", "0.6245748", "0.60753006", "0.5955333", "0.5913083", "0.5902333", "0.5899721", "0.58415", "0.5819029", "0.57943815", "0.57721925", "0.57478744", "0.5740907", "0.57306814", "0.5701392", "0.56610006"...
0.53877825
54
Connect to notebook on VDI
def nbconnect(ctx, local_port=0, runtime_dir=None): from ._ssh import mk_ssh from .nbconnect import run_nb_tunnel ctl = ctx.ctl ssh_cfg = ctx.ssh_cfg jobs = ctl('list-avail', '--partition', 'main', flatten=False) if len(jobs) == 0: click.echo('No jobs running', err=True) sys.e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connect():\n if not is_notebook():\n print('Python session is not running in a Notebook Kernel')\n return\n\n global _comm\n\n kernel = get_ipython().kernel\n kernel.comm_manager.register_target('tdb', handle_comm_opened)\n # initiate connection to frontend.\n _comm = Comm(targe...
[ "0.7302616", "0.66039044", "0.63957196", "0.6359534", "0.625341", "0.61476827", "0.5933724", "0.58434105", "0.5814478", "0.5782654", "0.5782654", "0.5765337", "0.57637745", "0.57462305", "0.57228035", "0.5720646", "0.56900316", "0.56900316", "0.56900316", "0.56900316", "0.569...
0.5402611
47
Initializes a model by invoking the _declarative_constructor in SQLAlchemy. We do this for full control over construction of an object
def __init__(self, **kwargs): _declarative_constructor(self, **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize_model(self):\n pass", "def init_model(self):\n pass", "def initialize_model(self):\n model = self.model_class()\n return model", "def initialize(self, model):\n pass", "def __init__(self):\n self.conf = None\n self.section = None\n self...
[ "0.73547405", "0.73199743", "0.73054415", "0.71788186", "0.7161744", "0.7003624", "0.6982105", "0.6978932", "0.6933112", "0.6892595", "0.6869878", "0.68538994", "0.6825778", "0.6809685", "0.680115", "0.6790181", "0.67675006", "0.6754955", "0.67461616", "0.6728338", "0.6725077...
0.79548216
0
Counts how many of the words in words is in the string
def count(words: list, string: str) -> int: count = 0 for word in words: if word in string: count += 1 return count
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def word_count(string):\n counts = dict()\n words = string.split()\n\n for word in words:\n if word in counts:\n counts[word] += 1\n else:\n counts[word] = 1\n\n return len(counts)", "def word_count(phrase):\n return collections.Counter(phrase.split())", "def ...
[ "0.8396281", "0.8102105", "0.8020761", "0.79431856", "0.79333764", "0.78711873", "0.78288954", "0.77515197", "0.76638436", "0.7632681", "0.75856996", "0.7585386", "0.75299984", "0.75235", "0.7513716", "0.7484651", "0.74768686", "0.7471442", "0.73890334", "0.738431", "0.735072...
0.8242722
1
returns True if should be applied inline
def is_inline(self): return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _isinline(self, tagname):\n return False", "def is_inline(self):\n\t\treturn self.name in get_elements_collection(self.__res, 'inline_level')", "async def toggle_inline(self,ctx):\n self.inline = not self.inline", "def inline(self, *args, **kwargs):\n pass", "def check_inline(self,...
[ "0.77492195", "0.7354087", "0.6929993", "0.67634755", "0.67171144", "0.65181583", "0.6015258", "0.59730154", "0.58445996", "0.5717896", "0.566447", "0.5585809", "0.55486566", "0.5530199", "0.552938", "0.55007964", "0.5497933", "0.5411998", "0.5401784", "0.5384311", "0.5361384...
0.83974105
0
Creates shape based on argument passed
def make_shape(type, name, divisions): if type == 'cube': mc.polyCube(n=name, sx=divisions, sy=divisions, sz=divisions) elif type == 'cone': mc.polyCone(n=name, sx=divisions, sy=divisions, sz=divisions) elif type == 'cylinder': mc.polyCylinder(n=name, sx=divisions, sy=divisions, sz=...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shape(self) -> Shape:", "def convert_shape(node, **kwargs):\n return create_basic_op_node('Shape', node, kwargs)", "def shape(self):", "def shape(self):", "def create_helper_shape_node(input_name, output_name):\n shape_node = onnx.helper.make_node(\n \"Shape\",\n inputs=[input_name]...
[ "0.6973547", "0.6951561", "0.68281937", "0.68281937", "0.6700044", "0.668615", "0.6627734", "0.66211987", "0.656545", "0.6553772", "0.65018815", "0.64977", "0.6407365", "0.6397423", "0.63803166", "0.63372326", "0.633629", "0.6289472", "0.628697", "0.6280554", "0.62646955", ...
0.6377532
15
Registration view This function get email and password from json request, check if email isn't in db add email and password into db, set status_id to 'Non_active', generate and send urltoken to user email.
def registration_view(request): json = request.json_body user_query = User.get_user_by_email(request, request.json['email']) nickname_query = User\ .get_user_by_nickname(request, request.json['nickname']) if user_query is None: if nickname_query is None: url_token_confirmatio...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def register():\n if request.method == 'POST':\n details = request.get_json()\n name = details.get('name')\n email = details.get('email')\n national_id = details.get('national_id')\n is_admin = details.get('admin')\n password = details.get('password')\n confirm_p...
[ "0.71419096", "0.7078366", "0.69472104", "0.693519", "0.6849618", "0.6833757", "0.6800396", "0.67971", "0.6776243", "0.6734129", "0.672741", "0.6721706", "0.67000985", "0.6641306", "0.6616081", "0.6606314", "0.6594442", "0.6594169", "0.65885717", "0.65880513", "0.6569257", ...
0.79071903
0
Confirm registration view This function get url_token, check if it isn't in db return the 404 Error. If url_token is in db, this function create url address, change status_id to 'Active', and set role_id to 'user'
def confirm_registration_view(request): user_email_token = request.matchdict['email_confirm'] non_active_user = User.get_one(request, url_token=user_email_token) if non_active_user is None: return {"msg": "Error404 HTTPNotFound"} else: non_active_user.status_id = UserStatus\ ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def registration_view(request):\n json = request.json_body\n user_query = User.get_user_by_email(request, request.json['email'])\n nickname_query = User\\\n .get_user_by_nickname(request, request.json['nickname'])\n if user_query is None:\n if nickname_query is None:\n url_toke...
[ "0.6548345", "0.6258552", "0.61127406", "0.608939", "0.58567214", "0.57589483", "0.5681468", "0.5643639", "0.5612052", "0.5604041", "0.5584628", "0.55466235", "0.55418366", "0.5535246", "0.55350983", "0.55026156", "0.5497721", "0.5479488", "0.5478785", "0.5464513", "0.5454822...
0.6808517
0
Test on creating todo using various string
def test_creating_todo(todoApp, input): # Create new todo new_todo_input = todoApp.find_new_todo_input() print new_todo_input new_todo_input.send_keys(input, Keys.ENTER) # ASSERTION # Check whether the new todo exist in the todo list or not. todo = todoApp.find_todo(input) # Check the new todo sta...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_a_todo(self):\n # hit the API endpoint\n response = self.make_a_request(\n kind=\"post\",\n version=\"v1\",\n data=self.valid_data\n )\n self.assertEqual(response.data, self.valid_data)\n self.assertEqual(response.status_code, stat...
[ "0.7448695", "0.7200586", "0.7179226", "0.70477134", "0.67458063", "0.6732294", "0.67137444", "0.6646171", "0.658738", "0.64375156", "0.6411311", "0.6406063", "0.63943994", "0.63770974", "0.6347952", "0.63256353", "0.6297843", "0.6278811", "0.61461645", "0.60870665", "0.60866...
0.74891263
0
Init client with Config
def __init__( self, config: shuziwuliu_models.Config, ): if UtilClient.is_unset(config): raise TeaException({ 'code': 'ParameterMissing', 'message': "'config' can not be unset" }) self._access_key_id = config.access_key_id ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, **kwargs):\n self.config = kwargs[\"config\"]\n self.cli = client.DefaultClient(app_key=self.config[\"app_key\"], app_secret=self.config[\"app_secret\"])\n self.req = None", "def client_setup(self):\n self.client = Client()", "def Init(self, config):\r\n pass",...
[ "0.77205205", "0.748969", "0.72411644", "0.72370625", "0.70527494", "0.7052649", "0.6980011", "0.68673897", "0.67569655", "0.67425776", "0.66892445", "0.6673647", "0.66587555", "0.66520613", "0.6649865", "0.6626396", "0.6625521", "0.6571919", "0.65580463", "0.6548734", "0.654...
0.6140049
84
Encapsulate the request and invoke the network
def do_request( self, version: str, action: str, protocol: str, method: str, pathname: str, request: dict, headers: Dict[str, str], runtime: util_models.RuntimeOptions, ) -> dict: runtime.validate() _runtime = { 'tim...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _request(self, *args):\n raise NotImplementedError", "def request(self, flow: mitmproxy.http.HTTPFlow):", "def request(self, flow: mitmproxy.http.HTTPFlow):", "def _request(self, *args, **kwargs):\n raise NotImplementedError()", "def _request(self, method, url, payload=None, **params):\n ...
[ "0.73217505", "0.7197748", "0.7197748", "0.7048525", "0.7036744", "0.70269066", "0.7022818", "0.6974834", "0.6882881", "0.68694514", "0.6863585", "0.68612176", "0.68199706", "0.6787917", "0.6735247", "0.6733511", "0.66759455", "0.6661492", "0.6628497", "0.6589683", "0.6576732...
0.639922
30
Encapsulate the request and invoke the network
async def do_request_async( self, version: str, action: str, protocol: str, method: str, pathname: str, request: dict, headers: Dict[str, str], runtime: util_models.RuntimeOptions, ) -> dict: runtime.validate() _runtime = { ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _request(self, *args):\n raise NotImplementedError", "def request(self, flow: mitmproxy.http.HTTPFlow):", "def request(self, flow: mitmproxy.http.HTTPFlow):", "def _request(self, *args, **kwargs):\n raise NotImplementedError()", "def _request(self, method, url, payload=None, **params):\n ...
[ "0.7322879", "0.7198152", "0.7198152", "0.70495856", "0.703823", "0.7027944", "0.70223516", "0.6975768", "0.68829155", "0.6870372", "0.6864595", "0.6862463", "0.682029", "0.67883766", "0.67363423", "0.67352724", "0.66783005", "0.6662441", "0.66296285", "0.6591807", "0.657711"...
0.0
-1
Identifies red lights in the incoming camera image and publishes the index of the waypoint closest to the red light's stop line to /traffic_waypoint
def image_cb(self, msg): light_wp = self.last_wp state = self.state self.has_image = True self.camera_image = msg light_wp, state = self.process_traffic_lights() ''' Publish upcoming red lights at camera frequency. Each predicted state has to occ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_traffic_lights(self):\n light = None\n\n #some plausability checks before starting the processing\n if None is self.waypoints:\n return -1, TrafficLight.UNKNOWN\n if None is self.pose:\n return -1, TrafficLight.UNKNOWN\n if len( self.stopLineIndex) =...
[ "0.7070285", "0.7041899", "0.6967643", "0.6816919", "0.6754921", "0.6677822", "0.6675664", "0.6624752", "0.6600227", "0.64905286", "0.6460968", "0.63963324", "0.6225359", "0.6108355", "0.6083328", "0.5994978", "0.59109867", "0.57418406", "0.5628054", "0.5600468", "0.55992246"...
0.56167054
19
Identifies the closest path waypoint to the given position
def get_closest_waypoint(self, pose): wpclosestDist = sys.maxint for index in range(len(self.waypoints.waypoints)): wp = self.waypoints.waypoints[index] wpdist = self.calcDistance_PoseStamped(pose, wp.pose) if(wpclosestDist > wpdist): wpclosestDist = wpdist ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_closest_waypoint(self, pose):\n #TODO implement - Done\n # Iterate the base_waypoints' x value with current position's x value and find the closest\n # match, and pick that waypoint location index. \n min_idx = 0\n min_dist = None\n cur_x = pose.position.x\n ...
[ "0.7640383", "0.718817", "0.7167996", "0.7131444", "0.7131107", "0.70338064", "0.7031135", "0.7023831", "0.70102865", "0.6980016", "0.69242376", "0.6840171", "0.68167746", "0.67727935", "0.67419153", "0.6639293", "0.6608368", "0.66068965", "0.65030026", "0.6495123", "0.648817...
0.67397225
15
Finds closest visible traffic light, if one exists, and determines its location and color
def process_traffic_lights(self): light = None #some plausability checks before starting the processing if None is self.waypoints: return -1, TrafficLight.UNKNOWN if None is self.pose: return -1, TrafficLight.UNKNOWN if len( self.stopLineIndex) == 0: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_traffic_lights(self):\n #DONE find the closest visible traffic light (if one exists within LOOKAHEAD_WPS)\n if self.init:\n state = self.get_light_state(0)\n return -1, TrafficLight.UNKNOWN\n elif self.ntlwp:\n state = self.get_light_state(self.ntlw...
[ "0.706805", "0.7047184", "0.6819055", "0.6764632", "0.67316353", "0.6700383", "0.65447426", "0.6457697", "0.64285344", "0.63972515", "0.62802887", "0.6241258", "0.6087701", "0.6074844", "0.6063886", "0.6034228", "0.60252565", "0.5981899", "0.59716964", "0.59051466", "0.589391...
0.6203305
12
Handles putio.get_items request with better error handling. Since the putio API will hand back HTTP exception all the time this function will allow them to happen without crashing your script. If there are no items in a directory we return an empty list. Return A list of Item objects (from putio class...) or an empty l...
def get_items(self, parent=None, id_Number=None): sigkill = 0 while 1: try: value = self.API.get_items(parent_id=parent, id=id_Number) return value except putio.PutioError as err: if str(err) == "You have no items to show...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_items():\n return requester.perform_request(Uri.items)", "def test_get_all_item(self, app, item):\n res = app.store_items.get_all_items(\n header=item.header,\n type_response=ItemsResponse,\n )\n assert res.status_code == 200", "async def get_items(\n ...
[ "0.7251653", "0.62557507", "0.61749214", "0.61535305", "0.60895795", "0.60632527", "0.60632527", "0.6048731", "0.5943761", "0.5902527", "0.58333397", "0.5765952", "0.5759044", "0.5714463", "0.5705385", "0.56921226", "0.56823844", "0.5629779", "0.56284565", "0.56101763", "0.56...
0.6713535
1
Get entire put.io account and and save it to a dict called contents. This function will iterate over your entire put.io account and download all files. It saves the following attribuites to the
def getAllItems(self): control = [] for folder in self.get_items(): control.append(folder.id) while len(control) > 0: try: for item in self.get_items(parent=control.pop()): print("Getting content for: " + item.name) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download_output_files(self):\n bucket_list = self.bucket.list(\"output/part\")\n for bucket_entry in bucket_list:\n key_string = str(bucket_entry.key)\n # check if file exists locally, if not: download it\n if not os.path.exists(key_string):\n bucke...
[ "0.5624332", "0.5565257", "0.5325051", "0.5309067", "0.53066105", "0.5221628", "0.51972795", "0.51733166", "0.5163463", "0.512532", "0.5081053", "0.50756407", "0.507155", "0.5058799", "0.5047412", "0.5042756", "0.49936804", "0.498855", "0.49836323", "0.49819744", "0.49795422"...
0.47829255
55
Figures out the full path to a file on Put.io itemID equals the id of the file which you want to determine the path. returns a string that contains the path of the file /foo/bar.txt
def putioPath(self, itemID=None): path = self.get_items(id_Number=itemID)[0].name while 1: itemID = self.get_items(id_Number=itemID)[0].parent_id if itemID == "0": break else: path = self.get_items(id_Number=itemID)[0].name +...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetchPutIOFile(self, fileID=None, fileDir=None):\r\n\r\n sigkill = 0\r\n\r\n if fileID == None or fileDir == None:\r\n raise ValueError('You must send a putio item id and file path.')\r\n\r\n if not fileID in self.contents:\r\n self.getItem(fileID)\r\n\r\n file...
[ "0.65508145", "0.6093909", "0.605057", "0.60210365", "0.59997284", "0.5959347", "0.5940371", "0.59336776", "0.59185827", "0.5912623", "0.5863045", "0.58628094", "0.58371645", "0.5830468", "0.5817235", "0.579462", "0.5781786", "0.5779269", "0.5740309", "0.5699368", "0.5698278"...
0.7573712
0
Check whether local directory tree exists. Create if not.
def createLocalDirectory(self, file=None): if file == None: raise ValueError("Pass a file path!") path, fileName = os.path.split(file) try: if not os.path.exists(path): os.makedirs(path) except OSError as err: print("ERROR...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_local_directory(dirpath: pathlib.Path):\n if dirpath.exists():\n return False\n\n # TODO: Debug and improve this in order to catch particular exceptions\n try:\n dirpath.mkdir(parents=True)\n except Exception as error:\n raise SrtUtilsException(\n f'Directory ...
[ "0.7586968", "0.752541", "0.72212356", "0.7198572", "0.7167625", "0.70522654", "0.7001844", "0.69993913", "0.69269073", "0.6925842", "0.6918411", "0.6912752", "0.6870089", "0.68536395", "0.685239", "0.68481475", "0.6830266", "0.6827925", "0.67800814", "0.67182344", "0.6705626...
0.0
-1
We will fetch a file and store it locally. fileID is the file ID of the file you want to download from put.io fileDir The file name and local directory to save the file.
def fetchPutIOFile(self, fileID=None, fileDir=None): sigkill = 0 if fileID == None or fileDir == None: raise ValueError('You must send a putio item id and file path.') if not fileID in self.contents: self.getItem(fileID) fileName = self.contents[file...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_file(self, file_id, filename=''):\n method = 'getFile?' + 'file_id=' + str(file_id)\n res = requests.post(self.api_url + method, file_id)\n try:\n file_path = res.json()['result']['file_path']\n # Determine the fileName. Use modified file_path if none given.\n ...
[ "0.67713237", "0.6571637", "0.6508179", "0.6468049", "0.6434974", "0.63675445", "0.6354371", "0.6251986", "0.6228547", "0.62186724", "0.62175226", "0.621723", "0.6213369", "0.61421895", "0.61183006", "0.6111253", "0.60803854", "0.60776365", "0.60721976", "0.6070534", "0.60533...
0.76239014
0
Gets all the files in our local putio directory The reason for this function is os.path.exists is so slow. Walking the local directory and then doing a list lookup is a lot faster. We also clean up the path t o make it TODO support other drives in windows other than C. returns a list containing the full path of each fi...
def getLocalFiles(self): for dirpath, dirnames, filenames in os.walk(self.dlLocation): for name in filenames: currentPath = os.path.join(dirpath, name) currentPath = re.sub('^\w:', '', currentPath) currentPath = re.sub(r"\\",'/', currentPath) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_all_files(root):\n local_files = []\n for path, dirs, files in os.walk(os_path(root), followlinks=False):\n if len(files) > 0:\n path_wo_root = path[(len(root) + len(slash)):] # remove root part\n local_files.extend([os.path.join(path_wo_root, f) for f in files])\n r...
[ "0.7015901", "0.68982315", "0.6829185", "0.67371505", "0.6656817", "0.662845", "0.65805537", "0.6536745", "0.6507714", "0.6487095", "0.6482098", "0.6480075", "0.64740694", "0.6470006", "0.6440682", "0.6436125", "0.64173836", "0.6416718", "0.637361", "0.63688713", "0.6312427",...
0.6604958
6
calculate the point of intersection of axes of wheels F and B
def calc_O(F:Vec3, B:Vec3, theta:float): if F == B: raise ValueError('F cannot be equal to B') if theta == 0.0: raise ValueError('theta cannot be equal to 0.0') L = F - B Ox = norm2(L) / tan(theta) phi = atan2(L.y, L.x) alpha = phi - pi/2.0 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def intersection(self, axis2):", "def intersection(x, y, f, p):", "def fun(x0, x1, y0, y1, xx, yy): \n\n # Look for point of intersection between interpolated curve between nodes in x, y\n # and the normal to the face between nodes (x0, y0) and (x1, y1)\n # Transform coordinate axes\n # Center o...
[ "0.646259", "0.641344", "0.6152979", "0.5793187", "0.57662004", "0.5640328", "0.5593812", "0.55634004", "0.55567926", "0.5550685", "0.55491304", "0.5429276", "0.5378254", "0.537555", "0.5375357", "0.5359578", "0.53533936", "0.53409344", "0.5306884", "0.52935976", "0.5290464",...
0.50560206
62
rotate point P about O by dtheta radians
def rotate_point_by(P:Vec3, O:Vec3, dtheta:float): PO = P - O R = norm2(PO) cos_theta = PO.x / R sin_theta = PO.y / R cos_dtheta = cos(dtheta) sin_dtheta = sin(dtheta) cos_theta_plus_dtheta = cos_theta*cos_dtheta - sin_theta*sin_dtheta sin_theta_plus_dthet...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rotate_about(self, p, theta):\n result = self.clone()\n result.translate(-p.x, -p.y)\n result.rotate(theta)\n result.translate(p.x, p.y)\n return result", "def rotate(self, theta, point):\n r = self - point\n x = r.x * math.cos(theta) - r.y * math.sin(theta)\n...
[ "0.7366025", "0.7336842", "0.7231373", "0.697945", "0.6894734", "0.68924886", "0.6783059", "0.67477643", "0.6742044", "0.6718778", "0.6710311", "0.66871434", "0.665914", "0.6606632", "0.65712065", "0.6569933", "0.6564392", "0.65294605", "0.6525388", "0.652423", "0.6508847", ...
0.88402575
0
Function to perform read operation with the database to get the top artist
def get_top_artist_tracks(session, number_of_artist): try: if not issubclass(type(session), sqlalchemy.orm.session.Session): raise AttributeError("session not passed correctly, should be of type 'sqlalchemy.orm.session.Session' ") if not issubclass(type(number_of_artist), int) or number...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_artists_most_played(session_):\n # artists = session_.query(Artist).order_by(Artist.name.asc()).paginate()\n artists = session_.query(Artist).order_by(Artist.plays.desc()).all()\n return artists", "def top_artists_from_API(api_results):\r\n df = pd.DataFrame(api_results[\"items\"])\r\n col...
[ "0.6849134", "0.66032416", "0.65351725", "0.6413231", "0.63552356", "0.63133323", "0.62837493", "0.6265987", "0.6252838", "0.6200527", "0.61681056", "0.6130825", "0.6129044", "0.61084133", "0.61036533", "0.60961986", "0.6052323", "0.6035289", "0.6007485", "0.5997498", "0.5984...
0.7609244
0
Add uniform noise to a given dataset. Function to add uniform random noise to a given dataset. Uniform noise in range [510^(p), 510^(p)] is added to each data entry. For integervalued sequences, p = 1.
def add_uniform_noise(data, p=1): if p < 1: raise ValueError("'p' has to be greater or equal to 1.") noise = np.random.uniform(-5.*10**(-p), 5*10**(-p), size = len(data)) randomized_data = data + noise # ensure there are no negative entries after noise is added randomized_data = \ ra...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_noise(self, data):", "def uniform_noise_like(\n da: xr.DataArray, low: float = 1e-6, high: float = 1e-3\n) -> xr.DataArray:\n if uses_dask(da):\n mod = dsk\n kw = {\"chunks\": da.chunks}\n else:\n mod = np\n kw = {}\n\n return da.copy(\n data=(high - low) * ...
[ "0.7465272", "0.7017835", "0.69086975", "0.68982387", "0.68722546", "0.68413025", "0.68310094", "0.6785632", "0.6685227", "0.664166", "0.6633581", "0.6620472", "0.6596529", "0.6596529", "0.6562329", "0.6559136", "0.6473762", "0.64221513", "0.63911885", "0.6359188", "0.6347256...
0.7983066
0