Skip to content

Commit

Permalink
sdk generation tests, trailmap fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
tehcoderer committed Mar 18, 2023
1 parent 7638ac3 commit 2575784
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 8 deletions.
16 changes: 10 additions & 6 deletions generate_sdk.py
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ def build(self) -> None:
subprocess.check_call(["black", "openbb_terminal"]) # nosec: B603, B607


def generate_sdk(sort: bool = False) -> None:
def generate_sdk(sort: bool = False) -> bool:
"""Generate the SDK.
Parameters
Expand All @@ -544,11 +544,15 @@ def generate_sdk(sort: bool = False) -> None:
Whether to sort the CSVs, by default False
"""
trailmaps = get_trailmaps(sort)

console.print("[yellow]Generating SDK...[/]")
BuildCategoryModelClasses(trailmaps).build()
console.print("[green]SDK Generated Successfully.[/]")
return
try:
console.print("[yellow]Generating SDK...[/]")
BuildCategoryModelClasses(trailmaps).build()
console.print("[green]SDK Generated Successfully.[/]")
except Exception as e:
console.print(f"[red]Error generating SDK: {e}[/]")
return False

return True


if __name__ == "__main__":
Expand Down
2 changes: 1 addition & 1 deletion openbb_terminal/core/sdk/sdk_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ def get_sdk_imports_text() -> str:
cfg.start_plot_backend()
logger = logging.getLogger(__name__)
theme.applyMPLstyle()
cfg.theme.applyMPLstyle()
\r\r\r
"""
return "\r".join(sdk_imports.splitlines())
1 change: 0 additions & 1 deletion openbb_terminal/core/sdk/trail_map.csv
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,6 @@ keys.messari,keys_model.set_messari_key,
keys.mykeys,keys_model.get_keys,
keys.news,keys_model.set_news_key,
keys.oanda,keys_model.set_oanda_key,
keys.openbb,keys_model.set_openbb_personal_access_token,
keys.polygon,keys_model.set_polygon_key,
keys.quandl,keys_model.set_quandl_key,
keys.reddit,keys_model.set_reddit_key,
Expand Down
1 change: 1 addition & 0 deletions openbb_terminal/sdk.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
cfg.start_plot_backend()

logger = logging.getLogger(__name__)
cfg.theme.applyMPLstyle()


class OpenBBSDK:
Expand Down
6 changes: 6 additions & 0 deletions tests/test_generate_sdk.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from generate_sdk import generate_sdk


def test_sdk_generation():
"""Test the sdk markdown generator"""
assert generate_sdk() is True

0 comments on commit 2575784

Please sign in to comment.