dev #10
|
@ -1,5 +1,6 @@
|
|||
import re
|
||||
jon-lee marked this conversation as resolved
|
||||
import shlex
|
||||
jon-lee marked this conversation as resolved
张泊明518370910136
commented
Some Some `with_.update` is still using raw dict, not model with `model_dump`.
|
||||
from pathlib import Path
|
||||
from typing import Any, Callable, Dict, List, Tuple
|
||||
|
||||
from joj3_config_generator.models import result, task
|
||||
|
@ -34,7 +35,10 @@ def get_conf_stage(
|
|||
fn(parser_model, conf_stage.parsers[idx])
|
||||
jon-lee marked this conversation as resolved
Outdated
张泊明518370910136
commented
Do we need to support both kinds of names? Do we need to support both kinds of names?
李衍志523370910113
commented
probably yes, since it is easy for new ta to type it wrong probably yes, since it is easy for new ta to type it wrong
张泊明518370910136
commented
parsers name should be a str enum, force them to use the correct names parsers name should be a str enum, force them to use the correct names
李衍志523370910113
commented
ok, then removed. ok, then removed.
|
||||
elif parser == "diff":
|
||||
jon-lee marked this conversation as resolved
Outdated
张泊明518370910136
commented
underscore underscore
李衍志523370910113
commented
fixed fixed
|
||||
fix_diff(
|
||||
task_stage, task_conf, conf_stage.parsers[idx], conf_stage.executor
|
||||
task_stage,
|
||||
conf_stage.parsers[idx],
|
||||
conf_stage.executor,
|
||||
JOJ3_CONFIG_ROOT / task_conf.path.parent,
|
||||
)
|
||||
else:
|
||||
continue
|
||||
|
@ -154,9 +158,9 @@ def fix_file(file_parser_config: task.ParserFile, file_parser: result.Parser) ->
|
|||
|
||||
def fix_diff(
|
||||
task_stage: task.Stage,
|
||||
jon-lee marked this conversation as resolved
Outdated
张泊明518370910136
commented
move move `continue` to the other branch to reduce nesting
张泊明518370910136
commented
I mean
I mean
```
if parser not in keyword_parser:
continue
```
```
if getattr(task_stage, parser, None) is None:
continue
````
```
if score != score_:
continue
````
李衍志523370910113
commented
fixed. fixed.
|
||||
task_conf: task.Config,
|
||||
diff_parser_config: result.Parser,
|
||||
diff_executor: result.Executor,
|
||||
base_dir: Path,
|
||||
) -> None:
|
||||
skip = task_stage.skip
|
||||
cases = task_stage.cases
|
||||
jon-lee marked this conversation as resolved
Outdated
张泊明518370910136
commented
Is it necessary to rename? Is it necessary to rename?
|
||||
|
@ -180,7 +184,7 @@ def fix_diff(
|
|||
stage_cases.append(
|
||||
result.OptionalCmd(
|
||||
stdin=result.LocalFile(
|
||||
src=str(JOJ3_CONFIG_ROOT / task_conf.path.parent / stdin),
|
||||
src=str(base_dir / stdin),
|
||||
),
|
||||
args=shlex.split(command) if command else None,
|
||||
jon-lee marked this conversation as resolved
Outdated
张泊明518370910136
commented
Pass Pass `JOJ3_CONFIG_ROOT / task_conf.path.parent` as `base_dir` in parameters.
李衍志523370910113
commented
resolved. resolved.
|
||||
cpu_limit=cpu_limit,
|
||||
|
@ -203,9 +207,7 @@ def fix_diff(
|
|||
result.DiffOutputConfig(
|
||||
score=diff_output.score,
|
||||
file_name="stdout",
|
||||
answer_path=str(
|
||||
JOJ3_CONFIG_ROOT / task_conf.path.parent / stdout
|
||||
),
|
||||
answer_path=str(base_dir / stdout),
|
||||
force_quit_on_diff=diff_output.force_quit,
|
||||
jon-lee marked this conversation as resolved
Outdated
张泊明518370910136
commented
Create models for these dicts, then update them with the dict from Create models for these dicts, then update them with the dict from `model_dump`
李衍志523370910113
commented
@bomingzh I don't think we can change it. This is to make proper alias so that we can get the content of @bomingzh I don't think we can change it. This is to make proper alias so that we can get the content of `result-status`.
张泊明518370910136
commented
Then ```
class DummyConfig(BaseModel):
score: int
comment: str
```
Then `dummy_parser_.with_.update(dummy_config(...).model_dump())`.
李衍志523370910113
commented
fixed fixed
|
||||
always_hide=diff_output.hide,
|
||||
compare_space=not diff_output.ignore_spaces,
|
||||
|
|
Loading…
Reference in New Issue
Block a user
Path should not be relative to
JOJ3_CONFIG_ROOT
in this file, should be relative totask.toml
dirI reckon you said things is relative to
JOJ3_CONFIG_ROOT
in JTC before. we have atask.type
intask.toml
to mend the pathconfig.path
is relative toJOJ3_CONFIG_ROOT
.could you explain further? I m not quite sure my understanding is clear.
In
joj3_config_generator/models/task.py
,Config.path
is relative toJOJ3_CONFIG_ROOT
, sotask.toml
will located atJOJ3_CONFIG_ROOT / task_conf.path
in JTC.