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

Method with_stem

Lib/pathlib/__init__.py:417–426  ·  view source on GitHub ↗

Return a new path with the stem changed.

(self, stem)

Source from the content-addressed store, hash-verified

415 return self._from_parsed_parts(self.drive, self.root, tail)
416
417 def with_stem(self, stem):
418 """Return a new path with the stem changed."""
419 suffix = self.suffix
420 if not suffix:
421 return self.with_name(stem)
422 elif not stem:
423 # If the suffix is non-empty, we can't make the stem empty.
424 raise ValueError(f"{self!r} has a non-empty suffix")
425 else:
426 return self.with_name(stem + suffix)
427
428 def with_suffix(self, suffix):
429 """Return a new path with the file suffix changed. If the path

Callers 5

test_with_segmentsMethod · 0.45
test_with_stemMethod · 0.45
test_with_stemMethod · 0.45
test_bytesMethod · 0.45

Calls 1

with_nameMethod · 0.95

Tested by 5

test_with_segmentsMethod · 0.36
test_with_stemMethod · 0.36
test_with_stemMethod · 0.36
test_bytesMethod · 0.36