(self, method: str)
| 124 | self.logformatter: LogFormatter = crawler.logformatter |
| 125 | |
| 126 | def _check_deprecated_itemproc_method(self, method: str) -> None: |
| 127 | itemproc_cls = type(self.itemproc) |
| 128 | if not hasattr(self.itemproc, "process_item_async"): |
| 129 | warnings.warn( |
| 130 | f"{global_object_name(itemproc_cls)} doesn't define a {method}_async() method," |
| 131 | f" this is deprecated and the method will be required in future Scrapy versions.", |
| 132 | ScrapyDeprecationWarning, |
| 133 | stacklevel=2, |
| 134 | ) |
| 135 | self._itemproc_has_async[method] = False |
| 136 | elif ( |
| 137 | issubclass(itemproc_cls, ItemPipelineManager) |
| 138 | and method_is_overridden(itemproc_cls, ItemPipelineManager, method) |
| 139 | and not method_is_overridden( |
| 140 | itemproc_cls, ItemPipelineManager, f"{method}_async" |
| 141 | ) |
| 142 | ): |
| 143 | warnings.warn( |
| 144 | f"{global_object_name(itemproc_cls)} overrides {method}() but doesn't override {method}_async()." |
| 145 | f" This is deprecated. {method}() will be used, but in future Scrapy versions {method}_async() will be used instead.", |
| 146 | ScrapyDeprecationWarning, |
| 147 | stacklevel=2, |
| 148 | ) |
| 149 | self._itemproc_has_async[method] = False |
| 150 | else: |
| 151 | self._itemproc_has_async[method] = True |
| 152 | |
| 153 | def open_spider( |
| 154 | self, spider: Spider | None = None |
no test coverage detected