(path)
return False
Test whether a path is a mount point
Test whether a path is a mount point
Test whether a path is a mount point
def ismount(path):
    """Test whether a path is a mount point"""
    try:
        s1 = os.lstat(path)
    except (OSError, ValueError):
        # It doesn't exist -- so not a mount point. :-)
        return False
    else:
        # A symlink can never be a mount point
        if stat.S_ISLNK(s1.st_mode):
            return False

    if isinstance(path, bytes):
        parent = join(path, b'..')
    else:
        parent = join(path, '..')
    parent = realpath(parent)
    try:
        s2 = os.lstat(parent)
    except (OSError, ValueError):
        return False

    dev1 = s1.st_dev
    dev2 = s2.st_dev
    if dev1 != dev2:
        return True     # path/.. on a different device as path
    ino1 = s1.st_ino
    ino2 = s2.st_ino
    if ino1 == ino2:
        return True     # path/.. is the same i-node as path
    return False
def ismount ( path ) : try : s1 = os . lstat ( path ) except ( OSError , ValueError ) : # It doesn't exist -- so not a mount point. :-) return False else : # A symlink can never be a mount point if stat . S_ISLNK ( s1 . st_mode ) : return False if isinstance ( path , bytes ) : parent = join ( path , b'..' ) else : parent = join ( path , '..' ) parent = realpath ( parent ) try : s2 = os . lstat ( parent ) except ( OSError , ValueError ) : return False dev1 = s1 . st_dev dev2 = s2 . st_dev if dev1 != dev2 : return True # path/.. on a different device as path ino1 = s1 . st_ino ino2 = s2 . st_ino if ino1 == ino2 : return True # path/.. is the same i-node as path return False