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,
     )
Example #2
0
 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
     )
Example #4
0
 def _checkNtType(self, data) -> None:
     if not NetworkTableEntry.isValidDataType(data):
         raise TypeError("Cannot add data of type %r to Shuffleboard" %
                         type(data))
Example #5
0
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)
Example #6
0
 def checkNtType(self, data):
     assert NetworkTableEntry.isValidDataType(
         data), "Cannot add data of type%s to Shuffleboard" % (type(data), )