MCPcopy Index your code
hub / github.com/cool-RR/PySnooper / with_name

Method with_name

tests/mini_toolbox/pathlib.py:1020–1029  ·  view source on GitHub ↗

Return a new path with the file name changed.

(self, name)

Source from the content-addressed store, hash-verified

1018 return name
1019
1020 def with_name(self, name):
1021 """Return a new path with the file name changed."""
1022 if not self.name:
1023 raise ValueError("%r has an empty name" % (self,))
1024 drv, root, parts = self._flavour.parse_parts((name,))
1025 if (not name or name[-1] in [self._flavour.sep, self._flavour.altsep]
1026 or drv or root or len(parts) != 1):
1027 raise ValueError("Invalid name %r" % (name))
1028 return self._from_parsed_parts(self._drv, self._root,
1029 self._parts[:-1] + [name])
1030
1031 def with_suffix(self, suffix):
1032 """Return a new path with the file suffix changed (or added, if

Callers

nothing calls this directly

Calls 2

_from_parsed_partsMethod · 0.95
parse_partsMethod · 0.80

Tested by

no test coverage detected