"""Environment Util.""" from __future__ import annotations from grass import config def select( prod: str | None = None, qa: str | None = None, uat: str | None = None, dev: str | None = None, default: str | None = None, ) -> str | None: """Select a value. Selection of the value is a simple solution that looks in finding the value that corresponds for the environment of the application, and if not found, returns either nothing or a default value. Args: prod (mixed): the production value. qa (mixed): the qa value. uat (mixed): the uat value. dev (mixed): the dev value. default (mixed): the default value. Returns: mixed: the value that corresponds to the right environment. None if no corresponding value has been found. """ if prod and config.environment == config.PROD_ENVIRONMENT: return prod elif qa and config.environment in [ config.TEST_ENVIRONMENT, config.QA_ENVIRONMENT, ]: return qa elif uat and config.environment == config.UAT_ENVIRONMENT: return uat elif dev and config.environment == config.DEV_ENVIRONMENT: return dev elif default: return default return None