From a32978a3187b496d31afefecf803a2a43d6f584b Mon Sep 17 00:00:00 2001 From: Pino Toscano Date: Wed, 13 Nov 2024 17:06:31 +0100 Subject: [PATCH] chore: move constants import earlier/global Import the 'constants' module earlier in a global context: this way more things can be added to it later. There should be no behaviour changes. Signed-off-by: Pino Toscano --- src/insights_client/__init__.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/insights_client/__init__.py b/src/insights_client/__init__.py index 2cdcde05..400d1d9f 100644 --- a/src/insights_client/__init__.py +++ b/src/insights_client/__init__.py @@ -15,6 +15,14 @@ from distutils.version import LooseVersion +try: + from .constants import InsightsConstants +except ImportError: + # The source file is build from 'constants.py.in' and is not + # available during development + class InsightsConstants(object): + version = "development" + LOG_FORMAT = "%(asctime)s %(levelname)8s %(name)s:%(lineno)s %(message)s" NO_COLOR = os.environ.get("NO_COLOR") is not None @@ -448,14 +456,6 @@ def _main(): sys.exit("Unable to load Insights Config") if config["version"]: - try: - from insights_client.constants import InsightsConstants - except ImportError: - # The source file is build from 'constants.py.in' and is not - # available during development - class InsightsConstants(object): - version = "development" - print("Client: %s" % InsightsConstants.version) print("Core: %s" % InsightsClient().version()) return