mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-27 12:40:35 +00:00
* autogenerate credentials model * revert to to_dict * black * mypy * ruff * ignore mypy * degiro secret to replace me * add safeguard for people not flashing keys * ruff * split local and hub keys * warn if writing to .env * warn if sending to hub * update user on what's going on... * update fixture * rewrite expected * rewrite cassettes * rewrite controller cassettes * too much changes, let's revert here * rever env handler * rewrite std output * patch usermodel and rewrite cassettes * delete unecessary cassettes and std out records * remove controller cassettes * ruff * add exception for inconclusive api tests opening controller * fix twitter key and env handler prints * fix twitter test --------- Co-authored-by: Henrique Joaquim <h.joaquim@campus.fct.unl.pt>
27 lines
818 B
Python
27 lines
818 B
Python
import json
|
|
from dataclasses import make_dataclass
|
|
|
|
from pydantic.dataclasses import dataclass as pydanticdataclass
|
|
|
|
from openbb_terminal.core.config.paths import MISCELLANEOUS_DIRECTORY
|
|
from openbb_terminal.core.models.base_model import BaseModel
|
|
|
|
with open(MISCELLANEOUS_DIRECTORY / "models" / "hub_credentials.json") as f:
|
|
HUB_CREDENTIALS = json.load(f)
|
|
|
|
with open(MISCELLANEOUS_DIRECTORY / "models" / "local_credentials.json") as f:
|
|
LOCAL_CREDENTIALS = json.load(f)
|
|
|
|
|
|
dc = make_dataclass(
|
|
cls_name="CredentialsModel",
|
|
fields=[
|
|
(k, str, "REPLACE_ME") for k in list(HUB_CREDENTIALS) + list(LOCAL_CREDENTIALS)
|
|
],
|
|
bases=(BaseModel,),
|
|
)
|
|
dc.__repr__ = dc.__base__.__repr__ # type: ignore
|
|
CredentialsModel = pydanticdataclass(
|
|
dc, config=dict(validate_assignment=True, frozen=True)
|
|
)
|