diff --git a/ReText/__init__.py b/ReText/__init__.py
index 537eb2be..de7d21d6 100644
--- a/ReText/__init__.py
+++ b/ReText/__init__.py
@@ -16,10 +16,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
+from os.path import abspath, dirname, expanduser, join
+
import markups
import markups.common
-from os.path import abspath, dirname, join, expanduser
-
from PyQt6.QtCore import QByteArray, QLocale, QSettings
from PyQt6.QtGui import QFont, QFontDatabase
diff --git a/ReText/__main__.py b/ReText/__main__.py
index 27d66921..2f45416f 100755
--- a/ReText/__main__.py
+++ b/ReText/__main__.py
@@ -19,18 +19,29 @@
import ctypes
import multiprocessing
-import sys
import signal
-import markups
+import sys
from os.path import exists, isdir, join
-from ReText import packageDir, settings, cache, globalSettings, app_version
-from ReText.window import ReTextWindow
-from PyQt6.QtCore import QCommandLineOption, QCommandLineParser, QFile, \
- QFileInfo, QIODevice, QLibraryInfo, QTextStream, QTranslator, Qt
-from PyQt6.QtWidgets import QApplication
-from PyQt6.QtNetwork import QNetworkProxyFactory
+import markups
+from PyQt6.QtCore import (
+ QCommandLineOption,
+ QCommandLineParser,
+ QFile,
+ QFileInfo,
+ QIODevice,
+ QLibraryInfo,
+ Qt,
+ QTextStream,
+ QTranslator,
+)
from PyQt6.QtDBus import QDBusConnection, QDBusInterface
+from PyQt6.QtNetwork import QNetworkProxyFactory
+from PyQt6.QtWidgets import QApplication
+
+from ReText import app_version, cache, globalSettings, packageDir, settings
+from ReText.window import ReTextWindow
+
def canonicalize(option):
if option == '-':
diff --git a/ReText/config.py b/ReText/config.py
index e01df668..88b5e430 100644
--- a/ReText/config.py
+++ b/ReText/config.py
@@ -15,16 +15,29 @@
# along with this program. If not, see .
import sys
-from ReText import globalSettings, getBundledIcon, getSettingsFilePath
-from ReText.icontheme import get_icon_theme
-from markups.common import CONFIGURATION_DIR
from os.path import join
-from PyQt6.QtCore import pyqtSignal, QFile, QFileInfo, QUrl, Qt
+from markups.common import CONFIGURATION_DIR
+from PyQt6.QtCore import QFile, QFileInfo, Qt, QUrl, pyqtSignal
from PyQt6.QtGui import QDesktopServices, QIcon
-from PyQt6.QtWidgets import QCheckBox, QDialog, QDialogButtonBox, \
- QFileDialog, QGridLayout, QLabel, QLineEdit, QPushButton, QSpinBox, \
- QComboBox, QTabWidget, QVBoxLayout, QWidget
+from PyQt6.QtWidgets import (
+ QCheckBox,
+ QComboBox,
+ QDialog,
+ QDialogButtonBox,
+ QFileDialog,
+ QGridLayout,
+ QLabel,
+ QLineEdit,
+ QPushButton,
+ QSpinBox,
+ QTabWidget,
+ QVBoxLayout,
+ QWidget,
+)
+
+from ReText import getBundledIcon, getSettingsFilePath, globalSettings
+from ReText.icontheme import get_icon_theme
MKD_EXTS_FILE = join(CONFIGURATION_DIR, 'markdown-extensions.txt')
diff --git a/ReText/converterprocess.py b/ReText/converterprocess.py
index 9c23faf5..3f562f8f 100644
--- a/ReText/converterprocess.py
+++ b/ReText/converterprocess.py
@@ -14,17 +14,18 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-import markups
import multiprocessing as mp
import os
import pickle
import signal
-from socket import socketpair
import struct
import traceback
import weakref
+from socket import socketpair
+
+import markups
+from PyQt6.QtCore import QObject, QSocketNotifier, pyqtSignal
-from PyQt6.QtCore import pyqtSignal, QObject, QSocketNotifier
def recvall(sock, remaining):
alldata = bytearray()
diff --git a/ReText/dialogs.py b/ReText/dialogs.py
index 502065fe..b73192e1 100644
--- a/ReText/dialogs.py
+++ b/ReText/dialogs.py
@@ -14,11 +14,19 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
+from PyQt6.QtWidgets import (
+ QCheckBox,
+ QDialog,
+ QDialogButtonBox,
+ QLabel,
+ QLineEdit,
+ QTextEdit,
+ QVBoxLayout,
+)
+
from ReText import globalSettings
from ReText.highlighter import ReTextHighlighter
-from PyQt6.QtWidgets import QCheckBox, QDialog, QDialogButtonBox, \
- QLabel, QLineEdit, QTextEdit, QVBoxLayout
class HtmlDialog(QDialog):
def __init__(self, parent=None):
diff --git a/ReText/editor.py b/ReText/editor.py
index e3811766..fcad252e 100644
--- a/ReText/editor.py
+++ b/ReText/editor.py
@@ -21,13 +21,33 @@
import weakref
from markups import MarkdownMarkup, ReStructuredTextMarkup, TextileMarkup
-from ReText import globalSettings, settings, tablemode
-
-from PyQt6.QtCore import pyqtSignal, QFileInfo, QMimeDatabase, QPoint, QPointF, QRect, QSize, Qt
-from PyQt6.QtGui import QAction, QColor, QImage, QKeyEvent, QMouseEvent, QPainter, \
-QPalette, QTextCursor, QTextFormat, QWheelEvent, QGuiApplication
+from PyQt6.QtCore import (
+ QFileInfo,
+ QMimeDatabase,
+ QPoint,
+ QPointF,
+ QRect,
+ QSize,
+ Qt,
+ pyqtSignal,
+)
+from PyQt6.QtGui import (
+ QAction,
+ QColor,
+ QGuiApplication,
+ QImage,
+ QKeyEvent,
+ QMouseEvent,
+ QPainter,
+ QPalette,
+ QTextCursor,
+ QTextFormat,
+ QWheelEvent,
+)
from PyQt6.QtWidgets import QApplication, QFileDialog, QLabel, QTextEdit, QWidget
+from ReText import globalSettings, settings, tablemode
+
try:
from ReText.fakevimeditor import ReTextFakeVimHandler
except ImportError:
diff --git a/ReText/fakevimeditor.py b/ReText/fakevimeditor.py
index 31bcf976..20ddd337 100644
--- a/ReText/fakevimeditor.py
+++ b/ReText/fakevimeditor.py
@@ -14,16 +14,22 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-from FakeVim import FakeVimProxy, FakeVimHandler, FAKEVIM_PYQT_VERSION, \
- MessageError
+from FakeVim import FAKEVIM_PYQT_VERSION, FakeVimHandler, FakeVimProxy, MessageError
if FAKEVIM_PYQT_VERSION != 6:
raise ImportError("FakeVim must be compiled with Qt 6")
-from PyQt6.QtCore import QDir, QRegExp, QObject, Qt
+from PyQt6.QtCore import QDir, QObject, QRegExp, Qt
from PyQt6.QtGui import QPainter, QPen, QTextCursor
-from PyQt6.QtWidgets import QWidget, QLabel, QLineEdit, \
- QMessageBox, QStatusBar, QTextEdit
+from PyQt6.QtWidgets import (
+ QLabel,
+ QLineEdit,
+ QMessageBox,
+ QStatusBar,
+ QTextEdit,
+ QWidget,
+)
+
class FakeVimMode:
@staticmethod
diff --git a/ReText/highlighter.py b/ReText/highlighter.py
index 429fb368..9e4201e9 100644
--- a/ReText/highlighter.py
+++ b/ReText/highlighter.py
@@ -14,13 +14,14 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-from ReText.editor import getColor
-from enum import IntFlag, auto
import re
+from enum import IntFlag, auto
from PyQt6.QtCore import Qt
from PyQt6.QtGui import QFont, QSyntaxHighlighter, QTextCharFormat
+from ReText.editor import getColor
+
reHtmlTags = re.compile('<[^<>@]*>')
reHtmlSymbols = re.compile(r'?\w+;')
reHtmlStrings = re.compile('"[^"<]*"(?=[^<]*>)')
diff --git a/ReText/icontheme.py b/ReText/icontheme.py
index c326528c..9a3dbfc4 100644
--- a/ReText/icontheme.py
+++ b/ReText/icontheme.py
@@ -15,7 +15,7 @@
# along with this program. If not, see .
def get_from_xsettings():
- from ReText.xsettings import get_xsettings, XSettingsError
+ from ReText.xsettings import XSettingsError, get_xsettings
try:
xsettings = get_xsettings()
except XSettingsError:
diff --git a/ReText/preview.py b/ReText/preview.py
index 1a52ca4f..46d195c2 100644
--- a/ReText/preview.py
+++ b/ReText/preview.py
@@ -16,11 +16,13 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-from os.path import exists
import time
+from os.path import exists
+
from PyQt6.QtCore import QDir, QUrl
from PyQt6.QtGui import QDesktopServices, QTextCursor, QTextDocument
from PyQt6.QtWidgets import QTextBrowser
+
from ReText import globalSettings
class ReTextPreview(QTextBrowser):
diff --git a/ReText/tab.py b/ReText/tab.py
index 046bb936..526dccbb 100644
--- a/ReText/tab.py
+++ b/ReText/tab.py
@@ -16,21 +16,21 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-from os.path import exists, splitext
import locale
import time
-from markups import get_markup_for_file_name, find_markup_class_by_name
+from os.path import exists, splitext
+
+from markups import find_markup_class_by_name, get_markup_for_file_name
from markups.common import MODULE_HOME_PAGE
+from PyQt6.QtCore import QDir, QFile, QFileInfo, QPoint, Qt, QTimer, QUrl, pyqtSignal
+from PyQt6.QtGui import QPalette, QTextCursor, QTextDocument
+from PyQt6.QtWidgets import QApplication, QMessageBox, QSplitter, QTextEdit
-from ReText import app_version, globalSettings, converterprocess
+from ReText import app_version, converterprocess, globalSettings
from ReText.editor import ReTextEdit
from ReText.highlighter import ReTextHighlighter
from ReText.preview import ReTextPreview
-from PyQt6.QtCore import pyqtSignal, Qt, QDir, QFile, QFileInfo, QPoint, QTimer, QUrl
-from PyQt6.QtGui import QPalette, QTextCursor, QTextDocument
-from PyQt6.QtWidgets import QApplication, QTextEdit, QSplitter, QMessageBox
-
try:
from ReText.webenginepreview import ReTextWebEnginePreview
except ImportError:
diff --git a/ReText/tabledialog.py b/ReText/tabledialog.py
index 0cb5f78f..42839e97 100644
--- a/ReText/tabledialog.py
+++ b/ReText/tabledialog.py
@@ -16,8 +16,7 @@
from markups import ReStructuredTextMarkup
from PyQt6.QtCore import Qt
-from PyQt6.QtWidgets import QDialog, QDialogButtonBox, QGridLayout, QLabel, \
- QSpinBox
+from PyQt6.QtWidgets import QDialog, QDialogButtonBox, QGridLayout, QLabel, QSpinBox
class InsertTableDialog(QDialog):
diff --git a/ReText/tablemode.py b/ReText/tablemode.py
index 60cb0189..3087646f 100644
--- a/ReText/tablemode.py
+++ b/ReText/tablemode.py
@@ -17,8 +17,8 @@
# along with this program. If not, see .
import sys
-from markups import MarkdownMarkup, ReStructuredTextMarkup
+from markups import MarkdownMarkup, ReStructuredTextMarkup
from PyQt6.QtGui import QTextCursor
LARGER_THAN_ANYTHING = sys.maxsize
diff --git a/ReText/webenginepreview.py b/ReText/webenginepreview.py
index 05cee091..e20abb28 100644
--- a/ReText/webenginepreview.py
+++ b/ReText/webenginepreview.py
@@ -16,12 +16,15 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-from ReText import globalSettings
-from ReText.editor import getColor
-from ReText.syncscroll import SyncScroll
from PyQt6.QtCore import QEvent, Qt
-from PyQt6.QtGui import QCursor, QDesktopServices, QFontInfo, QGuiApplication, QTextDocument, QColor
-from PyQt6.QtWidgets import QLabel
+from PyQt6.QtGui import (
+ QColor,
+ QCursor,
+ QDesktopServices,
+ QFontInfo,
+ QGuiApplication,
+ QTextDocument,
+)
from PyQt6.QtWebEngineCore import (
QWebEnginePage,
QWebEngineSettings,
@@ -29,6 +32,11 @@
QWebEngineUrlRequestInterceptor,
)
from PyQt6.QtWebEngineWidgets import QWebEngineView
+from PyQt6.QtWidgets import QLabel
+
+from ReText import globalSettings
+from ReText.editor import getColor
+from ReText.syncscroll import SyncScroll
class ReTextWebEngineUrlRequestInterceptor(QWebEngineUrlRequestInterceptor):
diff --git a/ReText/window.py b/ReText/window.py
index fc4fb90a..ef096269 100644
--- a/ReText/window.py
+++ b/ReText/window.py
@@ -16,22 +16,28 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-import markups
-import sys
import os
-from subprocess import Popen
+import sys
import warnings
+from subprocess import Popen
-from ReText import getBundledIcon, app_version, globalSettings, globalCache
-from ReText.tab import (ReTextTab, ReTextWebEnginePreview,
- PreviewDisabled, PreviewNormal, PreviewLive)
-from ReText.dialogs import EncodingDialog, HtmlDialog, LocaleDialog
+import markups
+
+from ReText import app_version, getBundledIcon, globalCache, globalSettings
from ReText.config import ConfigDialog, setIconThemeFromSettings
-from ReText.tabledialog import InsertTableDialog
+from ReText.dialogs import EncodingDialog, HtmlDialog, LocaleDialog
from ReText.filesystemmodel import ReTextFileSystemModel
+from ReText.tab import (
+ PreviewDisabled,
+ PreviewLive,
+ PreviewNormal,
+ ReTextTab,
+ ReTextWebEnginePreview,
+)
+from ReText.tabledialog import InsertTableDialog
try:
- from ReText.fakevimeditor import ReTextFakeVimHandler, FakeVimMode
+ from ReText.fakevimeditor import FakeVimMode, ReTextFakeVimHandler
except ImportError:
ReTextFakeVimHandler = None
@@ -40,16 +46,54 @@
except ImportError:
enchant = None
-from PyQt6.QtCore import QByteArray, QDir, QFile, QFileInfo, \
- QFileSystemWatcher, QIODevice, QLocale, QMarginsF, QStandardPaths, \
- QTextStream, QTimer, QUrl, Qt, pyqtSlot
-from PyQt6.QtGui import QAction, QActionGroup, QColor, QDesktopServices, \
- QIcon, QKeySequence, QPageLayout, QPageSize, \
- QPalette, QTextDocument, QTextDocumentWriter
-from PyQt6.QtWidgets import QApplication, QCheckBox, QComboBox, QDialog, \
- QFileDialog, QFontDialog, QInputDialog, QLineEdit, QMainWindow, QMenu, \
- QMessageBox, QSplitter, QTabWidget, QToolBar, QToolButton, QTreeView
-from PyQt6.QtPrintSupport import QPrintDialog, QPrintPreviewDialog, QPrinter
+from PyQt6.QtCore import (
+ QByteArray,
+ QDir,
+ QFile,
+ QFileInfo,
+ QFileSystemWatcher,
+ QIODevice,
+ QLocale,
+ QMarginsF,
+ QStandardPaths,
+ Qt,
+ QTextStream,
+ QTimer,
+ QUrl,
+ pyqtSlot,
+)
+from PyQt6.QtGui import (
+ QAction,
+ QActionGroup,
+ QColor,
+ QDesktopServices,
+ QIcon,
+ QKeySequence,
+ QPageLayout,
+ QPageSize,
+ QPalette,
+ QTextDocument,
+ QTextDocumentWriter,
+)
+from PyQt6.QtPrintSupport import QPrintDialog, QPrinter, QPrintPreviewDialog
+from PyQt6.QtWidgets import (
+ QApplication,
+ QCheckBox,
+ QComboBox,
+ QDialog,
+ QFileDialog,
+ QFontDialog,
+ QInputDialog,
+ QLineEdit,
+ QMainWindow,
+ QMenu,
+ QMessageBox,
+ QSplitter,
+ QTabWidget,
+ QToolBar,
+ QToolButton,
+ QTreeView,
+)
previewStatesByName = {
'editor': PreviewDisabled,
diff --git a/tests/test_editor.py b/tests/test_editor.py
index 36f2c5a2..61b290cd 100644
--- a/tests/test_editor.py
+++ b/tests/test_editor.py
@@ -20,13 +20,13 @@
import unittest
from unittest.mock import patch
-from ReText.editor import ReTextEdit
-from ReText.editor import documentIndentMore, documentIndentLess
-from PyQt6.QtGui import QImage, QTextCursor, QTextDocument, QKeyEvent
-from PyQt6.QtCore import Qt, QMimeData, QEvent
-from PyQt6.QtWidgets import QApplication
-from PyQt6.QtTest import QTest
from markups import MarkdownMarkup, ReStructuredTextMarkup
+from PyQt6.QtCore import QEvent, QMimeData, Qt
+from PyQt6.QtGui import QImage, QKeyEvent, QTextCursor, QTextDocument
+from PyQt6.QtTest import QTest
+from PyQt6.QtWidgets import QApplication
+
+from ReText.editor import ReTextEdit, documentIndentLess, documentIndentMore
QApplication.setAttribute(Qt.ApplicationAttribute.AA_ShareOpenGLContexts)
# Keep a reference so it is not garbage collected
diff --git a/tests/test_posmap.py b/tests/test_posmap.py
index 6d0cc80d..7206d91e 100644
--- a/tests/test_posmap.py
+++ b/tests/test_posmap.py
@@ -17,16 +17,18 @@
# along with this program. If not, see .
from textwrap import dedent
-from unittest import skipIf, TestCase
+from unittest import TestCase, skipIf
from markdown import markdown
from markdown.extensions.codehilite import CodeHiliteExtension
from markdown.extensions.fenced_code import FencedCodeExtension
+
+from ReText.mdx_posmap import PosMapExtension
+
try:
from pymdownx.superfences import SuperFencesCodeExtension
except ImportError:
SuperFencesCodeExtension = None
-from ReText.mdx_posmap import PosMapExtension
class PosMapTest(TestCase):
diff --git a/tests/test_settings.py b/tests/test_settings.py
index 24712c88..3d6d12fd 100644
--- a/tests/test_settings.py
+++ b/tests/test_settings.py
@@ -14,16 +14,21 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-import unittest
-import tempfile
import sys
-
+import tempfile
+import unittest
from os.path import basename, dirname, splitext
-from PyQt6.QtCore import Qt, QSettings
+
+from PyQt6.QtCore import QSettings, Qt
from PyQt6.QtGui import QColor
from PyQt6.QtWidgets import QApplication
-from ReText import readListFromSettings, writeListToSettings, \
- readFromSettings, writeToSettings
+
+from ReText import (
+ readFromSettings,
+ readListFromSettings,
+ writeListToSettings,
+ writeToSettings,
+)
from ReText.editor import getColor, updateColorScheme
# For this particular test, QCoreApplication is enough. However, we should
diff --git a/tests/test_window.py b/tests/test_window.py
index 74231c29..700981fa 100644
--- a/tests/test_window.py
+++ b/tests/test_window.py
@@ -16,22 +16,22 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-from contextlib import suppress
-import markups
import os
+import platform
import sys
import tempfile
import unittest
-from unittest.mock import patch, MagicMock
import warnings
-import platform
+from contextlib import suppress
+from unittest.mock import MagicMock, patch
+import markups
from markups.abstract import ConvertedMarkup
-
-from PyQt6.QtCore import pyqtSignal, QObject, Qt
+from PyQt6.QtCore import QObject, Qt, pyqtSignal
from PyQt6.QtGui import QTextCursor
from PyQt6.QtTest import QTest
from PyQt6.QtWidgets import QApplication, QMessageBox
+
import ReText
from ReText.window import ReTextWindow