Skip to content

Commit cadc083

Browse files
p-l-gpotter2
authored andcommitted
utils.lhex(): fix unnecessary else after return, use isinstance()
1 parent cc34f80 commit cadc083

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

scapy/utils.py

+6-7
Original file line numberDiff line numberDiff line change
@@ -257,14 +257,13 @@ def lhex(x):
257257
from scapy.volatile import VolatileValue
258258
if isinstance(x, VolatileValue):
259259
return repr(x)
260-
if type(x) in six.integer_types:
260+
if isinstance(x, six.integer_types):
261261
return hex(x)
262-
elif isinstance(x, tuple):
263-
return "(%s)" % ", ".join(map(lhex, x))
264-
elif isinstance(x, list):
265-
return "[%s]" % ", ".join(map(lhex, x))
266-
else:
267-
return str(x)
262+
if isinstance(x, tuple):
263+
return "(%s)" % ", ".join(lhex(v) for v in x)
264+
if isinstance(x, list):
265+
return "[%s]" % ", ".join(lhex(v) for v in x)
266+
return str(x)
268267

269268

270269
@conf.commands.register

0 commit comments

Comments
 (0)