From df81e9f7dd5fbaf623150fd306afa1cb97a9dd32 Mon Sep 17 00:00:00 2001 From: Matt Date: Mon, 9 Sep 2024 21:34:48 -0700 Subject: [PATCH] Run lint --- .../struct/PhotonPipelineMetadataSerde.java | 1 - .../photonvision/struct/PnpResultSerde.java | 1 - .../struct/TargetCornerSerde.java | 1 - .../common/networktables/NTTopicSet.java | 5 ++- scripts/catnt.py | 35 +++++++++++++------ 5 files changed, 28 insertions(+), 15 deletions(-) diff --git a/photon-targeting/src/generated/main/java/org/photonvision/struct/PhotonPipelineMetadataSerde.java b/photon-targeting/src/generated/main/java/org/photonvision/struct/PhotonPipelineMetadataSerde.java index 2e07ce585b..8f3f62aa10 100644 --- a/photon-targeting/src/generated/main/java/org/photonvision/struct/PhotonPipelineMetadataSerde.java +++ b/photon-targeting/src/generated/main/java/org/photonvision/struct/PhotonPipelineMetadataSerde.java @@ -75,7 +75,6 @@ public PhotonPipelineMetadata unpack(Packet packet) { @Override public PacketSerde[] getNested() { return new PacketSerde[] { - }; } } diff --git a/photon-targeting/src/generated/main/java/org/photonvision/struct/PnpResultSerde.java b/photon-targeting/src/generated/main/java/org/photonvision/struct/PnpResultSerde.java index 1a99cbf14e..f79281078e 100644 --- a/photon-targeting/src/generated/main/java/org/photonvision/struct/PnpResultSerde.java +++ b/photon-targeting/src/generated/main/java/org/photonvision/struct/PnpResultSerde.java @@ -83,7 +83,6 @@ public PnpResult unpack(Packet packet) { @Override public PacketSerde[] getNested() { return new PacketSerde[] { - }; } } diff --git a/photon-targeting/src/generated/main/java/org/photonvision/struct/TargetCornerSerde.java b/photon-targeting/src/generated/main/java/org/photonvision/struct/TargetCornerSerde.java index baca57d84c..1f570ec7d6 100644 --- a/photon-targeting/src/generated/main/java/org/photonvision/struct/TargetCornerSerde.java +++ b/photon-targeting/src/generated/main/java/org/photonvision/struct/TargetCornerSerde.java @@ -69,7 +69,6 @@ public TargetCorner unpack(Packet packet) { @Override public PacketSerde[] getNested() { return new PacketSerde[] { - }; } } diff --git a/photon-targeting/src/main/java/org/photonvision/common/networktables/NTTopicSet.java b/photon-targeting/src/main/java/org/photonvision/common/networktables/NTTopicSet.java index 4650a0b56f..d5f53f70d2 100644 --- a/photon-targeting/src/main/java/org/photonvision/common/networktables/NTTopicSet.java +++ b/photon-targeting/src/main/java/org/photonvision/common/networktables/NTTopicSet.java @@ -75,7 +75,10 @@ public void updateEntries() { var rawBytesEntry = subTable .getRawTopic("rawBytes") - .publish(PhotonPipelineResult.photonStruct.getTypeString(), PubSubOption.periodic(0.01), PubSubOption.sendAll(true)); + .publish( + PhotonPipelineResult.photonStruct.getTypeString(), + PubSubOption.periodic(0.01), + PubSubOption.sendAll(true)); resultPublisher = new PacketPublisher(rawBytesEntry, PhotonPipelineResult.photonStruct); diff --git a/scripts/catnt.py b/scripts/catnt.py index 473e3e096a..a971fda4b6 100644 --- a/scripts/catnt.py +++ b/scripts/catnt.py @@ -3,24 +3,31 @@ import argparse from tabulate import tabulate + def list_topics(inst: ntcore.NetworkTableInstance, root: str): topics = inst.getTable(root).getTopics() subtables = inst.getTable(root).getSubTables() - + print(f"Topics under {root}") - print(tabulate([[topic.getName(), topic.getType().name, topic.getTypeString()] for topic in topics], - headers=["Topic Name", "Type", "Type String"])) + print( + tabulate( + [ + [topic.getName(), topic.getType().name, topic.getTypeString()] + for topic in topics + ], + headers=["Topic Name", "Type", "Type String"], + ) + ) print("") print(f"Tables under {root}") - print(tabulate([[table] for table in subtables], - headers=["Table Name"])) + print(tabulate([[table] for table in subtables], headers=["Table Name"])) print("") def print_topic(inst: ntcore.NetworkTableInstance, topic: str): - sub = inst.getTopic(topic).genericSubscribe(options= - ntcore.PubSubOptions(sendAll=True, pollStorage=20) + sub = inst.getTopic(topic).genericSubscribe( + options=ntcore.PubSubOptions(sendAll=True, pollStorage=20) ) print("") print(f"Subscribed to {topic}, typestring '{sub.getTopic().getTypeString()}'") @@ -40,18 +47,24 @@ def print_topic(inst: ntcore.NetworkTableInstance, topic: str): print(f"{topic} = {sub.get().value()} (rate={hz:.1f}hz, samples={count})") sleep(1) + def connect(inst: ntcore.NetworkTableInstance, server: str): inst.stopServer() inst.setServer(server) inst.startClient4("catnt") + def main(): - parser = argparse.ArgumentParser( - description="Cat a topic" + parser = argparse.ArgumentParser(description="Cat a topic") + parser.add_argument( + "--echo", type=str, help="Fully qualified topic name", required=False ) - parser.add_argument("--echo", type=str, help="Fully qualified topic name", required=False) parser.add_argument( - "--server", type=str, default="127.0.0.1", help="IP address of the NT4 server", required=False + "--server", + type=str, + default="127.0.0.1", + help="IP address of the NT4 server", + required=False, ) parser.add_argument("--list", help="List all topics", required=False)