Skip to content

Scrapy, a fast high-level web crawling & scraping framework for Python.

Move collect_asyncgen to utils.asyncgen

Eugenio Lacuesta0a93df9efd20
diff --git a/scrapy/utils/asyncgen.py b/scrapy/utils/asyncgen.py
new file mode 100644
index 000000000..7f697af5f
--- /dev/null
+++ b/scrapy/utils/asyncgen.py
@@ -0,0 +1,5 @@
+async def collect_asyncgen(result):
+ results = []
+ async for x in result:
+ results.append(x)
+ return results
diff --git a/scrapy/utils/py36.py b/scrapy/utils/py36.py
index 070b145a4..653e2bbbb 100644
--- a/scrapy/utils/py36.py
+++ b/scrapy/utils/py36.py
@@ -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,
)
diff --git a/scrapy/utils/python.py b/scrapy/utils/python.py
index 7bd286523..5703fd4c3 100644
--- a/scrapy/utils/python.py
+++ b/scrapy/utils/python.py
@@ -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