MCPcopy Index your code
hub / github.com/python/cpython / get

Function get

Lib/webbrowser.py:40–68  ·  view source on GitHub ↗

Return a browser launcher instance appropriate for the environment.

(using=None)

Source from the content-addressed store, hash-verified

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

Callers 4

__get__Method · 0.70
openFunction · 0.70
_descriptor_getFunction · 0.70
urlretrieveFunction · 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