accomodate for pypy
This commit is contained in:
parent
904caf85ae
commit
78e180871e
2
setup.py
2
setup.py
@ -3,7 +3,7 @@ from setuptools import setup
|
|||||||
setup(
|
setup(
|
||||||
name='py-tools',
|
name='py-tools',
|
||||||
version='0.2',
|
version='0.2',
|
||||||
packages=[''],
|
packages=['tools'],
|
||||||
url='',
|
url='',
|
||||||
license='GPLv3',
|
license='GPLv3',
|
||||||
author='Stefan Harmuth',
|
author='Stefan Harmuth',
|
||||||
|
|||||||
16
tools/aoc.py
16
tools/aoc.py
@ -116,7 +116,7 @@ def printSolution(day: int, part: int, solution: Any, test: bool = None, test_ca
|
|||||||
if exec_time is None:
|
if exec_time is None:
|
||||||
time_output = ""
|
time_output = ""
|
||||||
else:
|
else:
|
||||||
units = ['s', 'ms', 'μs', 'ns']
|
units = ['s', 'ms', 'µs', 'ns']
|
||||||
unit = 0
|
unit = 0
|
||||||
while exec_time < 1:
|
while exec_time < 1:
|
||||||
exec_time *= 1000
|
exec_time *= 1000
|
||||||
@ -126,11 +126,19 @@ def printSolution(day: int, part: int, solution: Any, test: bool = None, test_ca
|
|||||||
|
|
||||||
if test is not None:
|
if test is not None:
|
||||||
print(
|
print(
|
||||||
"%s (TEST day%d/part%d/case%d) -- got '%s' -- expected '%s'"
|
"%s (TEST day%d/part%d/case%d) -- got '%s' -- expected '%s'%s"
|
||||||
% ("OK" if test == solution else "FAIL", day, part, test_case, solution, test)
|
% ("OK" if test == solution else "FAIL", day, part, test_case, solution, test, time_output)
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
print("Solution to day %s, part %s: %s%s" % (day, part, solution, time_output))
|
print(
|
||||||
|
"Solution to day %s, part %s: %s%s"
|
||||||
|
% (
|
||||||
|
day,
|
||||||
|
part,
|
||||||
|
solution,
|
||||||
|
time_output
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def splitLine(line, split_char: str = ',', return_type: Union[Type, List[Type]] = None):
|
def splitLine(line, split_char: str = ',', return_type: Union[Type, List[Type]] = None):
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user