Exemple #1
0
def issues(db_path, repo, issue, auth, load):
    "Save issues for a specified repository, e.g. simonw/datasette"
    db = sqlite_utils.Database(db_path)
    token = load_token(auth)
    if load:
        issues = json.load(open(load))
    else:
        issues = utils.fetch_issues(repo, token, issue)

    issues = list(issues)
    utils.save_issues(db, issues)
Exemple #2
0
def issues(db_path, repo, issue_ids, auth, load):
    "Save issues for a specified repository, e.g. simonw/datasette"
    db = sqlite_utils.Database(db_path)
    token = load_token(auth)
    repo_full = utils.fetch_repo(repo, token)
    utils.save_repo(db, repo_full)
    if load:
        issues = json.load(open(load))
    else:
        issues = utils.fetch_issues(repo, token, issue_ids)

    issues = list(issues)
    utils.save_issues(db, issues, repo_full)
    utils.ensure_db_shape(db)
def db(issues):
    db = sqlite_utils.Database(memory=True)
    db["repos"].insert(
        {"id": 1},
        pk="id",
        columns={
            "organization": int,
            "topics": str,
            "name": str,
            "description": str
        },
    )
    utils.save_issues(db, issues, {"id": 1})
    return db
Exemple #4
0
def issues(db_path, repo, issue, auth, load, rev_req):
    "Save issues for a specified repository, e.g. simonw/datasette"
    db = sqlite_utils.Database(db_path)
    token = load_token(auth)
    if load:
        issues = json.load(open(load))
    else:
        issues = utils.fetch_issues(repo, token, issue)

    issues = list(issues)
    utils.save_issues(db, issues)

    # Get PR reivews
    if rev_req:
        pulls = utils.is_open_pr(issues)
        for pull in pulls:
            reviews = utils.fetch_reviews(repo, token, pull)
            reviews = list(reviews)
            utils.save_reviews(db, reviews)
def db(issues):
    db = sqlite_utils.Database(memory=True)
    utils.save_issues(db, issues)
    return db