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

Class GenericBrowser

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

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

Source from the content-addressed store, hash-verified

157
158
159class GenericBrowser(BaseBrowser):
160 """Class for all browsers started with a command
161 and without remote functionality."""
162
163 def __init__(self, name):
164 if isinstance(name, str):
165 self.name = name
166 self.args = ["%s"]
167 else:
168 # name should be a list with arguments
169 self.name = name[0]
170 self.args = name[1:]
171 self.basename = os.path.basename(self.name)
172
173 def open(self, url, new=0, autoraise=True):
174 sys.audit("webbrowser.open", url)
175 cmdline = [self.name] + [arg.replace("%s", url)
176 for arg in self.args]
177 try:
178 if sys.platform[:3] == 'win':
179 p = subprocess.Popen(cmdline)
180 else:
181 p = subprocess.Popen(cmdline, close_fds=True)
182 return not p.wait()
183 except OSError:
184 return False
185
186
187class BackgroundBrowser(GenericBrowser):

Callers 2

getFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected