From c7cf4c070478e6e05293713a601c649e7fcd6260 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Sun, 4 Oct 2020 16:52:07 +0200 Subject: [PATCH] flake8 fixes --- install.py | 9 ++++----- novelWriter.py | 8 ++++---- setup.py | 2 +- tests/test_gui.py | 4 ++-- 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/install.py b/install.py index 4bd4c0e7..ea7c976d 100755 --- a/install.py +++ b/install.py @@ -27,13 +27,13 @@ helpMsg = ( ) try: - inOpts, inArgs = getopt.getopt(sys.argv[1:],shortOpt,longOpt) + inOpts, inArgs = getopt.getopt(sys.argv[1:], shortOpt, longOpt) except getopt.GetoptError: print(helpMsg) sys.exit(2) for inOpt, inArg in inOpts: - if inOpt in ("-h","--help"): + if inOpt in ("-h", "--help"): print(helpMsg) sys.exit() elif inOpt in ("-d", "--debug"): @@ -41,7 +41,7 @@ for inOpt, inArg in inOpts: # Run pip packList = ["pyinstaller"] -with open("requirements.txt",mode="r") as reqFile: +with open("requirements.txt", mode="r") as reqFile: for reqPack in reqFile: if len(reqPack.strip()) > 0: packList.append(reqPack) @@ -72,7 +72,7 @@ if buildWindowed: instOpt.append("novelWriter.py") -import PyInstaller.__main__ +import PyInstaller.__main__ # noqa: F401 PyInstaller.__main__.run(instOpt) print("") @@ -82,4 +82,3 @@ print("##################") print("") print("If everything went well, the novelWriter executable should be in the folder named 'dist'") print("") - diff --git a/novelWriter.py b/novelWriter.py index 1d4b711a..d6c7deb7 100755 --- a/novelWriter.py +++ b/novelWriter.py @@ -4,10 +4,10 @@ import sys try: - import PyQt5.QtWidgets - import PyQt5.QtGui - import PyQt5.QtCore -except: + import PyQt5.QtWidgets # noqa: F401 + import PyQt5.QtGui # noqa: F401 + import PyQt5.QtCore # noqa: F401 +except Exception: print("ERROR: Failed to load dependency python3-pyqt5") sys.exit(1) diff --git a/setup.py b/setup.py index e3ce209c..515c2bfd 100755 --- a/setup.py +++ b/setup.py @@ -135,7 +135,7 @@ setuptools.setup( "console_scripts" : ["novelWriter-cli=nw:main"], "gui_scripts" : ["novelWriter=nw:main"], }, - packages = setuptools.find_packages(exclude=["docs","tests","sample"]), + packages = setuptools.find_packages(exclude=["docs", "tests", "sample"]), include_package_data = True, package_data = {"": ["*.conf"]}, project_urls = { diff --git a/tests/test_gui.py b/tests/test_gui.py index 87eca280..ab732fca 100644 --- a/tests/test_gui.py +++ b/tests/test_gui.py @@ -95,8 +95,8 @@ def testLaunch(qtbot, monkeypatch, nwFuncTemp, nwTemp): ) nwGUI.closeMain() nwGUI.close() - assert ex.value.code & 4 == 4 # Python version not satisfied - assert ex.value.code & 8 == 8 # Qt version not satisfied + assert ex.value.code & 4 == 4 # Python version not satisfied + assert ex.value.code & 8 == 8 # Qt version not satisfied assert ex.value.code & 16 == 16 # PyQt version not satisfied assert ex.value.code & 32 == 32 # lxml package missing monkeypatch.undo()