Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix unused variables: flake8 --select=F841 #623

Merged
merged 3 commits into from
Oct 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest just deleting this line entirely

Copy link
Contributor Author

@cclauss cclauss Oct 7, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.


expected_duration = int(
math.ceil(math.ceil(message_length / float(fragment_size)))
* self.protocol.delay_between_messages
Expand Down
2 changes: 1 addition & 1 deletion rosbridge_library/test/capabilities/test_call_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Copy link
Member

@amacneil amacneil Oct 7, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think since this is a test this whole block of commented code (line 38-45) seems to be dead, we can delete it

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually, maybe leave it there. I'm not sure if the test is being used. someone has been making PRs to fix these tests so maybe it is helpful for now.

# 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
Expand Down
2 changes: 1 addition & 1 deletion rosbridge_server/scripts/rosbridge_websocket.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 0 additions & 2 deletions rosbridge_server/src/rosbridge_server/udp_handler.py
Original file line number Diff line number Diff line change
@@ -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


Expand Down Expand Up @@ -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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

self.write(message)

def check_origin(self, origin):
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down