mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-28 04:52:07 +00:00
* import order * pylint * no login, go to prompt * add logout and whoami * clear before prompt * black * these are unecessary * error * improve login prompt message * login does not follow the controller pattern, so will name it differently * nop * move logout and change to results * change return obj * ruff * pyupgrade * remove user from statics * message * fetch configs at start * remove unecessary func * unecessary dataclass * change user vars * change login flow * remote logout should not be used * simplify * fix double exit logout bug * wrong exception * apply keys * change controller * mypy * save if no internet * pylint * logout everywhere * breaking changes: move to local/hub models * unused import * fix logout bug * whoami in guest mode * add todo * small bug guest allowed * limit flair length * fix bug on user pull * logout working * handle no connection * logout user when logout * remove keys push * split logger funcs * commant apply configs for now * account to session * rename user * clear sounds better * breaking changes: splitting guest from logged users * pull imports up * delete session model * move logout func * add ability to save and apply keys from remote * no sensitive keys * add support for feature flags * unecessary print * allow settings from differnt modules * change setff to static * change way to set ff * fix bug in applying configs * simplify obbff application * bug on setting configs * allow text ff * obbff in settings * add upload to cfg_plot 1 * data sources + backend * this solves circular import? * move create_session to model * rever logs changes, not needed for now * sync optionally * outline account controller interface * don't sync when guest * block guest on installer * or not and * start routines * fix bug on ff, settings * is installer * implementing chavi suggestions * fix colors on installer prompt * Logging login (#4046) * basic logging for the login * removing unused import * hacking the logs custom filter to not filter the email * black * cooping with the new changes * removing redundant method * ruff * ruff * mypy * SDK login (#4051) * sdk login * adding to the trail map * minor fix * improve sdk expirience * adapting to new changes * add docstrings * block guest from account * change guest msg * change guest messages * add sync on/off * display onoff * missing paragraph * fix glitch on logout * add sys clear * filtering password * filtering the email from user * avoid writing to multiple log files if a user logs out * fix bug, guest allowed in installer without connection * log user on the sdk * split login from lauch * add clear and change messages on account * docstrings * start pull cmd * change account menu description * Fix login bug and decouple some logic (#4056) * fix bug, guest allowed in installer without connection * split login from lauch * improvements on the sdk login --------- Co-authored-by: hjoaquim <h.joaquim@campus.fct.unl.pt> * sync fix * change account controller description * ruff * add help on account cmds * update clear prompt * fix email not in jwt * remove jwt from requiremnts * pull command output * remove character * pull cmd when no data * add space below whoami * fix log filenotfound exception * changed arg name * delete .hist on logout * add asteriscs to password * pylint * uncomment rich config * show only diffs on pull * black# * warn when no changes# * pull msg was switched * apply diff only * breaking?: strbool change * reduce some code * add timeout to hub requests * black * add remote logout * success msg only if success * remove colors in prompt * update docstrings * keep timeout outside funcs * update clear * clear and patch * delete session * routine upload * move .his file to .openbb folder * change apply configs * refactor logout * remove mixed portfolio changes * fix bug in lock file * fix bug pwidth, pheight are floats * fix sources command & add choices * refactor timezone setting * userdata * fix flair * need to cast paths * cast on diff * fix flair default * save session test * get session * data * test remove * test remove with assert * add bad test cases * add exception cases to unittests * test remove cli hist file * black * test apply configs * test apply with sync flag * test create session, session model * login tests, session model * some tests for the hub_model * test logout user * black * test clear vars, reload * test create session * update user-json to user * update user class * add user tests * tests sdk session * tests for hub_model * start account controller tsts * unused import * tests account controller: clear, pull * tests for session_controller * logout success bugfix * add integration test for account * black * move routine related commands to other PR * test for the user input * completed tests for session controller * convert to hist to str) * fix import errors * ruff * ruff tests * fix qa * add help to settings cmds * ruff * fix pull keys bug * point to dev * account model tests * black * ruff * fix for empty feature settings * ruff * don't display config msg if wrong token * general msgs * remove print * ruff * fix sources not updated real time * missing return doc * add guest if no email * Routine remote storage (#4143) * add upload routine command * remove prints * point to local again * add commands * add delete * add download command and upload 409 * list comprehension * add download & save plus upload fixe * add user uuid folder * add list command * ruff * en.yml detail * provide choices to delete & download * add choices to upload * change menu text * starting adding unit tests * bad english * Update test_print_help.txt * genearl msgs * remove print * add docstrings * add unit tests to account controller * change parser * fix routine upload test * add to be implemented tests hub * add to be implemented tests local * add total pages to title * split list into model and view * add docstring * print msg if character * add local model tests * hub tests routines * fix test * point to dev and glob * fix small bug on upload * missing return * log decorators missing * black * ruff * change prompt display * rewrite test * rewrite expected * rewrite call * try passing git action * change .yml everywhere --------- Co-authored-by: Henrique Joaquim <h.joaquim@campus.fct.unl.pt> Co-authored-by: James Maslek <jmaslek11@gmail.com>
160 lines
4.5 KiB
Python
160 lines
4.5 KiB
Python
# IMPORTATION STANDARD
|
|
import os
|
|
import os.path
|
|
|
|
# IMPORTATION THIRDPARTY
|
|
import i18n
|
|
|
|
from openbb_terminal.base_helpers import load_env_vars, strtobool
|
|
from openbb_terminal.core.config import paths_helper
|
|
|
|
# IMPORTATION INTERNAL
|
|
from openbb_terminal.core.config.paths import (
|
|
MISCELLANEOUS_DIRECTORY,
|
|
USER_DATA_SOURCES_DEFAULT_FILE,
|
|
)
|
|
|
|
paths_helper.init_userdata()
|
|
|
|
# pylint: disable=no-member,c-extension-no-member
|
|
|
|
try:
|
|
__import__("git")
|
|
except ImportError:
|
|
WITH_GIT = False
|
|
else:
|
|
WITH_GIT = True
|
|
|
|
# Sync with OpenBB server
|
|
SYNC_ENABLED = load_env_vars("OPENBB_SYNC_ENABLED", strtobool, True, "featflags")
|
|
|
|
# Always overwrite exported files
|
|
FILE_OVERWITE = load_env_vars("OPENBB_FILE_OVERWRITE", strtobool, False, "featflags")
|
|
|
|
# Retry unknown commands with `load`
|
|
RETRY_WITH_LOAD = load_env_vars("OPENBB_RETRY_WITH_LOAD", strtobool, False, "featflags")
|
|
|
|
# Use tabulate to print dataframes
|
|
USE_TABULATE_DF = load_env_vars("OPENBB_USE_TABULATE_DF", strtobool, True, "featflags")
|
|
|
|
# Use clear console after each command
|
|
USE_CLEAR_AFTER_CMD = load_env_vars(
|
|
"OPENBB_USE_CLEAR_AFTER_CMD", strtobool, False, "featflags"
|
|
)
|
|
|
|
# Use coloring features
|
|
USE_COLOR = load_env_vars("OPENBB_USE_COLOR", strtobool, True, "featflags")
|
|
|
|
# Add date and time to command line
|
|
USE_DATETIME = load_env_vars("OPENBB_USE_DATETIME", strtobool, True, "featflags")
|
|
|
|
# Enable interactive matplotlib mode
|
|
USE_ION = load_env_vars("OPENBB_USE_ION", strtobool, True, "featflags")
|
|
|
|
# Enable watermark in the figures
|
|
USE_WATERMARK = load_env_vars("OPENBB_USE_WATERMARK", strtobool, True, "featflags")
|
|
|
|
# Enable command and source in the figures
|
|
USE_CMD_LOCATION_FIGURE = load_env_vars(
|
|
"OPENBB_USE_CMD_LOCATION_FIGURE", strtobool, True, "featflags"
|
|
)
|
|
|
|
# Enable Prompt Toolkit
|
|
USE_PROMPT_TOOLKIT = load_env_vars(
|
|
"OPENBB_USE_PROMPT_TOOLKIT", strtobool, True, "featflags"
|
|
)
|
|
|
|
# Enable plot autoscaling
|
|
USE_PLOT_AUTOSCALING = load_env_vars(
|
|
"OPENBB_USE_PLOT_AUTOSCALING", strtobool, False, "featflags"
|
|
)
|
|
|
|
# Enable thoughts of the day
|
|
ENABLE_THOUGHTS_DAY = load_env_vars(
|
|
"OPENBB_ENABLE_THOUGHTS_DAY", strtobool, False, "featflags"
|
|
)
|
|
|
|
# Quick exit for testing
|
|
ENABLE_QUICK_EXIT = load_env_vars(
|
|
"OPENBB_ENABLE_QUICK_EXIT", strtobool, False, "featflags"
|
|
)
|
|
|
|
# Open report as HTML, otherwise notebook
|
|
OPEN_REPORT_AS_HTML = load_env_vars(
|
|
"OPENBB_OPEN_REPORT_AS_HTML", strtobool, True, "featflags"
|
|
)
|
|
|
|
# Enable auto print_help when exiting menus
|
|
ENABLE_EXIT_AUTO_HELP = load_env_vars(
|
|
"OPENBB_ENABLE_EXIT_AUTO_HELP", strtobool, True, "featflags"
|
|
)
|
|
|
|
# Remember contexts during session
|
|
REMEMBER_CONTEXTS = load_env_vars(
|
|
"OPENBB_REMEMBER_CONTEXTS", strtobool, True, "featflags"
|
|
)
|
|
|
|
# Use the colorful rich terminal
|
|
ENABLE_RICH = load_env_vars("OPENBB_ENABLE_RICH", strtobool, True, "featflags")
|
|
|
|
# Use the colorful rich terminal
|
|
ENABLE_RICH_PANEL = load_env_vars(
|
|
"OPENBB_ENABLE_RICH_PANEL", strtobool, True, "featflags"
|
|
)
|
|
|
|
# Check API KEYS before running a command
|
|
ENABLE_CHECK_API = load_env_vars(
|
|
"OPENBB_ENABLE_CHECK_API", strtobool, True, "featflags"
|
|
)
|
|
|
|
# Send logs to data lake
|
|
LOG_COLLECTION = load_env_vars("OPENBB_LOG_COLLECT", strtobool, True, "featflags")
|
|
|
|
# Provide export folder path. If empty that means default.
|
|
EXPORT_FOLDER_PATH = str(os.getenv("OPENBB_EXPORT_FOLDER_PATH", ""))
|
|
|
|
# Toolbar hint
|
|
TOOLBAR_HINT = load_env_vars("OPENBB_TOOLBAR_HINT", strtobool, True, "featflags")
|
|
|
|
# Select language to be used
|
|
USE_LANGUAGE = str(os.getenv("OPENBB_USE_LANGUAGE", "en"))
|
|
|
|
# File that contains a JSON dictionary of preferred sources for commands
|
|
PREFERRED_DATA_SOURCE_FILE = str(
|
|
os.getenv(
|
|
"OPENBB_PREFERRED_DATA_SOURCE_FILE",
|
|
USER_DATA_SOURCES_DEFAULT_FILE,
|
|
)
|
|
)
|
|
|
|
# Timezone
|
|
TIMEZONE = str(os.getenv("OPENBB_TIMEZONE", "America/New_York"))
|
|
|
|
# Select console flair (choose from config_terminal.py list)
|
|
USE_FLAIR = str(os.getenv("OPENBB_USE_FLAIR", ":openbb"))
|
|
|
|
# Guess file
|
|
GUESS_EASTER_EGG_FILE = str(
|
|
os.getenv(
|
|
"OPENBB_GUESS_EASTER_EGG_FILE",
|
|
os.getcwd() + os.path.sep + "guess_game.json",
|
|
)
|
|
)
|
|
|
|
try:
|
|
if not WITH_GIT:
|
|
import pkg_resources
|
|
|
|
version = pkg_resources.get_distribution("OpenBB").version
|
|
else:
|
|
raise Exception("Using git")
|
|
except Exception:
|
|
version = "2.3.1"
|
|
VERSION = str(os.getenv("OPENBB_VERSION", version))
|
|
|
|
# Select the terminal translation language
|
|
i18n_dict_location = MISCELLANEOUS_DIRECTORY / "i18n"
|
|
i18n.load_path.append(i18n_dict_location)
|
|
i18n.set("locale", USE_LANGUAGE)
|
|
i18n.set("filename_format", "{locale}.{format}")
|