]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-40561: Add docstrings for webbrowser open functions (GH-19999)
authorBrad Solomon <brad.solomon.1124@gmail.com>
Mon, 11 May 2020 18:50:11 +0000 (14:50 -0400)
committerGitHub <noreply@github.com>
Mon, 11 May 2020 18:50:11 +0000 (14:50 -0400)
Co-authored-by: Brad Solomon <brsolomon@deloitte.com>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Lib/webbrowser.py
Misc/NEWS.d/next/Documentation/2020-05-08-08-39-40.bpo-40561.ZMB_2i.rst [new file with mode: 0644]

index 1ef179a91a6f19dbbf2b013e94f15150902e3d7e..9c73bcfb44ae81b27d081d9f9a82c08885e1f15f 100755 (executable)
@@ -69,6 +69,14 @@ def get(using=None):
 # instead of "from webbrowser import *".
 
 def open(url, new=0, autoraise=True):
+    """Display url using the default browser.
+
+    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:
             if _tryorder is None:
@@ -80,9 +88,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)
 
 
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 (file)
index 0000000..bda2471
--- /dev/null
@@ -0,0 +1 @@
+Provide docstrings for webbrowser open functions.