Skip to content

Commit

Permalink
update examples
Browse files Browse the repository at this point in the history
  • Loading branch information
tehcoderer committed Aug 30, 2023
1 parent 1e2eec8 commit e52cd3d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 deletions.
9 changes: 2 additions & 7 deletions examples/plotly_figure/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def send_figure(self, fig: go.Figure):
fig : go.Figure
Plotly figure to send to backend.
"""
self.loop.run_until_complete(self.check_backend())
self.check_backend()
title = fig.layout.title.text if fig.layout.title else "Plotly Figure"

json_data = json.loads(fig.to_json())
Expand Down Expand Up @@ -82,7 +82,7 @@ def figure_write_image(
timeout : int, optional
Timeout for receiving the image, by default 5
"""
self.loop.run_until_complete(self.check_backend())
self.check_backend()

json_data = json.loads(fig.to_json())
json_data["scale"] = scale
Expand Down Expand Up @@ -117,11 +117,6 @@ def start(self, debug: bool = False, headless: bool = False):
if self.isatty:
super().start(debug, headless)

async def check_backend(self):
"""Override to check if isatty."""
if self.isatty:
await super().check_backend()


def pywry_backend(daemon: bool = True) -> Backend:
"""Get the backend."""
Expand Down
7 changes: 1 addition & 6 deletions examples/streamlit/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def send_url(
height : int, optional
Height of the window, by default 800
"""
self.loop.run_until_complete(self.check_backend())
self.check_backend()
script = f"""
<script>
window.location.replace("{url}");
Expand All @@ -76,11 +76,6 @@ def start(self, debug: bool = False):
if self.isatty:
super().start(debug)

async def check_backend(self):
"""Override to check if isatty."""
if self.isatty:
await super().check_backend()


def pywry_backend(daemon: bool = True) -> Backend:
"""Get the backend."""
Expand Down

0 comments on commit e52cd3d

Please sign in to comment.