From 8ef3783d5dba37e01bacfcfe6436de1a708700c5 Mon Sep 17 00:00:00 2001 From: liyang Date: Wed, 20 Nov 2024 12:59:29 +0800 Subject: [PATCH] make lint happy --- megfile/fsspec.py | 10 +++++----- tests/test_smart_path.py | 5 ++++- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/megfile/fsspec.py b/megfile/fsspec.py index 9df40c16..999e150e 100644 --- a/megfile/fsspec.py +++ b/megfile/fsspec.py @@ -63,7 +63,7 @@ def _make_entry(filesystem, info): class BaseFSSpecPath(URIPath): protocol: str - filesystem: 'fsspec.AbstractFileSystem' + filesystem: "fsspec.AbstractFileSystem" def __init__(self, path: PathLike, *other_paths: PathLike): super().__init__(path, *other_paths) @@ -375,7 +375,7 @@ def sync( self.path_without_protocol, dst_path, recursive=True ) - def rename(self, dst_path: PathLike, overwrite: bool = True) -> "BaseFSSpecPath": + def rename(self, dst_path: PathLike, overwrite: bool = True): """ rename file with fsspec @@ -384,7 +384,7 @@ def rename(self, dst_path: PathLike, overwrite: bool = True) -> "BaseFSSpecPath" """ self.filesystem.mv(self.path_without_protocol, dst_path, recursive=False) - def move(self, dst_path: PathLike, overwrite: bool = True) -> "BaseFSSpecPath": + def move(self, dst_path: PathLike, overwrite: bool = True): """ move file/directory with fsspec @@ -393,7 +393,7 @@ def move(self, dst_path: PathLike, overwrite: bool = True) -> "BaseFSSpecPath": """ self.filesystem.mv(self.path_without_protocol, dst_path, recursive=True) - def unlink(self, missing_ok: bool = False) -> None: + def unlink(self, missing_ok: bool = False): """ Remove the file with fsspec @@ -403,7 +403,7 @@ def unlink(self, missing_ok: bool = False) -> None: return self.filesystem.rm(self.path_without_protocol, recursive=False) - def remove(self, missing_ok: bool = False) -> None: + def remove(self, missing_ok: bool = False): """ Remove the file or directory with fsspec diff --git a/tests/test_smart_path.py b/tests/test_smart_path.py index 51b93607..883d3ae8 100644 --- a/tests/test_smart_path.py +++ b/tests/test_smart_path.py @@ -12,6 +12,7 @@ ) from megfile.fs_path import FSPath from megfile.hdfs_path import HdfsPath +from megfile.hf_path import HFPath from megfile.http_path import HttpPath, HttpsPath from megfile.interfaces import Access from megfile.s3_path import S3Path @@ -58,7 +59,7 @@ def s3_empty_client(mocker): def test_register_result(): - assert len(SmartPath._registered_protocols) == 7 + assert len(SmartPath._registered_protocols) == 8 assert S3Path.protocol in SmartPath._registered_protocols assert FSPath.protocol in SmartPath._registered_protocols assert HttpPath.protocol in SmartPath._registered_protocols @@ -66,6 +67,7 @@ def test_register_result(): assert StdioPath.protocol in SmartPath._registered_protocols assert SftpPath.protocol in SmartPath._registered_protocols assert HdfsPath.protocol in SmartPath._registered_protocols + assert HFPath.protocol in SmartPath._registered_protocols assert SmartPath._registered_protocols[S3Path.protocol] == S3Path assert SmartPath._registered_protocols[FSPath.protocol] == FSPath @@ -73,6 +75,7 @@ def test_register_result(): assert SmartPath._registered_protocols[HttpsPath.protocol] == HttpsPath assert SmartPath._registered_protocols[StdioPath.protocol] == StdioPath assert SmartPath._registered_protocols[HdfsPath.protocol] == HdfsPath + assert SmartPath._registered_protocols[HFPath.protocol] == HFPath assert SmartPath.from_uri(FS_TEST_ABSOLUTE_PATH) == SmartPath(FS_TEST_ABSOLUTE_PATH)