<s> import sys <EOL> import os <EOL> import getopt <EOL> try : <EOL> import pypet <EOL> except ImportError : <EOL> path = os . path . abspath ( '<STR_LIT>' ) <EOL> print ( '<STR_LIT>' % path ) <EOL> sys . path . append ( path ) <EOL> from pypet import Environment <EOL> from pypet import cartesian_product , GitDiffError <EOL> import pypet . compat as compat <EOL> def multiply ( traj ) : <EOL> z = traj . x * traj . y <EOL> traj . f_add_result ( '<STR_LIT:z>' , z , comment = '<STR_LIT>' ) <EOL> def get_opt ( ) : <EOL> opt_list , _ = getopt . getopt ( sys . argv [ <NUM_LIT:1> : ] , '<STR_LIT>' ) <EOL> opt_dict = { } <EOL> for opt , arg in opt_list : <EOL> if opt == '<STR_LIT>' : <EOL> opt_dict [ '<STR_LIT>' ] = True <EOL> print ( '<STR_LIT>' ) <EOL> if opt == '<STR_LIT>' : <EOL> opt_dict [ '<STR_LIT>' ] = True <EOL> print ( '<STR_LIT>' ) <EOL> return opt_dict <EOL> def fail_on_diff ( ) : <EOL> try : <EOL> Environment ( trajectory = '<STR_LIT>' , <EOL> filename = os . path . join ( '<STR_LIT>' , <EOL> '<STR_LIT>' , ) , <EOL> file_title = '<STR_LIT>' , <EOL> git_repository = '<STR_LIT:.>' , git_message = '<STR_LIT>' , <EOL> git_fail = True ) <EOL> raise RuntimeError ( '<STR_LIT>' ) <EOL> except GitDiffError as exc : <EOL> print ( '<STR_LIT>' % repr ( exc ) ) <EOL> def main ( fail = False ) : <EOL> try : <EOL> if compat . python_major == <NUM_LIT:3> : <EOL> print ( '<STR_LIT>' ) <EOL> sumatra_project = None <EOL> else : <EOL> sumatra_project = '<STR_LIT:.>' <EOL> if fail : <EOL> print ( '<STR_LIT>' ) <EOL> with Environment ( trajectory = '<STR_LIT>' , <EOL> filename = os . path . join ( '<STR_LIT>' , <EOL> '<STR_LIT>' , ) , <EOL> file_title = '<STR_LIT>' , <EOL> comment = '<STR_LIT>' , <EOL> complib = '<STR_LIT>' , <EOL> small_overview_tables = False , <EOL> git_repository = '<STR_LIT:.>' , git_message = '<STR_LIT>' , <EOL> git_fail = fail , <EOL> sumatra_project = sumatra_project , sumatra_reason = '<STR_LIT>' ) as env : <EOL> traj = env . v_trajectory <EOL> traj . f_add_parameter ( '<STR_LIT:x>' , <NUM_LIT:1> , comment = '<STR_LIT>' ) <EOL> traj . f_add_parameter ( '<STR_LIT:y>' , <NUM_LIT:1> , comment = '<STR_LIT>' ) <EOL> traj . f_explore ( cartesian_product ( { '<STR_LIT:x>' : [ <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ] , '<STR_LIT:y>' : [ <NUM_LIT:6> , <NUM_LIT:7> , <NUM_LIT:8> ] } ) ) <EOL> env . f_run ( multiply ) <EOL> assert '<STR_LIT>' in traj <EOL> assert '<STR_LIT>' in traj <EOL> assert '<STR_LIT>' in traj <EOL> assert '<STR_LIT>' in traj <EOL> print ( "<STR_LIT>" ) <EOL> except Exception as exc : <EOL> print ( repr ( exc ) ) <EOL> sys . exit ( <NUM_LIT:1> ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> opt_dict = get_opt ( ) <EOL> test_fail = opt_dict . get ( '<STR_LIT>' , False ) <EOL> if test_fail : <EOL> fail_on_diff ( ) <EOL> test_no_fail = opt_dict . get ( '<STR_LIT>' , False ) <EOL> main ( test_no_fail ) </s>
