pfnet / pfio

IO library to access various filesystems with unified API
https://pfio.readthedocs.io/
MIT License
52 stars 20 forks source link

Fix pathlib name to follow standard pathlib.Path #315

Closed belldandyxtq closed 1 year ago

belldandyxtq commented 1 year ago

This PR matches the pfio.v2.pathlib.Path.name with standard pathlib.Path, which only return the file name of the file WITHOUT the directory.

import pathlib
import pfio.v2 as pfio

a = pathlib.Path("dir/file.txt")
b = pfio.pathlib.Path("dir/file.txt")

print(f"name from pathlib {a.name}")
print(f"name from pfio {b.name}")

output:

name from pathlib file.txt
name from pfio dir/file.txt

with this PR

name from pathlib file.txt
name from pfio file.txt
kuenishi commented 1 year ago

This bug is also fixed by #314 and this patch conflicts with it. As #314 fixes issues in wider range, I'll take it and closing this patch so far, but thank you.