Skip to content

[3.7] bpo-40561: Add docstrings for webbrowser open functions (GH-19999) #20037

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions Lib/webbrowser.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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)


Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Provide docstrings for webbrowser open functions.