Skip to content

Commit

Permalink
fixup: correct python linter errors
Browse files Browse the repository at this point in the history
  • Loading branch information
kgiusti committed May 20, 2024
1 parent 8a1da2d commit e77bea4
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 14 deletions.
3 changes: 1 addition & 2 deletions python/skupper_router/management/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,8 +296,7 @@ def query(self, type=None, attribute_names=None, offset=None, count=None):
if count == len_response_results:
break

if count - len_response_results < request_count:
request_count = count - len_response_results
request_count = min(request_count, count - len_response_results)

offset += request_count

Expand Down
1 change: 1 addition & 0 deletions python/skupper_router_internal/management/qdrouter.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ def validate_add(
super(QdSchema, self).validate_add(attributes, entities)
entities.append(attributes)
router_mode = router_id = listener_connector_role = listener_role = None
list_conn_entity = None
for e in entities:
short_type = self.short_name(e['type'])
if short_type == "router":
Expand Down
4 changes: 1 addition & 3 deletions python/skupper_router_internal/tools/display.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,7 @@ def table(self, title, heads, rows):
width = len(head)
for row in rows:
text = UNICODE(row[col])
cellWidth = len(text)
if cellWidth > width:
width = cellWidth
width = max(width, len(text))
colWidth.append(width + self.tableSpacing)
line = line + head
if col < len(heads) - 1:
Expand Down
8 changes: 5 additions & 3 deletions tests/TCP_echo_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,13 @@ def run(self):
total_sent = 0
total_rcvd = 0

payload_out = []
out_list_idx = 0 # current _out array being sent
out_byte_idx = 0 # next-to-send in current array
out_ready_to_send = False

if self.count > 0 and self.size > 0:
# outbound payload only if count and size both greater than zero
payload_out = []
out_list_idx = 0 # current _out array being sent
out_byte_idx = 0 # next-to-send in current array
out_ready_to_send = True
# Generate unique content for each message so you can tell where the message
# or fragment belongs in the whole stream. Chunks look like:
Expand Down
1 change: 0 additions & 1 deletion tests/TCP_echo_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ def connection_made(self, transport):
if self.echo_server.close_on_conn:
self.logger.log(f' {self.name}: Connection from {self.peername} closing due to close_on_conn')
self.transport.close()
return

def connection_lost(self, exc):
self.logger.log(f' {self.name}: Connection to {self.peername} lost, exception={exc}')
Expand Down
3 changes: 2 additions & 1 deletion tests/system_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,8 @@ def get_local_host_socket(socket_address_family='IPv4'):
elif socket_address_family == 'IPv6':
s = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
host = '::1'

else:
raise Exception(f"Invalid socket_address_family: {socket_address_family}")
return s, host


Expand Down
2 changes: 2 additions & 0 deletions tests/system_tests_topology.py
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,8 @@ def on_message(self, event):
router = 'C'
elif event.receiver == self.routers['D']['mgmt_receiver']:
router = 'D'
else:
raise Exception("Unexpected event receiver")

# ----------------------------------------------------------------
# This is a management message.
Expand Down
3 changes: 1 addition & 2 deletions tests/system_tests_topology_disposition.py
Original file line number Diff line number Diff line change
Expand Up @@ -1150,8 +1150,7 @@ def quick_print_unknown_messages(self) :
count = count + 1
if first == -1 :
first = i
if i > last :
last = i
last = i

print(' first : %s sent : %.6lf' % (first, self.message_times[str(first)]))
print(' last : %s sent : %.6lf' % (last, self.message_times[str(last)]))
Expand Down
4 changes: 2 additions & 2 deletions tests/system_tests_two_routers.py
Original file line number Diff line number Diff line change
Expand Up @@ -482,9 +482,9 @@ def on_message(self, event):
if event.message.properties['statusDescription'] != 'OK':
error = "Expected statusDescription to be OK but instead got %s" % \
event.message.properties['statusDescription']
elif event.message.body['adminStatus'] != self.deleted_admin_status:
else:
error = "Expected adminStatus to be %s but instead got %s" % \
(self.deleted_admin_status, event.message.properties['adminStatus'])
(self.deleted_admin_status, event.message.properties['adminStatus'])
self.bail(error)

elif event.receiver == self.mgmt_receiver_2:
Expand Down

0 comments on commit e77bea4

Please sign in to comment.