Skip to main content

Advent of Code helper functions

Project description

https://travis-ci.org/mvaal/advent-of-code-helpers.svg?branch=master https://badge.fury.io/py/advent-of-code-helpers.svg https://coveralls.io/repos/github/mvaal/advent-of-code-helpers/badge.svg

Advent of Code helper functions

from aoc.helpers import output, read_input_from_file, input_lines

Setup Guide

Install with pip

pip install advent-of-code-helpers

Usage

Using the template:

from aoc import template


class Part1(template.Part1):
    def __init__(self, day: int, year: int) -> None:
        super().__init__(day, year)

    def solve(self):
        # Read input
        lines = input_lines(self.input())
        # Do some work here

        # Sample output
        result = ','.join(lines)
        return result


def main():
    output_dir = '../out'
    test_data = os.path.join(os.path.dirname(__file__),
                             'resources/test_input.txt')
    Part1(1, 2018).data(test_data).output(output_dir)

    data = os.path.join(os.path.dirname(__file__), 'resources/input.txt')
    Part1(1, 2018).data(data).output(output_dir)


if __name__ == "__main__":
    main()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for advent-of-code-helpers, version 0.1.0
Filename, size File type Python version Upload date Hashes
Filename, size advent-of-code-helpers-0.1.0.tar.gz (2.9 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page