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)
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
def db(starred, user): db = sqlite_utils.Database(memory=True) utils.save_stars(db, user, starred) utils.ensure_db_shape(db) return db