diff --git a/docs/eye.rst b/docs/eye.rst index 6f4b183..b29b597 100644 --- a/docs/eye.rst +++ b/docs/eye.rst @@ -30,6 +30,5 @@ Submodules eye.qt eye.reutils eye.structs - eye.three eye.utils diff --git a/docs/eye.three.rst b/docs/eye.three.rst deleted file mode 100644 index f014cbf..0000000 --- a/docs/eye.three.rst +++ /dev/null @@ -1,7 +0,0 @@ -eye.three module -================ - -.. automodule:: eye.three - :members: - :undoc-members: - :show-inheritance: diff --git a/eye/app.py b/eye/app.py index bd0867d..3276e3f 100644 --- a/eye/app.py +++ b/eye/app.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # this project is licensed under the WTFPLv2, see COPYING.txt for details import argparse @@ -12,7 +12,6 @@ qApp = lambda: QApplication.instance() -from .three import execfile from .qt import Slot from . import pathutils from . import connector @@ -181,6 +180,14 @@ def setupLogging(): root.handlers[0].setLevel(logging.WARNING) +def execfile(path, globals): + """Exec Python `file` with `globals` as in Python 2""" + with open(path) as fd: + src = fd.read() + code = compile(src, path, 'exec') + exec(code, globals) # pylint: disable=exec-used + + def main(): """Run eye app""" diff --git a/eye/colorutils.py b/eye/colorutils.py index 41bd7e0..6c31096 100644 --- a/eye/colorutils.py +++ b/eye/colorutils.py @@ -9,7 +9,6 @@ from PyQt5.QtCore import Qt from PyQt5.QtGui import QColor -from .three import bytes, str __all__ = ('QColorAlpha', 'QColor') diff --git a/eye/connector.py b/eye/connector.py index 6e9adcc..69e2788 100644 --- a/eye/connector.py +++ b/eye/connector.py @@ -56,7 +56,6 @@ def foo(editor_obj, path): from PyQt5.QtWidgets import QWidget from .qt import Signal, Slot -from .three import bytes, str from .utils import exceptionLogging from . import BUILDING_DOCS, _addDoc diff --git a/eye/helpers/_lexercolorgroups.py b/eye/helpers/_lexercolorgroups.py index f28c777..91791af 100644 --- a/eye/helpers/_lexercolorgroups.py +++ b/eye/helpers/_lexercolorgroups.py @@ -2,7 +2,6 @@ from PyQt5.Qsci import QsciLexerPython, QsciLexerCPP, QsciLexerBash, QsciLexerCSS -from ..three import range # TODO case insensitive diff --git a/eye/helpers/actions.py b/eye/helpers/actions.py index 61a1236..4d55f2c 100644 --- a/eye/helpers/actions.py +++ b/eye/helpers/actions.py @@ -39,7 +39,6 @@ def myActionFunc(ed): from PyQt5.QtWidgets import QAction from PyQt5.Qsci import QsciCommand, QsciScintilla -from ..three import bytes, str from ..connector import categoryObjects, CONNECTOR from ..qt import Slot from .. import BUILDING_DOCS diff --git a/eye/helpers/confcache.py b/eye/helpers/confcache.py index b0e1ef9..2588372 100644 --- a/eye/helpers/confcache.py +++ b/eye/helpers/confcache.py @@ -5,7 +5,6 @@ from PyQt5.QtCore import QObject from ..qt import Slot -from ..three import str from .file_monitor import MonitorWithRename diff --git a/eye/helpers/editor_search.py b/eye/helpers/editor_search.py index 1ef9bc7..0d20b67 100644 --- a/eye/helpers/editor_search.py +++ b/eye/helpers/editor_search.py @@ -8,7 +8,6 @@ from ..connector import registerSignal, CategoryMixin from ..widgets.editor import HasWeakEditorMixin, SciModification from ..widgets import minibuffer -from ..three import range from ..qt import Signal, Slot from .. import structs from . import buffers diff --git a/eye/helpers/file_monitor.py b/eye/helpers/file_monitor.py index 7ae32f3..9ec9cb6 100644 --- a/eye/helpers/file_monitor.py +++ b/eye/helpers/file_monitor.py @@ -9,7 +9,6 @@ from PyQt5.QtCore import QFileSystemWatcher, QSignalMapper, QObject -from ..three import str from ..qt import Signal, Slot from ..connector import registerSignal, disabled diff --git a/eye/helpers/file_search_plugins/base.py b/eye/helpers/file_search_plugins/base.py index 21850a4..24442a5 100644 --- a/eye/helpers/file_search_plugins/base.py +++ b/eye/helpers/file_search_plugins/base.py @@ -2,7 +2,6 @@ from PyQt5.QtCore import QObject -from ...three import str from ...qt import Signal, Slot diff --git a/eye/helpers/keys.py b/eye/helpers/keys.py index 9e053ba..c3340f1 100644 --- a/eye/helpers/keys.py +++ b/eye/helpers/keys.py @@ -64,7 +64,6 @@ from PyQt5.QtCore import Qt from PyQt5.QtGui import QKeySequence -from ..three import str from .actions import registerActionShortcut from ..pathutils import getConfigFilePath diff --git a/eye/helpers/lexercolor.py b/eye/helpers/lexercolor.py index a6d3344..7d26222 100644 --- a/eye/helpers/lexercolor.py +++ b/eye/helpers/lexercolor.py @@ -101,7 +101,6 @@ from six.moves.configparser import SafeConfigParser from logging import getLogger -from ..three import str from ..connector import categoryObjects, registerSignal, registerSetup, disabled from ..colorutils import QColorAlpha from ..lexers import stylesFromLexer diff --git a/eye/helpers/minimap.py b/eye/helpers/minimap.py index 8270e3d..d1e10a3 100644 --- a/eye/helpers/minimap.py +++ b/eye/helpers/minimap.py @@ -8,7 +8,6 @@ from ..widgets.editor import Editor, SciModification from ..widgets.window import Window from ..widgets.helpers import acceptIf -from ..three import range from ..qt import Signal, Slot diff --git a/eye/helpers/remote_control.py b/eye/helpers/remote_control.py index 3826419..bc7a856 100644 --- a/eye/helpers/remote_control.py +++ b/eye/helpers/remote_control.py @@ -7,7 +7,6 @@ from PyQt5.QtCore import QObject, Q_CLASSINFO from PyQt5.QtDBus import QDBusConnection, QDBusVariant, QDBusMessage -from ..three import str from ..connector import disabled, CategoryMixin from ..app import qApp from ..qt import Slot diff --git a/eye/helpers/script_reload.py b/eye/helpers/script_reload.py index 13cf0d0..7826610 100644 --- a/eye/helpers/script_reload.py +++ b/eye/helpers/script_reload.py @@ -17,7 +17,6 @@ import logging import os -from ..three import str from ..app import qApp from ..connector import deleteCreatedBy from ..qt import Slot diff --git a/eye/helpers/session.py b/eye/helpers/session.py index cef7c6f..96b134d 100644 --- a/eye/helpers/session.py +++ b/eye/helpers/session.py @@ -9,7 +9,6 @@ import json import os -from ..three import range, bytes from ..connector import categoryObjects from ..pathutils import getConfigFilePath from ..widgets.window import Window diff --git a/eye/helpers/ycm/daemon.py b/eye/helpers/ycm/daemon.py index 0d2c0fb..29a6d1d 100644 --- a/eye/helpers/ycm/daemon.py +++ b/eye/helpers/ycm/daemon.py @@ -20,7 +20,6 @@ from PyQt5.QtCore import QObject, QTimer, QProcess, QUrl from PyQt5.QtNetwork import QNetworkAccessManager, QNetworkRequest -from ...three import str, bytes from ...connector import CategoryMixin from ...qt import Signal, Slot from ...app import qApp diff --git a/eye/procutils.py b/eye/procutils.py index e50f908..2a2c6d4 100644 --- a/eye/procutils.py +++ b/eye/procutils.py @@ -5,7 +5,6 @@ from PyQt5.QtCore import QProcess -from .three import str, bytes from .qt import Signal, Slot diff --git a/eye/three.py b/eye/three.py deleted file mode 100644 index c5e9039..0000000 --- a/eye/three.py +++ /dev/null @@ -1,35 +0,0 @@ -# this project is licensed under the WTFPLv2, see COPYING.txt for details - -"""Python 2 and Python 3 compatibility - -This module exports `bytes`, `str`. In Python 3, they map to the normal `bytes` and `str`, but in -Python 2, the module exports them as aliases to `str` and `unicode`, respectively. - -Through all the EYE documentation, `bytes` and `str` will refer to the Python 3 types. EYE uses -this module to keep compatibility with both versions of Python. The -`six `_ third-party module is also used in EYE. - -`range` is also exported, mapping to `xrange` on Python 2. A drop-in implementation of `execfile` -for Python 3 is exported too. -""" - -import sys - -# pylint: disable=redefined-builtin - -if sys.version_info.major < 3: - from __builtin__ import str as bytes, unicode as str - from __builtin__ import execfile, xrange as range -else: - from builtins import bytes, str, range - - # cheap but ad-hoc replacement - def execfile(path, globals): - """Exec Python `file` with `globals` as in Python 2""" - with open(path) as fd: - src = fd.read() - code = compile(src, path, 'exec') - exec(code, globals) # pylint: disable=exec-used - - -__all__ = ('bytes', 'str', 'execfile', 'range') diff --git a/eye/widgets/editor.py b/eye/widgets/editor.py index 1c375b5..8aa03b0 100644 --- a/eye/widgets/editor.py +++ b/eye/widgets/editor.py @@ -11,12 +11,11 @@ Positions in the text of an editor widget can be expressed in multiple ways. First, the position of a character can be expressed as "line-index", which is the line and column of -that character, in terms of Unicode codepoints, with the `str` type (`unicode` for Python 2, -see :doc:`eye.three`). +that character, in terms of Unicode codepoints, with the `str` type. Unless specified otherwise, line and column numbers start at 0 in EYE. -Another way, more low-level, is the byte offset of the byte in the byte text (with type `bytes`, see -:doc:`eye.three`). The internal byte encoding of the editor is UTF-8, regardless of the encoding of +Another way, more low-level, is the byte offset of the byte in the byte text (with type `bytes`). +The internal byte encoding of the editor is UTF-8, regardless of the encoding of the underlying disk file, which only intervenes when loading/saving. Module contents @@ -38,7 +37,6 @@ import sip import six -from ..three import bytes, str from ..connector import disabled, registerEventFilter from .helpers import CentralWidgetMixin, acceptIf from ..qt import Slot, Signal, override diff --git a/eye/widgets/eval_console.py b/eye/widgets/eval_console.py index 5a83412..c413aef 100644 --- a/eye/widgets/eval_console.py +++ b/eye/widgets/eval_console.py @@ -16,7 +16,6 @@ from PyQt5.QtWidgets import QVBoxLayout, QLineEdit, QPlainTextEdit, QWidget, QAction, QCompleter from six import StringIO -from ..three import bytes from ..app import qApp from ..utils import exceptionLogging from ..qt import Signal, Slot diff --git a/eye/widgets/filechooser.py b/eye/widgets/filechooser.py index 040f4f1..872b8b1 100644 --- a/eye/widgets/filechooser.py +++ b/eye/widgets/filechooser.py @@ -8,7 +8,6 @@ import re from time import time -from ..three import str, range from ..structs import PropDict from ..consts import AbsolutePathRole from ..qt import Slot diff --git a/eye/widgets/locationlist.py b/eye/widgets/locationlist.py index e491339..0a343d7 100644 --- a/eye/widgets/locationlist.py +++ b/eye/widgets/locationlist.py @@ -11,7 +11,6 @@ from PyQt5.QtGui import QStandardItemModel, QStandardItem from PyQt5.QtWidgets import QTreeView -from ..three import str from .helpers import WidgetMixin from .. import consts from ..consts import AbsolutePathRole diff --git a/eye/widgets/minibuffer.py b/eye/widgets/minibuffer.py index eb7d77b..7ded57b 100644 --- a/eye/widgets/minibuffer.py +++ b/eye/widgets/minibuffer.py @@ -4,7 +4,6 @@ from PyQt5.QtGui import QKeySequence from PyQt5.QtWidgets import QLineEdit, QShortcut -from ..three import str from ..app import qApp from ..connector import categoryObjects from ..qt import Signal, Slot diff --git a/eye/widgets/search.py b/eye/widgets/search.py index b0a70f6..32c643f 100644 --- a/eye/widgets/search.py +++ b/eye/widgets/search.py @@ -6,7 +6,6 @@ import os -from ..three import str from .. import consts from .helpers import WidgetMixin from ..helpers import file_search, buffers diff --git a/eye/widgets/tabs.py b/eye/widgets/tabs.py index da43fe1..4feb8f1 100644 --- a/eye/widgets/tabs.py +++ b/eye/widgets/tabs.py @@ -8,7 +8,6 @@ from PyQt5.QtWidgets import QTabWidget, QTabBar, QStackedWidget, QToolButton, QMenu from .. import consts -from ..three import str from ..qt import Signal, Slot, override from ..connector import CategoryMixin, disabled, registerSetup from .droparea import DropAreaMixin, BandMixin diff --git a/eye/widgets/window.py b/eye/widgets/window.py index 2cb0a84..f12bc45 100644 --- a/eye/widgets/window.py +++ b/eye/widgets/window.py @@ -8,7 +8,6 @@ from PyQt5.QtWidgets import QMainWindow, QFileDialog, QDockWidget, QWidget from ..connector import registerSignal, disabled -from ..three import str from ..qt import Signal, Slot from .. import consts from .helpers import CategoryMixin, acceptIf, parentTabWidget diff --git a/main.py b/main.py index 5af463b..e8a3184 100755 --- a/main.py +++ b/main.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # this project is licensed under the WTFPLv2, see COPYING.txt for details import sys diff --git a/setup.cfg b/setup.cfg index f711353..60fec1d 100644 --- a/setup.cfg +++ b/setup.cfg @@ -19,11 +19,7 @@ classifier = License :: Public Domain Topic :: Text Editors Topic :: Text Editors :: Integrated Development Environments (IDE) - Programming Language :: Python :: 2 - Programming Language :: Python :: 2.7 Programming Language :: Python :: 3 - Programming Language :: Python :: 3.2 - Programming Language :: Python :: 3.3 Programming Language :: Python :: 3.4 Programming Language :: Python :: 3.5 Programming Language :: Python :: 3.6 @@ -31,8 +27,8 @@ classifier = [options] zip_safe = 0 +python_requires = >=3.3 install_requires = - six PyQt5 QScintilla pyxdg diff --git a/setup.py b/setup.py index c2684c6..86efb12 100755 --- a/setup.py +++ b/setup.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # this project is licensed under the WTFPLv2, see COPYING.txt for details import glob