MCPcopy Index your code
hub / github.com/python/cpython / rename

Method rename

Lib/pathlib/__init__.py:1264–1277  ·  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

1262 self.unlink()
1263
1264 def rename(self, target):
1265 """
1266 Rename this path to the target path.
1267
1268 The target path may be absolute or relative. Relative paths are
1269 interpreted relative to the current working directory, *not* the
1270 directory of the Path object.
1271
1272 Returns the new Path instance pointing to the target path.
1273 """
1274 os.rename(self, target)
1275 if not hasattr(target, 'with_segments'):
1276 target = self.with_segments(target)
1277 return target
1278
1279 def replace(self, target):
1280 """

Callers 15

rotateMethod · 0.45
doRolloverMethod · 0.45
test_renameMethod · 0.45
test_renameMethod · 0.45
test_d_runtime_errorMethod · 0.45
_do_copyishMethod · 0.45
run_perfFunction · 0.45
test_with_segmentsMethod · 0.45
test_renameMethod · 0.45

Calls 1

with_segmentsMethod · 0.45

Tested by 15

test_renameMethod · 0.36
test_renameMethod · 0.36
test_d_runtime_errorMethod · 0.36
_do_copyishMethod · 0.36
run_perfFunction · 0.36
test_with_segmentsMethod · 0.36
test_renameMethod · 0.36
test_walk_bad_dirMethod · 0.36