33import argparse
44
55from pydantic import BaseModel , ConfigDict , Field
6+
67from matrix_logic .validation import load_config_files , load_runner_file
78
89MASTER_CONFIGS = [".github/configs/amd-master.yaml" ,
1213class ChangelogEntry (BaseModel ):
1314 model_config = ConfigDict (extra = 'forbid' , populate_by_name = True )
1415
15- config_key : str = Field (alias = 'config-key ' )
16+ config_keys : list [ str ] = Field (alias = 'config-keys ' )
1617 description : str
1718 seq_lens : list [str ] = Field (alias = 'seq-lens' )
1819
1920
20- class Config (BaseModel ):
21- changelog : list [ChangelogEntry ]
22-
23-
2421def main ():
2522 parser = argparse .ArgumentParser ()
2623 parser .add_argument (
@@ -34,22 +31,19 @@ def main():
3431
3532 master_config_data = load_config_files (MASTER_CONFIGS )
3633
37- changelog_path = args .changelog_file
38- with open (changelog_path , 'r' ) as f :
34+ with open (args .changelog_file , 'r' ) as f :
3935 changelog_data = yaml .safe_load (f )
36+
37+ for entry_data in changelog_data :
38+ entry = ChangelogEntry .model_validate (entry_data )
4039
41- changelog_data = Config .model_validate (changelog_data )
42-
43- # Validate all config-keys actually exist in the master config files
44- for entry in changelog_data .changelog :
45- if entry .config_key not in master_config_data .keys ():
46- raise ValueError (
47- f"Changelog entry with config-key '{ entry .config_key } ' does not exist in master config files."
48- )
49-
50-
51-
40+ # Make sure the specfied config keys actually exist in the master config files
41+ for config_key in entry .config_keys :
42+ if config_key not in master_config_data .keys ():
43+ raise ValueError (
44+ f"Config key '{ config_key } ' does not exist in master config files."
45+ )
5246
5347
5448if __name__ == "__main__" :
55- main ()
49+ main ()
0 commit comments