MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / with_name

Method with_name

tools/python-3.11.9-amd64/Lib/pathlib.py:667–676  ·  view source on GitHub ↗

Return a new path with the file name changed.

(self, name)

Source from the content-addressed store, hash-verified

665 return name
666
667 def with_name(self, name):
668 """Return a new path with the file name changed."""
669 if not self.name:
670 raise ValueError("%r has an empty name" % (self,))
671 drv, root, parts = self._flavour.parse_parts((name,))
672 if (not name or name[-1] in [self._flavour.sep, self._flavour.altsep]
673 or drv or root or len(parts) != 1):
674 raise ValueError("Invalid name %r" % (name))
675 return self._from_parsed_parts(self._drv, self._root,
676 self._parts[:-1] + [name])
677
678 def with_stem(self, stem):
679 """Return a new path with the stem changed."""

Callers 1

with_stemMethod · 0.95

Calls 2

_from_parsed_partsMethod · 0.95
parse_partsMethod · 0.80

Tested by

no test coverage detected