support injecting supporting files by --inject <file_path>, or injecting a buntch of .py files in a folder by --inject-all <folder_path>
support auto injecting files in aga_injection directory sitting in cwd or any parent folders of cwd by --auto-inject
add __call__ method to problems so that they behave like the old functions
usage
cli command
aga gen problem.py --inject ./supporting.py
supporting.py
def prize_fn(*args, **kwargs):
pass
problem.py
from aga import problem, prize, test_case
from aga.injection import prize_fn # the prize_fn in the supporting will be injected
@test_case(1, aga_expect=1)
@prize(prize_fn) # and can be used here
@problem()
def test(a: int) -> int:
return a * a
assert test(10) == 100
--inject <file_path>
, or injecting a buntch of.py
files in a folder by--inject-all <folder_path>
aga_injection
directory sitting incwd
or any parent folders ofcwd
by--auto-inject
__call__
method to problems so that they behave like the old functionsusage
cli command
supporting.py
problem.py