accomodate for pypy

This commit is contained in:
Stefan Harmuth 2021-12-12 17:58:03 +01:00
parent 904caf85ae
commit 78e180871e
2 changed files with 13 additions and 5 deletions

View File

@ -3,7 +3,7 @@ from setuptools import setup
setup(
name='py-tools',
version='0.2',
packages=[''],
packages=['tools'],
url='',
license='GPLv3',
author='Stefan Harmuth',

View File

@ -116,7 +116,7 @@ def printSolution(day: int, part: int, solution: Any, test: bool = None, test_ca
if exec_time is None:
time_output = ""
else:
units = ['s', 'ms', 'μs', 'ns']
units = ['s', 'ms', 'µs', 'ns']
unit = 0
while exec_time < 1:
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:
print(
"%s (TEST day%d/part%d/case%d) -- got '%s' -- expected '%s'"
% ("OK" if test == solution else "FAIL", day, part, test_case, solution, test)
"%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, time_output)
)
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):