run_aoc.py
def main(day_num, split=False):
    """Run the main function from a specified day."""
    day_name = 'day{}'.format(day_num)
    if not re.match(DAY_NAME_MATCH, day_name):
        raise ValueError('Bad day_name.')

    input_func = split_input_lines if split else input_lines
    input_filename = INPUT_NAME.format(day_name)
    input_filepath = os.path.join(day_name, input_filename)
    solution_modulename = SOLUTION_MODULE.format(day_name)
    solution_module = import_module('.'.join((day_name, solution_modulename)))

    for n in ('1', '2'):
        lines = input_func(input_filepath)
        solution_func = getattr(solution_module, 'part' + n)
        before = time()
        solution_func(lines)
        after = time()
        print('Part {} ran in {}.'.format(n, after - before))
Run the main function from a specified day.
Run the main function from a specified day.
Run the main function from a specified day .
def main(day_num, split=False):
    day_name = 'day{}'.format(day_num)
    if not re.match(DAY_NAME_MATCH, day_name):
        raise ValueError('Bad day_name.')
    input_func = split_input_lines if split else input_lines
    input_filename = INPUT_NAME.format(day_name)
    input_filepath = os.path.join(day_name, input_filename)
    solution_modulename = SOLUTION_MODULE.format(day_name)
    solution_module = import_module('.'.join((day_name, solution_modulename)))
    for n in ('1', '2'):
        lines = input_func(input_filepath)
        solution_func = getattr(solution_module, 'part' + n)
        before = time()
        solution_func(lines)
        after = time()
        print('Part {} ran in {}.'.format(n, after - before))
def main ( day_num , split = False ) : day_name = 'day{}' . format ( day_num ) if not re . match ( DAY_NAME_MATCH , day_name ) : raise ValueError ( 'Bad day_name.' ) input_func = split_input_lines if split else input_lines input_filename = INPUT_NAME . format ( day_name ) input_filepath = os . path . join ( day_name , input_filename ) solution_modulename = SOLUTION_MODULE . format ( day_name ) solution_module = import_module ( '.' . join ( ( day_name , solution_modulename ) ) ) for n in ( '1' , '2' ) : lines = input_func ( input_filepath ) solution_func = getattr ( solution_module , 'part' + n ) before = time ( ) solution_func ( lines ) after = time ( ) print ( 'Part {} ran in {}.' . format ( n , after - before ) )
Run the main function from a specified day.
Run the main function from a specified day .
"""Run the main function from a specified day."""
day_num
split