# Path: common/db.py
# def user_db_prefix():
# def database_name(domain, family):
# def use_db(conn, domain, family, cursor_class = None):
# def create_conn(**kwargs):
#     def __init__(self, db_name):
#     def open(self):
#     def close(self):
# def connection(db_obj):
# class UserDb(object):


import os,codecs
import time, sys
    import urllib
            import pywikibot
    import pywikibot
        import graph
from ws_category import domain_urls as urls
from common_stat import decode_res, disambiguations
from common import db
    from common.pywikibot_utils import safe_put
    'pa',
    'pl',
    'pt',
    'ro',
    'ru',
    'sa',
    'sl',
    'sr',
    'sv',
    'ta',
    'te',
    'th',
    'tr',
    'uk',
    'vec',
    'vi',
    'zh',
    'zh-min-nan'
])

def catreq(cat, ns):
    return "select /* SLOW_OK */ count(cl_from) as num from categorylinks where cl_to='%s' and cl_from in (select page_id from page where page_namespace=%d)"%(cat,ns)

def get_stats(domains):

    res = {}

    for dom in domains:
        print dom
        conn = db.create_conn(domain = dom, family = 'wikisource')

# Path: common/db.py
# def user_db_prefix():
# def database_name(domain, family):
# def use_db(conn, domain, family, cursor_class = None):
# def create_conn(**kwargs):
#     def __init__(self, db_name):
#     def open(self):
#     def close(self):
# def connection(db_obj):
# class UserDb(object):


# Path: statistics/gen_stats.py
import os,codecs
import time, sys
    import urllib
            import pywikibot
    import pywikibot
        import graph
from ws_category import domain_urls as urls
from common_stat import decode_res, disambiguations
from common import db
    from common.pywikibot_utils import safe_put

    'pa',
    'pl',
    'pt',
    'ro',
    'ru',
    'sa',
    'sl',
    'sr',
    'sv',
    'ta',
    'te',
    'th',
    'tr',
    'uk',
    'vec',
    'vi',
    'zh',
    'zh-min-nan'
])

def catreq(cat, ns):
    return "select /* SLOW_OK */ count(cl_from) as num from categorylinks where cl_to='%s' and cl_from in (select page_id from page where page_namespace=%d)"%(cat,ns)

def get_stats(domains):

    res = {}

    for dom in domains:
        print dom
        conn = db.create_conn(domain = dom, family = 'wikisource')

        cursor = db.use_db(conn, domain = dom, family = 'wikisource')