def update(): uid = request.form['uid'] course = request.form['course'] newGrade = request.form['grade'] import Update if 'sig' in request.form: return Update.Update(uid, course, newGrade, request.form['sig']) else: return Update.Update(uid, course, newGrade)
def __init__(self, canvas, naam, unit, s): self.canvas = canvas self.naam = naam self.unit = unit self.s=s ###--- drawButtonsSide ---### nameModule = self.naam self.canvas.create_text(58,10, text='Module: %s'% nameModule, font = "Helvetica 14 bold", anchor=N) self.canvas.create_text(53,270, text='Manual:', anchor=N) self.buttonOn = Button(self.canvas, text = "On", state=NORMAL, command = self.manualOn) #Nog iets met dat die geselecteerd is, 'aan' staat self.buttonOn.configure(width = 7) # activebackground = "#33B5E5", self.buttonOn_window = self.canvas.create_window(66, 300, window=self.buttonOn) # anchor=NW, self.buttonOff = Button(self.canvas, text = "Off", state=DISABLED, command = self.manualOff) #anchor = SW , command = manual self.buttonOff.configure(width = 7) # activebackground = "#33B5E5", self.buttonOff_window = self.canvas.create_window(66, 325, window=self.buttonOff) # anchor=NW, # Updating the status and the temperature of the side controller updateSideController = Update(s, 2000, self.unit, self.canvas) updateSideController.keepPlotting()
def update(self, url, currentVersion, key=None, fileName=None, targetPath=None, install=False): """Search for updates. If an update is found, it can notify the user or install the update and notify the end user that the update has been installed. Args: url (str): The url to download the package to install. currentVersion (str): The current version of the app running. key (str): If the system needs a key to access. Defaults to None. Return: str or None: The url found if install flag is False or None if no update is found. """ update = Update.Update(url, currentVersion) updateUrl = update.checkUpdates() if not updateUrl: return return updateUrl
def update(self): Update.Update() infoBox = QMessageBox() infoBox.setIcon(QMessageBox.Information) infoBox.setText("Updated") infoBox.setWindowTitle("Information") infoBox.setStandardButtons(QMessageBox.Ok) infoBox.exec_()
def scrape_update(url): print print("Scraping {0}").format(url.strip()) page = urllib2.urlopen(url) soup = BeautifulSoup(page) scraped_update_url = url project_title = str(soup.find("div", {"class": "container"})) project_title_strip = [ '\n', "<div class=\"container\"><h1>", "</h1></div>" ] project_title = text_stripper(project_title, project_title_strip) if project_title == "Project not found": out_url = url.strip() + "\n" print url.strip( ) + " is an invalid url or the project has been removed from the domain." insert_count = 0 update_file("page_not_found.txt", out_url) else: project_title = str(soup.find("div", {"class": "container"})) project_title_strip = [ '\n', "<div class=\"container\"><h1>", "</h1></div>" ] project_title = text_stripper(project_title, project_title_strip) project_title = regex_strip(project_title, r"(.*?)<.*") print "Project Title: " + project_title update_list = soup.findAll("div", {"class": "update-box"}) insert_count = 0 for update in update_list: strip = ["\n"] strip_update = text_stripper(str(update), strip) strip = r".*?>.*?>(.*?)<.*" update_title = regex_strip(strip_update, strip) strip = r".*?>.*?>.*?>(.*?)<.*" update_date = regex_strip(strip_update, strip) update_strip = ["\n", "on"] update_date = text_stripper(update_date, update_strip) strip = r".*?>.*?>.*?>.*?>.*?>(.*)" update_text = regex_strip(strip_update, strip) update_text_strip = ['\n', "<br />", "<p>", "</p>", "</div>"] update_text = text_stripper(update_text, update_text_strip) out_update = Update(scraped_update_url, project_title, update_title, update_date, update_text) check = out_update.is_in_database() if check == False: print "Inserting {0} into database.".format( out_update.update_title) out_update.insert_into_database() insert_count += 1 else: print "'{0}' update already in database.".format( out_update.update_title) return insert_count
def delegate(conn, user_in): user_in = user_in.lower() if user_in == "create": print("\n") return Create.Create(conn) elif user_in == "read": print("\n") return Read.Read(conn) elif user_in == "update": print("\n") return Update.Update(conn) elif user_in == "delete": print("\n") return Delete.Delete(conn) else: raise Exception("Invalid User input: " + user_in)
def main(): update_init_print = Update_say("Welcome to Guess a Number!") update_init_nextstate = Update_set(field='current_state', value='choose') state_init = State([update_init_print, update_init_nextstate]) update_guessed_num = Update_get('guessed_num', int, "Guess a number: ") update_victory = Update_set( field='victory', value_expression=lambda _fields: _fields['number_to_guess'] == _fields[ 'guessed_num']) update_guess_branch = Update( branch_state_true='high', branch_state_false='low', branch_expression=lambda _fields: _fields['guessed_num'] > _fields[ 'number_to_guess']) state_choose = State( [update_guessed_num, update_victory, update_guess_branch]) update_high_say = Update_say("Too high!") update_high_nextstate = Update_set(field='current_state', value='choose') state_high = State([update_high_say, update_high_nextstate]) update_low_say = Update_say("Too low!") update_low_nextstate = Update_set(field='current_state', value='choose') state_low = State([update_low_say, update_low_nextstate]) game = Game( fields, { "init": state_init, "choose": state_choose, "low": state_low, "high": state_high }) while (not fields['victory']): game.step() print("You won!")
# Function to go back x months in time # 12 + month - x to avoid month 0 def back(today, interval): if today.month < interval: return (12 + today.month - interval), (today.year - 1) else: return (today.month - interval), today.year # This program assumes that a MongoDB instance is running on the default host and port. # To do this, open a terminal and type in mongod. if __name__ == '__main__': up = Update.Update() # Get the current date and go back 6 months (default initialization value) today = datetime.date.today() startMonth, startYear = back(today, 6) startDate = datetime.date(startYear, startMonth, today.day) print "Beginning initialization:", len( up.symbols), "historical files to insert." errors = 0 notFound = [] counter = 0 for symbol in up.symbols: try: # Create a new document for each symbol and insert into database obj = up.new(symbol)