def __init__(self, data_file, sub_table = 0): """ """ if os.path.exists(self.pickle_file): if os.path.getmtime(self.pickle_file) > os.path.getmtime(data_file): try: with open(self.pickle_file, 'rb') as data_bin: self.all_content = pickle.load(data_bin) if sub_table > 0: self.all_content = self.all_content[:sub_table] except IOError as err: print ("File error: " + str(err)) else: p = ParsePage(self.doz_by_raffle) p.feed(utils.get_content(data_file)) self.all_content = p.get_full_data() if sub_table > 0: self.all_content = self.all_content[:sub_table] try: with open(self.pickle_file, 'wb') as data_bin: pickle.dump(self.all_content, data_bin) except IOError as err: print ("File error: " + str(err)) self.all_stat = [] self.even_odd = {} self.doze = {} self.even_odd = {'e' + str(i) + 'xo' + str(j): [] for i in range(0, self.doz_by_raffle + 1) for j in reversed(range(0, self.doz_by_raffle + 1)) if (i+j) == self.doz_by_raffle} self.doze = {str(i) + 'x': [] for i in range(0, self.dozen_dozens + 1)} self.unit = {'x' + str(i): [] for i in range(0, 10)} self.init_stat_table() self.build_occur_list() self.build_delay_list() self.build_freq_dict() self.more_often_num() self.last_time() self.most_delay() self.aver_delay() self.fill_up_stand_dev() self.fill_up_stand_sco() self.rule_even_by_odd() self.more_often_dozen() self.more_often_unit()
Lottery.__init__(self) if os.path.exists('data/facil.pickle'): self.updated = os.path.getmtime(data_file) if os.path.getmtime('data/facil.pickle') > os.path.getmtime(data_file): try: data_bin = open('../data/facil.pickle', 'rb') self.all_content = pickle.load(data_bin) if sub_table > 0: self.all_content = self.all_content[:sub_table] except IOError, err: print ("File error: " + str(err)) else: data_bin.close() else: p = ParsePage(self.doz_by_raffle) p.feed(utils.get_content(data_file)) self.all_content = p.get_full_data() if sub_table > 0: self.all_content = self.all_content[:sub_table] try: data_bin = open('../data/facil.pickle', 'wb') pickle.dump(self.all_content, data_bin) except IOError, err: print ("File error: " + str(err)) else: data_bin.close() self.init_stat_table() self.even_odd = {"e0xo15": [], "e1xo14": [], "e2xo13": [], "e3xo12": [], "e4xo11": [], "e5xo10": [], "e6xo9": [], "e7xo8": [], "e8xo7": [], "e9xo6": [], "e10xo5": [], "e11xo4": [], "e12xo3": [], "e13xo2": [], "e14xo1": [], "e15xo0": []}