This commit is contained in:
		
						commit
						45903ae308
					
				|  | @ -2,7 +2,7 @@ from pathlib import Path | |||
| from typing import Tuple | ||||
| 
 | ||||
| import inquirer | ||||
| import rtoml | ||||
| import tomli | ||||
| import yaml | ||||
| 
 | ||||
| from joj3_config_generator.models import answer, joj1, repo, task | ||||
|  | @ -32,8 +32,8 @@ def load_joj1_yaml(yaml_path: Path) -> joj1.Config: | |||
| def load_joj3_toml( | ||||
|     root_path: Path, repo_toml_path: Path, task_toml_path: Path | ||||
| ) -> Tuple[repo.Config, task.Config]: | ||||
|     repo_obj = rtoml.loads(repo_toml_path.read_text()) | ||||
|     task_obj = rtoml.loads(task_toml_path.read_text()) | ||||
|     repo_obj = tomli.loads(repo_toml_path.read_text()) | ||||
|     task_obj = tomli.loads(task_toml_path.read_text()) | ||||
|     repo_conf = repo.Config(**repo_obj) | ||||
|     repo_conf.root = root_path | ||||
|     repo_conf.path = repo_toml_path.relative_to(root_path) | ||||
|  |  | |||
|  | @ -2,7 +2,7 @@ import json | |||
| from pathlib import Path | ||||
| from typing import Optional | ||||
| 
 | ||||
| import rtoml | ||||
| import tomlkit | ||||
| import typer | ||||
| from typing_extensions import Annotated | ||||
| 
 | ||||
|  | @ -34,7 +34,7 @@ def create( | |||
|     result_dict = task_model.model_dump( | ||||
|         mode="json", by_alias=True, exclude_none=True, exclude_unset=True | ||||
|     ) | ||||
|     toml_str = rtoml.dumps(result_dict) | ||||
|     toml_str = tomlkit.dumps(result_dict) | ||||
|     if toml_path is None: | ||||
|         logger.info("Writing task toml to stdout") | ||||
|         print(toml_str) | ||||
|  | @ -52,7 +52,7 @@ def convert_joj1(yaml_path: Path, toml_path: Path) -> None: | |||
|     joj1_model = load_joj1_yaml(yaml_path) | ||||
|     task_model = convert_joj1_conf(joj1_model) | ||||
|     result_dict = task_model.model_dump(mode="json", by_alias=True, exclude_none=True) | ||||
|     toml_path.write_text(rtoml.dumps(result_dict)) | ||||
|     toml_path.write_text(tomlkit.dumps(result_dict)) | ||||
| 
 | ||||
| 
 | ||||
| @app.command() | ||||
|  |  | |||
|  | @ -45,7 +45,7 @@ def get_conf_stage( | |||
| 
 | ||||
| def get_parser_handler_map( | ||||
|     task_stage: task.Stage, | ||||
|     diff_executor_config: result.Executor, | ||||
|     executor: result.Executor, | ||||
|     task_root: Path, | ||||
|     task_path: Path, | ||||
| ) -> Dict[ParserEnum, Tuple[Callable[[Any, result.Parser], None], Any]]: | ||||
|  | @ -62,7 +62,7 @@ def get_parser_handler_map( | |||
|             partial( | ||||
|                 fix_diff, | ||||
|                 task_stage=task_stage, | ||||
|                 diff_executor_config=diff_executor_config, | ||||
|                 executor=executor, | ||||
|                 task_root=task_root, | ||||
|                 task_path=task_path, | ||||
|             ), | ||||
|  | @ -159,9 +159,9 @@ def fix_file(file_parser_config: task.ParserFile, file_parser: result.Parser) -> | |||
| 
 | ||||
| def fix_diff( | ||||
|     _: task.ParserDiff, | ||||
|     diff_parser_config: result.Parser, | ||||
|     diff_parser: result.Parser, | ||||
|     task_stage: task.Stage, | ||||
|     diff_executor_config: result.Executor, | ||||
|     executor: result.Executor, | ||||
|     task_root: Path, | ||||
|     task_path: Path, | ||||
| ) -> None: | ||||
|  | @ -177,8 +177,7 @@ def fix_diff( | |||
|     stage_cases = [] | ||||
|     parser_cases = [] | ||||
|     for case, case_stage in valid_cases: | ||||
|         stage_cases.append( | ||||
|             result.OptionalCmd( | ||||
|         cmd = result.OptionalCmd( | ||||
|             stdin=result.LocalFile( | ||||
|                 src=str(base_dir / (case_stage.in_ or f"{case}.in")) | ||||
|             ), | ||||
|  | @ -188,9 +187,18 @@ def fix_diff( | |||
|             memory_limit=case_stage.limit.mem, | ||||
|             proc_limit=50, | ||||
|         ) | ||||
|         ) | ||||
|         parser_cases.append( | ||||
|             result.DiffCasesConfig( | ||||
|         if cmd.args == executor.with_.default.args: | ||||
|             cmd.args = None | ||||
|         if cmd.cpu_limit == executor.with_.default.cpu_limit: | ||||
|             cmd.cpu_limit = None | ||||
|         if cmd.clock_limit == executor.with_.default.clock_limit: | ||||
|             cmd.clock_limit = None | ||||
|         if cmd.memory_limit == executor.with_.default.memory_limit: | ||||
|             cmd.memory_limit = None | ||||
|         if cmd.proc_limit == executor.with_.default.proc_limit: | ||||
|             cmd.proc_limit = None | ||||
|         stage_cases.append(cmd) | ||||
|         parser_case = result.DiffCasesConfig( | ||||
|             outputs=[ | ||||
|                 result.DiffOutputConfig( | ||||
|                     score=case_stage.diff.output.score, | ||||
|  | @ -202,13 +210,13 @@ def fix_diff( | |||
|                 ) | ||||
|             ] | ||||
|         ) | ||||
|         ) | ||||
|         parser_cases.append(parser_case) | ||||
|     for case in default_cases: | ||||
|         stage_cases.append( | ||||
|             result.OptionalCmd(stdin=result.LocalFile(src=str(base_dir / f"{case}.in"))) | ||||
|         cmd = result.OptionalCmd( | ||||
|             stdin=result.LocalFile(src=str(base_dir / f"{case}.in")) | ||||
|         ) | ||||
|         parser_cases.append( | ||||
|             result.DiffCasesConfig( | ||||
|         stage_cases.append(cmd) | ||||
|         parser_case = result.DiffCasesConfig( | ||||
|             outputs=[ | ||||
|                 result.DiffOutputConfig( | ||||
|                     # TODO: how to balance a good score strategy | ||||
|  | @ -218,9 +226,9 @@ def fix_diff( | |||
|                 ) | ||||
|             ] | ||||
|         ) | ||||
|         ) | ||||
|     diff_executor_config.with_.cases = stage_cases | ||||
|     diff_parser_config.with_ = result.DiffConfig(name="diff", cases=parser_cases) | ||||
|         parser_cases.append(parser_case) | ||||
|     executor.with_.cases = stage_cases | ||||
|     diff_parser.with_ = result.DiffConfig(name="diff", cases=parser_cases) | ||||
| 
 | ||||
| 
 | ||||
| def get_testcases( | ||||
|  |  | |||
							
								
								
									
										89
									
								
								pdm.lock
									
									
									
									
									
								
							
							
						
						
									
										89
									
								
								pdm.lock
									
									
									
									
									
								
							|  | @ -5,7 +5,7 @@ | |||
| groups = ["default", "dev", "lint", "test"] | ||||
| strategy = ["inherit_metadata"] | ||||
| lock_version = "4.5.0" | ||||
| content_hash = "sha256:424d6498e1179468af00a955af3b14d987aa1ffa281b9f028f4a62ce71e33506" | ||||
| content_hash = "sha256:871844bf136123c9677a605fce706c5ea8f86734f29eefcba10513c082531657" | ||||
| 
 | ||||
| [[metadata.targets]] | ||||
| requires_python = ">=3.9" | ||||
|  | @ -821,79 +821,6 @@ files = [ | |||
|     {file = "rich-13.9.4.tar.gz", hash = "sha256:439594978a49a09530cff7ebc4b5c7103ef57baf48d5ea3184f21d9a2befa098"}, | ||||
| ] | ||||
| 
 | ||||
| [[package]] | ||||
| name = "rtoml" | ||||
| version = "0.12.0" | ||||
| requires_python = ">=3.9" | ||||
| summary = "" | ||||
| groups = ["default"] | ||||
| files = [ | ||||
|     {file = "rtoml-0.12.0-cp310-cp310-macosx_10_12_x86_64.whl", hash = "sha256:750761d30c70ffd45cd30ef8982e4c0665e76914efcc828ff4cd8450acddd328"}, | ||||
|     {file = "rtoml-0.12.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:af6dd6adc39a5be17dc6b07e13c1dd0e07af095a909e04355b756ad7ee7a7211"}, | ||||
|     {file = "rtoml-0.12.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4f4f3f7667c4d030669ae378da5d15a5c8dcb0065d12d2505b676f84828426b0"}, | ||||
|     {file = "rtoml-0.12.0-cp310-cp310-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:76261f8ffdf78f0947c6628f364807073f3d30c2f480f5d7ee40d09e951ec84a"}, | ||||
|     {file = "rtoml-0.12.0-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:71884d293c34abf37d14b5e561ea0e57d71caa81b6f42c4c04120c7dd19650ca"}, | ||||
|     {file = "rtoml-0.12.0-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:4d991801446b964040b914527c62ae42d3f36be52a45be1d1f5fc2f36aa1dce3"}, | ||||
|     {file = "rtoml-0.12.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:08da11609dab48b57ee2969beec593863db1f83957d0879a8bb88d2d41b44f2c"}, | ||||
|     {file = "rtoml-0.12.0-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:8a2dbb5aa11ab76e4f2f6fcfc53996eb1a3aaedd8465352b597a8a70e1ec0818"}, | ||||
|     {file = "rtoml-0.12.0-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:ded14b9b0fce50bfe38eab6a3f8300eb969019f69bd64a3f6eb1b47949d9f34d"}, | ||||
|     {file = "rtoml-0.12.0-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:79adf4665f50153cb1b625bb1271fd9c0362ce48ffb7ee12c729e7f8087242ce"}, | ||||
|     {file = "rtoml-0.12.0-cp310-cp310-win32.whl", hash = "sha256:17b9628a7c70404fdd440d95eea5ba749653f000773df868d4accc2d61760db4"}, | ||||
|     {file = "rtoml-0.12.0-cp310-cp310-win_amd64.whl", hash = "sha256:540e461998f419a11fd73ebd2aa6de8986af8348ddfd18d2eb2c5f57ec9ed08d"}, | ||||
|     {file = "rtoml-0.12.0-cp311-cp311-macosx_10_12_x86_64.whl", hash = "sha256:d986a7ea113122023a76ff9b2ed40ecc86ff9ed1e5c459010b6b06b5f05ef4ed"}, | ||||
|     {file = "rtoml-0.12.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:0229a51ec690b30a899b60ec06ae132c4ebf86bc81efd2a9a131f482570324d1"}, | ||||
|     {file = "rtoml-0.12.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:51c9112935bd33dd9d30d45ff37567f0ece78b0ff5aa823072d448a96693f429"}, | ||||
|     {file = "rtoml-0.12.0-cp311-cp311-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:69a0bbd81ab27272845f2d2c211f7a1fc18d16ef6fc756796ec636589867c1e5"}, | ||||
|     {file = "rtoml-0.12.0-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:90becb592ac6129b132d299fc4c911c470fbf88d032a0df7987f9a30c8260966"}, | ||||
|     {file = "rtoml-0.12.0-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:d70ac00b0d838f5e54a5d957a74399aac2e671c60354f6457e0400c5e509d83d"}, | ||||
|     {file = "rtoml-0.12.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:53ce9204b52a51cb4d7aa29eb846cd78ce8644f3750c8de07f07f1561150c109"}, | ||||
|     {file = "rtoml-0.12.0-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:1b59008b2e8e5216aab65a9a711df032a89ef91c5bd66a1e22c74cd5ea4dfe7a"}, | ||||
|     {file = "rtoml-0.12.0-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:1a571e582b14cf4d36f52ae2066c098e4265714780db9d2ba1f1f2fc6718cf7e"}, | ||||
|     {file = "rtoml-0.12.0-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:4171fce22163ba0c5f9ca07320d768e25fd3c5603cf56366f327443e60aabc8c"}, | ||||
|     {file = "rtoml-0.12.0-cp311-cp311-win32.whl", hash = "sha256:1f11b74bd8f730bb87fdbace4367d49adec006b75228fea869da3e9e460a20b2"}, | ||||
|     {file = "rtoml-0.12.0-cp311-cp311-win_amd64.whl", hash = "sha256:6bc52a5d177668d9244c09aad75df8dc9a022155e4002850c03badba51585e5c"}, | ||||
|     {file = "rtoml-0.12.0-cp311-cp311-win_arm64.whl", hash = "sha256:e8308f6b585f5b9343fc54bd028d2662c0d6637fa123d5f8b96beef4626a323a"}, | ||||
|     {file = "rtoml-0.12.0-cp312-cp312-macosx_10_12_x86_64.whl", hash = "sha256:ac75a75f15924fa582df465a3b1f4495710e3d4e1930837423ea396bcb1549b6"}, | ||||
|     {file = "rtoml-0.12.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:fd895de2745b4874498608948a9496e587b3154903ca8c6b4dec8f8b6c2a5252"}, | ||||
|     {file = "rtoml-0.12.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1c1c82d2a79a943c33b851ec3745580ea93fbc40dcb970288439107b6e4a7062"}, | ||||
|     {file = "rtoml-0.12.0-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:5ada7cc9fc0b94d1f5095d71d8966d10ee2628d69c574e3ef8c9e6dd36a9d525"}, | ||||
|     {file = "rtoml-0.12.0-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:a7e4c13ed587d5fc8012aaacca3b73d283191f5462f27b005cadbf9a30083428"}, | ||||
|     {file = "rtoml-0.12.0-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:cd24ed60f588aa7262528bfabf97ebf776ff1948ae78829c00389813cd482374"}, | ||||
|     {file = "rtoml-0.12.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:827159e7313fa35b8495c3ec1c54526ccd2fbd9713084ad959c4455749b4a68d"}, | ||||
|     {file = "rtoml-0.12.0-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:2fad4117620e22482468f28556362e778d44c2065dfac176bf42ac4997214ae4"}, | ||||
|     {file = "rtoml-0.12.0-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:5248359a67aa034e409f2b06fed02de964bf9dd7f401661076dd7ddf3a81659b"}, | ||||
|     {file = "rtoml-0.12.0-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:28a81c9335f2d7b9cdb6053940b35c590c675222d4935f7a4b8751071e5a5519"}, | ||||
|     {file = "rtoml-0.12.0-cp312-cp312-win32.whl", hash = "sha256:b28c7882f60622645ff7dd180ddb85f4e018406b674ea86f65d99ac0f75747bc"}, | ||||
|     {file = "rtoml-0.12.0-cp312-cp312-win_amd64.whl", hash = "sha256:d7e187c38a86202bde843a517d341c026f7b0eb098ad5396ed40f93170565bd7"}, | ||||
|     {file = "rtoml-0.12.0-cp312-cp312-win_arm64.whl", hash = "sha256:477131a487140163cc9850a66d92a864fb507b37d81fb3366ad5203d30c85520"}, | ||||
|     {file = "rtoml-0.12.0-cp313-cp313-macosx_10_12_x86_64.whl", hash = "sha256:12e99b493f0d59ad925b307b4c3b15c560ee44c672dce2ddce227e550560af5e"}, | ||||
|     {file = "rtoml-0.12.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:a058a1739a2519a41afe160280dcd791c202068e477ceb7ebf606830299c63af"}, | ||||
|     {file = "rtoml-0.12.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8f5ee3825c9c7aad732b184fed58cc2c368360ca8d553516663374937b9497be"}, | ||||
|     {file = "rtoml-0.12.0-cp313-cp313-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:3637da07651aa522fcaa81d7944167a9db886c687ec81c31aade0048caa51c97"}, | ||||
|     {file = "rtoml-0.12.0-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:559f77c916cf02e0261756a7924382e5b4a529a316106aba9b7ff4b3b39e227a"}, | ||||
|     {file = "rtoml-0.12.0-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:0b9156c2d30a2917f172b9a98c251864d3063dc5bc9764147779245c8a690441"}, | ||||
|     {file = "rtoml-0.12.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:bea9797f08311b0b605cae671abd884724d8d3d6524c184ccf8c70b220a9a68b"}, | ||||
|     {file = "rtoml-0.12.0-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:b522f671f8964a79dda162c9985950422e27fe9420dd924257dee0184c8d047f"}, | ||||
|     {file = "rtoml-0.12.0-cp313-cp313-musllinux_1_1_aarch64.whl", hash = "sha256:321ee9dca365b5c1dab8c74617e7f8c941de3fdc10ac9f3c11c9ac261418ed80"}, | ||||
|     {file = "rtoml-0.12.0-cp313-cp313-musllinux_1_1_x86_64.whl", hash = "sha256:57912b150aa48a8a90b599b57691a165092a9f5cf9a98bf431b1cd380e58414a"}, | ||||
|     {file = "rtoml-0.12.0-cp313-cp313-win32.whl", hash = "sha256:7aebc94ed208ff46e6ce469ef30b98095932a3e74b99bde102a0f035d5034620"}, | ||||
|     {file = "rtoml-0.12.0-cp313-cp313-win_amd64.whl", hash = "sha256:1c88e48946adef48dce2dc54f1380f6ff0d580f06770f9ca9600ef330bc06c39"}, | ||||
|     {file = "rtoml-0.12.0-cp313-cp313-win_arm64.whl", hash = "sha256:730770673649220d4265d9986d3a9089d38434f36c1c629b98a58eb2bbee9cfb"}, | ||||
|     {file = "rtoml-0.12.0-cp39-cp39-macosx_10_12_x86_64.whl", hash = "sha256:9d3d266cbb0d42cf83658eb0ecc40288036fe986b200cefd2c6ad8e3c714b4cf"}, | ||||
|     {file = "rtoml-0.12.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:4e919d19518a8f3c769601105677c2c2c73c1a7a1ac4306830f570801abf3299"}, | ||||
|     {file = "rtoml-0.12.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:48f6ca7405f3bb45307029156b2f69c7048cc8c0cd840356f81f64091030adeb"}, | ||||
|     {file = "rtoml-0.12.0-cp39-cp39-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:8c7865af375c8f40e75bcf82cbb10e20d662f239a9f49e5597e28742c938f4e5"}, | ||||
|     {file = "rtoml-0.12.0-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:67e7c7c61224d2b31aa2d6f9bbdd81011a505cb0388f2e9e6d815a840dd6c39a"}, | ||||
|     {file = "rtoml-0.12.0-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:206c7ba5ab2a4b5f452565b1751430cc14d7b1423045370e5968a0e5a15846a7"}, | ||||
|     {file = "rtoml-0.12.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b8f4ae09e9ca8de5bd874b661302f8083dc1a47b0865f99f7becf24903f76736"}, | ||||
|     {file = "rtoml-0.12.0-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:3c7b633b74f7590f4c1e1fe36c1e6a26ca6dfa6491b9d91530d6e907b29d296b"}, | ||||
|     {file = "rtoml-0.12.0-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:63f6742f3e0dd076309c195af422447513ccace978023784607ee22302f4a900"}, | ||||
|     {file = "rtoml-0.12.0-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:9d5564dcc5ca1755f5bae59e036fb4e255ed59a9f8af836eb2d9765d125b11bb"}, | ||||
|     {file = "rtoml-0.12.0-cp39-cp39-win32.whl", hash = "sha256:fe180b78d026499ee3b42c368a6c060a3d5b23838f17dde42d099839a8f8a2c6"}, | ||||
|     {file = "rtoml-0.12.0-cp39-cp39-win_amd64.whl", hash = "sha256:b7c6bdc9128c0a4ebf45e6720ae03c99ed7443a7135e494d93d3c30c14769eb3"}, | ||||
|     {file = "rtoml-0.12.0.tar.gz", hash = "sha256:662e56bd5953ee7ebcc5798507ae90daa329940a5d5157a48f3d477ebf99c55b"}, | ||||
| ] | ||||
| 
 | ||||
| [[package]] | ||||
| name = "runs" | ||||
| version = "1.2.2" | ||||
|  | @ -935,8 +862,7 @@ name = "tomli" | |||
| version = "2.2.1" | ||||
| requires_python = ">=3.8" | ||||
| summary = "A lil' TOML parser" | ||||
| groups = ["lint", "test"] | ||||
| marker = "python_version < \"3.11\"" | ||||
| groups = ["default", "lint", "test"] | ||||
| files = [ | ||||
|     {file = "tomli-2.2.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:678e4fa69e4575eb77d103de3df8a895e1591b48e740211bd1067378c69e8249"}, | ||||
|     {file = "tomli-2.2.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:023aa114dd824ade0100497eb2318602af309e5a55595f76b626d6d9f3b7b0a6"}, | ||||
|  | @ -972,6 +898,17 @@ files = [ | |||
|     {file = "tomli-2.2.1.tar.gz", hash = "sha256:cd45e1dc79c835ce60f7404ec8119f2eb06d38b1deba146f07ced3bbc44505ff"}, | ||||
| ] | ||||
| 
 | ||||
| [[package]] | ||||
| name = "tomlkit" | ||||
| version = "0.13.2" | ||||
| requires_python = ">=3.8" | ||||
| summary = "Style preserving TOML library" | ||||
| groups = ["default"] | ||||
| files = [ | ||||
|     {file = "tomlkit-0.13.2-py3-none-any.whl", hash = "sha256:7a974427f6e119197f670fbbbeae7bef749a6c14e793db934baefc1b5f03efde"}, | ||||
|     {file = "tomlkit-0.13.2.tar.gz", hash = "sha256:fff5fe59a87295b278abd31bec92c15d9bc4a06885ab12bcea52c71119392e79"}, | ||||
| ] | ||||
| 
 | ||||
| [[package]] | ||||
| name = "typer" | ||||
| version = "0.15.2" | ||||
|  |  | |||
|  | @ -11,8 +11,9 @@ dependencies = [ | |||
|     "loguru>=0.7.2", | ||||
|     "pydantic>=2.9.2", | ||||
|     "inquirer>=3.4.0", | ||||
|     "rtoml>=0.11.0", | ||||
|     "humanfriendly>=10.0", | ||||
|     "tomlkit>=0.13.2", | ||||
|     "tomli>=2.2.1", | ||||
| ] | ||||
| requires-python = ">=3.9" | ||||
| authors = [{ name = "JOJ3-dev", email = "joj3@focs.ji.sjtu.edu.cn" }] | ||||
|  |  | |||
|  | @ -712,17 +712,13 @@ | |||
|                                 }, | ||||
|                                 "cpuLimit": 500000000, | ||||
|                                 "clockLimit": 1000000000, | ||||
|                                 "memoryLimit": 5242880, | ||||
|                                 "procLimit": 50 | ||||
|                                 "memoryLimit": 5242880 | ||||
|                             }, | ||||
|                             { | ||||
|                                 "stdin": { | ||||
|                                     "src": "/home/tt/.config/joj/basic/case1.in" | ||||
|                                 }, | ||||
|                                 "cpuLimit": 1000000000, | ||||
|                                 "clockLimit": 2000000000, | ||||
|                                 "memoryLimit": 5242880, | ||||
|                                 "procLimit": 50 | ||||
|                                 "memoryLimit": 5242880 | ||||
|                             } | ||||
|                         ] | ||||
|                     } | ||||
|  |  | |||
|  | @ -66,10 +66,7 @@ | |||
|                                 "stdin": { | ||||
|                                     "src": "/home/tt/.config/joj/diff/case0.in" | ||||
|                                 }, | ||||
|                                 "cpuLimit": 1000000000, | ||||
|                                 "clockLimit": 2000000000, | ||||
|                                 "memoryLimit": 2097152, | ||||
|                                 "procLimit": 50 | ||||
|                                 "memoryLimit": 2097152 | ||||
|                             }, | ||||
|                             { | ||||
|                                 "stdin": { | ||||
|  | @ -77,6 +74,7 @@ | |||
|                                 }, | ||||
|                                 "cpuLimit": 2000000000, | ||||
|                                 "clockLimit": 4000000000, | ||||
| <<<<<<< HEAD | ||||
|                                 "memoryLimit": 4194304, | ||||
|                                 "procLimit": 50 | ||||
|                             }, | ||||
|  | @ -119,6 +117,9 @@ | |||
|                                 "stdin": { | ||||
|                                     "src": "/home/tt/.config/joj/diff/task1/subtask1/task5.in" | ||||
|                                 } | ||||
| ======= | ||||
|                                 "memoryLimit": 4194304 | ||||
| >>>>>>> master | ||||
|                             } | ||||
|                         ] | ||||
|                     } | ||||
|  |  | |||
|  | @ -1,3 +1,4 @@ | |||
| import difflib | ||||
| import json | ||||
| from pathlib import Path | ||||
| 
 | ||||
|  | @ -15,4 +16,11 @@ def load_case(case_name: str) -> None: | |||
|     result = convert_joj3_conf(repo_conf, task_conf).model_dump( | ||||
|         mode="json", by_alias=True, exclude_none=True | ||||
|     ) | ||||
|     if result != expected_result: | ||||
|         result_str = json.dumps(result, indent=2, ensure_ascii=False).splitlines() | ||||
|         expected_str = json.dumps( | ||||
|             expected_result, indent=2, ensure_ascii=False | ||||
|         ).splitlines() | ||||
|         diff = "\n".join(difflib.ndiff(expected_str, result_str)) | ||||
|         print(f"Test case '{case_name}' failed!\nDifferences:\n{diff}") | ||||
|     assert result == expected_result | ||||
|  |  | |||
|  | @ -1,6 +1,8 @@ | |||
| import difflib | ||||
| import json | ||||
| from pathlib import Path | ||||
| 
 | ||||
| import rtoml | ||||
| import tomli | ||||
| 
 | ||||
| from joj3_config_generator.generator import convert_joj1_conf | ||||
| from joj3_config_generator.loader import load_joj1_yaml | ||||
|  | @ -12,8 +14,15 @@ def load_case(case_name: str) -> None: | |||
|     task_yaml = load_joj1_yaml(task_yaml_path) | ||||
|     task_toml_path = root / case_name / "task.toml" | ||||
|     task_toml = task_toml_path.read_text() | ||||
|     expected_result = rtoml.loads(task_toml) | ||||
|     expected_result = tomli.loads(task_toml) | ||||
|     result = convert_joj1_conf(task_yaml).model_dump( | ||||
|         mode="json", by_alias=True, exclude_none=True | ||||
|     ) | ||||
|     if result != expected_result: | ||||
|         result_str = json.dumps(result, indent=2, ensure_ascii=False).splitlines() | ||||
|         expected_str = json.dumps( | ||||
|             expected_result, indent=2, ensure_ascii=False | ||||
|         ).splitlines() | ||||
|         diff = "\n".join(difflib.ndiff(expected_str, result_str)) | ||||
|         print(f"Test case '{case_name}' failed!\nDifferences:\n{diff}") | ||||
|     assert result == expected_result | ||||
|  |  | |||
|  | @ -3,16 +3,20 @@ name = "hw7 ex2" | |||
| 
 | ||||
| [[stages]] | ||||
| name = "Cppcheck" | ||||
| cases = {} | ||||
| 
 | ||||
| [stages.cases] | ||||
| 
 | ||||
| [[stages]] | ||||
| name = "Cpplint" | ||||
| cases = {} | ||||
| 
 | ||||
| [stages.cases] | ||||
| 
 | ||||
| [[stages]] | ||||
| name = "Clang-Tidy" | ||||
| cases = {} | ||||
| 
 | ||||
| [stages.cases] | ||||
| 
 | ||||
| [[stages]] | ||||
| name = "Run" | ||||
| cases = {} | ||||
| 
 | ||||
| [stages.cases] | ||||
|  |  | |||
|  | @ -1,7 +1,8 @@ | |||
| import difflib | ||||
| import json | ||||
| from pathlib import Path | ||||
| 
 | ||||
| import rtoml | ||||
| import tomli | ||||
| 
 | ||||
| from joj3_config_generator.generator import create_joj3_task_conf | ||||
| from joj3_config_generator.models import answer | ||||
|  | @ -16,10 +17,15 @@ def load_case(case_name: str) -> None: | |||
|     language.set_stages(answers_dict["stages"]) | ||||
|     language.set_attribute(answers_dict["attribute"]) | ||||
|     answers = answer.Answers(name=answers_dict["name"], language=language) | ||||
|     expected_result = rtoml.loads(task_toml_path.read_text()) | ||||
|     expected_result = tomli.loads(task_toml_path.read_text()) | ||||
|     result = create_joj3_task_conf(answers).model_dump( | ||||
|         mode="json", by_alias=True, exclude_none=True, exclude_unset=True | ||||
|     ) | ||||
|     print(result) | ||||
|     print(expected_result) | ||||
|     if result != expected_result: | ||||
|         result_str = json.dumps(result, indent=2, ensure_ascii=False).splitlines() | ||||
|         expected_str = json.dumps( | ||||
|             expected_result, indent=2, ensure_ascii=False | ||||
|         ).splitlines() | ||||
|         diff = "\n".join(difflib.ndiff(expected_str, result_str)) | ||||
|         print(f"Test case '{case_name}' failed!\nDifferences:\n{diff}") | ||||
|     assert result == expected_result | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user