Skip to content

Commit

Permalink
Use decoded soup message type, and avoid Landscape warning.
Browse files Browse the repository at this point in the history
  • Loading branch information
da4089 committed Jul 18, 2016
1 parent dcb89ea commit c3f837d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions rnps/soupbin.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
########################################################################
# robot-nps, Network Protocol Simulator for Robot Framework
#
# Copyright (C) 2014 David Arnold
# Copyright (C) 2014-2016 David Arnold
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -45,7 +45,7 @@ def has_complete_message(buf):
# SoupBin header length field is count of following bytes (so + 2).
return False

if buf[2] not in Messages.keys():
if soup_type not in Messages.keys():
# Unrecognised SoupBin message type code.
return False

Expand All @@ -60,7 +60,7 @@ def get_message(buf):
if len(buf) < soup_length + 2:
return None, buf

constructor = Messages.get(buf[2])
constructor = Messages.get(soup_type)
if not constructor:
return None, buf

Expand Down Expand Up @@ -127,7 +127,7 @@ def decode(self, buf):

# Bytes 0 & 1 are len, 2 is type, 3+ are payload.
# Length: +1 for type, +1 for Python slicing.
self.text = buf[3:soup_len + 2]
self.text = buf[3:soup_len + 2]
return


Expand Down

0 comments on commit c3f837d

Please sign in to comment.