mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-28 21:12:16 +00:00
* removing references to test_mode as env variable * removing references to os.getenv * adding functions to change system properties * removing references to env * introducing set_system_variable and removing change_logging_suppress function * removing change_test_mode and change_debug_mode * removing change_log_collect * adjusting config_terminal and generate_sdk * generating the sdk * removing unused imoports * introducing DISABLE_STREAMLIT_WARNING * removing load_env_vars * test_print_help test * sync tests * rewrite tests * setting the auth to True as default --------- Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com>
43 lines
1000 B
Python
43 lines
1000 B
Python
# IMPORTS STANDARD
|
|
import dataclasses
|
|
from copy import deepcopy
|
|
from typing import Any
|
|
|
|
# IMPORTS INTERNAL
|
|
from openbb_terminal.core.models import SystemModel
|
|
from openbb_terminal.core.session.env_handler import read_env
|
|
from openbb_terminal.core.session.utils import load_dict_to_model
|
|
|
|
|
|
def get_current_system() -> SystemModel:
|
|
"""Get current system."""
|
|
return deepcopy(__system)
|
|
|
|
|
|
def set_current_system(system: SystemModel):
|
|
"""Set current system."""
|
|
global __system # pylint: disable=global-statement
|
|
__system = system
|
|
|
|
|
|
def set_system_variable(
|
|
name: str,
|
|
value: Any,
|
|
):
|
|
"""Set system variable
|
|
|
|
Parameters
|
|
----------
|
|
name : str
|
|
Variable name
|
|
value : Any
|
|
Variable value
|
|
"""
|
|
current_system = get_current_system()
|
|
updated_system = dataclasses.replace(current_system, **{name: value}) # type: ignore
|
|
set_current_system(updated_system)
|
|
|
|
|
|
__env_dict = read_env()
|
|
__system = load_dict_to_model(__env_dict, SystemModel)
|