-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UPath(path).parent does not work as expected for memory URIs with authority component #161
Comments
Hi @kadykov, Thanks for opening the issue. I don't fully understand how this blocks the PR you mentioned. Could you be more specific? Regarding the URIs you used in your example: All being said, try running your example with a minor change: from upath import UPath
def get_dir(path):
return str(UPath(path).parent)
# empty authority URIs
print(f"{get_dir('memory:///cat.yml') = }") # 'memory:/'
print(f"{get_dir('memory:///dir/cat.yml') = }") # 'memory:/dir'
print(f"{get_dir('file:///cat.yml') = }") # 'file:/'
print(f"{get_dir('file:///dir/cat.yml') = }") # 'file:/dir'
# no authority URIs
print(f"{get_dir('memory:/cat.yml') = }") # 'memory:/'
print(f"{get_dir('memory:/dir/cat.yml') = }") # 'memory:/dir'
print(f"{get_dir('file:/cat.yml') = }") # 'file:/'
print(f"{get_dir('file:/dir/cat.yml') = }") # 'file:/dir' To support the not-well Let me know if this clears things up. Andreas |
Thank you for the explanation.
Sorry, I posted a wrong link, the actual PR that uses |
.parent()
method of the paths pointing to the files in the root directory returns the filename with added slash, instead of root symbol.This issue blocks PR in intake
Code to reproduce:
The text was updated successfully, but these errors were encountered: