<commit_before>import re
from datetime import datetime

def handle_parse_exception(soup):
    print '\nException parsing HTML.', \
          'Probably contained something unexpected.', \
          'Check unexpected_output.html'
    with open('unexpected_output.html', 'wb') as output:
        output.write(soup.prettify().encode('UTF-8')) 

def parse_court_names(soup):
    try:
        # Load list of courts and fips codes
        fips = [tag['value'] for tag in soup.find_all('input', 
            {'name':'courtFips'})]
        names = [tag['value'] for tag in soup.find_all('input', 
            {'name':'courtName'})]
        court_names = {}
        for f, c in zip(fips, names):
            court_names[f] = c
        return court_names
    except:
        handle_parse_exception(soup)
        raise

def parse_hearing_date_search(soup):
    try:
        cases = []
        rows = soup.find('table', {'class':'tableborder'}).find_all('tr')
        for row in rows:
            cells = row.find_all('td')
            if cells[0]['class'][0] == 'gridheader':
                continue
            cases.append({
                'details_url': cells[1].a['href'],
                'status': list(cells[6].stripped_strings)[0]
            })
        return cases
    except:
        handle_parse_exception(soup)
        raise

def next_button_found(soup):
    try:
        return soup.find('input', {'name': 'caseInfoScrollForward'}) is not None
    except:<commit_msg>Handle blank case status cell<commit_after>import re
from datetime import datetime

def handle_parse_exception(soup):
    print '\nException parsing HTML.', \
          'Probably contained something unexpected.', \
          'Check unexpected_output.html'
    with open('unexpected_output.html', 'wb') as output:
        output.write(soup.prettify().encode('UTF-8')) 

def parse_court_names(soup):
    try:
        # Load list of courts and fips codes
        fips = [tag['value'] for tag in soup.find_all('input', 
            {'name':'courtFips'})]
        names = [tag['value'] for tag in soup.find_all('input', 
            {'name':'courtName'})]
        court_names = {}
        for f, c in zip(fips, names):
            court_names[f] = c
        return court_names
    except:
        handle_parse_exception(soup)
        raise

def parse_hearing_date_search(soup):
    try:
        cases = []
        rows = soup.find('table', {'class':'tableborder'}).find_all('tr')
        for row in rows:
            cells = row.find_all('td')
            if cells[0]['class'][0] == 'gridheader':
                continue
            details_url = cells[1].a['href']
            status_cell_content = list(cells[6].stripped_strings)
            status = ''
            if len(status_cell_content) > 0:
                status = status_cell_content[0]
            cases.append({
                'details_url': details_url,
                'status': status
            })
        return cases
    except:
        handle_parse_exception(soup)
        raise

def next_button_found(soup):
    try:
        return soup.find('input', {'name': 'caseInfoScrollForward'}) is not None
    except:
{'fraction_non_alphanumeric': 0.12575420768497936, 'fraction_numerical': 0.00412829469672912, 'mean_word_length': 2.185035389282103, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '7039002', 'n_tokens_mistral': 935, 'n_tokens_neox': 912, 'n_words': 213}