Ejemplo n.º 1
0
def insert(args):
    if hasattr(args, 'json'):
        data = json.loads(args.json)
    else:
        data = json.load(args.infile)
    with dbManager('config/db.cfg') as db:
        for org in data:
            db.insertOrganism(org, args.dbname)
    return data
Ejemplo n.º 2
0
	def run(self):
		self.isRunning = True
		start = datetime.now()
		dbm = db.dbManager()
		
		while self.isRunning:
			bdi = breakdownInfo.UserBreakdownInfo()
			dbm.insert(bdi)
			#print 'inserted'
			elapsedSeconds = (datetime.now() - start).total_seconds()
			if delay > elapsedSeconds:
				time.sleep(delay - elapsedSeconds)
Ejemplo n.º 3
0
def calc(args):
    with dbManager('config/db.cfg') as db:
        # do custom list comparison if we have an id list
        if hasattr(args, 'ids') and args.ids:
            scores_calc = comparison_list(db, args.job, 'input', args.ids,
                                          args.dbname, 'standard')
        else:
            scores_calc = comparison(db, args.job, 'input', args.dbname,
                                     'standard')
        # output if requested
        if args.output:
            print "Scores for " + args.virus + " versus " + args.dbname
            for k in sorted(scores_calc[0], key=scores_calc[0].get):
                print scores_calc[0][k], k
            print "Shuffle scores for " + args.virus + " versus " + args.dbname
            for k in sorted(scores_calc[1], key=scores_calc[1].get):
                print scores_calc[1][k], k
        # otherwise put in the results table
        else:
            db.storeResults(args.job, scores_calc[0], scores_calc[1])
Ejemplo n.º 4
0
def calc(args):
    with dbManager('config/db.cfg') as db:
        # do custom list comparison if we have an id list
        if hasattr(args, 'ids') and args.ids:
            scores_calc = comparison_list(db, args.job, 'input',
                                          args.ids, args.dbname, 'standard')
        else:
            scores_calc = comparison(db, args.job, 'input',
                                     args.dbname, 'standard')
        # output if requested
        if args.output:
            print "Scores for " + args.virus + " versus " + args.dbname
            for k in sorted(scores_calc[0], key=scores_calc[0].get):
                print scores_calc[0][k], k
            print "Shuffle scores for " + args.virus + " versus " + args.dbname
            for k in sorted(scores_calc[1], key=scores_calc[1].get):
                print scores_calc[1][k], k
        # otherwise put in the results table
        else:
            db.storeResults(args.job, scores_calc[0], scores_calc[1])
Ejemplo n.º 5
0
#     'martineserios': 'MARINA'
#     }

# # firebase config
# with open("/app/fb_config.json") as jsonfile:
#     # `json.loads` parses a string in json format
#     config_info = json.load(jsonfile)
#     FB_CONFIG = config_info['FB_CONFIG']

# firebase init
firebase = pyrebase.initialize_app(FB_CONFIG)
storage = firebase.storage()
auth = firebase.auth()

from db import dbManager
db_manager = dbManager()


## Telegram commands
def start(update: Update, _: CallbackContext) -> int:
    update.message.reply_text("Hola! Soy el bot de SphinxAI. Ingresa tu mail.")
    logger.info(MAIL)
    return MAIL


def token(update: Update, context: CallbackContext):
    update.message.reply_text(f'{USER_TOKEN}')


# function to handle the /help command
def help(update, context):
Ejemplo n.º 6
0
	def __init__(self):
		self.dbm = db.dbManager()
Ejemplo n.º 7
0
def clearresultsdb(args):
    with dbManager('config/db.cfg') as db:
        db.clearResults(args.days)