Check if the device object matches this filter.
180278
def match(self, device):
        """"""
        return all(match_value(getattr(device, k), v)
                   for k, v in self._match.items())
1373815
def has_saved(self, addr):
        """"""
        saved = False
        if self._saved_devices.get(addr, None) is not None:
            saved = True
        return saved
528070
public boolean matchesFilter(String filter, int priValue, int secValue) {

        filter = filter.toLowerCase();
        return m_parameters[priValue].toLowerCase().contains(filter)
            || m_parameters[secValue].toLowerCase().contains(filter);
    }
34102
private boolean doesPortMatch(String connectionObjPort, String remotePort) {
        boolean match = false;

        if (remotePort.equalsIgnoreCase(connectionObjPort))
            match = true;

        return match;
    }
216866
def search_device_by_id(self, deviceID) -> Device:
        
        for d in self.devices:
            if d.id == deviceID:
                return d
        return None
777948
public boolean detectNintendo() {

        if ((userAgent.indexOf(deviceNintendo) != -1)
            || (userAgent.indexOf(deviceWii) != -1)
            || (userAgent.indexOf(deviceNintendoDs) != -1)) {
            return true;
        }
        return false;
    }
368686
def find_raw_devices(vendor=None, product=None, serial_number=None,
                     custom_match=None, **kwargs):
    
    def is_usbraw(dev):
        if custom_match and not custom_match(dev):
            return False
        return bool(find_interfaces(dev, bInterfaceClass=0xFF,
                                    bInterfaceSubClass=0xFF))

    return find_devices(vendor, product, serial_number, is_usbraw, **kwargs)
611933
def is_interface(obj):
    
    return isinstance(obj, type) and issubclass(
        obj, InterfaceBase) and not (
        obj.__module__.startswith('lewis.core.devices') or obj.__module__.startswith(
            'lewis.adapters'))
37163
def set_bpf_filter_on_all_devices(filterstr):
        '''
        
        '''
        with PcapLiveDevice._lock:
            for dev in PcapLiveDevice._OpenDevices.values():
                _PcapFfi.instance()._set_filter(dev, filterstr)
130890
def is_device(obj):
    
    return isinstance(obj, type) and issubclass(
        obj, DeviceBase) and obj.__module__ not in ('lewis.devices', 'lewis.core.devices')
730974
def lookup_camera_by_id(self, device_id):
        """"""
        camera = list(filter(
            lambda cam: cam.device_id == device_id, self.cameras))[0]
        if camera:
            return camera
        return None
1314307
def _find_device(self, idVendor, idProduct):
        """"""
        for bus in usb.busses():
            for device in bus.devices:
                if (device.idVendor == idVendor and
                    device.idProduct == idProduct):
                    return device
        return None
719668
public final AbstractItem matches(final Filter filter, boolean allowUnavailable) throws SevereMessageStoreException
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "matches", new Object[] { filter, Boolean.valueOf(allowUnavailable) });

        AbstractItem foundItem = null;
        if (allowUnavailable || isAvailable())
        {
            if (!isExpired())
            {
                AbstractItem item = getItem();
                if (null == item)
                {
                    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                        SibTr.debug(this, tc, "item does not exist");
                }
                else
                {
                    try
                    {
                        if (null == filter || filter.filterMatches(item))
                        {
                            foundItem = item;
                        }
                    } catch (Exception e)
                    {
                        //No FFDC Code Needed.
                        // assume exception is false return
                    }
                }
            }
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "matches", foundItem);
        return foundItem;
    }
45979
def match_filter(self, idx_list, pattern, dict_type=False,
                     dict_key='name'):
        

        if dict_type is False:
            return self._return_deque([
                obj for obj in idx_list
                if re.search(pattern, obj)
            ])
        elif dict_type is True:
            return self._return_deque([
                obj for obj in idx_list
                if re.search(pattern, obj.get(dict_key))
            ])
        else:
            return self._return_deque()
585326
private static boolean hasMatchingAncestor(
            Context context, AccessibilityNodeInfoCompat node, NodeFilter filter) {
        if (node == null) {
            return false;
        }

        final AccessibilityNodeInfoCompat result = getMatchingAncestor(context, node, filter);
        if (result == null) {
            return false;
        }

        result.recycle();
        return true;
    }
1321370
def compare_config(self):
        """"""
        diff = self.device.cu.diff()

        if diff is None:
            return ''
        else:
            return diff.strip()
88442
function findBlinkSticks (filter) {
    if (filter === undefined) filter = function () { return true; };

    var result = [], device, i, devices;

    if (isWin) {
        devices = usb.devices();

        for (i in devices) {
            device = devices[i];

            if (device.vendorId === VENDOR_ID &&
                device.productId === PRODUCT_ID &&
                    filter(device))
                {
                    result.push(new BlinkStick(device.path, device.serialNumber, device.manufacturer, device.product));
                }
        }

    } else {
        devices = usb.getDeviceList();

        for (i in devices) {
            device = devices[i];
            if (device.deviceDescriptor.idVendor === VENDOR_ID &&
                device.deviceDescriptor.idProduct === PRODUCT_ID &&
                    filter(device))
                result.push(new BlinkStick(device));
        }
    }

    return result;
}