From 469092002b7f1e1657468941bd86ccd3738baac3 Mon Sep 17 00:00:00 2001 From: Tom van der Lee Date: Thu, 1 Dec 2022 09:36:18 +0100 Subject: Added pre-commit --- aoc/__init__.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'aoc/__init__.py') diff --git a/aoc/__init__.py b/aoc/__init__.py index b13489c..5fce415 100644 --- a/aoc/__init__.py +++ b/aoc/__init__.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- import os from abc import ABC from typing import Generator, Any, Iterator @@ -5,23 +6,24 @@ from typing import Generator, Any, Iterator class BaseAssignment(ABC): example_result = NotImplemented + def __init__(self, path): self.path = path def __str__(self): - return f'{self.__module__}.{self.__class__.__name__}' + return f"{self.__module__}.{self.__class__.__name__}" def parse_item(self, item: str) -> Any: return item - def read_input(self, example = False) -> Generator: - file = f'{self.path}/input.txt' + def read_input(self, example=False) -> Generator: + file = f"{self.path}/input.txt" if example or not os.path.isfile(file): - file = f'{self.path}/example.txt' + file = f"{self.path}/example.txt" - with open(file, 'r') as input_file: + with open(file, "r") as input_file: for line in input_file.readlines(): yield self.parse_item(line.strip()) def run(self, input: Iterator) -> Any: - raise NotImplementedError('Please implement run') \ No newline at end of file + raise NotImplementedError("Please implement run") -- cgit v1.2.3