MCPcopy Index your code
hub / github.com/RustPython/RustPython / GenericBrowser

Class GenericBrowser

Lib/webbrowser.py:168–193  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

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

Callers 2

getFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected