MCPcopy Index your code
hub / github.com/RustPython/RustPython / rename

Method rename

Lib/pathlib/__init__.py:1066–1079  ·  view source on GitHub ↗

Rename this path to the target path. The target path may be absolute or relative. Relative paths are interpreted relative to the current working directory, *not* the directory of the Path object. Returns the new Path instance pointing to the target path.

(self, target)

Source from the content-addressed store, hash-verified

1064 self.unlink()
1065
1066 def rename(self, target):
1067 """
1068 Rename this path to the target path.
1069
1070 The target path may be absolute or relative. Relative paths are
1071 interpreted relative to the current working directory, *not* the
1072 directory of the Path object.
1073
1074 Returns the new Path instance pointing to the target path.
1075 """
1076 os.rename(self, target)
1077 if not hasattr(target, 'with_segments'):
1078 target = self.with_segments(target)
1079 return target
1080
1081 def replace(self, target):
1082 """

Callers 15

rotateMethod · 0.45
doRolloverMethod · 0.45
test_renameMethod · 0.45
test_renameMethod · 0.45
test_d_runtime_errorMethod · 0.45
test_walk_bad_dirMethod · 0.45
_do_copyishMethod · 0.45
test_rename_dir_fdMethod · 0.45
test_rename_replaceMethod · 0.45

Calls 2

hasattrFunction · 0.85
with_segmentsMethod · 0.45

Tested by 14

test_renameMethod · 0.36
test_renameMethod · 0.36
test_d_runtime_errorMethod · 0.36
test_walk_bad_dirMethod · 0.36
_do_copyishMethod · 0.36
test_rename_dir_fdMethod · 0.36
test_rename_replaceMethod · 0.36
test_with_segmentsMethod · 0.36
test_renameMethod · 0.36