示例#1
0
    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()
示例#2
0
    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()
示例#3
0
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() 
示例#4
0
    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()
示例#5
0
    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()
示例#6
0
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'])
示例#7
0
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
示例#8
0
    zoom=14, scale=2, maptype="roadmap")

pprint.pprint(metainfo)

print StaticMap.xy2latlon(metainfo, 0, 0)
print StaticMap.latlon2xy_centered(metainfo, center_latlon.lat, center_latlon.lon)


ll = metainfo['bbox']['low_left']
ur = metainfo['bbox']['upper_right']
x_range = Range(ll['lon'], ur['lon'])
y_range = Range(ll['lat'], ur['lat'])
boundary = Boundary(x_range, y_range)

map_dir = "test_data/shrink-road-maps/"
map_g = Fileio.load_map(map_dir)

print len(map_g.edges)

lines = []
for edge in map_g.edges.values():
    # in_node  = StaticMap.latlon2xy_centered(metainfo, edge.in_node.lat, edge.in_node.lon)
    # out_node = StaticMap.latlon2xy_centered(metainfo, edge.out_node.lat, edge.out_node.lon)
    #
    # offset = glob.PIC_WIDTH / 2.0
    #
    # in_node  = [in_node['X'] + offset, in_node['Y']+offset]
    # out_node = [out_node['X'] + offset, out_node['Y']+offset]
    
    in_node = [edge.in_node.lon, edge.in_node.lat]
    out_node = [edge.out_node.lon, edge.out_node.lat]
示例#9
0
文件: ui.py 项目: nickryt/passpal
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:
示例#10
0
def main():
    f = Fileio()
    name_list = f.get_name()
    c = CookieHandle('username', 'password')
    cookie = c.get_cookie()
    recongnize(name_list, cookie)