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

Method with_suffix

Lib/pathlib/__init__.py:428–440  ·  view source on GitHub ↗

Return a new path with the file suffix changed. If the path has no suffix, add given suffix. If the given suffix is an empty string, remove the suffix from the path.

(self, suffix)

Source from the content-addressed store, hash-verified

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
430 has no suffix, add given suffix. If the given suffix is an empty
431 string, remove the suffix from the path.
432 """
433 stem = self.stem
434 if not stem:
435 # If the stem is empty, we can't make the suffix non-empty.
436 raise ValueError(f"{self!r} has an empty name")
437 elif suffix and not suffix.startswith('.'):
438 raise ValueError(f"Invalid suffix {suffix!r}")
439 else:
440 return self.with_name(stem + suffix)
441
442 @property
443 def stem(self):

Callers 15

create_archiveFunction · 0.45
test_cmdline_createMethod · 0.45
_compile_importlibMethod · 0.45
test_with_segmentsMethod · 0.45
test_with_suffixMethod · 0.45
test_with_suffixMethod · 0.45
test_bytesMethod · 0.45
test_walk_bad_dirMethod · 0.45
test_compilationMethod · 0.45
update_catalog_snapshotsFunction · 0.45
extract_from_snapshotsFunction · 0.45
test_data.pyFile · 0.45

Calls 2

with_nameMethod · 0.95
startswithMethod · 0.45

Tested by 10

test_cmdline_createMethod · 0.36
_compile_importlibMethod · 0.36
test_with_segmentsMethod · 0.36
test_with_suffixMethod · 0.36
test_with_suffixMethod · 0.36
test_bytesMethod · 0.36
test_walk_bad_dirMethod · 0.36
test_compilationMethod · 0.36
update_catalog_snapshotsFunction · 0.36
extract_from_snapshotsFunction · 0.36