Пример #1
0
    parser = ArgumentParser(description='Update football results database with season information')
    add_database_option(parser)
    add_logging_options(parser)
    return parser.parse_args()


def create_season_json():
    seasons_json = get_seasons_json()
    messages.verbose_message("Extracting season JSON")
    store(seasons_json, get_seasons())


def main(arguments: Namespace):
    create_season_json()

    seasons_json = get_seasons_json()
    with seasons_json.open() as in_file:
        json_text = load(in_file)
        for data in json_text['api']['leagues']:
            create_season_from_json(data)

    with Database(arguments.database) as db:
        db.create_table(Season)
        db.create_rows(Season)


if __name__ == '__main__':
    arguments = parse_command_line()
    set_logging_options(arguments)
    main(arguments)
Пример #2
0
                plot(ax, datum, x_limit, args.lines)
                used.add((chunk_id, 2))

            for i in range(0, nrows):
                for j in range(1, 3):
                    if (i, j) not in used:
                        fig.delaxes(axes[i, j])
    else:
        data = compute_aggregated_data(seasons, selected_team, func,
                                       args.negate, args.venue, args.half)
        x_limit, _ = find_limits(data)
        display = DisplayGrid(len(data), 2)
        fig, axes = plt.subplots(nrows=display.nrows,
                                 ncols=display.ncols,
                                 figsize=(20, 10),
                                 squeeze=False)
        for i, datum in enumerate(data):
            cell_x, cell_y = display.index(i)
            ax = axes[cell_x, cell_y]
            plot(ax, datum, x_limit, args.lines)

    title = construct_title(league, func, args.negate, args.venue, args.half)
    fig.suptitle(title, fontweight='bold', fontsize=14)
    plt.show(block=args.block)


if __name__ == '__main__':
    args = parse_command_line()
    set_logging_options(args)
    main(args)