Skip to content
This repository has been archived by the owner on Aug 1, 2024. It is now read-only.

Commit

Permalink
open_html -> open
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromedockes committed Jun 21, 2024
1 parent 5da3e7f commit c7363fb
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ from sklearn.datasets import load_iris
from skrubview import Report

df = load_iris(as_frame=True)["frame"]
Report(df).open_html()
Report(df).open()
```

![screenshot](doc/screenshot.png)
Expand Down
2 changes: 1 addition & 1 deletion src/skrubview/_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def run():
input_file = Path(args.input_file).resolve()
report = Report(input_file, order_by=args.order_by)
if args.open:
report.open_html()
report.open()
elif args.dict:
rprint(report.summary_without_plots)
elif args.json:
Expand Down
6 changes: 3 additions & 3 deletions src/skrubview/_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from ._html import to_html
from ._text import to_text
from ._utils import read
from ._serve import open_html_in_browser, open_file_in_browser
from ._serve import open_in_browser, open_file_in_browser


class Report:
Expand Down Expand Up @@ -101,7 +101,7 @@ def _repr_mimebundle_(self, include=None, exclude=None):
del include, exclude
return {"text/html": self.html_snippet, "text/plain": self.text}

def open_html(self, file_path=None):
def open(self, file_path=None):
"""Open the HTML report in a web browser.
Parameters
Expand All @@ -114,7 +114,7 @@ def open_html(self, file_path=None):
in a "Not found" error.
"""
if file_path is None:
open_html_in_browser(self.html)
open_in_browser(self.html)
return
file_path = Path(file_path).resolve()
file_path.write_text(self.html, "UTF-8")
Expand Down
2 changes: 1 addition & 1 deletion src/skrubview/_serve.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
BROWSER_TIMEOUT_SECONDS = 3


def open_html_in_browser(content):
def open_in_browser(content):
encoded_content = content.encode("UTF-8")
queue = Queue()

Expand Down
4 changes: 2 additions & 2 deletions tests/test_serve.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from urllib.request import urlopen
import webbrowser

from skrubview._serve import open_html_in_browser
from skrubview._serve import open_in_browser


class UrlOpener:
Expand All @@ -13,5 +13,5 @@ def __call__(self, url):
def test_open_in_browser_file(monkeypatch):
opener = UrlOpener()
monkeypatch.setattr(webbrowser, "open", opener)
open_html_in_browser("hello")
open_in_browser("hello")
assert opener.content == b"hello"

0 comments on commit c7363fb

Please sign in to comment.