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

Method open

tools/python-3.11.9-amd64/Lib/webbrowser.py:258–282  ·  view source on GitHub ↗
(self, url, new=0, autoraise=True)

Source from the content-addressed store, hash-verified

256 return not p.wait()
257
258 def open(self, url, new=0, autoraise=True):
259 sys.audit("webbrowser.open", url)
260 if new == 0:
261 action = self.remote_action
262 elif new == 1:
263 action = self.remote_action_newwin
264 elif new == 2:
265 if self.remote_action_newtab is None:
266 action = self.remote_action_newwin
267 else:
268 action = self.remote_action_newtab
269 else:
270 raise Error("Bad 'new' parameter to open(); " +
271 "expected 0, 1, or 2, got %s" % new)
272
273 args = [arg.replace("%s", url).replace("%action", action)
274 for arg in self.remote_args]
275 args = [arg for arg in args if arg]
276 success = self._invoke(args, True, autoraise, url)
277 if not success:
278 # remote invocation failed, try straight way
279 args = [arg.replace("%s", url) for arg in self.args]
280 return self._invoke(args, False, False)
281 else:
282 return True
283
284
285class Mozilla(UnixBrowser):

Callers

nothing calls this directly

Calls 3

_invokeMethod · 0.95
ErrorClass · 0.70
replaceMethod · 0.45

Tested by

no test coverage detected