def __init__(self): io = Fileio() self.hype_messages = io.importMessages('hype.txt', 'hype') self.hype_words = io.getWordsFromFile('hype.txt', 'hype') self.normal_messages = io.importMessages('normal.txt', 'normal') self.normal_words = io.getWordsFromFile('normal.txt', 'normal') self.wordList = self.hype_words + self.normal_words self.classifier = self.trainHypeClassifier()
def __init__(): io = Fileio() self.serious_messages = io.importMessages('serious.txt', 'serious') self.serious_words = io.getWordsFromFile('serious.txt', 'serious') self.idiotic_messages = io.importMessages('idiotic.txt', 'idiotic') self.idiotic_words = io.getWordsFromFile('idiotic.txt', 'idiotic') self.wordList = self.serious_words + self.idiotic_words self.classifier = self.trainSeriousClassifier()
def delete_record(f_name,db_name,tb_name): """ Read CSV file which contains records to be deleted """ print ("Reading CSV file "+f_name) csvfile = Fileio(f_name) dataset = csvfile.getDataSet() """ Get database connection """ user = "******" passwd = "citoKUKU123" db = Database(db_name,user,passwd) db.getConnection() for dict in dataset: sql_string = "DELETE FROM "+tb_name+" WHERE order_id="+str(dict['Order_id']) db.updateSQL(sql_string) #print(sql_string) """ Close database """ db.closeDatabase()
if opts.readf == "NONE": print("CSV file not defined") sys.exit(0) else: f_name = opts.readf """ Get database connection """ user = "******" passwd = "citoKUKU123" db = Database(db_name, user, passwd) db.getConnection() """ Read CSV file and insert sales_record_number, shipping into item_cost table """ print("Reading CSV file " + f_name + ".csv") csvfile = Fileio(f_name + ".csv") dataset = csvfile.getDataSet() print("Inserting into item_cost table") for dict in dataset: seq = str(dict['sales_record_number']) + "," + str(dict['shipping']) sql_string = "INSERT INTO item_cost (sales_record_number,shipping) VALUES(" + seq + ")" db.insertSQL(sql_string) """ Read CSV file and update shipping column in item_cost table """ # print ("Reading CSV file "+f_name+".csv") # csvfile = Fileio(f_name+".csv") # dataset = csvfile.getDataSet() # print ("Updating shipping values in item_cost table") # for dict in dataset: # seq = str(dict['sales_record_number'])+","+str(dict['shipping']) # sql_string = "UPDATE item_cost SET shipping="+str(dict['shipping'])+" WHERE sales_record_number="+str(dict['sales_record_number'])
if opts.readf == "NONE": print("CSV file not defined") sys.exit(0) else: f_name = opts.readf """ Get database connection """ user = "******" passwd = "citoKUKU123" db = Database(db_name, user, passwd) db.getConnection() """ Read CSV file which contains ebay sales """ print("Reading CSV file " + f_name) csvfile = Fileio(f_name) dataset = csvfile.getDataSet() #print ("Inserting into item_cost table") previous_record = 0 for dict in dataset: record_exists = False #print (dict['Sales Record Number']) if (dict['Sale Price']): sale_price = Decimal(sub(r'[^\d.]', '', dict['Sale Price'])) if (dict['Postage and Handling']): postage = Decimal(sub(r'[^\d.]', '', dict['Postage and Handling'])) else: postage = 0.0 if (previous_record != dict['Sales Record Number']): # Check for an existing record, suppossed to be the fastest method to check
import tkinter as tk from manager import Manager from fileio import Fileio # --------------------------------------------------------------- | GLOBALS BACKGROUND = '#1E1E1E' LIGHT_ONE = '#252526' LIGHT_TWO = '#37373D' LIGHT_THREE = '#333333' LIGHT_FOUR = '#999999' FOREGROUND = 'white' WINDOWSIZE = '1200x600' Man = Manager() io = Fileio() # --------------------------------------------------------------- | BUTTON FUNCTIONS def pressednewfile(): consoleoutput("New File Created") Man.loaded = [] Man.generate() updateaccountlist() accountslist.selection_clear(0, last=len(Man.loaded)) def pressedimportbutton(): boolean = io.importfile(Man) if boolean:
def main(): f = Fileio() name_list = f.get_name() c = CookieHandle('username', 'password') cookie = c.get_cookie() recongnize(name_list, cookie)