@staticmethod<EOL><INDENT>def parse(file_path, content=None):<DEDENT>
try:<EOL><INDENT>if content is None:<EOL><INDENT>with open(file_path) as f:<EOL><INDENT>content = f.read()<EOL><DEDENT><DEDENT>py_tree = RedBaron(content)<EOL>return RedbaronPythonFile(file_path, py_tree)<EOL><DEDENT>except Exception as ex:<EOL><INDENT>msg = str(ex)<EOL>marker = "<STR_LIT>"<EOL>marker_pos = msg.find(marker)<EOL>if marker_pos > <NUM_LIT:0>:<EOL><INDENT>msg = msg[:marker_pos + len(marker)]<EOL><DEDENT>logging.error("<STR_LIT>".format(file_path, msg))<EOL><DEDENT>
Create a PythonFile object with specified file_path and content.
If content is None then, it is loaded from the file_path method.
Otherwise, file_path is only used for reporting errors.