def run(driver_path=None): while True: try: print_menu() menu = input('Which information do you want to know : ') if menu == '1': i = index.Index(driver_path) i.print_index() elif menu == '2': stockgraph.run() elif menu == '3': r = rate.Rate(driver_path) r.print_rate() elif menu == '4': r = rate.Rate(driver_path) r.calculate_rate() elif menu == '5': realtimePrice.run_mystock() break elif menu == '6': import sys sys.exit() else: print('invalid number!! write valid number') except KeyboardInterrupt as e: print('시스템이 강제로 종류 되었습니다.\n') break
def retrieveIdeaList(self, kwList, criteria, filt): dl = docList.DocList(kwList=kwList) dlist = dl.doRetrieveDoc() #print dlist #filter sf = searchFilter.Filter(filt, dlist) dlist = sf.doFilter() #sort sortObj = sorter.Sorter(criteria, dlist) sortObj.doSort() dlist = sortObj.getList() data = list() for d in dlist: rateObj = rate.Rate(d, '0') rt = rateObj.rateGet() d_detail = dict() d_detail["id"] = d dd = docDetail.DocDetail(d) d_detail["title"] = dd.getTitle() d_detail["description"] = dd.getDescription() d_detail["tags"] = dd.getTags() d_detail["rating"] = rt d_detail["innovators"] = dd.getInnovator() data.append(d_detail) return data
def get(self, postid, email): print "DetailAPI" #Return document detail dd = docDetail.DocDetail(postid) rateObj = rate.Rate(postid, '0') rt = rateObj.rateGet() data = dict() data["title"] = dd.getTitle() data["description"] = dd.getDescription() data["innovators"] = dd.getInnovator() data["submit_date"] = dd.getUpdatedDate() data["rtc"] = dd.getRelevance() data["pps"] = dd.getProbSolved() data["success_benefit"] = dd.getSuccessBenefit() data["rating"] = rt data["tags"] = dd.getTags() data["innovators"] = dd.getInnovator() data["id"] = postid #Write user preference uo = UserProfile.objects.get_or_404(email=email) docList = deque(uo.doc) if postid not in docList: docList.append(postid) if (len(docList) > 5): docList.popleft() docList = list(docList) uo.doc = docList uo.save() return data
def _test_rate_reports_recent_progress(self): """ progress starts at 100km/s, but recent reports are 0.1km/s, so we probably want to use that data, rather then the earlier data """ r = rate.Rate() r.progress(1000, 1.0) r.progress(900, 6.0) r.progress(100, 800.0) r.progress(99, 810.0) self.assertEqual(990, r.remaining_secs())
def waypoint_change(a, b, c): wp = this.waypoints.info(this.target_waypoint.get()) if wp: this.target = wp this.selected_waypoint = this.target_waypoint.get() config.set("Kumay3305.target_waypoint", this.selected_waypoint) this.current_distance.set('---') this.remaining_time.set("---") this.target_heading.set("---") if 'next' in wp: this.next_waypoint.set(wp['next']) this._rate = rate.Rate()
def post(self): args = self.reqparse.parse_args() email = args["Email"] rating = args["Rating"] docid = args["PostID"] rateObj = rate.Rate(docid, email) msg = rateObj.ratePost(rating) print msg if (msg == "Rate successfully!"): return 201 return 450
def test_need_update(self): r = rate.Rate() # No reports, so no need to update self.assertFalse(r.need_update(1000.0)) r.progress(1000, 1000.0) r.progress(1001, 1020.0) # Now we have progress, so we need to report self.assertTrue(r.need_update(1020.0)) # When we have made a report then we don't need another self.assertIsNone(r.remaining_secs(1020.0)) self.assertFalse(r.need_update(1021.0)) self.assertTrue(r.need_update(1026.0)) # But we should report again after 20 seconds self.assertTrue(r.need_update(1026.0))
def retrieveIdeaList(self, email): userObj = UserProfile.objects.get_or_404(email=email) dl = docList.DocList(userObj=userObj) dlist = dl.doRetrieveDoc() data = list() ideasDict = {} for d in dlist: rateObj = rate.Rate(d, '0') rt = rateObj.rateGet() d_detail = dict() d_detail["id"] = d dd = docDetail.DocDetail(d) d_detail["title"] = dd.getTitle() d_detail["description"] = dd.getDescription() d_detail["tags"] = dd.getTags() d_detail["rating"] = rt d_detail["innovators"] = dd.getInnovator() data.append(d_detail) return data
def getSimilarPosts(self, postid): d = list() d.append(postid) dl = docList.DocList(docList=d) dlist = dl.doRetrieveDoc() data = list() for d in dlist: rateObj = rate.Rate(d, '0') rt = rateObj.rateGet() d_detail = dict() d_detail["id"] = d dd = docDetail.DocDetail(d) d_detail["title"] = dd.getTitle() d_detail["description"] = dd.getDescription() d_detail["tags"] = dd.getTags() d_detail["rating"] = rt d_detail["innovators"] = dd.getInnovator() data.append(d_detail) return data
import sys import plug import heading import version import waypoints import rate import json from sys import platform from util import GridHelper, debug, error from ttkHyperlinkLabel import HyperlinkLabel from waypoints import Waypoints this = sys.modules[__name__] # For holding module globals this.target = None this._rate = rate.Rate() this._location = None # Normally the last known lat lon in a tuple #this.debug = True if platform == 'darwin' else False this.NO_VALUE = "---" # Used when we don't have a value for a field this.debug_buttons = False # Set True to display buttons for debugging window = tk.Tk() window.withdraw() def local_file(name): return os.path.join(os.path.dirname(os.path.realpath(__file__)), name) this.waypoints = Waypoints(local_file("waypoints.json"))
temps = gcm_data['temp'] pressure = gcm_data['press'] obs_ilat = gcm_data['obs_ilat'] obs_phase = gcm_data['obs_phase'] lats = gcm_data['lats'] lons = gcm_data['lons'] phase = gcm_data['phase'] nlat = len(lats) nlon = len(lons) nlayers = len(pressure) nphase = len(obs_phase) # Chemistry in equilibrium for solar composition at 0.1 bar and lat 60 deg: r = rate.Rate(C=2.5e-4, N=1.0e-4, O=5.0e-4, fHe=0.0851) ipress = 42 # ~0.1 bar ilat_q = 0 # -60 deg (Nice switch from CO--CH4 dominated atm) p = np.tile(pressure[ipress] / pc.bar, len(obs_phase)) # bars rtemp = temps[:, ilat_q, ipress] Q_equil = r.solve(rtemp, p) labels = r.species pyrat = pb.run('model_WASP43b.cfg') nwave = pyrat.spec.nwave press = pyrat.atm.press / pc.bar wavelength = 1.0 / (pyrat.spec.wn * pc.um) rprs = pyrat.phy.rplanet / pyrat.phy.rstar q0 = np.copy(pyrat.atm.qbase) imol = [labels.index(molfree) for molfree in pyrat.atm.molfree] nmol = len(pyrat.atm.molfree)
def updater(self): # rates of update draw_rate = rate.Rate(1 / 25.0) game_rate = rate.Rate(1 / 2.0) update_rate = rate.Rate(1 / 50.0) replay_rate = rate.Rate(1 / 2.0) # reset the replay file overwriting it with a empty byte string self.replay.reset_replay_file() while True: if replay_rate.is_time(): self.replay.play_frames() # drawing scenese if draw_rate.is_time(): self.draw() # game stuff if game_rate.is_time(): if self.paused or self.game.state == g_eng.GameEngine.gamestate_game_over: pass else: # clears annoying text self.areas[0].clear_text() # reads the next key, thus the next direction from the # buffer next_dir = self.key_buffer.get_key() # if the key is actually a direction and is a valid one # here could actually skip the invalid directions... # like random keys but keep the backward to head direction # which is a mistake the player can make if next_dir: self.game.snake.change_dir(next_dir) self.game.routine() # writes the frames if the record option is on self.replay.save_replay_frame(self.game) # updates the score label self.score_str.set("Score: " + str(self.game.score)) # if the games ends in a game over, then show the top score # board if self.game.state == g_eng.GameEngine.gamestate_game_over: self.areas[0].add_text("Game Over\nPress space for new game") # create new score curr_score = score.Score(datetime.datetime.now(), self.game.score) self.score_board.add_score(curr_score) self.score_board.render_scores() # pause the game self.paused = True # update the tkinter cycle if update_rate.is_time(): self.root.update_idletasks() self.root.update() # updates the checkbox self.replay.replay_settings.read_state()
def test_rate_no_reports(self): r = rate.Rate() self.assertIsNone(r.remaining_secs())
def test_rate_reports_negative_progress(self): r = rate.Rate() r.progress(1000, 1000.0) r.progress(1100, 1020.0) self.assertIsNone(r.remaining_secs())
def test_rate_reports(self): r = rate.Rate() r.progress(1000, 1.0) r.progress(900, 11.0) self.assertEqual(90, r.remaining_secs())
def get(self, postid, email): #0 email means getting average rating rateObj = rate.Rate(postid, email) rt = rateObj.rateGet() return { 'rating': rt }