drivendataorg/cloudpathlib

replace and rename don't handle "directories"

開放

#64 建立於 2020年9月1日

 (0 則留言) (0 個反應) (0 位負責人)Python (87 個分叉)auto 404
S3bugdesign decisiongood first issue

倉庫指標

星標
 (624 顆星)
PR 合併指標
 (PR 指標待抓取)

描述

CloudPath.replace and CloudPath.rename (which are the same function for cloudpathlib) do not handle "directories".

The pathlib docs say:

Rename this file or directory to the given target, and return a new Path instance pointing to target. If target points to an existing file or directory, it will be unconditionally replaced.
>>> from cloudpathlib import CloudPath
>>> s = CloudPath("s3://my-bucket/")
>>> (s / "foo" / "bar.txt").touch()
>>> (s / "foo").replace(s / "baz")
Traceback (most recent call last):
...
botocore.exceptions.ClientError: An error occurred (404) when calling the HeadObject operation: Not Found

貢獻者指南