From ba60ebfb60f4faecaa904faeb04823b5d37d0479 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20L=C3=A9one?= <remy.leone@gmail.com> Date: Thu, 12 May 2016 14:50:25 +0200 Subject: [PATCH] List creation could be rewritten by list litteral --- scapy/arch/winpcapy.py | 5 +---- scapy/contrib/ldp.py | 3 +-- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/scapy/arch/winpcapy.py b/scapy/arch/winpcapy.py index fc452a02..6decea39 100755 --- a/scapy/arch/winpcapy.py +++ b/scapy/arch/winpcapy.py @@ -148,10 +148,7 @@ class pcap_stat(Structure): pass ### _fields_ list in Structure is final. ### We need a temp list -_tmpList=[] -_tmpList.append(("ps_recv",c_uint)) -_tmpList.append(("ps_drop",c_uint)) -_tmpList.append(("ps_ifdrop",c_uint)) +_tmpList = [("ps_recv", c_uint), ("ps_drop", c_uint), ("ps_ifdrop", c_uint)] if HAVE_REMOTE: _tmpList.append(("ps_capt",c_uint)) _tmpList.append(("ps_sent",c_uint)) diff --git a/scapy/contrib/ldp.py b/scapy/contrib/ldp.py index 8fc939c9..9614ad30 100644 --- a/scapy/contrib/ldp.py +++ b/scapy/contrib/ldp.py @@ -226,8 +226,7 @@ class CommonHelloTLVField(StrField): class CommonSessionTLVField(StrField): islist = 1 def m2i(self, pkt, x): - l = [] - l.append(struct.unpack("!H",x[6:8])[0]) + l = [struct.unpack("!H", x[6:8])[0]] octet = struct.unpack("B",x[8:9])[0] l.append( (octet & 2**7 ) >> 7 ) l.append( (octet & 2**6 ) >> 6 ) -- GitLab