Test whether a path is a mount point (a drive root, the root of a share, or a mounted volume)
(path)
| 278 | except ImportError: |
| 279 | _getvolumepathname = None |
| 280 | def ismount(path): |
| 281 | """Test whether a path is a mount point (a drive root, the root of a |
| 282 | share, or a mounted volume)""" |
| 283 | path = os.fspath(path) |
| 284 | seps = _get_bothseps(path) |
| 285 | path = abspath(path) |
| 286 | drive, root, rest = splitroot(path) |
| 287 | if drive and drive[0] in seps: |
| 288 | return not rest |
| 289 | if root and not rest: |
| 290 | return True |
| 291 | |
| 292 | if _getvolumepathname: |
| 293 | x = path.rstrip(seps) |
| 294 | y =_getvolumepathname(path).rstrip(seps) |
| 295 | return x.casefold() == y.casefold() |
| 296 | else: |
| 297 | return False |
| 298 | |
| 299 | |
| 300 | _reserved_chars = frozenset( |
searching dependent graphs…