(browser, *, preferred=False)
return [None, None]
Attempt to synthesize a controller based on existing controllers.

    This is useful to create a controller when a user specifies a path to
    an entry in the BROWSER environment variable -- we can copy a general
    controller to operate using a specific installation of the desired
    browser in this way.

    If we can't create a controller in this way, or if there is no
    executable for the requested browser, return [None, None].
Attempt to synthesize a controller based on existing controllers.
Attempt to synthesize a controller based on existing controllers .
def _synthesize(browser, *, preferred=False):
    """Attempt to synthesize a controller based on existing controllers.

    This is useful to create a controller when a user specifies a path to
    an entry in the BROWSER environment variable -- we can copy a general
    controller to operate using a specific installation of the desired
    browser in this way.

    If we can't create a controller in this way, or if there is no
    executable for the requested browser, return [None, None].

    """
    cmd = browser.split()[0]
    if not shutil.which(cmd):
        return [None, None]
    name = os.path.basename(cmd)
    try:
        command = _browsers[name.lower()]
    except KeyError:
        return [None, None]
    # now attempt to clone to fit the new name:
    controller = command[1]
    if controller and name.lower() == controller.basename:
        import copy
        controller = copy.copy(controller)
        controller.name = browser
        controller.basename = os.path.basename(browser)
        register(browser, None, instance=controller, preferred=preferred)
        return [None, controller]
    return [None, None]
def _synthesize ( browser , * , preferred = False ) : cmd = browser . split ( ) [ 0 ] if not shutil . which ( cmd ) : return [ None , None ] name = os . path . basename ( cmd ) try : command = _browsers [ name . lower ( ) ] except KeyError : return [ None , None ] # now attempt to clone to fit the new name: controller = command [ 1 ] if controller and name . lower ( ) == controller . basename : import copy controller = copy . copy ( controller ) controller . name = browser controller . basename = os . path . basename ( browser ) register ( browser , None , instance = controller , preferred = preferred ) return [ None , controller ] return [ None , None ]