From f73a372e6b49b0a28889358dff8b51ab8ffd753f Mon Sep 17 00:00:00 2001 From: Athanasius Date: Fri, 11 Sep 2020 14:09:47 +0100 Subject: [PATCH 1/3] EDMC.py: Correct `import eddn` position, with isort comments isort thinks this is a STDLIB import, when it's actually from the plugins directory. So add comments to stop isort from re-ordering it. --- EDMC.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/EDMC.py b/EDMC.py index c156a4d2..8ef2e78c 100755 --- a/EDMC.py +++ b/EDMC.py @@ -3,6 +3,7 @@ # Command-line interface. Requires prior setup through the GUI. # + import argparse import json import logging @@ -16,7 +17,6 @@ from typing import Any, Optional import collate import commodity import companion -import eddn import EDMCLogging import edshipyard import l10n @@ -29,6 +29,13 @@ from config import appcmdname, appversion, config from monitor import monitor from update import EDMCVersion, Updater +sys.path.append(config.internal_plugin_dir) +# This import must be after the sys.path.append. +# The sys.path.append has to be after `import sys` and `from config import config` +# isort: off +import eddn # noqa: E402 +# isort: on + # workaround for https://github.com/EDCD/EDMarketConnector/issues/568 os.environ["EDMC_NO_UI"] = "1" @@ -37,7 +44,6 @@ l10n.Translations.install_dummy() logger = EDMCLogging.Logger(appcmdname).get_logger() logger.setLevel(logging.INFO) -sys.path.append(config.internal_plugin_dir) SERVER_RETRY = 5 # retry pause for Companion servers [s] EXIT_SUCCESS, EXIT_SERVER, EXIT_CREDENTIALS, EXIT_VERIFICATION, EXIT_LAGGING, EXIT_SYS_ERR, EXIT_ARGS = range(7) From 17e65ae4116f0931bb575d906b4573e540ea5c16 Mon Sep 17 00:00:00 2001 From: Athanasius Date: Fri, 11 Sep 2020 14:10:56 +0100 Subject: [PATCH 2/3] Update flake8/isort/etc versions. Using older versions meant isort didn't pay attention to control comments for the fixes in EDMC.py. --- requirements-dev.txt | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/requirements-dev.txt b/requirements-dev.txt index 3de3dd5b..ce67445d 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,21 +1,24 @@ # Static analysis tools flake8==3.8.3 flake8-annotations-coverage==0.0.4 -flake8-cognitive-complexity==0.0.2 +flake8-cognitive-complexity==0.1.0 flake8-comprehensions==3.2.3 -flake8-polyfill==1.0.2 -flake8-json -flake8-isort==3.0.1 -pep8-naming==0.11.1 -flake8-noqa==1.0.5 flake8-docstrings==1.5.0 +isort==5.5.2 +flake8-isort==4.0.0 +flake8-json==19.8.0 +flake8-noqa==1.0.5 +flake8-pep3101==1.3.0 +flake8-polyfill==1.0.2 flake8-use-fstring==1.1 +pep8-naming==0.11.1 + # Code formatting tools -autopep8==1.5.3 +autopep8==1.5.4 # HTML changelogs -grip==4.5.2 +grip>=4.5.2 # Packaging # This isn't available via 'pip install', so has to be commented out in order for From 35568086063555fb1f1aa40d6a0428dc8ec8496b Mon Sep 17 00:00:00 2001 From: Athanasius Date: Fri, 11 Sep 2020 14:18:44 +0100 Subject: [PATCH 3/3] Remove flake8-pep3101, we're using flake8-use-fstrings instead --- requirements-dev.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/requirements-dev.txt b/requirements-dev.txt index ce67445d..7f756495 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -8,7 +8,6 @@ isort==5.5.2 flake8-isort==4.0.0 flake8-json==19.8.0 flake8-noqa==1.0.5 -flake8-pep3101==1.3.0 flake8-polyfill==1.0.2 flake8-use-fstring==1.1