summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2015-10-02 14:23:46 -0300
committerArnaldo Carvalho de Melo <acme@redhat.com>2015-10-02 14:23:46 -0300
commitb517ee3008f64583762da957e57e277e6d32087d (patch)
treef92f78b1edd157e3e0ab2c166203a11823007cd0
parentc122cccd08cd9d103e6eae4ebcd98337e3ec3d60 (diff)
downloadpython-linux-procfs-b517ee3008f64583762da957e57e277e6d32087d.tar.gz
Add items() method to all the classes with dicts
Reported-by: Guy Streeter <streeter@redhat.com> Signed-off-by: Arnaldo Carvalho de Melo <acme@edhat.com>
-rwxr-xr-xprocfs/procfs.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/procfs/procfs.py b/procfs/procfs.py
index fc5b911..dc845c1 100755
--- a/procfs/procfs.py
+++ b/procfs/procfs.py
@@ -124,6 +124,9 @@ class pidstat:
def has_key(self, fieldname):
return self.fields.has_key(fieldname)
+ def items(self):
+ return self.fields
+
def __contains__(self, fieldname):
return fieldname in self.fields
@@ -251,6 +254,9 @@ class pidstatus:
def has_key(self, fieldname):
return self.fields.has_key(fieldname)
+ def items(self):
+ return self.fields
+
def __contains__(self, fieldname):
return fieldname in self.fields
@@ -390,6 +396,9 @@ class pidstats:
def has_key(self, key):
return self.processes.has_key(key)
+ def items(self):
+ return self.processes
+
def __contains__(self, key):
return key in self.processes
@@ -537,6 +546,9 @@ class interrupts:
def has_key(self, key):
return self.interrupts.has_key(str(key))
+ def items(self):
+ return self.interrupts
+
def __contains__(self, key):
return str(key) in self.interrupts
@@ -676,6 +688,9 @@ class cmdline:
def keys(self):
return self.options.keys()
+ def items(self):
+ return self.options
+
class cpuinfo:
"""
Dictionary with information about CPUs in the system.
@@ -719,6 +734,9 @@ class cpuinfo:
def keys(self):
return self.tags.keys()
+ def items(self):
+ return self.tags
+
def parse(self, filename):
f = file(filename)
for line in f.readlines():
@@ -780,6 +798,9 @@ class smaps_lib:
def keys(self):
return self.tags.keys()
+ def items(self):
+ return self.tags
+
class smaps:
"""
@@ -906,6 +927,9 @@ class cpusstats:
def keys(self):
return self.entries.keys()
+ def items(self):
+ return self.entries
+
def reload(self):
last_entries = self.entries
self.entries = {}