Skip to content

Commit

Permalink
Run isort on all Python files
Browse files Browse the repository at this point in the history
  • Loading branch information
mitya57 committed Dec 15, 2024
1 parent ae2bb74 commit e218b9e
Show file tree
Hide file tree
Showing 19 changed files with 210 additions and 90 deletions.
4 changes: 2 additions & 2 deletions ReText/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

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

Expand Down
27 changes: 19 additions & 8 deletions ReText/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 == '-':
Expand Down
27 changes: 20 additions & 7 deletions ReText/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,29 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.

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')

Expand Down
7 changes: 4 additions & 3 deletions ReText/converterprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,18 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

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()
Expand Down
12 changes: 10 additions & 2 deletions ReText/dialogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,19 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

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):
Expand Down
30 changes: 25 additions & 5 deletions ReText/editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
16 changes: 11 additions & 5 deletions ReText/fakevimeditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,22 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

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
Expand Down
5 changes: 3 additions & 2 deletions ReText/highlighter.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,14 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

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('"[^"<]*"(?=[^<]*>)')
Expand Down
2 changes: 1 addition & 1 deletion ReText/icontheme.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.

def get_from_xsettings():
from ReText.xsettings import get_xsettings, XSettingsError
from ReText.xsettings import XSettingsError, get_xsettings
try:
xsettings = get_xsettings()
except XSettingsError:
Expand Down
4 changes: 3 additions & 1 deletion ReText/preview.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

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):
Expand Down
14 changes: 7 additions & 7 deletions ReText/tab.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,21 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

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:
Expand Down
3 changes: 1 addition & 2 deletions ReText/tabledialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion ReText/tablemode.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.

import sys
from markups import MarkdownMarkup, ReStructuredTextMarkup

from markups import MarkdownMarkup, ReStructuredTextMarkup
from PyQt6.QtGui import QTextCursor

LARGER_THAN_ANYTHING = sys.maxsize
Expand Down
18 changes: 13 additions & 5 deletions ReText/webenginepreview.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,27 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

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,
QWebEngineUrlRequestInfo,
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):
Expand Down
Loading

0 comments on commit e218b9e

Please sign in to comment.