Coverage for skema/program_analysis/run_ann_cast_pipeline.py: 44%

16 statements  

« prev     ^ index     » next       coverage.py v7.5.0, created at 2024-04-30 17:15 +0000

1""" 

2This program reads a JSON file that contains the CAST representation 

3of a program, and transforms it to annotated CAST. It then calls a 

4series of passes that each augment the information in the annotatd CAST nodes 

5in preparation for the GrFN generation. 

6 

7One command-line argument is expected, namely the name of the JSON file that 

8contains the CAST data. 

9""" 

10 

11import sys 

12import dill 

13import argparse 

14 

15from skema.utils.script_functions import ann_cast_pipeline 

16from skema.utils.fold import dictionary_to_gromet_json, del_nulls 

17 

18 

19def get_args(): 

20 parser = argparse.ArgumentParser( 

21 description="Runs Annotated Cast pipeline on input CAST json file." 

22 ) 

23 parser.add_argument( 

24 "--grfn_2_2", 

25 help="Generate GrFN 2.2 for the CAST-> Annotated Cast -> GrFN pipeline", 

26 action="store_true", 

27 ) 

28 parser.add_argument( 

29 "--gromet", 

30 help="Generates GroMEt using the AnnCAST. CAST -> AnnCast -> GroMEt", 

31 action="store_true", 

32 ) 

33 parser.add_argument( 

34 "--agraph", 

35 help="Generates a pdf of the Annotated CAST", 

36 action="store_true", 

37 ) 

38 parser.add_argument("cast_json", help="input CAST.json file") 

39 options = parser.parse_args() 

40 return options 

41 

42 

43if __name__ == "__main__": 

44 args = get_args() 

45 ann_cast_pipeline( 

46 args.cast_json, 

47 gromet=args.gromet, 

48 grfn_2_2=args.grfn_2_2, 

49 a_graph=args.agraph, 

50 from_obj=False, 

51 indent_level=2, 

52 )