MCPcopy
hub / github.com/scrapy/scrapy / is_reactorless

Function is_reactorless

scrapy/utils/reactorless.py:16–30  ·  view source on GitHub ↗

Check if we are running in the reactorless mode, i.e. with :setting:`TWISTED_REACTOR_ENABLED` set to ``False``. As this checks the runtime state and not the setting itself, it can be wrong when executed very early, before the reactor and/or the asyncio event loop are initialized.

()

Source from the content-addressed store, hash-verified

14
15
16def is_reactorless() -> bool:
17 """Check if we are running in the reactorless mode, i.e. with
18 :setting:`TWISTED_REACTOR_ENABLED` set to ``False``.
19
20 As this checks the runtime state and not the setting itself, it can be
21 wrong when executed very early, before the reactor and/or the asyncio event
22 loop are initialized.
23
24 .. note:: As this function uses
25 :func:`scrapy.utils.asyncio.is_asyncio_available()`, it has the same
26 limitations for detecting a running asyncio event loop as that one.
27
28 .. versionadded:: 2.15.0
29 """
30 return is_asyncio_available() and not is_reactor_installed()
31
32
33class ReactorImportHook(MetaPathFinder):

Callers 9

__init__Method · 0.90
startMethod · 0.90
startMethod · 0.90
startMethod · 0.90
startMethod · 0.90
startMethod · 0.90
startMethod · 0.90
startMethod · 0.90
startMethod · 0.90

Calls 2

is_asyncio_availableFunction · 0.90
is_reactor_installedFunction · 0.90

Tested by

no test coverage detected