Skip to content

Commit

Permalink
Don't use argument-unpacking for our container declarations
Browse files Browse the repository at this point in the history
  • Loading branch information
jleibs committed Mar 20, 2024
1 parent d4e4576 commit 702af1c
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions examples/python/blueprint_stocks/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ def one_stock(symbol: str) -> rrb.ViewportLike:
return rrb.TimeSeriesView(name=f"{symbol}", origin=f"/stocks/{symbol}")


def one_stock_with_info(symbol: str) -> rrb.ViewportLike:
"""Create a blueprint showing a single stock."""
return rrb.Horizontal(rrb.TimeSeriesView(name=f"{symbol}", origin=f"/stocks/{symbol}"))


def compare_two(symbol1: str, symbol2: str, day: Any) -> rrb.ViewportLike:
"""Create a blueprint comparing 2 stocks for a single day."""
return rrb.TimeSeriesView(
Expand Down Expand Up @@ -61,13 +66,13 @@ def one_stock_no_peaks(symbol: str) -> rrb.ViewportLike:
def stock_grid(symbols: list[str], dates: list[Any]) -> rrb.ViewportLike:
"""Create a grid of stocks and their time series over all days."""
return rrb.Vertical(
*(
contents=[
rrb.Horizontal(
rrb.TextDocumentView(name=f"{symbol}", origin=f"/stocks/{symbol}/info"),
*(rrb.TimeSeriesView(name=f"{day}", origin=f"/stocks/{symbol}/{day}") for day in dates),
contents=[rrb.TextDocumentView(name=f"{symbol}", origin=f"/stocks/{symbol}/info")]
+ [rrb.TimeSeriesView(name=f"{day}", origin=f"/stocks/{symbol}/{day}") for day in dates],
)
for symbol in symbols
)
]
)


Expand Down

0 comments on commit 702af1c

Please sign in to comment.