You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I don’t know if I’m misunderstanding the nature of the ‘shim’ here but the 3.12 slots are not actually being populated in the UPath as I expected when I found this code. Specifically accessing _raw_paths fails.
I was really hoping to find a backport for this as it’s used in my library to preserve the leading ./ part of relative file paths like ./foo.txt which regular Path “normalises” to foo.txt.
Have I misunderstood the purpose of the shim class or is this a bug?
The text was updated successfully, but these errors were encountered:
Thanks for reporting! The issue you're describing is happening because of the way local path handling in universal-pathlib was designed.
To ensure that universal-pathlib's upath.UPath can be used as a drop-in replacement for pathlib.Path it was decided to guarantee as much as possible that the two are compatible for local paths. This is why there are three local path classes in universal-pathlib:
PosixUPath, WindowsUPath and FileUPath.
The first two are basically using the PosixPath and WindowsPath implementations of pathlib. That's why on python<=3.11 none of them populate _raw_paths. FileUPath on the other hand uses fsspec's LocalFileSystem for handling local paths and populates _raw_paths. The distinction is made because fsspec ensures that all relative paths are made absolute, and that changes some of the behavior.
Hi, I don’t know if I’m misunderstanding the nature of the ‘shim’ here but the 3.12 slots are not actually being populated in the
UPath
as I expected when I found this code. Specifically accessing_raw_paths
fails.I was really hoping to find a backport for this as it’s used in my library to preserve the leading
./
part of relative file paths like./foo.txt
which regular Path “normalises” tofoo.txt
.Have I misunderstood the purpose of the shim class or is this a bug?
The text was updated successfully, but these errors were encountered: