Skip to content

Commit

Permalink
Fix mypy
Browse files Browse the repository at this point in the history
  • Loading branch information
alan-cooney authored Oct 23, 2023
1 parent d440385 commit 59868e5
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions python/circuitsvis/utils/render.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,11 @@ def __init__(self, local_src: str, cdn_src: str):
self.local_src = local_src
self.cdn_src = cdn_src

def _repr_html_(self, include_mime=True) -> Union[Tuple[str, Dict], str]:
def _repr_html_(self) -> Tuple[str, Dict]:
"""Jupyter/Colab HTML Representation
When Jupyter sees this method, it renders the HTML.
Args:
include_mime: Whether or not to include the mime content type. This is an undocumented
IPython feature.
Returns:
HTML for Jupyter/Colab
"""
Expand All @@ -63,14 +59,13 @@ def _repr_html_(self, include_mime=True) -> Union[Tuple[str, Dict], str]:
src = self.cdn_src

# Return html
if include_mime:
mime = {"Content-Type": "text/html"}
return src, mime
return src
mime = {"Content-Type": "text/html"}
return src, mime

def __html__(self) -> str:
"""Used by some tooling as an alternative to _repr_html_"""
return self._repr_html_(include_mime=False)
# Just return the source code (not the MIME data), as some tools may not support this.
return self._repr_html_()[0]

def show_code(self) -> str:
"""Show the code as HTML source code
Expand Down

0 comments on commit 59868e5

Please sign in to comment.