mirror of https://github.com/scrapy/scrapy.git
Replace return type
This commit is contained in:
parent
479260dca0
commit
ce6447731a
|
|
@ -126,10 +126,10 @@ class Request(object_ref):
|
|||
|
||||
__repr__ = __str__
|
||||
|
||||
def copy(self) -> RequestTypeVar:
|
||||
def copy(self) -> "Request":
|
||||
return self.replace()
|
||||
|
||||
def replace(self, *args, **kwargs) -> RequestTypeVar:
|
||||
def replace(self, *args, **kwargs) -> "Request":
|
||||
"""Create a new Request with the same attributes except for those given new values"""
|
||||
for x in self.attributes:
|
||||
kwargs.setdefault(x, getattr(self, x))
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import json
|
|||
import warnings
|
||||
from typing import Optional, Tuple
|
||||
|
||||
from scrapy.http.request import Request, RequestTypeVar
|
||||
from scrapy.http.request import Request
|
||||
from scrapy.utils.deprecate import create_deprecated_class
|
||||
|
||||
|
||||
|
|
@ -42,7 +42,7 @@ class JsonRequest(Request):
|
|||
def dumps_kwargs(self) -> dict:
|
||||
return self._dumps_kwargs
|
||||
|
||||
def replace(self, *args, **kwargs) -> RequestTypeVar:
|
||||
def replace(self, *args, **kwargs) -> Request:
|
||||
body_passed = kwargs.get('body', None) is not None
|
||||
data = kwargs.pop('data', None)
|
||||
data_passed = data is not None
|
||||
|
|
|
|||
Loading…
Reference in New Issue