aoc_mod.interactive =================== .. py:module:: aoc_mod.interactive .. autoapi-nested-parse:: Script to initialize a new day for Advent of Code. This script will basically grab the input and puzzle clue from the Advent of Code website. If user specifies a year and day, this script will create the files pertaining to that day and year. Note: This script is being provided as a courtesy and is simply an example of using the AocMod class for a command-line utility. While the functionality is correct here and the CLI can be utilized in a user's local install, it is recommended to perform any desired tweaks to ensure proper functionality. Author: David Eyrich Attributes ---------- .. autoapisummary:: aoc_mod.interactive.LOCAL_PUZZLE_FILEPATH aoc_mod.interactive.DEFAULT_FILE_TEMPLATE Functions --------- .. autoapisummary:: aoc_mod.interactive.create_solution_file aoc_mod.interactive.setup_challenge_day_template aoc_mod.interactive.file_exists aoc_mod.interactive.get_argument_parser aoc_mod.interactive.interactive Module Contents --------------- .. py:data:: LOCAL_PUZZLE_FILEPATH :value: 'challenges/{YEAR}/day{DAY}' .. py:data:: DEFAULT_FILE_TEMPLATE .. py:function:: create_solution_file(filename_in: str, day_path: pathlib.Path, year: int, day: int) read in the template solution file and replace instances of "{YEAR}" and "{DAY}" with the corresponding year and day arguments :param filename_in: path to the input file :type filename_in: str :param day_path: path to the output directory :type filename_out: Path :param year: year that was entered :type year: int :param day: day that was entered :type day: int :raises AocModError: if an error occurs with file operations .. py:function:: setup_challenge_day_template(aoc_mod: aoc_mod.utilities.AocMod, year: int, day: int, output_root_dir: str = '', template_path: str = '') set up a template folder named "challenges/{year}/day{day}" that contains the puzzle input (.txt), instructions (.md) and a template solution file, if specified :param year: year of the AoC puzzle :type year: int :param day: day of the AoC puzzle :type day: int :param output_root_dir: path to be prepended to the template folder, defaults to the current directory :type output_root_dir: str, optional :param template_path: path to a template file to use for solution code, defaults to "" :type template_path: str, optional .. py:function:: file_exists(filepath: str) -> str verify that a file exists for argparse argument :param filepath: path to the file :type filepath: str :raises argparse.ArgumentTypeError: raise if file doesn't exist or filepath is not a file :return: filepath, once verified :rtype: str .. py:function:: get_argument_parser() -> argparse.ArgumentParser create an argument parser and parse user args :return: parser.parse_known_args() return value :rtype: tuple[Type[argparse.Namespace], list[str]] .. py:function:: interactive() Entry-point to the aoc-mod program