traffic: Packet.from_line classmethod uses cls var
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Fri, 19 Oct 2018 03:41:36 +0000 (16:41 +1300)
committerDouglas Bagnall <dbagnall@samba.org>
Tue, 8 Jan 2019 22:55:32 +0000 (23:55 +0100)
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
python/samba/emulate/traffic.py

index 291162f279ac066757f1d4459df360759604ef9c..0414813704dace4f9954fcfeb6796f2c238b65e4 100644 (file)
@@ -162,7 +162,7 @@ class Packet(object):
             self.endpoints = (self.dest, self.src)
 
     @classmethod
-    def from_line(self, line):
+    def from_line(cls, line):
         fields = line.rstrip('\n').split('\t')
         (timestamp,
          ip_protocol,
@@ -178,8 +178,8 @@ class Packet(object):
         src = int(src)
         dest = int(dest)
 
-        return Packet(timestamp, ip_protocol, stream_number, src, dest,
-                      protocol, opcode, desc, extra)
+        return cls(timestamp, ip_protocol, stream_number, src, dest,
+                   protocol, opcode, desc, extra)
 
     def as_summary(self, time_offset=0.0):
         """Format the packet as a traffic_summary line.