Scrapy, a fast high-level web crawling & scraping framework for Python.
Make the _set_xback condition more readable
Adrián Chavesc883a13006ad
diff --git a/scrapy/http/request/__init__.py b/scrapy/http/request/__init__.pyindex a78ba5115..065f2daef 100644--- a/scrapy/http/request/__init__.py+++ b/scrapy/http/request/__init__.py@@ -106,10 +106,10 @@ class Request(object_ref):self.flags = [] if flags is None else list(flags)def _set_xback(self, name: str, value: Optional[Callable]) -> None:- if (- value is not None- and (name != "callback" or value is not NO_CALLBACK)- and not callable(value)+ if not (+ callable(value)+ or value is None+ or (name == "callback" and value is NO_CALLBACK)):raise TypeError(f"{name} must be a callable, got {type(value).__name__}")setattr(self, name, value)