def _get_text(self, encoding):
        lines = self.editor.toPlainText().splitlines()
        if self.clean_trailing_whitespaces:
            lines = [l.rstrip() for l in lines]
        # remove emtpy ending lines
        try:
            last_line = lines[-1]
        except IndexError:
            pass  # empty file
        else:
            while last_line == '':
                try:
                    lines.pop()
                    last_line = lines[-1]
                except __HOLE__:
                    last_line = None
        text = self._eol.join(lines) + self._eol
        return text.encode(encoding)
dataset/ETHPy150Open OpenCobolIDE/OpenCobolIDE/open_cobol_ide/extlibs/pyqode/core/managers/file.py/FileManager._get_text