bpo-40561: Add docstrings for webbrowser open functions (GH-19999)
Co-authored-by: Brad Solomon <brsolomon@deloitte.com> Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
This commit is contained in:
parent
d5d9a71866
commit
ef7973a981
@ -69,6 +69,14 @@ def get(using=None):
|
|||||||
# instead of "from webbrowser import *".
|
# instead of "from webbrowser import *".
|
||||||
|
|
||||||
def open(url, new=0, autoraise=True):
|
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:
|
if _tryorder is None:
|
||||||
with _lock:
|
with _lock:
|
||||||
if _tryorder is None:
|
if _tryorder is None:
|
||||||
@ -80,9 +88,17 @@ def open(url, new=0, autoraise=True):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
def open_new(url):
|
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)
|
return open(url, 1)
|
||||||
|
|
||||||
def open_new_tab(url):
|
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)
|
return open(url, 2)
|
||||||
|
|
||||||
|
|
||||||
|
@ -0,0 +1 @@
|
|||||||
|
Provide docstrings for webbrowser open functions.
|
Loading…
x
Reference in New Issue
Block a user