Comparison by mount and device file path.
334702
def is_file(self, path):
        """"""
        return (samefile(path, self.device_file) or
                samefile(path, self.loop_file) or
                any(samefile(path, mp) for mp in self.mount_paths) or
                sameuuid(path, self.id_uuid) or
                sameuuid(path, self.partition_uuid))
168598
def _islinklike(dir_path):
    '''
    
    '''
    dir_path = ph.path(dir_path)
    if platform.system() == 'Windows':
        if dir_path.isjunction():
            return True
    elif dir_path.islink():
        return True
    return False
1270154
def is_device_mounted(device):
    '''
    '''
    try:
        out = check_output(['lsblk', '-P', device]).decode('UTF-8')
    except Exception:
        return False
    return bool(re.search(r'MOUNTPOINT=".+"', out))
1338297
def _inspect_disk(self):
        
        roots = self._handler.inspect_os()

        if roots:
            self._root = roots[0]
            return sorted(self._handler.inspect_get_mountpoints(self._root),
                          key=lambda m: len(m[0]))
        else:
            raise RuntimeError("No OS found on the given disk image.")
1156882
def _disk(self):
        """"""
        mountpoints = [
            p.mountpoint for p in psutil.disk_partitions()
            if p.device.endswith(self.device)
        ]
        if len(mountpoints) != 1:
            raise CommandError("Unknown device: {0}".format(self.device))

        value = int(psutil.disk_usage(mountpoints[0]).percent)
        set_metric("disk-{0}".format(self.device), value, category=self.category)
        gauge("disk-{0}".format(self.device), value)
127921
def exists(self, path, **kwargs):
        """"""
        try:
            self.get_file_status(path, **kwargs)
            return True
        except HdfsFileNotFoundException:
            return False
180278
def match(self, device):
        """"""
        return all(match_value(getattr(device, k), v)
                   for k, v in self._match.items())
755772
def determine_path():
    """"""
    root = __file__
    if os.path.islink(root):
        root = os.path.realpath(root)
    return os.path.dirname(os.path.abspath(root))
136064
def disk_io_counters(device=None):
    '''
    
    '''
    if not device:
        return dict(psutil.disk_io_counters()._asdict())
    else:
        stats = psutil.disk_io_counters(perdisk=True)
        if device in stats:
            return dict(stats[device]._asdict())
        else:
            return False
1326091
def is_mount(self, name):
        """"""
        if self.mount_prefix.startswith(self.module_prefix):
            return name.startswith(self.mount_prefix)
        return name.startswith(self.mount_prefix) and not name.startswith(self.module_prefix)
804028
def is_files(self, path):
        """"""
        return self._getReturnCodeCmd([self._hadoop_cmd, 'fs', '-test', '-f', self._full_hdfs_path(path)]) == 0
1168387
def is_directory(self, path):
        """"""
        return self._getReturnCodeCmd([self._hadoop_cmd, 'fs', '-test', '-d', self._full_hdfs_path(path)]) == 0
776136
def _CheckIsDevice(self, file_entry):
    
    if definitions.FILE_ENTRY_TYPE_DEVICE not in self._file_entry_types:
      return False
    return file_entry.IsDevice()
1203169
def Stat(self, device_filename):
        """"""
        connection = self.protocol_handler.Open(self._handle, destination=b'sync:')
        mode, size, mtime = self.filesync_handler.Stat(
            connection, device_filename)
        connection.Close()
        return mode, size, mtime
253141
def _device_to_sysfs_path(device):
    """"""
    return '%s-%s' % (
        device.getBusNumber(),
        '.'.join([str(item) for item in device.GetPortNumberList()]))
182629
def logical_volume(cls, file_path, sudo=False):
		
		mp = WMountPoint.mount_point(file_path)
		if mp is not None:
			name_file = '/sys/block/%s/dm/name' % mp.device_name()
			if os.path.exists(name_file):
				lv_path = '/dev/mapper/%s' % open(name_file).read().strip()
				return WLogicalVolume(lv_path, sudo=sudo)
634878
def _match_pattern(filename, include, exclude, real, path, follow):
    """"""

    if real:
        symlinks = {}
        if isinstance(filename, bytes):
            curdir = os.fsencode(os.curdir)
            mount = RE_BWIN_MOUNT if util.platform() == "windows" else RE_BMOUNT
        else:
            curdir = os.curdir
            mount = RE_WIN_MOUNT if util.platform() == "windows" else RE_MOUNT

        if not mount.match(filename):
            exists = os.path.lexists(os.path.join(curdir, filename))
        else:
            exists = os.path.lexists(filename)

        if not exists:
            return False
        if path:
            return _match_real(filename, include, exclude, follow, symlinks)

    matched = False
    for pattern in include:
        if pattern.fullmatch(filename):
            matched = True
            break

    if not include and exclude:
        matched = True

    if matched:
        matched = True
        if exclude:
            for pattern in exclude:
                if not pattern.fullmatch(filename):
                    matched = False
                    break
    return matched