Move collect_asyncgen to utils.asyncgen

This commit is contained in:
Eugenio Lacuesta 2020-11-23 16:16:18 -03:00
parent 075ab156b0
commit 0a93df9efd
No known key found for this signature in database
GPG Key ID: DA3EF2D0913E9810
3 changed files with 7 additions and 9 deletions

5
scrapy/utils/asyncgen.py Normal file
View File

@ -0,0 +1,5 @@
async def collect_asyncgen(result):
results = []
async for x in result:
results.append(x)
return results

View File

@ -1,11 +1,11 @@
import warnings
from scrapy.exceptions import ScrapyDeprecationWarning
from scrapy.utils.python import collect_asyncgen # noqa: F401
from scrapy.utils.asyncgen import collect_asyncgen # noqa: F401
warnings.warn(
"Module `scrapy.utils.py36` is deprecated, please import from `scrapy.utils.python` instead.",
"Module `scrapy.utils.py36` is deprecated, please import from `scrapy.utils.asyncgen` instead.",
category=ScrapyDeprecationWarning,
stacklevel=2,
)

View File

@ -355,10 +355,3 @@ class MutableChain:
@deprecated("scrapy.utils.python.MutableChain.__next__")
def next(self):
return self.__next__()
async def collect_asyncgen(result):
results = []
async for x in result:
results.append(x)
return results