MCPcopy
hub / github.com/scrapy/scrapy / verify_installed_reactor

Function verify_installed_reactor

scrapy/utils/reactor.py:167–184  ·  view source on GitHub ↗

Raise :exc:`RuntimeError` if the installed :mod:`~twisted.internet.reactor` does not match the specified import path or if no reactor is installed.

(reactor_path: str)

Source from the content-addressed store, hash-verified

165
166
167def verify_installed_reactor(reactor_path: str) -> None:
168 """Raise :exc:`RuntimeError` if the installed
169 :mod:`~twisted.internet.reactor` does not match the specified import
170 path or if no reactor is installed."""
171 if not is_reactor_installed():
172 raise RuntimeError(
173 "verify_installed_reactor() called without an installed reactor."
174 )
175
176 from twisted.internet import reactor
177
178 expected_reactor_type = load_object(reactor_path)
179 reactor_type = type(reactor)
180 if not reactor_type == expected_reactor_type:
181 raise RuntimeError(
182 f"The installed reactor ({global_object_name(reactor_type)}) "
183 f"does not match the requested one ({reactor_path})"
184 )
185
186
187def verify_installed_asyncio_event_loop(loop_path: str) -> None:

Callers 2

_apply_settingsMethod · 0.90
__init__Method · 0.90

Calls 3

load_objectFunction · 0.90
global_object_nameFunction · 0.90
is_reactor_installedFunction · 0.85

Tested by

no test coverage detected