def parse(file_path):
_, ext = path.splitext(file_path)<EOL>if ext in ('<STR_LIT>', '<STR_LIT>'):<EOL><INDENT>func = yaml.load<EOL><DEDENT>elif ext == '<STR_LIT>':<EOL><INDENT>func = json.load<EOL><DEDENT>else:<EOL><INDENT>raise ValueError("<STR_LIT>" % ext)<EOL><DEDENT>with open(file_path, '<STR_LIT:r>') as f:<EOL><INDENT>return func(f)<EOL><DEDENT>
Parse a YAML or JSON file.