MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / get

Function get

tools/python-3.11.9-amd64/Lib/webbrowser.py:38–66  ·  view source on GitHub ↗

Return a browser launcher instance appropriate for the environment.

(using=None)

Source from the content-addressed store, hash-verified

36 _tryorder.append(name)
37
38def get(using=None):
39 """Return a browser launcher instance appropriate for the environment."""
40 if _tryorder is None:
41 with _lock:
42 if _tryorder is None:
43 register_standard_browsers()
44 if using is not None:
45 alternatives = [using]
46 else:
47 alternatives = _tryorder
48 for browser in alternatives:
49 if '%s' in browser:
50 # User gave us a command line, split it into name and args
51 browser = shlex.split(browser)
52 if browser[-1] == '&':
53 return BackgroundBrowser(browser[:-1])
54 else:
55 return GenericBrowser(browser)
56 else:
57 # User gave us a browser name or path.
58 try:
59 command = _browsers[browser.lower()]
60 except KeyError:
61 command = _synthesize(browser)
62 if command[1] is not None:
63 return command[1]
64 elif command[0] is not None:
65 return command[0]()
66 raise Error("could not locate runnable browser")
67
68# Please note: the following definition hides a builtin function.
69# It is recommended one does "import webbrowser" and uses webbrowser.open(url)

Callers 4

__get__Method · 0.70
openFunction · 0.70
_descriptor_getFunction · 0.70
runMethod · 0.50

Calls 7

BackgroundBrowserClass · 0.85
GenericBrowserClass · 0.85
_synthesizeFunction · 0.85
ErrorClass · 0.70
splitMethod · 0.45
lowerMethod · 0.45

Tested by

no test coverage detected