How to use asyncdb - 7 common examples

To help you get started, we’ve selected a few asyncdb examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github taiwan-online-judge / taiwan-online-judge / src / py / mail.py View on Github external
def __init__(self, mod_idendesc, get_link_fn):
        Mail.db = AsyncDB(config.CORE_DBNAME, config.CORE_DBUSER, 
                config.CORE_DBPASSWORD)
        Mail._idendesc = mod_idendesc
        self.get_link = get_link_fn

        Proxy.instance.register_call(
            'core/mail/', 'send_mail', self.send_mail)
        Proxy.instance.register_call(
            'core/mail/', 'recv_mail', self.recv_mail)
        Proxy.instance.register_call(
            'core/mail/', 'list_mail', self.list_mail)
        Proxy.instance.register_call(
            'core/mail/', 'del_mail', self.del_mail)
        Proxy.instance.register_call(
            'core/mail/', 'get_mail_count', self.get_mail_count)
github taiwan-online-judge / taiwan-online-judge / src / py / tojauth.py View on Github external
def __init__(self, pubkey, privkey = None):
        super().__init__()

        self.set_verifykey(pubkey)
        if privkey != None:
            self.set_signkey(privkey)

        TOJAuth.instance = self
        TOJAuth.db = AsyncDB(config.CORE_DBNAME, config.CORE_DBUSER,
                config.CORE_DBPASSWORD)
github taiwan-online-judge / taiwan-online-judge / src / py / problem.py View on Github external
def __init__(self, mod_idendesc, get_link_fn):
        ProblemMg.db = AsyncDB(config.CORE_DBNAME, config.CORE_DBUSER, 
                               config.CORE_DBPASSWORD)
        ProblemMg._idendesc = mod_idendesc
        self.get_link = get_link_fn
        self._pmod_list = {}

        Proxy.instance.register_filter('pro/', self.pmod_filter)

        Proxy.instance.register_call(
            'core/problem/', 'create_problem', self.create_problem)
        Proxy.instance.register_call(
            'core/problem/', 'delete_problem', self.delete_problem)
        Proxy.instance.register_call(
            'core/problem/', 'set_problem', self.imc_set_problem)
        Proxy.instance.register_call(
            'core/problem/', 'list_problem', self.list_problem)
        Proxy.instance.register_call(
github taiwan-online-judge / taiwan-online-judge / src / py / notice.py View on Github external
def __init__(self, mod_idendesc, get_link_fn):
        Notice.db = AsyncDB(config.CORE_DBNAME, config.CORE_DBUSER, 
                            config.CORE_DBPASSWORD)
        Notice._idendesc = mod_idendesc
        self.get_link = get_link_fn

        Proxy.instance.register_call(
            'core/notice/', 'list_notice', self.list_notice)
        Proxy.instance.register_call(
            'core/notice/', 'read_notice', self.read_notice)
        Proxy.instance.register_call(
            'core/notice/', 'del_notice', self.del_notice)
        Proxy.instance.register_call(
            'core/notice/', 'get_unseen_count', self.get_unseen_count)
github taiwan-online-judge / taiwan-online-judge / src / py / square.py View on Github external
def __init__(self, mod_idendesc, get_link_fn):
        SquareMg.db = AsyncDB(config.CORE_DBNAME, config.CORE_DBUSER, 
                config.CORE_DBPASSWORD)
        SquareMg._idendesc = mod_idendesc
        self.get_link = get_link_fn
        self._sqmod_list = {}

        Proxy.instance.register_filter('sq/', self.sqmod_filter)

        Proxy.instance.register_call(
            'core/square/', 'list_category', self.list_category)
        Proxy.instance.register_call(
            'core/square/', 'list_square', self.list_square)
        Proxy.instance.register_call(
            'core/square/', 'join_square', self.join_square)
        Proxy.instance.register_call(
            'core/square/', 'quit_square', self.quit_square)
        Proxy.instance.register_call(
github taiwan-online-judge / taiwan-online-judge / src / py / user.py View on Github external
def __init__(self, mod_idendesc, get_link_fn):
        UserMg.db = AsyncDB(config.CORE_DBNAME, config.CORE_DBUSER, 
                config.CORE_DBPASSWORD)
        UserMg._idendesc = mod_idendesc
        self.get_link = get_link_fn

        Proxy.instance.register_call(
            'core/user/', 'register', self.register)
        Proxy.instance.register_call(
            'core/user/', 'login', self.login)
        Proxy.instance.register_call(
            'core/user/', 'cookie_login', self.cookie_login)
        Proxy.instance.register_call(
            'core/user/', 'get_user_info', self.get_user_info)
        Proxy.instance.register_call(
            'core/user/', 'set_user_info', self.set_user_info)
        Proxy.instance.register_call(
            'core/user/', 'change_user_password', self.change_user_password)
github taiwan-online-judge / taiwan-online-judge / src / py / asyncmcd.py View on Github external
for i in range(0,1024):
        cur.execute('INSERT INTO "mcdtest" VALUES(%s,%s)',('bob2_' + str(i),data))

    et = time.perf_counter();
    print(et - st)

    st = time.perf_counter();

    for i in range(0,1024):
        cur.execute('SELECT "value" FROM "mcdtest" WHERE "key"=%s',('bob2_' + str(i),))

    et = time.perf_counter();
    print(et - st)

mc = AsyncMCD()
db = AsyncDB('testdb','pzread','pz3655742')
testmcd()

tornado.ioloop.IOLoop.instance().start()

asyncdb

Library for Asynchronous data source connections Collection of asyncio drivers.

BSD-2-Clause
Latest version published 6 days ago

Package Health Score

78 / 100
Full package analysis

Popular asyncdb functions