aboutsummaryrefslogtreecommitdiff
path: root/common/scangobj-merge.py
diff options
context:
space:
mode:
Diffstat (limited to 'common/scangobj-merge.py')
-rwxr-xr-xcommon/scangobj-merge.py20
1 files changed, 11 insertions, 9 deletions
diff --git a/common/scangobj-merge.py b/common/scangobj-merge.py
index 9a1cac9..4a9f1fc 100755
--- a/common/scangobj-merge.py
+++ b/common/scangobj-merge.py
@@ -6,6 +6,8 @@
parse, merge and write gstdoc-scanobj files
"""
+from __future__ import print_function, unicode_literals
+
import sys
import os
@@ -76,13 +78,13 @@ class Object:
return "<Object %s>" % self.name
def add_signal(self, signal, overwrite=True):
- if not overwrite and self._signals.has_key(signal.name):
- raise IndexError, "signal %s already in %r" % (signal.name, self)
+ if not overwrite and signal.name in self._signals:
+ raise IndexError("signal %s already in %r" % (signal.name, self))
self._signals[signal.name] = signal
def add_arg(self, arg, overwrite=True):
- if not overwrite and self._args.has_key(arg.name):
- raise IndexError, "arg %s already in %r" % (arg.name, self)
+ if not overwrite and arg.name in self._args:
+ raise IndexError("arg %s already in %r" % (arg.name, self))
self._args[arg.name] = arg
class Docable:
@@ -106,7 +108,7 @@ class GDoc:
lines = open(filename).readlines()
self.load_data("".join(lines))
except IOError:
- print "WARNING - could not read from %s" % filename
+ print ("WARNING - could not read from %s" % filename)
def save_file(self, filename, backup=False):
"""
@@ -117,7 +119,7 @@ class GDoc:
lines = open(filename).readlines()
olddata = "".join(lines)
except IOError:
- print "WARNING - could not read from %s" % filename
+ print ("WARNING - could not read from %s" % filename)
newdata = self.get_data()
if olddata and olddata == newdata:
return
@@ -161,7 +163,7 @@ class Signals(GDoc):
o = nmatch.group('object')
debug("Found object", o)
debug("Found signal", nmatch.group('signal'))
- if not self._objects.has_key(o):
+ if o not in self._objects:
object = Object(o)
self._objects[o] = object
@@ -222,7 +224,7 @@ class Args(GDoc):
o = nmatch.group('object')
debug("Found object", o)
debug("Found arg", nmatch.group('arg'))
- if not self._objects.has_key(o):
+ if o not in self._objects:
object = Object(o)
self._objects[o] = object
@@ -233,7 +235,7 @@ class Args(GDoc):
arg = Arg(**dict)
self._objects[o].add_arg(arg)
else:
- print "ERROR: could not match arg from block %s" % block
+ print ("ERROR: could not match arg from block %s" % block)
def get_data(self):
lines = []