parameters: (self, name)
return_statement: return self._from_parsed_parts(self._drv, self._root,
                                         self._parts[:-1] + [name])
docstring: Return a new path with the file name changed.
docstring_summary: Return a new path with the file name changed.
docstring_tokens: Return a new path with the file name changed .
function: def with_name(self, name):
          """Return a new path with the file name changed."""
          if not self.name:
              raise ValueError("%r has an empty name" % (self,))
          drv, root, parts = self._flavour.parse_parts((name,))
          if (not name or name[-1] in [self._flavour.sep, self._flavour.altsep]
              or drv or root or len(parts) != 1):
              raise ValueError("Invalid name %r" % (name))
          return self._from_parsed_parts(self._drv, self._root,
                                         self._parts[:-1] + [name])
function_tokens: def with_name ( self , name ) : if not self . name : raise ValueError ( "%r has an empty name" % ( self , ) ) drv , root , parts = self . _flavour . parse_parts ( ( name , ) ) if ( not name or name [ - 1 ] in [ self . _flavour . sep , self . _flavour . altsep ] or drv or root or len ( parts ) != 1 ) : raise ValueError ( "Invalid name %r" % ( name ) ) return self . _from_parsed_parts ( self . _drv , self . _root , self . _parts [ : - 1 ] + [ name ] )