Ticket #97 (closed enhancement: fixed)

Opened 10 months ago

Last modified 5 months ago

Add len() support for conf.mib

Reported by: Dirk Loss Assigned to: pbi
Priority: low Milestone:
Component: Scapy Version:
Keywords: DADict len conf.mib Cc:

Description

Evaluating len(conf.mib) would be useful in order to see how much entries there currently are in the MIB. At the moment, this raises an AttributeError. Here's a simple patch for the Unix version:

diff -r c919e540a57b scapy.py
--- a/scapy.py  Fri Mar 07 16:22:27 2008 +0100
+++ b/scapy.py  Fri Mar 07 21:27:54 2008 +0100
@@ -280,6 +280,9 @@ class DADict:
         return r
     def keys(self):
         return filter(lambda x:x and x[0]!="_", self.__dict__.keys())
+
+    def __len__(self):
+        return len(self.keys())

Attachments

Change History

08/17/08 00:53:26 changed by pbi

  • status changed from new to closed.
  • resolution set to fixed.

Added in [6c18ed160f0e]


Add/Change #97 (Add len() support for conf.mib)




Change Properties
Action