Skip to content

Commit 69be7e2

Browse files
authored
upath.core: deprecate keyword arguments for UPath.rename() (#496)
1 parent 2b1d015 commit 69be7e2

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

upath/core.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1862,9 +1862,30 @@ def rename(
18621862
# avoid calling .resolve for if not needed
18631863
if ".." in target_abs.parts or "." in target_abs.parts:
18641864
target_abs = target_abs.resolve()
1865+
if kwargs:
1866+
warnings.warn(
1867+
"Passing additional keyword arguments to "
1868+
f"{type(self).__name__}.rename() is deprecated and will be"
1869+
" removed in future univeral-pathlib versions.",
1870+
DeprecationWarning,
1871+
stacklevel=2,
1872+
)
18651873
if recursive is not UNSET_DEFAULT:
1874+
warnings.warn(
1875+
f"{type(self).__name__}.rename()'s `recursive` keyword argument is"
1876+
" deprecated and will be removed in future universal-pathlib versions."
1877+
f" Please use {type(self).__name__}.move() or .move_into() instead.",
1878+
DeprecationWarning,
1879+
stacklevel=2,
1880+
)
18661881
kwargs["recursive"] = recursive
18671882
if maxdepth is not UNSET_DEFAULT:
1883+
warnings.warn(
1884+
f"{type(self).__name__}.rename()'s `maxdepth` keyword argument is"
1885+
" deprecated and will be removed in future universal-pathlib versions.",
1886+
DeprecationWarning,
1887+
stacklevel=2,
1888+
)
18681889
kwargs["maxdepth"] = maxdepth
18691890
self.fs.mv(
18701891
source_abs.path,

0 commit comments

Comments
 (0)