All checks were successful
build / build (push) Successful in 2m18s
- 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
Co-authored-by: Boming Zhang <bomingzh@sjtu.edu.cn>
Reviewed-on: https://focs.ji.sjtu.edu.cn/git/JOJ/JOJ3-config-generator/pulls/10
Reviewed-by: Boming Zhang <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)
|