(reactor_path, event_loop_path=None)
Installs the :mod:`~twisted.internet.reactor` with the specified
    import path. Also installs the asyncio event loop with the specified import
    path if the asyncio reactor is enabled
Installs the :mod:`~twisted.internet.reactor` with the specified
    import path. Also installs the asyncio event loop with the specified import
    path if the asyncio reactor is enabled
Installs the : mod : ~twisted . internet . reactor with the specified import path . Also installs the asyncio event loop with the specified import path if the asyncio reactor is enabled
def install_reactor(reactor_path, event_loop_path=None):
    """Installs the :mod:`~twisted.internet.reactor` with the specified
    import path. Also installs the asyncio event loop with the specified import
    path if the asyncio reactor is enabled"""
    reactor_class = load_object(reactor_path)
    if reactor_class is asyncioreactor.AsyncioSelectorReactor:
        with suppress(error.ReactorAlreadyInstalledError):
            if sys.version_info >= (3, 8) and sys.platform == "win32":
                policy = asyncio.get_event_loop_policy()
                if not isinstance(policy, asyncio.WindowsSelectorEventLoopPolicy):
                    asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
            if event_loop_path is not None:
                event_loop_class = load_object(event_loop_path)
                event_loop = event_loop_class()
                asyncio.set_event_loop(event_loop)
            else:
                event_loop = asyncio.get_event_loop()
            asyncioreactor.install(eventloop=event_loop)
    else:
        *module, _ = reactor_path.split(".")
        installer_path = module + ["install"]
        installer = load_object(".".join(installer_path))
        with suppress(error.ReactorAlreadyInstalledError):
            installer()
def install_reactor ( reactor_path , event_loop_path = None ) : reactor_class = load_object ( reactor_path ) if reactor_class is asyncioreactor . AsyncioSelectorReactor : with suppress ( error . ReactorAlreadyInstalledError ) : if sys . version_info >= ( 3 , 8 ) and sys . platform == "win32" : policy = asyncio . get_event_loop_policy ( ) if not isinstance ( policy , asyncio . WindowsSelectorEventLoopPolicy ) : asyncio . set_event_loop_policy ( asyncio . WindowsSelectorEventLoopPolicy ( ) ) if event_loop_path is not None : event_loop_class = load_object ( event_loop_path ) event_loop = event_loop_class ( ) asyncio . set_event_loop ( event_loop ) else : event_loop = asyncio . get_event_loop ( ) asyncioreactor . install ( eventloop = event_loop ) else : * module , _ = reactor_path . split ( "." ) installer_path = module + [ "install" ] installer = load_object ( "." . join ( installer_path ) ) with suppress ( error . ReactorAlreadyInstalledError ) : installer ( )