# 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
import sys
import ws_namespaces as namespaces
from common import db
                       images)
        for r in cursor.fetchall():
            yield r

# cursor is the cursor to the local DB
def get_images_credit(cursor, images):
    if not len(images):
        return []

    images = [x.replace(' ', '_') for x in images]

    conn = db.create_conn(domain = 'commons', family = 'wiki')
    common_cursor = db.use_db(conn, 'commons', 'wiki')
    temp = []
    for r in get_images_credit_db(common_cursor, images):
        temp.append(r[0])
    results = [x[1] for x in get_user_names(common_cursor, temp)]
    common_cursor.close()
    conn.close()

    temp = []
    for r in get_images_credit_db(cursor, images):
        temp.append(r[0])
    results += [x[1] for x in get_user_names(cursor, temp)]

    return results

def get_credit(domain, family, books, pages, images):
    conn = db.create_conn(domain = domain, family = family)
    ns = get_source_ns(domain, family)

# 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: history_credit/get_credit.py
import os
import sys
import ws_namespaces as namespaces
from common import db

                       images)
        for r in cursor.fetchall():
            yield r

# cursor is the cursor to the local DB
def get_images_credit(cursor, images):
    if not len(images):
        return []

    images = [x.replace(' ', '_') for x in images]

    conn = db.create_conn(domain = 'commons', family = 'wiki')
    common_cursor = db.use_db(conn, 'commons', 'wiki')
    temp = []
    for r in get_images_credit_db(common_cursor, images):
        temp.append(r[0])
    results = [x[1] for x in get_user_names(common_cursor, temp)]
    common_cursor.close()
    conn.close()

    temp = []
    for r in get_images_credit_db(cursor, images):
        temp.append(r[0])
    results += [x[1] for x in get_user_names(cursor, temp)]

    return results

def get_credit(domain, family, books, pages, images):
    conn = db.create_conn(domain = domain, family = family)
    ns = get_source_ns(domain, family)

    cursor = db.use_db(conn, domain, family)