Beispiel #1
0
def random_pick(max_past_days):
    chosen = random_generate(max_past_days=max_past_days)
    commit_readme(
        create_readme(README_TEMPLATE,
                      README_NEW,
                      chosen.get_new_dir_name(),
                      chosen.to_dict(),
                      from_input=False))
Beispiel #2
0
def week_pick():
    ps = []
    for _ in range(7):
        ps.append(random_generate(ps))
    for p in ps:
        print(p.get_new_dir_name())
    rms = [
        create_readme(README_TEMPLATE,
                      README_NEW,
                      p.get_new_dir_name(),
                      p.to_dict(),
                      from_input=False) for p in ps
    ]
    comfirmed = input(f"write to the above files and commit? [T]/F: ")
    if comfirmed in TRUE_ALIAS:
        for readme in rms:
            commit_readme(readme, auto=True)
Beispiel #3
0
def choose_pick(max_past_days):
    check_cwd()
    pid = int(input('choose problem id: '))
    dates, lc_ids = get_past_problems(SUB_DIRS)
    problems_to_do = \
      list(filter(lambda x: x.pid not in lc_ids,
                  Problem.from_file(get_new_date(dates, max_past_days))))
    if pid in (i.pid for i in problems_to_do):
        chosen: Problem = next(i for i in problems_to_do if i.pid == pid)
        commit_readme(
            create_readme(README_TEMPLATE,
                          README_NEW,
                          chosen.get_new_dir_name(),
                          chosen.to_dict(),
                          from_input=False))
    elif pid in lc_ids:
        print("problem have been chosen")
    else:
        print("problem id is not in the database")