Skip to content

Commit bee1a57

Browse files
mzuenniRagnarGrootKoerkamp
authored andcommitted
only add to cache if validation was successful
1 parent f5f6b26 commit bee1a57

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

bin/generate.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -690,10 +690,12 @@ def validate_in(t, problem, testcase, meta_yaml, bar):
690690
bar.debug('Use generate --no-validators to ignore validation results.')
691691
bar.done(False)
692692
return False
693-
694-
for h in input_validator_hashes:
695-
meta_yaml['input_validator_hashes'][h] = input_validator_hashes[h]
696-
write_yaml(meta_yaml, problem.tmpdir / 'data' / t.hash / 'meta_.yaml', allow_yamllib=True)
693+
else:
694+
for h in input_validator_hashes:
695+
meta_yaml['input_validator_hashes'][h] = input_validator_hashes[h]
696+
write_yaml(
697+
meta_yaml, problem.tmpdir / 'data' / t.hash / 'meta_.yaml', allow_yamllib=True
698+
)
697699
return True
698700

699701
def validate_ans(t, problem, testcase, meta_yaml, bar):
@@ -726,12 +728,12 @@ def validate_ans(t, problem, testcase, meta_yaml, bar):
726728
bar.debug('Use generate --no-validators to ignore validation results.')
727729
bar.done(False)
728730
return False
729-
730-
for h in answer_validator_hashes:
731-
meta_yaml['answer_validator_hashes'][h] = answer_validator_hashes[h]
732-
write_yaml(
733-
meta_yaml, problem.tmpdir / 'data' / t.hash / 'meta_.yaml', allow_yamllib=True
734-
)
731+
else:
732+
for h in answer_validator_hashes:
733+
meta_yaml['answer_validator_hashes'][h] = answer_validator_hashes[h]
734+
write_yaml(
735+
meta_yaml, problem.tmpdir / 'data' / t.hash / 'meta_.yaml', allow_yamllib=True
736+
)
735737
return True
736738

737739
def generate(t, problem, generator_config, parent_bar):

0 commit comments

Comments
 (0)