(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"""
    if islink(path):
        # A symlink can never be a mount point
        return False
    try:
        s1 = os.lstat(path)
        if isinstance(path, bytes):
            parent = join(path, b'..')
        else:
            parent = join(path, '..')
        s2 = os.lstat(parent)
    except os.error:
        return False # It doesn't exist -- so not a mount point :-)
    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 ) : if islink ( path ) : # A symlink can never be a mount point return False try : s1 = os . lstat ( path ) if isinstance ( path , bytes ) : parent = join ( path , b'..' ) else : parent = join ( path , '..' ) s2 = os . lstat ( parent ) except os . error : return False # It doesn't exist -- so not a mount point :-) 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