class Silly(object): """ Silly class Required keyword parameters: - ``walk`` - type of walk - ``silly`` - the level of silliness """ def __init__(self, **kwargs): self.walk = Walk(kwargs['walk']) self.silly = kwargs['silly'] self.is_very_silly = self.is_very_silly() def __str__(self): return "<Silly: %s>" % self.walk.name def __repr__(self): return "<Silly: %s>" % self.walk.name def action(self): self.walk.move() def is_very_silly(self): if self.silly > 3: return True else: return False
def plot_time_data(hr_folder, files): for file_num, file_name in enumerate(files): file_path = os.path.join(hr_folder, file_name) new_walk = Walk(file_path) if file_num <= num_files / 2: pl.subplot(2, 1, 1) else: pl.subplot(2, 1, 2) pl.plot(new_walk.hr, label=new_walk.name) pl.ylabel('Heart Rate (bpm)') pl.xlabel('Time (data points)') pl.subplot(2, 1, 1) pl.legend(loc=5) pl.subplot(2, 1, 2) pl.legend(loc=5) pl.show()
def mesh(self,x,y,M=20,eps=1e-14): """Initialize area for random walk""" self.x0 = x[0] self.x1 = x[1] self.y0 = y[0] self.y1 = y[1] nx0 = np.where(self.x-self.x0<eps) nx1 = np.where(self.x-self.x1<eps) ny0 = np.where(self.y-self.y0<eps) ny1 = np.where(self.y-self.y1<eps) # print nx0, ny1, self.x, self.y # self.rangex = range(nx0,nx1+1) # self.rangey = range(ny0,ny1+1) self.walk = Walk([[self.x0,self.y0],[self.x1,self.y1]]) #failsafe for coordinates self.M = M self.will_walk = True self.walkers = []
def plot_max_min(hr_folder, files): maxes = [] mins = [] means = [] for file_num, file_name in enumerate(files): file_path = os.path.join(hr_folder, file_name) new_walk = Walk(file_path) max_hr = np.max(new_walk.hr) mean_hr = np.mean(new_walk.hr) min_hr = np.min(new_walk.hr) maxes.append(max_hr) mins.append(min_hr) means.append(mean_hr) pl.plot(maxes, label='Max HR') pl.plot(means, label='Mean HR') pl.plot(mins, label='Min HR') pl.ylabel('Heart Rate (BPM)') pl.legend() pl.show()
def AddWalkArea(self,area): self.WalkSolvers.append(Walk(area)) self.Indeces.append(self.MapAreaToIndex(area))
def __init__(self, **kwargs): self.walk = Walk(kwargs['walk']) self.silly = kwargs['silly'] self.is_very_silly = self.is_very_silly()
#!python3 from walk import Walk import time import getopt import sys do_log = False opts, args = getopt.getopt( sys.argv[1:], "hl", ["help","log"] ) for k, v in opts: if k in ("-h", "--help"): print("use -l for log to file") elif k in ("-l", "--log"): do_log = True countries = ["ke", "ng", "gh"] for country in countries: screen_folder = "d:\\quicktest\\{}_market_{}".format( country, time.strftime("%Y%m%d_%H%M",time.localtime()) ) log_file = "{}\\result.log".format(screen_folder) if(do_log): w = Walk(screen_folder=screen_folder, country=country, log_file=log_file) else: w = Walk(screen_folder=screen_folder, country=country) w.wait(15).try_close_ads().set_country("ke") w.wait(5).try_close_ads().login().walk_quickbet() w.quit()
#!python3 from walk import Walk import time import getopt import sys do_log = False opts, args = getopt.getopt(sys.argv[1:], "hl", ["help", "log"]) for k, v in opts: if k in ("-h", "--help"): print("use -l for log to file") elif k in ("-l", "--log"): do_log = True countries = ["ke", "ng", "gh"] for country in countries: screen_folder = "d:\\quicktest\\{}_betslip_{}".format( country, time.strftime("%Y%m%d_%H%M", time.localtime())) log_file = "{}\\result.log".format(screen_folder) if (do_log): w = Walk(screen_folder=screen_folder, country=country, log_file=log_file) else: w = Walk(screen_folder=screen_folder, country=country) w.wait(10).try_close_ads().set_country(country).wait(5) w.try_close_ads().login().walk_betslip() w.quit()
from walk import Walk w = Walk(screen_folder="d:\\quicktest") w.wait(10) w.find_quick_entry("Sports").click() w.find_element_by_id_and_text("com.sportybet.android:id/item_text_view", "All Football").click() w.find("com.sportybet.android:id/home_team").click() el_container = w.find("com.sportybet.android:id/event_recycler") el_market_containers = el_container.find_elements_by_class_name( "android.widget.LinearLayout" ) for el_market_container in el_market_containers: if(el_market_container.location["x"] > 0): continue el_market_name = [] el_market_name = el_market_container.find_elements_by_id( "com.sportybet.android:id/title" ) if(el_market_name): print(el_market_container.location) print(el_market_name[0].text)