コード例 #1
0
ファイル: cli.py プロジェクト: th3architect/github-to-sqlite
def starred(db_path, username, auth, load):
    "Save repos starred by the specified (or authenticated) username"
    db = sqlite_utils.Database(db_path)
    token = load_token(auth)
    if load:
        stars = json.load(open(load))
    else:
        stars = utils.fetch_all_starred(username, token)

    # Which user are we talking about here?
    if username:
        user = utils.fetch_user(username, token)
    else:
        user = utils.fetch_user(token=token)

    utils.save_stars(db, user, stars)
    utils.ensure_db_shape(db)
コード例 #2
0
def db(starred, user):
    db = sqlite_utils.Database(memory=True)
    utils.save_stars(db, user, starred)
    utils.ensure_foreign_keys(db)
    utils.ensure_repo_fts(db)
    return db
コード例 #3
0
def db(starred, user):
    db = sqlite_utils.Database(memory=True)
    utils.save_stars(db, user, starred)
    utils.ensure_db_shape(db)
    return db