make AOCDay.getInput() return type casted input
This commit is contained in:
parent
a2aa81388c
commit
353ff51411
18
tools/aoc.py
18
tools/aoc.py
@ -168,17 +168,17 @@ class AOCDay:
|
|||||||
|
|
||||||
answer_cache.save()
|
answer_cache.save()
|
||||||
|
|
||||||
def getInput(self) -> Union[str, List]:
|
def getInput(self, return_type: Type = None) -> Any:
|
||||||
if len(self.input) == 1:
|
if len(self.input) == 1:
|
||||||
return self.input[0]
|
if return_type:
|
||||||
|
return return_type(self.input[0])
|
||||||
|
else:
|
||||||
|
return self.input[0]
|
||||||
else:
|
else:
|
||||||
return self.input.copy()
|
if return_type:
|
||||||
|
return [return_type(i) for i in self.input]
|
||||||
def getInputListAsType(self, return_type: Type) -> List:
|
else:
|
||||||
"""
|
return self.input.copy()
|
||||||
get input as list casted to return_type, each line representing one list entry
|
|
||||||
"""
|
|
||||||
return [return_type(i) for i in self.input]
|
|
||||||
|
|
||||||
def getMultiLineInputAsArray(self, return_type: Type = None, join_char: str = None) -> List:
|
def getMultiLineInputAsArray(self, return_type: Type = None, join_char: str = None) -> List:
|
||||||
"""
|
"""
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user