mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-11-08 18:32:21 +00:00
[BugFix] Improve Warning For Invalid Defaults Key In user_settings.json (#6651)
* improve warning for invalid defaults key in user_settings.json * didn't add to the commit
This commit is contained in:
@@ -30,11 +30,16 @@ class Defaults(BaseModel):
|
||||
"""Validate model (before)."""
|
||||
key = "commands"
|
||||
if "routes" in values:
|
||||
warn(
|
||||
message="'routes' is deprecated. Use 'commands' instead.",
|
||||
category=OpenBBWarning,
|
||||
)
|
||||
key = "routes"
|
||||
if not values.get("routes"):
|
||||
del values["routes"]
|
||||
show_warnings = values.get("preferences", {}).get("show_warnings")
|
||||
if show_warnings is False or show_warnings in ["False", "false"]:
|
||||
warn(
|
||||
message="The 'routes' key is deprecated within 'defaults' of 'user_settings.json'."
|
||||
+ " Suppress this warning by updating the key to 'commands'.",
|
||||
category=OpenBBWarning,
|
||||
)
|
||||
key = "routes"
|
||||
|
||||
new_values: Dict[str, Dict[str, Optional[List[str]]]] = {"commands": {}}
|
||||
for k, v in values.get(key, {}).items():
|
||||
|
||||
Reference in New Issue
Block a user