Skip to content

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

scrapy.utils.data_path type hint change (#6133)

cakemdeafe828484d9
diff --git a/scrapy/utils/project.py b/scrapy/utils/project.py
index a2c224b90..de3c8eaf9 100644
--- a/scrapy/utils/project.py
+++ b/scrapy/utils/project.py
@@ -1,7 +1,9 @@
import os
import warnings
from importlib import import_module
+from os import PathLike
from pathlib import Path
+from typing import Union
from scrapy.exceptions import NotConfigured
from scrapy.settings import Settings
@@ -44,7 +46,7 @@ def project_data_dir(project: str = "default") -> str:
return str(d)
-def data_path(path: str, createdir: bool = False) -> str:
+def data_path(path: Union[str, PathLike], createdir: bool = False) -> str:
"""
Return the given path joined with the .scrapy data directory.
If given an absolute path, return it unmodified.