diff --git a/bin/generate.py b/bin/generate.py index 18f3bcb3..f695add0 100644 --- a/bin/generate.py +++ b/bin/generate.py @@ -519,6 +519,9 @@ def __init__(self, problem, generator_config, key, name: str, yaml, parent): if ext in self.hardcoded: hashes[ext] = hash_string(self.hardcoded[ext]) + if isinstance(yaml, ruamel.yaml.comments.CommentedMap): + print(yaml.__dict__) + # Warn/Error for unknown keys. for key in yaml: if key in RESERVED_TESTCASE_KEYS: @@ -1626,9 +1629,11 @@ def get_or_add(yaml, key, t=ruamel.yaml.comments.CommentedMap): entry.append(ruamel.yaml.comments.CommentedMap()) path_in_gen = in_file.relative_to('generators') name = path_in_gen.as_posix().replace('/', '_') - entry[-1][f'{name}_{in_file.stem}'] = { - 'copy': path_in_gen.with_suffix('').as_posix() - } + new = ruamel.yaml.comments.CommentedMap( + {'copy': path_in_gen.with_suffix('').as_posix()} + ) + new.fa.set_flow_style() + entry[-1][f'{name}_{in_file.stem}'] = new bar.log('added to generators.yaml.') bar.done() diff --git a/doc/commands.md b/doc/commands.md index 9e9a273a..6a8f1d02 100644 --- a/doc/commands.md +++ b/doc/commands.md @@ -14,7 +14,7 @@ This lists all subcommands and their most important options. - Problem development: - [`bt run [-v] [-t TIMELIMIT] [submissions [submissions ...]] [testcases [testcases ...]]`](#run) - [`bt test [-v] [-t TIMEOUT] submission [--interactive | --samples | [testcases [testcases ...]]]`](#test) - - [`bt generate [-v] [-t TIMEOUT] [--clean] [--check-deterministic] [--jobs JOBS] [--no-validators] [--no-visualizer] [testcases [testcases ...]]`](#generate) + - [`bt generate [-v] [-t TIMEOUT] [--add] [--clean] [--check-deterministic] [--jobs JOBS] [--no-validators] [--no-visualizer] [testcases [testcases ...]]`](#generate) - [`bt pdf [-v] [--all] [--web] [--cp] [--no-timelimit] [--language LANG]`](#pdf) - [`bt solutions [-v] [--web] [--cp] [--order ORDER]`](#solutions) - [`bt stats`](#stats) @@ -156,6 +156,7 @@ Pass a list of testcases or directories to only generate a subset of data. See [ **Flags** - `--check-deterministic`: Check that the .in files are generated deterministically for all test cases, skipping the up-to-date check. +- `--add [, ]`: Add the testcases (inside the directories) as `copy` entries in the `generator.yaml` - `--clean`: Delete all cached files. - `--jobs `/`-j `: The number of parallel jobs to use when generating testcases. Defaults to half the number of cores. Set to `0` to disable parallelization. - `--timeout `/`-t `: Override the default timeout for generators and visualizers (`30s`) and submissions (`1.5*timelimit+1`).