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

Class GenericBrowser

Lib/webbrowser.py:173–199  ·  view source on GitHub ↗

Class for all browsers started with a command and without remote functionality.

Source from the content-addressed store, hash-verified

171
172
173class GenericBrowser(BaseBrowser):
174 """Class for all browsers started with a command
175 and without remote functionality."""
176
177 def __init__(self, name):
178 if isinstance(name, str):
179 self.name = name
180 self.args = ["%s"]
181 else:
182 # name should be a list with arguments
183 self.name = name[0]
184 self.args = name[1:]
185 self.basename = os.path.basename(self.name)
186
187 def open(self, url, new=0, autoraise=True):
188 sys.audit("webbrowser.open", url)
189 self._check_url(url)
190 cmdline = [self.name] + [arg.replace("%s", url)
191 for arg in self.args]
192 try:
193 if sys.platform[:3] == 'win':
194 p = subprocess.Popen(cmdline)
195 else:
196 p = subprocess.Popen(cmdline, close_fds=True)
197 return not p.wait()
198 except OSError:
199 return False
200
201
202class BackgroundBrowser(GenericBrowser):

Callers 2

getFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…