

def one_to_dict(cur=None, row=None, col_names=None):
    'Fetch one row from a cursor and make it as a dict.\n\n    If `col_names` or `row` is provided, it will be used first.\n\n    :rtype: dict\n    '
    if (col_names is None):
        assert (cur is not None), 'You must specify cur or col_names.'
        col_names = extract_col_names(cur)
    if (row is None):
        assert (cur is not None), 'You must specify cur or row.'
        row = cur.fetchone()
    return dict(izip(col_names, row))

dataset/ETHPy150Open moskytw/mosql/mosql/db.py one_to_dict/original