summaryrefslogtreecommitdiffstats
path: root/tools/cim2dot.py
diff options
context:
space:
mode:
authorPeter Schiffer <pschiffe@redhat.com>2014-01-16 15:10:26 +0100
committerPeter Schiffer <pschiffe@redhat.com>2014-01-16 15:10:26 +0100
commit97d3041f1e38dfcc931d0e495c0e1c66497cf09c (patch)
treed56f207fb9ca08a4eccfbd406b609ae4402e5c5a /tools/cim2dot.py
parent785bc9bf7e4ba5ba60477fd09974377c4cf48b10 (diff)
downloadopenlmi-providers-97d3041f1e38dfcc931d0e495c0e1c66497cf09c.tar.gz
openlmi-providers-97d3041f1e38dfcc931d0e495c0e1c66497cf09c.tar.xz
openlmi-providers-97d3041f1e38dfcc931d0e495c0e1c66497cf09c.zip
Remove trailing spaces
This patch removes trailing spaces from source files.
Diffstat (limited to 'tools/cim2dot.py')
-rwxr-xr-xtools/cim2dot.py24
1 files changed, 12 insertions, 12 deletions
diff --git a/tools/cim2dot.py b/tools/cim2dot.py
index 7d5678f..e185f8f 100755
--- a/tools/cim2dot.py
+++ b/tools/cim2dot.py
@@ -72,20 +72,20 @@ class CimExporter(object):
if instance.has_key(i):
title += "\\n" + instance[i]
return title
-
+
def drawInstance(self, instance):
if self.isIgnored(instance):
return
path = self.loader.getInstancePath(instance)
name = 'obj' + str(len(self.instanceLabels))
self.instanceLabels[path] = name
-
+
_encodeObject = lambda x: (base64.b64encode(zlib.compress(cPickle.dumps(x, cPickle.HIGHEST_PROTOCOL))))
params = {'url': self.loader.cliconn.url, 'ns': self.loader.namespace, 'instPath':_encodeObject(instance)}
url = self.urltemplate + "?" + cgi.urllib.urlencode(params)
title = self.getTitle(instance)
print '%s [tooltip="%s",label="%s",URL="%s"];' % (name, path, title, url)
-
+
def drawReference(self, reference):
# find the first and the second CIMInstanceName among keybindings
vals = reference.keybindings.values()
@@ -97,14 +97,14 @@ class CimExporter(object):
while not isinstance(vals[i], pywbem.CIMInstanceName):
i = i+1
dst = vals[i]
-
+
if self.isIgnored(src) or self.isIgnored(dst) or self.isIgnored(reference):
return
label = reference.classname
srcName = self.instanceLabels[self.loader.getInstancePath(src)]
dstName = self.instanceLabels[self.loader.getInstancePath(dst)]
print '%s -- %s [label="%s"];' % (srcName, dstName, label)
-
+
def export(self):
instances = self.loader.instances.values()
instances.sort()
@@ -126,7 +126,7 @@ class CimLoader(object):
self.queue = {} #path -> level
self.references = {} #'classname:path-path' -> reference
self.ignore = ignore
-
+
def isIgnored(self, instance):
if self.ignore is None:
return False
@@ -140,13 +140,13 @@ class CimLoader(object):
instance.host='f16'
path = str(instance)
return path.replace('"', "'")
-
+
def getReferencePath(self, reference, src, dst):
label = reference.classname
srcName = self.getInstancePath(src)
dstName = self.getInstancePath(dst)
return label+':'+srcName+'-'+dstName
-
+
def addInstances(self, instances, level):
for i in instances:
path = self.getInstancePath(i)
@@ -176,7 +176,7 @@ class CimLoader(object):
# add initial instances
instances = self.cliconn.EnumerateInstanceNames(self.classname, namespace=self.namespace)
self.addInstances(instances, 0)
-
+
while True:
try:
(path, level) = self.queue.popitem()
@@ -184,12 +184,12 @@ class CimLoader(object):
break
instance = self.instances[path]
self.addReferences(instance, level)
-
+
def dumpTo(self, filename):
f = open(filename, 'w')
cPickle.dump((self.instances, self.references), f)
f.close()
-
+
def loadFrom(self, filename):
f = open(filename, 'r')
(self.instances, self.references) = cPickle.load(f)
@@ -221,7 +221,7 @@ if options.infile:
l.loadFrom(options.infile)
else:
l.load()
-
+
if options.outfile:
l.dumpTo(options.outfile)