From 98824034590d92dbaf2152f4db6416c69547c17d Mon Sep 17 00:00:00 2001 From: Brad Solomon Date: Fri, 8 May 2020 08:30:13 -0400 Subject: [PATCH 1/4] Provide docstrings for public-facing webbrowser functions --- Lib/webbrowser.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Lib/webbrowser.py b/Lib/webbrowser.py index 1ef179a91a6f19..92b49cb33f8156 100755 --- a/Lib/webbrowser.py +++ b/Lib/webbrowser.py @@ -69,6 +69,15 @@ def get(using=None): # instead of "from webbrowser import *". def open(url, new=0, autoraise=True): + """Display url using the default browser. + + If new is: + - 0: url is opened in the same browser window, if possible + - 1: a new browser window is opened, if possible + - 2: a new browser page ("tab") is opened, if possible + + If autoraise is True, the window is raised, if possible. + """ if _tryorder is None: with _lock: if _tryorder is None: @@ -80,9 +89,17 @@ def open(url, new=0, autoraise=True): return False def open_new(url): + """Open url in a new window of the default browser. + + If not possible, then open url in the only browser window. + """ return open(url, 1) def open_new_tab(url): + """Open url in a new page ("tab") of the default browser. + + If not possible, then the behavior becomes equivalent to open_new(). + """ return open(url, 2) From e0ed64d715d0f41bc645314a74a39041774e3c5f Mon Sep 17 00:00:00 2001 From: Brad Solomon Date: Fri, 8 May 2020 08:40:09 -0400 Subject: [PATCH 2/4] Add news entry --- .../next/Documentation/2020-05-08-08-39-40.bpo-40561.ZMB_2i.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Documentation/2020-05-08-08-39-40.bpo-40561.ZMB_2i.rst diff --git a/Misc/NEWS.d/next/Documentation/2020-05-08-08-39-40.bpo-40561.ZMB_2i.rst b/Misc/NEWS.d/next/Documentation/2020-05-08-08-39-40.bpo-40561.ZMB_2i.rst new file mode 100644 index 00000000000000..a9272b939c91ec --- /dev/null +++ b/Misc/NEWS.d/next/Documentation/2020-05-08-08-39-40.bpo-40561.ZMB_2i.rst @@ -0,0 +1 @@ +Provide docstrings for public-facing webbrowser functions. From c48b2637af1795036ba76acb8a74f277d9db5604 Mon Sep 17 00:00:00 2001 From: Terry Jan Reedy Date: Sat, 9 May 2020 21:06:40 -0400 Subject: [PATCH 3/4] Change open docstring --- Lib/webbrowser.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Lib/webbrowser.py b/Lib/webbrowser.py index 92b49cb33f8156..9c73bcfb44ae81 100755 --- a/Lib/webbrowser.py +++ b/Lib/webbrowser.py @@ -71,12 +71,11 @@ def get(using=None): def open(url, new=0, autoraise=True): """Display url using the default browser. - If new is: - - 0: url is opened in the same browser window, if possible - - 1: a new browser window is opened, if possible - - 2: a new browser page ("tab") is opened, if possible - - If autoraise is True, the window is raised, if possible. + If possible, open url in a location determined by new. + - 0: the same browser window (the default). + - 1: a new browser window. + - 2: a new browser page ("tab"). + If possible, autoraise raises the window (the default) or not. """ if _tryorder is None: with _lock: From c9aefceacd39fbd1839496a2eed02b35501d8882 Mon Sep 17 00:00:00 2001 From: Terry Jan Reedy Date: Sat, 9 May 2020 21:08:21 -0400 Subject: [PATCH 4/4] Edit news entry. --- .../next/Documentation/2020-05-08-08-39-40.bpo-40561.ZMB_2i.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Misc/NEWS.d/next/Documentation/2020-05-08-08-39-40.bpo-40561.ZMB_2i.rst b/Misc/NEWS.d/next/Documentation/2020-05-08-08-39-40.bpo-40561.ZMB_2i.rst index a9272b939c91ec..bda24719b12cb3 100644 --- a/Misc/NEWS.d/next/Documentation/2020-05-08-08-39-40.bpo-40561.ZMB_2i.rst +++ b/Misc/NEWS.d/next/Documentation/2020-05-08-08-39-40.bpo-40561.ZMB_2i.rst @@ -1 +1 @@ -Provide docstrings for public-facing webbrowser functions. +Provide docstrings for webbrowser open functions.