Scrapy, a fast high-level web crawling & scraping framework for Python.
correcting type hints
Alexeecc035f4c2e
diff --git a/scrapy/pipelines/files.py b/scrapy/pipelines/files.pyindex 1b724ce60..fcd9f9078 100644--- a/scrapy/pipelines/files.py+++ b/scrapy/pipelines/files.py@@ -9,11 +9,11 @@ import loggingimport mimetypesimport osimport time-from os import PathLikefrom collections import defaultdictfrom contextlib import suppressfrom ftplib import FTPfrom io import BytesIO+from os import PathLikefrom pathlib import Pathfrom typing import DefaultDict, Optional, Set, Unionfrom urllib.parse import urlparse@@ -54,12 +54,14 @@ class FSFilesStore:self._mkdir(Path(self.basedir))self.created_directories: DefaultDict[str, Set[str]] = defaultdict(set)- def persist_file(self, path: str, buf, info, meta=None, headers=None):+ def persist_file(+ self, path: Union[str, PathLike], buf, info, meta=None, headers=None+ ):absolute_path = self._get_filesystem_path(path)self._mkdir(absolute_path.parent, info)absolute_path.write_bytes(buf.getvalue())- def stat_file(self, path: str, info):+ def stat_file(self, path: Union[str, PathLike], info):absolute_path = self._get_filesystem_path(path)try:last_modified = absolute_path.stat().st_mtime