<commit_before>#!/usr/bin/env python3

"""\
This script generates an .ics calendar file from a Hal Higdon training
plan, tailored to a race day that you specify.

"""

from datetime import datetime, timedelta
from urllib.parse import urlparse
import dateutil.parser
import icalendar
import requests
import bs4

__version__ = '0.1.1'

DAY = timedelta(1)

def get_higdon_plan(url):
    """
    Given a URL on Hal Higdon's website, scrape out the training plan
    and return in as a daily sequence.

    """
    resp = requests.get(url)
    soup = bs4.BeautifulSoup(resp.text, features="html.parser")

    def gen_week(row):
        for cell in row.findAll('td')[1:]:
            yield cell.text

    def gen_all(table):
        for row in table.findAll('tr')[1:]:
            yield from gen_week(row)

    table = soup.find('table', attrs={'class': 'table-training'})<commit_msg>fix for updated higdon website<commit_after>#!/usr/bin/env python3

"""\
This script generates an .ics calendar file from a Hal Higdon training
plan, tailored to a race day that you specify.

"""

from datetime import datetime, timedelta
from urllib.parse import urlparse
import dateutil.parser
import icalendar
import requests
import bs4

__version__ = '0.1.1'

DAY = timedelta(1)

def get_higdon_plan(url):
    """
    Given a URL on Hal Higdon's website, scrape out the training plan
    and return in as a daily sequence.

    """
    resp = requests.get(url)
    soup = bs4.BeautifulSoup(resp.text, features="html.parser")

    def gen_week(row):
        for cell in row.findAll('td')[1:]:
            yield cell.text

    def gen_all(table):
        for row in table.findAll('tr')[1:]:
            yield from gen_week(row)

    table = soup.find('table', attrs={'class': 'tablesaw'})
{'fraction_non_alphanumeric': 0.11035653650254669, 'fraction_numerical': 0.010186757215619695, 'mean_word_length': 3.2705314009661834, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6130137', 'n_tokens_mistral': 579, 'n_tokens_neox': 556, 'n_words': 185}