mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-28 21:12:16 +00:00
* init * Update provider_interface.py * docstring * pydantic v2 * Update __init__.py * build package v2 support * `alises` to `aliases` Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com> * `alises` to `aliases` Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com> * `alises` to `aliases` Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com> * updates * Update registry.py * validate_arguments -> validate_call * update terminal classes * response_model_by_alias = False * query_params by alias * Update major_indices_constituents.py * add alias to Query in `provider_interface` * yfinance * build package, add param defaults and correct `OBBject` results type * fix cpi validation errors * Update risk_premium.py * fix `forex_pairs` active query param annotation, set default when only 1 provider * fix and refactor intrinio `options_chains` * Update poetry.lock * fix benzinga news, build package, add intrinio fred_historical fetcher * Update extension_map.json * ruff * Update unit_test_generator.py * updates * add `default=None` on Optional fields * `parse_obj` -> `model_validate` * add alias to dup fields on providers with `__alias_dict__`, fix `test_generate_model_docstring` * Update package_builder.py * fix validation errors, fix tests * tests http * `fred_historical` record * Update test_intrinio_fetchers.py * Update test_intrinio_fetchers.py * Update test_intrinio_fetchers.py * Update available_indices.py * Update stock_historical.py * build package * build package without optional * change `SystemSettings` -> `MockSystemSettings` in `test_system_settings.py` * `openbb_figure.py`/`backend.py` terminal changes , update deps/lock files * `linearmodels>4.26` auto installs `setuptools-scm` which cause error messages * clean up * `dev_install.py` for local development * ruff * dup `# noqa` * build * Update bitquery_model.py * records * rec * f * worky? * update `integration_test_generator.py` and `unit_test_generator.py` * renamed test to tests in file * fix import due to change in file name --------- Co-authored-by: Pratyush Shukla <ps4534@nyu.edu> Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com>
90 lines
2.8 KiB
Python
90 lines
2.8 KiB
Python
import platform
|
|
from typing import List, Literal
|
|
|
|
from pydantic import Field, field_validator, model_validator
|
|
from pydantic.dataclasses import dataclass
|
|
|
|
from openbb_terminal.core.models import BaseModel
|
|
|
|
# pylint: disable=too-many-instance-attributes
|
|
|
|
|
|
@dataclass(config=dict(validate_assignment=True, frozen=True))
|
|
class SystemModel(BaseModel):
|
|
"""
|
|
Data model for system variables and configurations.
|
|
|
|
Disclaimer:
|
|
If you need to have a system related variable that is a credential like
|
|
`LOGGING_AWS_ACCESS_KEY_ID` and `LOGGING_AWS_SECRET_ACCESS_KEY`, you need
|
|
refer to the following function
|
|
`openbb_terminal.core.log.generation.settings_logger.log_system`,
|
|
in order to filter it from the logs.
|
|
"""
|
|
|
|
# System section
|
|
OS: str = str(platform.system())
|
|
PYTHON_VERSION: str = str(platform.python_version())
|
|
PLATFORM: str = str(platform.platform())
|
|
|
|
# OpenBB section
|
|
VERSION: str = "3.2.1"
|
|
|
|
# Logging section
|
|
LOGGING_APP_ID: str = "REPLACE_ME"
|
|
LOGGING_APP_NAME: str = "gst"
|
|
LOGGING_AWS_ACCESS_KEY_ID: str = "REPLACE_ME"
|
|
LOGGING_AWS_SECRET_ACCESS_KEY: str = "REPLACE_ME"
|
|
LOGGING_COMMIT_HASH: str = "REPLACE_ME"
|
|
LOGGING_BRANCH: str = "REPLACE_ME"
|
|
LOGGING_FREQUENCY: Literal["D", "H", "M", "S"] = "H"
|
|
LOGGING_HANDLERS: List[str] = Field(default_factory=lambda: ["file"])
|
|
LOGGING_ROLLING_CLOCK: bool = False
|
|
LOGGING_VERBOSITY: int = 20
|
|
LOGGING_SUB_APP: str = "terminal"
|
|
LOGGING_SUPPRESS: bool = False
|
|
LOGGING_SEND_TO_S3: bool = True
|
|
LOG_COLLECT: bool = True
|
|
|
|
# Personalization section
|
|
DISABLE_STREAMLIT_WARNING: bool = False
|
|
DISABLE_FORECASTING_WARNING: bool = False
|
|
DISABLE_OPTIMIZATION_WARNING: bool = False
|
|
|
|
# Others
|
|
TEST_MODE: bool = False
|
|
DEBUG_MODE: bool = False
|
|
DEV_BACKEND: bool = False
|
|
ENABLE_AUTHENTICATION: bool = True
|
|
HEADLESS: bool = False
|
|
|
|
def __repr__(self) -> str: # pylint: disable=useless-super-delegation
|
|
return super().__repr__()
|
|
|
|
@model_validator()
|
|
@classmethod
|
|
def add_additional_handlers(cls, values):
|
|
if (
|
|
not any([values["TEST_MODE"], values["LOGGING_SUPPRESS"]])
|
|
and values["LOG_COLLECT"]
|
|
and "posthog" not in values["LOGGING_HANDLERS"]
|
|
):
|
|
values["LOGGING_HANDLERS"].append("posthog")
|
|
|
|
return values
|
|
|
|
@model_validator()
|
|
@classmethod
|
|
def validate_send_to_s3(cls, values):
|
|
if "posthog" in values["LOGGING_HANDLERS"] or values["LOG_COLLECT"] is False:
|
|
values["LOGGING_SEND_TO_S3"] = False
|
|
return values
|
|
|
|
@field_validator("LOGGING_HANDLERS")
|
|
@classmethod
|
|
def validate_logging_handlers(cls, v):
|
|
for value in v:
|
|
if value not in ["stdout", "stderr", "noop", "file", "posthog"]:
|
|
raise ValueError("Invalid logging handler")
|
|
return v
|