Skip to content

Commit c22ca8f

Browse files
author
liyang
committed
make lint happy
1 parent 4d65b59 commit c22ca8f

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

megfile/fsspec.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ def sync(
375375
self.path_without_protocol, dst_path, recursive=True
376376
)
377377

378-
def rename(self, dst_path: PathLike, overwrite: bool = True) -> "BaseFSSpecPath":
378+
def rename(self, dst_path: PathLike, overwrite: bool = True):
379379
"""
380380
rename file with fsspec
381381
@@ -384,7 +384,7 @@ def rename(self, dst_path: PathLike, overwrite: bool = True) -> "BaseFSSpecPath"
384384
"""
385385
self.filesystem.mv(self.path_without_protocol, dst_path, recursive=False)
386386

387-
def move(self, dst_path: PathLike, overwrite: bool = True) -> "BaseFSSpecPath":
387+
def move(self, dst_path: PathLike, overwrite: bool = True):
388388
"""
389389
move file/directory with fsspec
390390
@@ -393,7 +393,7 @@ def move(self, dst_path: PathLike, overwrite: bool = True) -> "BaseFSSpecPath":
393393
"""
394394
self.filesystem.mv(self.path_without_protocol, dst_path, recursive=True)
395395

396-
def unlink(self, missing_ok: bool = False) -> None:
396+
def unlink(self, missing_ok: bool = False):
397397
"""
398398
Remove the file with fsspec
399399
@@ -403,7 +403,7 @@ def unlink(self, missing_ok: bool = False) -> None:
403403
return
404404
self.filesystem.rm(self.path_without_protocol, recursive=False)
405405

406-
def remove(self, missing_ok: bool = False) -> None:
406+
def remove(self, missing_ok: bool = False):
407407
"""
408408
Remove the file or directory with fsspec
409409

megfile/utils/__init__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -339,12 +339,13 @@ def __get__( # pyre-ignore[14]
339339
"__set_name__ on it."
340340
)
341341
with self.lock:
342+
name: str = self.attrname # pyre-ignore[9]
342343
# check if another thread filled cache while we awaited lock
343344
# cannot use getattr since it will cause RecursionError
344-
val = cls.__dict__[self.attrname]
345+
val = getattr(cls, name)
345346
if val is self:
346347
val = self.func(cls)
347-
setattr(cls, self.attrname, val)
348+
setattr(cls, name, val)
348349
return val
349350

350351

tests/test_smart_path.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
ProtocolNotFoundError,
1212
)
1313
from megfile.fs_path import FSPath
14+
from megfile.hf_path import HFPath
1415
from megfile.hdfs_path import HdfsPath
1516
from megfile.http_path import HttpPath, HttpsPath
1617
from megfile.interfaces import Access
@@ -58,21 +59,23 @@ def s3_empty_client(mocker):
5859

5960

6061
def test_register_result():
61-
assert len(SmartPath._registered_protocols) == 7
62+
assert len(SmartPath._registered_protocols) == 8
6263
assert S3Path.protocol in SmartPath._registered_protocols
6364
assert FSPath.protocol in SmartPath._registered_protocols
6465
assert HttpPath.protocol in SmartPath._registered_protocols
6566
assert HttpsPath.protocol in SmartPath._registered_protocols
6667
assert StdioPath.protocol in SmartPath._registered_protocols
6768
assert SftpPath.protocol in SmartPath._registered_protocols
6869
assert HdfsPath.protocol in SmartPath._registered_protocols
70+
assert HFPath.protocol in SmartPath._registered_protocols
6971

7072
assert SmartPath._registered_protocols[S3Path.protocol] == S3Path
7173
assert SmartPath._registered_protocols[FSPath.protocol] == FSPath
7274
assert SmartPath._registered_protocols[HttpPath.protocol] == HttpPath
7375
assert SmartPath._registered_protocols[HttpsPath.protocol] == HttpsPath
7476
assert SmartPath._registered_protocols[StdioPath.protocol] == StdioPath
7577
assert SmartPath._registered_protocols[HdfsPath.protocol] == HdfsPath
78+
assert SmartPath._registered_protocols[HFPath.protocol] == HFPath
7679
assert SmartPath.from_uri(FS_TEST_ABSOLUTE_PATH) == SmartPath(FS_TEST_ABSOLUTE_PATH)
7780

7881

0 commit comments

Comments
 (0)