From 06b4ca2a49dce7701694cbfdc07150065c3bdf4e Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Thu, 7 Oct 2021 19:33:41 +0200 Subject: [PATCH] Fix unused variables: flake8 --select=F841 (#623) --- .../src/rosbridge_library/capabilities/fragmentation.py | 2 -- rosbridge_library/test/capabilities/test_call_service.py | 2 +- .../complex_srv+tcp/test_non-ros_service_server_complex-srv.py | 2 +- rosbridge_server/scripts/rosbridge_websocket.py | 2 +- rosbridge_server/src/rosbridge_server/udp_handler.py | 2 -- setup.cfg | 2 +- 6 files changed, 4 insertions(+), 8 deletions(-) diff --git a/rosbridge_library/src/rosbridge_library/capabilities/fragmentation.py b/rosbridge_library/src/rosbridge_library/capabilities/fragmentation.py index cd2294bec..dceec2b0d 100644 --- a/rosbridge_library/src/rosbridge_library/capabilities/fragmentation.py +++ b/rosbridge_library/src/rosbridge_library/capabilities/fragmentation.py @@ -77,8 +77,6 @@ def fragment(self, message, fragment_size, mid=None): if message_length <= fragment_size: return [message] - msg_id = message.get("id", None) - expected_duration = int( math.ceil(math.ceil(message_length / float(fragment_size))) * self.protocol.delay_between_messages diff --git a/rosbridge_library/test/capabilities/test_call_service.py b/rosbridge_library/test/capabilities/test_call_service.py index 6faca9849..4c2280a4c 100755 --- a/rosbridge_library/test/capabilities/test_call_service.py +++ b/rosbridge_library/test/capabilities/test_call_service.py @@ -70,7 +70,7 @@ def cb(msg, cid=None): def test_call_service_fail(self): # Dummy service that instantly fails - service_server = rospy.Service("set_bool_fail", SetBool, lambda req: None) + _ = rospy.Service("set_bool_fail", SetBool, lambda req: None) proto = Protocol("test_call_service_fail") s = CallService(proto) diff --git a/rosbridge_library/test/experimental/complex_srv+tcp/test_non-ros_service_server_complex-srv.py b/rosbridge_library/test/experimental/complex_srv+tcp/test_non-ros_service_server_complex-srv.py index 6cea68e95..bec171e69 100755 --- a/rosbridge_library/test/experimental/complex_srv+tcp/test_non-ros_service_server_complex-srv.py +++ b/rosbridge_library/test/experimental/complex_srv+tcp/test_non-ros_service_server_complex-srv.py @@ -35,7 +35,7 @@ def calculate_service_response(request): request_object = json.loads(request) # parse string for service request - args = request_object["args"] # get parameter field (args) + # args = request_object["args"] # get parameter field (args) # unused variable # count = int(args["count"] ) # get parameter(s) as described in corresponding ROS srv-file # # message = "" # calculate service response diff --git a/rosbridge_server/scripts/rosbridge_websocket.py b/rosbridge_server/scripts/rosbridge_websocket.py index 8ec65692f..6e6486c93 100755 --- a/rosbridge_server/scripts/rosbridge_websocket.py +++ b/rosbridge_server/scripts/rosbridge_websocket.py @@ -201,7 +201,7 @@ def __init__(self): if "--unregister_timeout" in sys.argv: idx = sys.argv.index("--unregister_timeout") + 1 if idx < len(sys.argv): - unregister_timeout = float(sys.argv[idx]) + RosbridgeWebSocket.unregister_timeout = float(sys.argv[idx]) else: print("--unregister_timeout argument provided without a value.") sys.exit(-1) diff --git a/rosbridge_server/src/rosbridge_server/udp_handler.py b/rosbridge_server/src/rosbridge_server/udp_handler.py index a9fedc761..4e73cdf9f 100644 --- a/rosbridge_server/src/rosbridge_server/udp_handler.py +++ b/rosbridge_server/src/rosbridge_server/udp_handler.py @@ -1,6 +1,5 @@ import rospy from rosbridge_library.rosbridge_protocol import RosbridgeProtocol -from rosbridge_library.util import bson from twisted.internet.protocol import DatagramProtocol @@ -70,7 +69,6 @@ def stopProtocol(self): rospy.loginfo("Client disconnected. %d clients total.", cls.clients_connected) def send_message(self, message): - binary = isinstance(message, bson.BSON) self.write(message) def check_origin(self, origin): diff --git a/setup.cfg b/setup.cfg index 943097b18..b603296fe 100644 --- a/setup.cfg +++ b/setup.cfg @@ -5,7 +5,7 @@ ignore-words-list = miror count = True max-complexity = 36 max-line-length = 217 -ignore = E203,F841,W503 +ignore = E203,W503 show-source = True statistics = True