All checks were successful
build / build (push) Successful in 2m32s
## What I have done: - basic generation of json files - supported parsers: - healthcheck - result-detail - result-status - file - log - dummy - keyword (keyword, clangtidy, cppcheck, cpplint) - diff - `convert` functions is mature, tested in engr151-24fa last two homeworks and engr151-24fa p3 - teapot and healthcheck should be up to date ## TODO - update all new comming parsers in future. @bomingzh Could you please help me do a code review first then I shall fix all things and rebase? I checked the source code of JOJ3 currently, and find we have more parsers, such as plugin and tierscore, I haven''t added them yet, and some of the keys might have changed such as clang-tidy, can you help me take a look if current version is still up to date? I ll redo the fix tomorrow Co-authored-by: Boming Zhang <bomingzh@sjtu.edu.cn> Reviewed-on: #10 Reviewed-by: 张泊明518370910136 <bomingzh@sjtu.edu.cn> Co-authored-by: jon-lee <jon-lee@sjtu.edu.cn> Co-committed-by: jon-lee <jon-lee@sjtu.edu.cn>
20 lines
605 B
Python
20 lines
605 B
Python
from typing import Union
|
|
|
|
import humanfriendly
|
|
|
|
|
|
class Memory(int):
|
|
def __new__(cls, value: Union[str, int]) -> "Memory":
|
|
if isinstance(value, str):
|
|
parsed = humanfriendly.parse_size(value, binary=True)
|
|
return super().__new__(cls, parsed)
|
|
return super().__new__(cls, value)
|
|
|
|
|
|
class Time(int):
|
|
def __new__(cls, value: Union[str, int]) -> "Time":
|
|
if isinstance(value, str):
|
|
parsed = humanfriendly.parse_timespan(value) * 1_000_000_000 # ns
|
|
return super().__new__(cls, round(parsed))
|
|
return super().__new__(cls, value)
|