From 2ec767405f40ac6661e990d23a116ae77ca45ec3 Mon Sep 17 00:00:00 2001 From: Athanasius Date: Wed, 13 Jan 2021 15:23:11 +0000 Subject: [PATCH] Move the 'duplicate' constants into a new constants.py 1. So now they're only defined in one place. 2. config.py does an import of them, and `from config import ...` then chains through, so no need to update other users. 3. No need to ' # noqa E402' the killswitch/config imports now. --- EDMarketConnector.py | 9 ++++----- protocol.py | 1 + 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/EDMarketConnector.py b/EDMarketConnector.py index 3968275a..80eb0a7b 100755 --- a/EDMarketConnector.py +++ b/EDMarketConnector.py @@ -16,11 +16,10 @@ from sys import platform from time import localtime, strftime, time from typing import TYPE_CHECKING, Any, Mapping, Optional, Tuple, cast +from constants import applongname, appname, protocolhandler_redirect + # config will now cause an appname logger to be set up, so we need the # console redirect before this -appname = 'EDMarketConnector' # TODO: Must match config.appname, add test -applongname = 'E:D Market Connector' # TODO: Must match config.applongname, add test -protocolhandler_redirect = 'edmc://auth' # TODO: Must match protocolhandler.redirect, add test if __name__ == '__main__': def no_other_instance_running() -> bool: # noqa: CCR001 """ @@ -143,8 +142,8 @@ if __name__ == '__main__': # TODO: Test: Make *sure* this redirect is working, else py2exe is going to cause an exit popup # isort: off -import killswitch # noqa: E402 # Will cause a logging import/startup so needs to be after the redirect -from config import applongname, appname, appversion, appversion_nobuild, config, copyright # noqa: E402 +import killswitch # Will cause a logging import/startup so needs to be after the redirect +from config import appversion, appversion_nobuild, config, copyright # isort: on diff --git a/protocol.py b/protocol.py index af09fc14..b27c5438 100644 --- a/protocol.py +++ b/protocol.py @@ -7,6 +7,7 @@ import sys from EDMCLogging import get_main_logger from config import config +from constants import protocolhandler_redirect logger = get_main_logger()