refactor1
This commit is contained in:
30
run.py
30
run.py
@@ -70,29 +70,6 @@ if len(sys.argv)>1:
|
||||
from flaskapp import app
|
||||
app.run(port=3000,debug=True)
|
||||
|
||||
if sys.argv[1] == "print_threads":
|
||||
mth=db_session.query(MailThread).all()
|
||||
for t in mth:
|
||||
print t.firstmail
|
||||
print t.mail_flat_dict()
|
||||
|
||||
if sys.argv[1] == "print_thrd":
|
||||
if len(sys.argv)<3:
|
||||
mth=db_session.query(MailThread).all()
|
||||
for t in mth:
|
||||
print t.firstmail
|
||||
else:
|
||||
t=db_session.query(MailThread).filter(MailThread.firstmail==sys.argv[2]).first()
|
||||
|
||||
print t.firstmail
|
||||
print t.subject()
|
||||
print t.text()
|
||||
if sys.argv[1] == "compile_threads":
|
||||
mth=db_session.query(MailThread).all()
|
||||
l=len(mth)
|
||||
for i,t in enumerate(mth):
|
||||
print "%d/%d" % (i,l)
|
||||
t.compile()
|
||||
|
||||
if sys.argv[1] == "trained_threads_from_yml":
|
||||
from classifier.classifier import train
|
||||
@@ -188,10 +165,9 @@ if len(sys.argv)>1:
|
||||
th.body=yaml.dump(t)
|
||||
th.islabeled=False
|
||||
th.opened=True
|
||||
else:
|
||||
th.body=yaml.dump(t)
|
||||
db_session.add(th)
|
||||
db_session.commit()
|
||||
th.compile()
|
||||
db_session.add(th)
|
||||
db_session.commit()
|
||||
print thrds
|
||||
|
||||
if sys.argv[1] == "print_raw_mail":
|
||||
|
||||
Reference in New Issue
Block a user