fix pylint errors for qemu-arm-static 74/217874/5 accepted/tizen/devbase/tools/20200104.060201 accepted/tizen/devbase/tools/20200106.014333 accepted/tizen/devbase/tools/20200109.052820 accepted/tizen/devbase/tools/20200110.011832 accepted/tizen/devbase/tools/20200114.020209 accepted/tizen/devbase/tools/20200114.115832 accepted/tizen/devbase/tools/20200115.231456 accepted/tizen/devbase/tools/20200219.094600 accepted/tizen/devbase/tools/20200415.093508 accepted/tizen/devbase/tools/20200423.100601 accepted/tizen/devbase/tools/20200514.023624 accepted/tizen/devbase/tools/20200520.012821 submit/trunk/20200104.111033 submit/trunk/20200104.134833 submit/trunk/20200105.092010 submit/trunk/20200108.172702 submit/trunk/20200109.105802 submit/trunk/20200109.112402 submit/trunk/20200109.124502 submit/trunk/20200109.151502 submit/trunk/20200109.154402 submit/trunk/20200110.111659 submit/trunk/20200114.100000 submit/trunk/20200114.110000 submit/trunk/20200115.110101 submit/trunk/20200219.120523 submit/trunk/20200409.194520 submit/trunk/20200409.200220 submit/trunk/20200409.202020 submit/trunk/20200410.143020 submit/trunk/20200410.160020 submit/trunk/20200413.132320 submit/trunk/20200413.150000 submit/trunk/20200413.150500 submit/trunk/20200413.151000 submit/trunk/20200414.141500 submit/trunk/20200414.173500 submit/trunk/20200414.191000 submit/trunk/20200422.115210 submit/trunk/20200422.142510 submit/trunk/20200422.165210 submit/trunk/20200423.102810 submit/trunk/20200423.115423 submit/trunk/20200423.122334 submit/trunk/20200513.162810 submit/trunk/20200519.161030 submit/trunk/20200519.164610 submit/trunk/20200519.184310
authoryan11.meng <yan11.meng@samsung.com>
Wed, 23 Oct 2019 08:16:27 +0000 (16:16 +0800)
committeryan11.meng <yan11.meng@samsung.com>
Tue, 19 Nov 2019 02:51:19 +0000 (10:51 +0800)
Change-Id: Ie98991d4e8f6d9310cc919cf7caddf9caded30b8
Signed-off-by: yan11.meng <yan11.meng@samsung.com>
17 files changed:
roms/seabios/tools/acpi_extract.py
roms/seabios/tools/acpi_extract_preprocess.py
roms/seabios/tools/checkrom.py
roms/seabios/tools/checksum.py
roms/seabios/tools/layoutrom.py
roms/seabios/tools/vgafixup.py
scripts/analyse-9p-simpletrace.py
scripts/qapi-commands.py
scripts/qapi-types.py
scripts/qapi-visit.py
scripts/qapi.py
scripts/qemu-gdb.py
scripts/simpletrace.py
scripts/tracetool.py
tests/qemu-iotests/iotests.py
tests/qemu-iotests/qcow2.py
tests/qemu-iotests/qed.py

index dd3ccfd..0621746 100755 (executable)
 # ACPI_EXTRACT_PKG_START - start of Package block
 #
 # ACPI_EXTRACT_ALL_CODE - create an array storing the generated AML bytecode
-# 
+#
 # ACPI_EXTRACT is not allowed anywhere else in code, except in comments.
 
-import re;
-import sys;
-import fileinput;
+import re
+import sys
+import fileinput
 
 aml = []
 asl = []
@@ -64,7 +64,7 @@ def add_asl(lineno, line):
 #Store an AML byte sequence
 #Verify that offset output by iasl matches # of bytes so far
 def add_aml(offset, line):
-    o = int(offset, 16);
+    o = int(offset, 16)
     # Sanity check: offset must match size of code so far
     if (o != len(aml)):
         die("Offset 0x%x != 0x%x" % (o, len(aml)))
@@ -79,13 +79,13 @@ def add_aml(offset, line):
     for c in code:
         # Require a legal hex number, two digits
         if (not(re.search(r'^[0-9A-Fa-f][0-9A-Fa-f]$', c))):
-            die("Unexpected octet %s" % c);
-        aml.append(int(c, 16));
+            die("Unexpected octet %s" % c)
+        aml.append(int(c, 16))
 
 # Process aml bytecode array, decoding AML
 def aml_pkglen_bytes(offset):
     # PkgLength can be multibyte. Bits 8-7 give the # of extra bytes.
-    pkglenbytes = aml[offset] >> 6;
+    pkglenbytes = aml[offset] >> 6
     return pkglenbytes + 1
 
 def aml_pkglen(offset):
@@ -110,47 +110,47 @@ def aml_method_string(offset):
     #0x14 MethodOp PkgLength NameString MethodFlags TermList
     if (aml[offset] != 0x14):
         die( "Method offset 0x%x: expected 0x14 actual 0x%x" %
-             (offset, aml[offset]));
-    offset += 1;
+             (offset, aml[offset]))
+    offset += 1
     pkglenbytes = aml_pkglen_bytes(offset)
-    offset += pkglenbytes;
-    return offset;
+    offset += pkglenbytes
+    return offset
 
 # Given name offset, find its NameString offset
 def aml_name_string(offset):
     #0x08 NameOp NameString DataRef
     if (aml[offset] != 0x08):
         die( "Name offset 0x%x: expected 0x08 actual 0x%x" %
-             (offset, aml[offset]));
+             (offset, aml[offset]))
     offset += 1
     # Block Name Modifier. Skip it.
     if (aml[offset] == 0x5c or aml[offset] == 0x5e):
         offset += 1
-    return offset;
+    return offset
 
 # Given data offset, find dword const offset
 def aml_data_dword_const(offset):
     #0x08 NameOp NameString DataRef
     if (aml[offset] != 0x0C):
         die( "Name offset 0x%x: expected 0x0C actual 0x%x" %
-             (offset, aml[offset]));
-    return offset + 1;
+             (offset, aml[offset]))
+    return offset + 1
 
 # Given data offset, find word const offset
 def aml_data_word_const(offset):
     #0x08 NameOp NameString DataRef
     if (aml[offset] != 0x0B):
         die( "Name offset 0x%x: expected 0x0B actual 0x%x" %
-             (offset, aml[offset]));
-    return offset + 1;
+             (offset, aml[offset]))
+    return offset + 1
 
 # Given data offset, find byte const offset
 def aml_data_byte_const(offset):
     #0x08 NameOp NameString DataRef
     if (aml[offset] != 0x0A):
         die( "Name offset 0x%x: expected 0x0A actual 0x%x" %
-             (offset, aml[offset]));
-    return offset + 1;
+             (offset, aml[offset]))
+    return offset + 1
 
 # Given name offset, find dword const offset
 def aml_name_dword_const(offset):
@@ -168,7 +168,7 @@ def aml_device_start(offset):
     #0x5B 0x82 DeviceOp PkgLength NameString
     if ((aml[offset] != 0x5B) or (aml[offset + 1] != 0x82)):
         die( "Name offset 0x%x: expected 0x5B 0x82 actual 0x%x 0x%x" %
-             (offset, aml[offset], aml[offset + 1]));
+             (offset, aml[offset], aml[offset + 1]))
     return offset
 
 def aml_device_string(offset):
@@ -190,7 +190,7 @@ def aml_processor_start(offset):
     #0x5B 0x83 ProcessorOp PkgLength NameString ProcID
     if ((aml[offset] != 0x5B) or (aml[offset + 1] != 0x83)):
         die( "Name offset 0x%x: expected 0x5B 0x83 actual 0x%x 0x%x" %
-             (offset, aml[offset], aml[offset + 1]));
+             (offset, aml[offset], aml[offset + 1]))
     return offset
 
 def aml_processor_string(offset):
@@ -213,14 +213,14 @@ def aml_package_start(offset):
     # 0x12 PkgLength NumElements PackageElementList
     if (aml[offset] != 0x12):
         die( "Name offset 0x%x: expected 0x12 actual 0x%x" %
-             (offset, aml[offset]));
+             (offset, aml[offset]))
     offset += 1
     return offset + aml_pkglen_bytes(offset) + 1
 
 lineno = 0
 for line in fileinput.input():
     # Strip trailing newline
-    line = line.rstrip();
+    line = line.rstrip()
     # line number and debug string to output in case of errors
     lineno = lineno + 1
     debug = "input line %d: %s" % (lineno, line)
@@ -228,7 +228,7 @@ for line in fileinput.input():
     pasl = re.compile('^\s+([0-9]+)(:\s\s|\.\.\.\.)\s*')
     m = pasl.search(line)
     if (m):
-        add_asl(lineno, pasl.sub("", line));
+        add_asl(lineno, pasl.sub("", line))
     # AML listing: offset in hex, then ...., then code
     paml = re.compile('^([0-9A-Fa-f]+)(:\s\s|\.\.\.\.)\s*')
     m = paml.search(line)
@@ -333,4 +333,4 @@ for array in output.keys():
         odata.append("0x%x" % value)
     sys.stdout.write("static unsigned %s %s[] = {\n" % (otype, array))
     sys.stdout.write(",\n".join(odata))
-    sys.stdout.write('\n};\n');
+    sys.stdout.write('\n};\n')
index 4ae364e..6ef7df0 100755 (executable)
@@ -8,9 +8,9 @@
 # We also put each directive on a new line, the machinery
 # in tools/acpi_extract.py requires this.
 
-import re;
-import sys;
-import fileinput;
+import re
+import sys
+import fileinput
 
 def die(diag):
     sys.stderr.write("Error: %s\n" % (diag))
@@ -22,7 +22,7 @@ psplit = re.compile(r''' (
                           ACPI_EXTRACT_\w+ # directive
                           \s+ # some whitespace
                           \w+ # array name
-                         )''', re.VERBOSE);
+                         )''', re.VERBOSE)
 
 lineno = 0
 for line in fileinput.input():
@@ -30,7 +30,7 @@ for line in fileinput.input():
     lineno = lineno + 1
     debug = "input line %d: %s" % (lineno, line.rstrip())
 
-    s = psplit.split(line);
+    s = psplit.split(line)
     # The way split works, each odd item is the matching ACPI_EXTRACT directive.
     # Put each in a comment, and on a line by itself.
     for i in range(len(s)):
index 69d65e8..636150f 100755 (executable)
@@ -10,7 +10,7 @@ import layoutrom
 
 def main():
     # Get args
-    objinfo, rawfile, outfile = sys.argv[1:]
+    objinfo, rawfile, outfile = sys.argv[1:] #pylint: disable=unbalanced-tuple-unpacking
 
     # Read in symbols
     objinfofile = open(objinfo, 'rb')
@@ -32,27 +32,27 @@ def main():
     end = symbols['code32flat_end'].offset
     expend = layoutrom.BUILD_BIOS_ADDR + layoutrom.BUILD_BIOS_SIZE
     if end != expend:
-        print "Error!  Code does not end at 0x%x (got 0x%x)" % (
-            expend, end)
+        print( "Error!  Code does not end at 0x%x (got 0x%x)" % (
+            expend, end))
         sys.exit(1)
     if datasize > finalsize:
-        print "Error!  Code is too big (0x%x vs 0x%x)" % (
-            datasize, finalsize)
+        print ("Error!  Code is too big (0x%x vs 0x%x)" % (
+            datasize, finalsize))
         sys.exit(1)
     expdatasize = end - start
     if datasize != expdatasize:
-        print "Error!  Unknown extra data (0x%x vs 0x%x)" % (
-            datasize, expdatasize)
+        print ("Error!  Unknown extra data (0x%x vs 0x%x)" % (
+            datasize, expdatasize))
         sys.exit(1)
 
     # Print statistics
     runtimesize = datasize
     if '_reloc_abs_start' in symbols:
         runtimesize = end - symbols['code32init_end'].offset
-    print "Total size: %d  Fixed: %d  Free: %d (used %.1f%% of %dKiB rom)" % (
+    print( "Total size: %d  Fixed: %d  Free: %d (used %.1f%% of %dKiB rom)" % (
         datasize, runtimesize, finalsize - datasize
         , (datasize / float(finalsize)) * 100.0
-        , finalsize / 1024)
+        , finalsize / 1024))
 
     # Write final file
     f = open(outfile, 'wb')
index 8c7665d..7fb02c5 100755 (executable)
@@ -10,7 +10,7 @@ import sys
 def main():
     data = sys.stdin.read()
     ords = map(ord, data)
-    print "sum=%x\n" % sum(ords)
+    print( "sum=%x\n" % sum(ords))
 
 if __name__ == '__main__':
     main()
index 816ff9b..734cd9a 100755 (executable)
@@ -73,8 +73,8 @@ def fitSections(sections, fillsections):
             section.finalsegloc = addr
             fixedsections.append((addr, section))
             if section.align != 1:
-                print "Error: Fixed section %s has non-zero alignment (%d)" % (
-                    section.name, section.align)
+                print ("Error: Fixed section %s has non-zero alignment (%d)" % (
+                    section.name, section.align))
                 sys.exit(1)
     fixedsections.sort()
     firstfixed = fixedsections[0][0]
@@ -235,11 +235,11 @@ def doLayout(sections, genreloc):
     size32flat = li.sec32seg_start - li.sec32flat_start
     size32init = li.sec32flat_start - li.sec32init_start
     sizelow = sec32low_top - li.sec32low_start
-    print "16bit size:           %d" % size16
-    print "32bit segmented size: %d" % size32seg
-    print "32bit flat size:      %d" % size32flat
-    print "32bit flat init size: %d" % size32init
-    print "Lowmem size:          %d" % sizelow
+    print ("16bit size:           %d" % size16)
+    print ("32bit segmented size: %d" % size32seg)
+    print ("32bit flat size:      %d" % size32flat)
+    print ("32bit flat init size: %d" % size32init)
+    print ("Lowmem size:          %d" % sizelow)
     return li
 
 
@@ -596,7 +596,7 @@ def parseObjDump(file, fileid):
 
 def main():
     # Get output name
-    in16, in32seg, in32flat, out16, out32seg, out32flat = sys.argv[1:]
+    in16, in32seg, in32flat, out16, out32seg, out32flat = sys.argv[1:]  #pylint: disable=unbalanced-tuple-unpacking
 
     # Read in the objdump information
     infile16 = open(in16, 'rb')
index 52fb934..3d8c819 100644 (file)
@@ -19,7 +19,7 @@
 import sys
 
 def main():
-    infilename, outfilename = sys.argv[1:]
+    infilename, outfilename = sys.argv[1:]  #pylint: disable=unbalanced-tuple-unpacking
     infile = open(infilename, 'rb')
     out = []
     for line in infile:
index 3c3dee4..c1b7537 100755 (executable)
@@ -79,135 +79,135 @@ symbol_9p = {
 
 class VirtFSRequestTracker(simpletrace.Analyzer):
         def begin(self):
-                print "Pretty printing 9p simpletrace log ..."
+                print ("Pretty printing 9p simpletrace log ...")
 
         def v9fs_rerror(self, tag, id, err):
-                print "RERROR (tag =", tag, ", id =", symbol_9p[id], ", err = \"", os.strerror(err), "\")"
+                print( "RERROR (tag =", tag, ", id =", symbol_9p[id], ", err = \"", os.strerror(err), "\")")
 
         def v9fs_version(self, tag, id, msize, version):
-                print "TVERSION (tag =", tag, ", msize =", msize, ", version =", version, ")"
+                print ("TVERSION (tag =", tag, ", msize =", msize, ", version =", version, ")")
 
         def v9fs_version_return(self, tag, id, msize, version):
-                print "RVERSION (tag =", tag, ", msize =", msize, ", version =", version, ")"
+                print ("RVERSION (tag =", tag, ", msize =", msize, ", version =", version, ")")
 
         def v9fs_attach(self, tag, id, fid, afid, uname, aname):
-                print "TATTACH (tag =", tag, ", fid =", fid, ", afid =", afid, ", uname =", uname, ", aname =", aname, ")"
+                print( "TATTACH (tag =", tag, ", fid =", fid, ", afid =", afid, ", uname =", uname, ", aname =", aname, ")")
 
         def v9fs_attach_return(self, tag, id, type, version, path):
-                print "RATTACH (tag =", tag, ", qid={type =", type, ", version =", version, ", path =", path, "})"
+                print ("RATTACH (tag =", tag, ", qid={type =", type, ", version =", version, ", path =", path, "})")
 
         def v9fs_stat(self, tag, id, fid):
-                print "TSTAT (tag =", tag, ", fid =", fid, ")"
+                print ("TSTAT (tag =", tag, ", fid =", fid, ")")
 
         def v9fs_stat_return(self, tag, id, mode, atime, mtime, length):
-                print "RSTAT (tag =", tag, ", mode =", mode, ", atime =", atime, ", mtime =", mtime, ", length =", length, ")"
+                print( "RSTAT (tag =", tag, ", mode =", mode, ", atime =", atime, ", mtime =", mtime, ", length =", length, ")")
 
         def v9fs_getattr(self, tag, id, fid, request_mask):
-                print "TGETATTR (tag =", tag, ", fid =", fid, ", request_mask =", hex(request_mask), ")"
+                print ("TGETATTR (tag =", tag, ", fid =", fid, ", request_mask =", hex(request_mask), ")")
 
         def v9fs_getattr_return(self, tag, id, result_mask, mode, uid, gid):
-                print "RGETATTR (tag =", tag, ", result_mask =", hex(result_mask), ", mode =", oct(mode), ", uid =", uid, ", gid =", gid, ")"
+                print ("RGETATTR (tag =", tag, ", result_mask =", hex(result_mask), ", mode =", oct(mode), ", uid =", uid, ", gid =", gid, ")")
 
         def v9fs_walk(self, tag, id, fid, newfid, nwnames):
-                print "TWALK (tag =", tag, ", fid =", fid, ", newfid =", newfid, ", nwnames =", nwnames, ")"
+                print ("TWALK (tag =", tag, ", fid =", fid, ", newfid =", newfid, ", nwnames =", nwnames, ")")
 
         def v9fs_walk_return(self, tag, id, nwnames, qids):
-                print "RWALK (tag =", tag, ", nwnames =", nwnames, ", qids =", hex(qids), ")"
+                print ("RWALK (tag =", tag, ", nwnames =", nwnames, ", qids =", hex(qids), ")")
 
         def v9fs_open(self, tag, id, fid, mode):
-                print "TOPEN (tag =", tag, ", fid =", fid, ", mode =", oct(mode), ")"
+                print ("TOPEN (tag =", tag, ", fid =", fid, ", mode =", oct(mode), ")")
 
         def v9fs_open_return(self, tag, id, type, version, path, iounit):
-                print "ROPEN (tag =", tag,  ", qid={type =", type, ", version =", version, ", path =", path, "}, iounit =", iounit, ")"
+                print ("ROPEN (tag =", tag,  ", qid={type =", type, ", version =", version, ", path =", path, "}, iounit =", iounit, ")")
 
         def v9fs_lcreate(self, tag, id, dfid, flags, mode, gid):
-                print "TLCREATE (tag =", tag, ", dfid =", dfid, ", flags =", oct(flags), ", mode =", oct(mode), ", gid =", gid, ")"
+                print ("TLCREATE (tag =", tag, ", dfid =", dfid, ", flags =", oct(flags), ", mode =", oct(mode), ", gid =", gid, ")")
 
         def v9fs_lcreate_return(self, tag, id, type, version, path, iounit):
-                print "RLCREATE (tag =", tag,  ", qid={type =", type, ", version =", version, ", path =", path, "}, iounit =", iounit, ")"
+                print ("RLCREATE (tag =", tag,  ", qid={type =", type, ", version =", version, ", path =", path, "}, iounit =", iounit, ")")
 
         def v9fs_fsync(self, tag, id, fid, datasync):
-                print "TFSYNC (tag =", tag, ", fid =", fid, ", datasync =", datasync, ")"
+                print ("TFSYNC (tag =", tag, ", fid =", fid, ", datasync =", datasync, ")")
 
         def v9fs_clunk(self, tag, id, fid):
-                print "TCLUNK (tag =", tag, ", fid =", fid, ")"
+                print( "TCLUNK (tag =", tag, ", fid =", fid, ")")
 
         def v9fs_read(self, tag, id, fid, off, max_count):
-                print "TREAD (tag =", tag, ", fid =", fid, ", off =", off, ", max_count =", max_count, ")"
+                print ("TREAD (tag =", tag, ", fid =", fid, ", off =", off, ", max_count =", max_count, ")")
 
         def v9fs_read_return(self, tag, id, count, err):
-                print "RREAD (tag =", tag, ", count =", count, ", err =", err, ")"
+                print ("RREAD (tag =", tag, ", count =", count, ", err =", err, ")")
 
         def v9fs_readdir(self, tag, id, fid, offset, max_count):
-                print "TREADDIR (tag =", tag, ", fid =", fid, ", offset =", offset, ", max_count =", max_count, ")"
+                print ("TREADDIR (tag =", tag, ", fid =", fid, ", offset =", offset, ", max_count =", max_count, ")")
 
         def v9fs_readdir_return(self, tag, id, count, retval):
-                print "RREADDIR (tag =", tag, ", count =", count, ", retval =", retval, ")"
+                print( "RREADDIR (tag =", tag, ", count =", count, ", retval =", retval, ")")
 
         def v9fs_write(self, tag, id, fid, off, count, cnt):
-                print "TWRITE (tag =", tag, ", fid =", fid, ", off =", off, ", count =", count, ", cnt =", cnt, ")"
+                print( "TWRITE (tag =", tag, ", fid =", fid, ", off =", off, ", count =", count, ", cnt =", cnt, ")")
 
         def v9fs_write_return(self, tag, id, total, err):
-                print "RWRITE (tag =", tag, ", total =", total, ", err =", err, ")"
+                print ("RWRITE (tag =", tag, ", total =", total, ", err =", err, ")")
 
         def v9fs_create(self, tag, id, fid, name, perm, mode):
-                print "TCREATE (tag =", tag, ", fid =", fid, ", perm =", oct(perm), ", name =", name, ", mode =", oct(mode), ")"
+                print( "TCREATE (tag =", tag, ", fid =", fid, ", perm =", oct(perm), ", name =", name, ", mode =", oct(mode), ")")
 
         def v9fs_create_return(self, tag, id, type, version, path, iounit):
-                print "RCREATE (tag =", tag,  ", qid={type =", type, ", version =", version, ", path =", path, "}, iounit =", iounit, ")"
+                print ("RCREATE (tag =", tag,  ", qid={type =", type, ", version =", version, ", path =", path, "}, iounit =", iounit, ")")
 
         def v9fs_symlink(self, tag, id, fid, name, symname, gid):
-                print "TSYMLINK (tag =", tag, ", fid =", fid, ", name =", name, ", symname =", symname, ", gid =", gid, ")"
+                print ("TSYMLINK (tag =", tag, ", fid =", fid, ", name =", name, ", symname =", symname, ", gid =", gid, ")")
 
         def v9fs_symlink_return(self, tag, id, type, version, path):
-                print "RSYMLINK (tag =", tag,  ", qid={type =", type, ", version =", version, ", path =", path, "})"
+                print ("RSYMLINK (tag =", tag,  ", qid={type =", type, ", version =", version, ", path =", path, "})")
 
         def v9fs_flush(self, tag, id, flush_tag):
-                print "TFLUSH (tag =", tag, ", flush_tag =", flush_tag, ")"
+                print ("TFLUSH (tag =", tag, ", flush_tag =", flush_tag, ")")
 
         def v9fs_link(self, tag, id, dfid, oldfid, name):
-                print "TLINK (tag =", tag, ", dfid =", dfid, ", oldfid =", oldfid, ", name =", name, ")"
+                print ("TLINK (tag =", tag, ", dfid =", dfid, ", oldfid =", oldfid, ", name =", name, ")")
 
         def v9fs_remove(self, tag, id, fid):
-                print "TREMOVE (tag =", tag, ", fid =", fid, ")"
+                print( "TREMOVE (tag =", tag, ", fid =", fid, ")")
 
         def v9fs_wstat(self, tag, id, fid, mode, atime, mtime):
-                print "TWSTAT (tag =", tag, ", fid =", fid, ", mode =", oct(mode), ", atime =", atime, "mtime =", mtime, ")"
+                print ("TWSTAT (tag =", tag, ", fid =", fid, ", mode =", oct(mode), ", atime =", atime, "mtime =", mtime, ")")
 
         def v9fs_mknod(self, tag, id, fid, mode, major, minor):
-                print "TMKNOD (tag =", tag, ", fid =", fid, ", mode =", oct(mode), ", major =", major, ", minor =", minor, ")"
+                print ("TMKNOD (tag =", tag, ", fid =", fid, ", mode =", oct(mode), ", major =", major, ", minor =", minor, ")")
 
         def v9fs_lock(self, tag, id, fid, type, start, length):
-                print "TLOCK (tag =", tag, ", fid =", fid, "type =", type, ", start =", start, ", length =", length, ")"
+                print ("TLOCK (tag =", tag, ", fid =", fid, "type =", type, ", start =", start, ", length =", length, ")")
 
         def v9fs_lock_return(self, tag, id, status):
-                print "RLOCK (tag =", tag, ", status =", status, ")"
+                print ("RLOCK (tag =", tag, ", status =", status, ")")
 
         def v9fs_getlock(self, tag, id, fid, type, start, length):
-                print "TGETLOCK (tag =", tag, ", fid =", fid, "type =", type, ", start =", start, ", length =", length, ")"
+                print ("TGETLOCK (tag =", tag, ", fid =", fid, "type =", type, ", start =", start, ", length =", length, ")")
 
         def v9fs_getlock_return(self, tag, id, type, start, length, proc_id):
-                print "RGETLOCK (tag =", tag, "type =", type, ", start =", start, ", length =", length, ", proc_id =", proc_id,  ")"
+                print ("RGETLOCK (tag =", tag, "type =", type, ", start =", start, ", length =", length, ", proc_id =", proc_id,  ")")
 
         def v9fs_mkdir(self, tag, id, fid, name, mode, gid):
-                print "TMKDIR (tag =", tag, ", fid =", fid, ", name =", name, ", mode =", mode, ", gid =", gid, ")"
+                print ("TMKDIR (tag =", tag, ", fid =", fid, ", name =", name, ", mode =", mode, ", gid =", gid, ")")
 
         def v9fs_mkdir_return(self, tag, id, type, version, path, err):
-                print "RMKDIR (tag =", tag,  ", qid={type =", type, ", version =", version, ", path =", path, "}, err =", err, ")"
+                print ("RMKDIR (tag =", tag,  ", qid={type =", type, ", version =", version, ", path =", path, "}, err =", err, ")")
 
         def v9fs_xattrwalk(self, tag, id, fid, newfid, name):
-                print "TXATTRWALK (tag =", tag, ", fid =", fid, ", newfid =", newfid, ", xattr name =", name, ")"
+                print ("TXATTRWALK (tag =", tag, ", fid =", fid, ", newfid =", newfid, ", xattr name =", name, ")")
 
         def v9fs_xattrwalk_return(self, tag, id, size):
-                print "RXATTRWALK (tag =", tag, ", xattrsize  =", size, ")"
+                print ("RXATTRWALK (tag =", tag, ", xattrsize  =", size, ")")
 
         def v9fs_xattrcreate(self, tag, id, fid, name, size, flags):
-                print "TXATTRCREATE (tag =", tag, ", fid =", fid, ", name =", name, ", xattrsize =", size, ", flags =", flags, ")"
+                print ("TXATTRCREATE (tag =", tag, ", fid =", fid, ", name =", name, ", xattrsize =", size, ", flags =", flags, ")")
 
         def v9fs_readlink(self, tag, id, fid):
-                print "TREADLINK (tag =", tag, ", fid =", fid, ")"
+                print ("TREADLINK (tag =", tag, ", fid =", fid, ")")
 
         def v9fs_readlink_return(self, tag, id, target):
-                print "RREADLINK (tag =", tag, ", target =", target, ")"
+                print ("RREADLINK (tag =", tag, ", target =", target, ")")
 
 simpletrace.run(VirtFSRequestTracker())
index b12b696..8a104f2 100644 (file)
@@ -393,7 +393,7 @@ try:
                                    ["source", "header", "prefix=",
                                     "output-dir=", "type=", "middle"])
 except getopt.GetoptError, err:
-    print str(err)
+    print( str(err))
     sys.exit(1)
 
 output_dir = ""
@@ -471,7 +471,7 @@ if dispatch_type == "sync":
         ret = gen_marshal_input(cmd['command'], arglist, ret_type, middle_mode) + "\n"
         fdef.write(ret)
 
-    fdecl.write("\n#endif\n");
+    fdecl.write("\n#endif\n")
 
     if not middle_mode:
         ret = gen_registry(commands)
index 5ee46ea..1186d32 100644 (file)
@@ -217,7 +217,7 @@ struct %(name)s
         if discriminator:
             base_fields = base_fields.copy()
             del base_fields[discriminator]
-        ret += generate_struct_fields(base_fields)
+        #ret += generate_struct_fields(base_fields)
     else:
         assert not discriminator
 
@@ -267,7 +267,7 @@ try:
                                    ["source", "header", "builtins",
                                     "prefix=", "output-dir="])
 except getopt.GetoptError, err:
-    print str(err)
+    print( str(err))
     sys.exit(1)
 
 output_dir = ""
index 597cca4..e86cb48 100644 (file)
@@ -312,7 +312,7 @@ void visit_type_%(name)s(Visitor *m, %(name)s ** obj, const char *name, Error **
 }
 ''')
 
-    pop_indent();
+    pop_indent()
     ret += mcgen('''
 }
 ''')
@@ -358,7 +358,7 @@ try:
                                    ["source", "header", "builtins", "prefix=",
                                     "output-dir="])
 except getopt.GetoptError, err:
-    print str(err)
+    print( str(err))
     sys.exit(1)
 
 output_dir = ""
index 0ebea94..de4d6fd 100644 (file)
@@ -258,33 +258,31 @@ struct_types = []
 union_types = []
 
 def add_struct(definition):
-    global struct_types
+
     struct_types.append(definition)
 
 def find_struct(name):
-    global struct_types
     for struct in struct_types:
         if struct['type'] == name:
             return struct
     return None
 
 def add_union(definition):
-    global union_types
+
     union_types.append(definition)
 
 def find_union(name):
-    global union_types
     for union in union_types:
         if union['union'] == name:
             return union
     return None
 
 def add_enum(name):
-    global enum_types
+
     enum_types.append(name)
 
 def is_enum(name):
-    global enum_types
+    #global enum_types
     return (name in enum_types)
 
 def c_type(name):
index 8a0f305..19c161a 100644 (file)
@@ -14,7 +14,7 @@
 # GNU GPL, version 2 or (at your option) any later version.
 
 
-import gdb
+import gdb #pylint: disable=import-error
 
 def isnull(ptr):
     return ptr == gdb.Value(0).cast(ptr.type)
index 8bbcb42..bfb31dc 100755 (executable)
@@ -180,6 +180,6 @@ if __name__ == '__main__':
                 else:
                     fields.append('%s=0x%x' % (name, rec[i + 1]))
                 i += 1
-            print ' '.join(fields)
+            print (' '.join(fields))
 
     run(Formatter())
index 5f4890f..21451d2 100755 (executable)
@@ -16,9 +16,9 @@ __email__      = "stefanha@linux.vnet.ibm.com"
 import sys
 import getopt
 
-from tracetool import error_write, out
-import tracetool.backend
-import tracetool.format
+from tracetool import error_write, out,generate,TracetoolError
+from tracetool import backend
+from tracetool import format
 
 
 _SCRIPT = ""
@@ -28,9 +28,9 @@ def error_opt(msg = None):
         error_write("Error: " + msg + "\n")
 
     backend_descr = "\n".join([ "    %-15s %s" % (n, d)
-                                for n,d in tracetool.backend.get_list() ])
+                                for n,d in backend.get_list() ])
     format_descr = "\n".join([ "    %-15s %s" % (n, d)
-                               for n,d in tracetool.format.get_list() ])
+                               for n,d in format.get_list() ])
     error_write("""\
 Usage: %(script)s --format=<format> --backend=<backend> [<options>]
 
@@ -90,7 +90,7 @@ def main(args):
             arg_format = arg
 
         elif opt == "--list-backends":
-            public_backends = tracetool.backend.get_list(only_public = True)
+            public_backends = backend.get_list(only_public = True)
             out(", ".join([ b for b,_ in public_backends ]))
             sys.exit(0)
         elif opt == "--check-backend":
@@ -112,7 +112,7 @@ def main(args):
         error_opt("backend not set")
 
     if check_backend:
-        if tracetool.backend.exists(arg_backend):
+        if backend.exists(arg_backend):
             sys.exit(0)
         else:
             sys.exit(1)
@@ -129,9 +129,9 @@ def main(args):
             probe_prefix = ".".join([ "qemu", target_type, target_name ])
 
     try:
-        tracetool.generate(sys.stdin, arg_format, arg_backend,
+        generate(sys.stdin, arg_format, arg_backend,
                            binary = binary, probe_prefix = probe_prefix)
-    except tracetool.TracetoolError, e:
+    except TracetoolError, e:
         error_opt(str(e))
 
 if __name__ == "__main__":
index 33ad0ec..73733fc 100644 (file)
@@ -22,10 +22,10 @@ import subprocess
 import string
 import unittest
 import sys; sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'QMP'))
-import qmp
+import qmp  #pylint: disable=import-error
 import struct
 
-__all__ = ['imgfmt', 'imgproto', 'test_dir' 'qemu_img', 'qemu_io',
+__all__ = ['imgfmt', 'imgproto', 'test_dir', 'qemu_img', 'qemu_io',
            'VM', 'QMPTestCase', 'notrun', 'main']
 
 # This will not work if arguments or path contain spaces but is necessary if we
@@ -234,7 +234,7 @@ def notrun(reason):
     seq = os.path.basename(sys.argv[0])
 
     open('%s.notrun' % seq, 'wb').write(reason + '\n')
-    print '%s not run: %s' % (seq, reason)
+    print( '%s not run: %s' % (seq, reason))
     sys.exit(0)
 
 def main(supported_fmts=[]):
index 44a2b45..a5c3982 100755 (executable)
@@ -42,7 +42,7 @@ class QcowHeader:
         [ uint64_t, '%#x',  'autoclear_features' ],
         [ uint32_t, '%d',   'refcount_order' ],
         [ uint32_t, '%d',   'header_length' ],
-    ];
+    ]
 
     fmt = '>' + ''.join(field[0] for field in fields)
 
@@ -125,8 +125,7 @@ class QcowHeader:
 
     def dump(self):
         for f in QcowHeader.fields:
-            print "%-25s" % f[2], f[1] % self.__dict__[f[2]]
-        print ""
+            print( "%-25s" % f[2], f[1] % self.__dict__[f[2]])
 
     def dump_extensions(self):
         for ex in self.extensions:
@@ -137,11 +136,10 @@ class QcowHeader:
             else:
                 data = "<binary>"
 
-            print "Header extension:"
-            print "%-25s %#x" % ("magic", ex.magic)
-            print "%-25s %d" % ("length", ex.length)
-            print "%-25s %s" % ("data", data)
-            print ""
+            print( "Header extension:")
+            print("%-25s %#x" % ("magic", ex.magic))
+            print( "%-25s %d" % ("length", ex.length))
+            print( "%-25s %s" % ("data", data))
 
 
 def cmd_dump_header(fd):
@@ -153,12 +151,12 @@ def cmd_set_header(fd, name, value):
     try:
         value = int(value, 0)
     except:
-        print "'%s' is not a valid number" % value
+        print( "'%s' is not a valid number" % value)
         sys.exit(1)
 
     fields = (field[2] for field in QcowHeader.fields)
     if not name in fields:
-        print "'%s' is not a known header field" % name
+        print( "'%s' is not a known header field" % name)
         sys.exit(1)
 
     h = QcowHeader(fd)
@@ -169,7 +167,7 @@ def cmd_add_header_ext(fd, magic, data):
     try:
         magic = int(magic, 0)
     except:
-        print "'%s' is not a valid magic number" % magic
+        print( "'%s' is not a valid magic number" % magic)
         sys.exit(1)
 
     h = QcowHeader(fd)
@@ -180,7 +178,7 @@ def cmd_del_header_ext(fd, magic):
     try:
         magic = int(magic, 0)
     except:
-        print "'%s' is not a valid magic number" % magic
+        print( "'%s' is not a valid magic number" % magic)
         sys.exit(1)
 
     h = QcowHeader(fd)
@@ -192,7 +190,7 @@ def cmd_del_header_ext(fd, magic):
             h.extensions.remove(ex)
 
     if not found:
-        print "No such header extension"
+        print( "No such header extension")
         return
 
     h.update(fd)
@@ -203,7 +201,7 @@ def cmd_set_feature_bit(fd, group, bit):
         if bit < 0 or bit >= 64:
             raise ValueError
     except:
-        print "'%s' is not a valid bit number in range [0, 64)" % bit
+        print( "'%s' is not a valid bit number in range [0, 64)" % bit)
         sys.exit(1)
 
     h = QcowHeader(fd)
@@ -214,7 +212,7 @@ def cmd_set_feature_bit(fd, group, bit):
     elif group == 'autoclear':
         h.autoclear_features |= 1 << bit
     else:
-        print "'%s' is not a valid group, try 'incompatible', 'compatible', or 'autoclear'" % group
+        print( "'%s' is not a valid group, try 'incompatible', 'compatible', or 'autoclear'" % group)
         sys.exit(1)
 
     h.update(fd)
@@ -239,16 +237,15 @@ def main(filename, cmd, args):
             else:
                 handler(fd, *args)
                 return
-        print "Unknown command '%s'" % cmd
+        print( "Unknown command '%s'" % cmd)
     finally:
         fd.close()
 
 def usage():
-    print "Usage: %s <file> <cmd> [<arg>, ...]" % sys.argv[0]
-    print ""
-    print "Supported commands:"
+    print( "Usage: %s <file> <cmd> [<arg>, ...]" % sys.argv[0])
+    print( "Supported commands:")
     for name, handler, num_args, desc in cmds:
-        print "    %-20s - %s" % (name, desc)
+        print( "    %-20s - %s" % (name, desc))
 
 if __name__ == '__main__':
     if len(sys.argv) < 3:
index 52ff845..2077228 100755 (executable)
@@ -108,12 +108,12 @@ def corrupt_table_invalidate(qed, table):
 def cmd_show(qed, *args):
     '''show [header|l1|l2 <offset>]- Show header or l1/l2 tables'''
     if not args or args[0] == 'header':
-        print qed.header
+        print( qed.header)
     elif args[0] == 'l1':
-        print qed.l1_table
+        print( qed.l1_table)
     elif len(args) == 2 and args[0] == 'l2':
         offset = int(args[1])
-        print qed.read_table(offset)
+        print (qed.read_table(offset))
     else:
         err('unrecognized sub-command')
 
@@ -146,7 +146,7 @@ def cmd_invalidate(qed, table_level):
 def cmd_need_check(qed, *args):
     '''need-check [on|off] - Test, set, or clear the QED_F_NEED_CHECK header bit'''
     if not args:
-        print bool(qed.header['features'] & QED_F_NEED_CHECK)
+        print (bool(qed.header['features'] & QED_F_NEED_CHECK))
         return
 
     if args[0] == 'on':
@@ -208,17 +208,16 @@ def cmd_copy_metadata(qed, outfile):
     out.close()
 
 def usage():
-    print 'Usage: %s <file> <cmd> [<arg>, ...]' % sys.argv[0]
-    print
-    print 'Supported commands:'
+    print ('Usage: %s <file> <cmd> [<arg>, ...]' % sys.argv[0])
+    print ('Supported commands:')
     for cmd in sorted(x for x in globals() if x.startswith('cmd_')):
-        print globals()[cmd].__doc__
+        print (globals()[cmd].__doc__)
     sys.exit(1)
 
 def main():
     if len(sys.argv) < 3:
         usage()
-    filename, cmd = sys.argv[1:3]
+    filename, cmd = sys.argv[1:3]  #pylint: disable=unbalanced-tuple-unpacking
 
     cmd = 'cmd_' + cmd.replace('-', '_')
     if cmd not in globals():