def createListener(self, entry: NetworkTableEntry) -> None: self.listener = entry.addListener( lambda entry, key, value, param: self.setter(value), NetworkTables.NotifyFlags.IMMEDIATE | NetworkTables.NotifyFlags.NEW | NetworkTables.NotifyFlags.UPDATE, )
def createListener(self, entry: NetworkTableEntry) -> None: flags = (NetworkTables.NotifyFlags.IMMEDIATE | NetworkTables.NotifyFlags.NEW | NetworkTables.NotifyFlags.UPDATE) if self.listen_local: flags |= NetworkTables.NotifyFlags.LOCAL self.listener = entry.addListener( lambda entry, key, value, param: self.setter(value), flags)
def createListener(self, entry: NetworkTableEntry) -> None: flags = ( NetworkTables.NotifyFlags.IMMEDIATE | NetworkTables.NotifyFlags.NEW | NetworkTables.NotifyFlags.UPDATE ) if self.listen_local: flags |= NetworkTables.NotifyFlags.LOCAL self.listener = entry.addListener( lambda entry, key, value, param: self.setter(value), flags )
def _checkNtType(self, data) -> None: if not NetworkTableEntry.isValidDataType(data): raise TypeError("Cannot add data of type %r to Shuffleboard" % type(data))
def test_isValidType(data, expected_result): if isinstance(expected_result, bool): assert NetworkTableEntry.isValidDataType(data) == expected_result else: with pytest.raises(expected_result): NetworkTableEntry.isValidDataType(data)
def checkNtType(self, data): assert NetworkTableEntry.isValidDataType( data), "Cannot add data of type%s to Shuffleboard" % (type(data), )