def parse_file(self, file_path):
        with file_path.open(mode='rb') as f:
            bytes_seq = f.read()

            is_empty = len(bytes_seq) == 0
            if is_empty:
                return self.parse('')

            encoding_hint = chardet.detect(bytes_seq)
            encoding = encoding_hint['encoding']
            if not encoding:
                # Falsey means we cannot detect the encoding of the file.
                raise EncodingDetectionError(file_path)

            decoded = bytes_seq.decode(encoding)
            decoded_and_lf_normalized = decoded.replace('\r\n', '\n')

            return self.parse(decoded_and_lf_normalized)
Parse vim script file and return the AST.
dataset/ETHPy150Open Kuniwak/vint/vint/ast/parsing.py/Parser.parse_file