def Dirname(self):
    """Get a new copied object with only the directory path."""
    result = self.Copy()

    while 1:
      last_directory = posixpath.dirname(result.last.path)
      if last_directory != "/" or len(result) <= 1:
        result.last.path = last_directory
        # Make sure to clear the inode information.
        result.last.inode = None

        break

      result.Pop(-1)

    return result
def Dirname ( self ) : result = self . Copy ( ) while 1 : last_directory = posixpath . dirname ( result . last . path ) if last_directory != "/" or len ( result ) <= 1 : result . last . path = last_directory result . last . inode = None break result . Pop ( - 1 ) return result
Get a new copied object with only the directory path.