def init(db_type, db_schema, db_host, db_port=0, db_user=None, db_password=None, db_driver=None, **db_args):
    '''
    Initialize database.

    Args:
      db_type: db type, 'mysql', 'sqlite3'.
      db_schema: schema name.
      db_host: db host.
      db_user: username.
      db_password: password.
      db_driver: db driver, default to None.
      **db_args: other parameters, e.g. use_unicode=True
    '''
    global _db_connect, _db_convert
    if db_type=='mysql':
        _log('init mysql...')
        default_args = {
            'host': '127.0.0.1',
            'port': 3306,
            'user': '',
            'password': '',
            'database': db_schema,
            'use_unicode': True,
            'charset': 'utf8',
            'collation': 'utf8_general_ci'
        }
        import mysql.connector
        for k, v in default_args.iteritems():
            db_args[k] = db_args.get(k, v)
        _db_connect = lambda: mysql.connector.connect(**db_args)
        _db_convert = '%s'
    elif db_type=='sqlite3':
        _log('init sqlite3...')
        import sqlite3
        _db_connect = lambda: sqlite3.connect(db_schema)
    else:
        raise DBError(db_type % 'Unsupported db: %s')
dataset/ETHPy150Open michaelliao/transwarp/transwarp/db.py/init/swapped operands of `%`