mirror of https://github.com/scrapy/scrapy.git
Minor refactoring
This commit is contained in:
parent
73f7dbaa50
commit
f5080c1e4c
|
|
@ -29,7 +29,7 @@ from scrapy.exceptions import (
|
|||
ScrapyDeprecationWarning,
|
||||
)
|
||||
from scrapy.http import Request, Response
|
||||
from scrapy.utils._stopmode import _normalize_stop_mode, _StopMode, max_stop_mode
|
||||
from scrapy.utils._stopmode import _max_stop_mode, _normalize_stop_mode, _StopMode
|
||||
from scrapy.utils.asyncio import (
|
||||
AsyncioLoopingCall,
|
||||
create_looping_call,
|
||||
|
|
@ -226,7 +226,7 @@ class ExecutionEngine:
|
|||
if not self._starting and not self._stopping:
|
||||
raise RuntimeError("Engine not running")
|
||||
|
||||
self._stop_mode = max_stop_mode(self._stop_mode, mode)
|
||||
self._stop_mode = _max_stop_mode(self._stop_mode, mode)
|
||||
|
||||
if self._stopping:
|
||||
if self.spider is not None and self._stop_mode == "fast":
|
||||
|
|
@ -653,7 +653,7 @@ class ExecutionEngine:
|
|||
.. versionadded:: 2.14
|
||||
"""
|
||||
mode = _normalize_stop_mode(mode, allow_force=False)
|
||||
self._stop_mode = max_stop_mode(self._stop_mode, mode)
|
||||
self._stop_mode = _max_stop_mode(self._stop_mode, mode)
|
||||
|
||||
if self.spider is None:
|
||||
raise RuntimeError("Spider not opened")
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ def _normalize_stop_mode(mode: _StopMode, *, allow_force: bool = True) -> _StopM
|
|||
return mode
|
||||
|
||||
|
||||
def max_stop_mode(mode1: _StopMode, mode2: _StopMode) -> _StopMode:
|
||||
def _max_stop_mode(mode1: _StopMode, mode2: _StopMode) -> _StopMode:
|
||||
if _STOP_MODE_PRIORITY[mode1] >= _STOP_MODE_PRIORITY[mode2]:
|
||||
return mode1
|
||||
return mode2
|
||||
|
|
|
|||
Loading…
Reference in New Issue