Codacy fixes

This commit is contained in:
Matthias Rustler 2021-01-05 14:41:47 +01:00 committed by deadwood
parent c1f8c8aedf
commit e04240883a
8 changed files with 15 additions and 16 deletions

View File

@ -6,7 +6,7 @@ import dbus
bus = dbus.Bus()
def signal_callback(interface, signal_name, service, path, message):
print "Received signal %s from %s" % (signal_name, interface)
print ("Received signal %s from %s" % (signal_name, interface))
# Catch signals from a specific interface and object, and call signal_callback
# when they arrive.

View File

@ -19,7 +19,7 @@ signal_object = SignalObject(service)
def send_ping():
signal_object.broadcast_signal("com.burtonini.dbus.Signal", "Ping")
print "Ping!"
print ("Ping!")
return gtk.TRUE
# Call send_ping every second to send the signal

View File

@ -34,7 +34,7 @@ def copy_tree(src, dst, ignore):
# directories like Locale/Help/Espanol on non-western systems, where locale
# is different from Latin-1 (e. g. russian).
# See http://docs.python.org/2/howto/unicode.html#unicode-filenames
# TODO: the following didn't work anymore with Python 3
#src_u = str(src, "utf-8").encode("utf-8")

View File

@ -1,8 +1,8 @@
#!/usr/bin/env python3
# -*- coding: iso-8859-1 -*-
# Copyright (C) 2003-2020, The AROS Development Team. All rights reserved.
# Copyright (C) 2003-2021, The AROS Development Team. All rights reserved.
import sys, re, os, errno
import sys, re, os
if not len(sys.argv) in [2, 3, 4, 5] :
print("Usage:",sys.argv[0],"tmplfile [inputfile outputfile]")
@ -40,7 +40,7 @@ class GenmfException(BaseException):
# will be added to this array.
def generate_templrefs(lines, templates):
templrefs = []
for lineno in range(len(lines)):
line = lines[lineno]
if len(line) == 0 or line[0] == "#":
@ -102,7 +102,7 @@ class arg:
# Specification can end with /A or /M
re_mode = re.compile('/(A|M)')
# You create this object with giving it the default value
# You create this object with giving it the default value
def __init__(self, default=None):
self.ismulti = 0
self.isneeded = 0
@ -199,7 +199,6 @@ class template:
self.used = 1
# Reading arguments of the template
argno = 0
while len(line) > 0:
m = re_arg.match(line)
if m and m.group(1) in self.args:
@ -276,7 +275,6 @@ def read_templates(filename):
print("Error reading template file: "+filename)
re_name = re.compile('[a-zA-Z0-9][a-zA-Z0-9_]*(?=(?:\s|$))')
re_openstring = re.compile('[^\s"]*"[^"]*$')
re_define = re.compile('%define(?=\s)')
lines = infile.readlines()
@ -351,7 +349,7 @@ while i < len(sys.argv):
templates = read_templates(argv[1])
#sys.stderr.write("Read %d templates\n" % len(templates))
if listfile == None:
if not listfile:
# Read one input file and write out one outputfile
if len(sys.argv) == argin:
lines = sys.stdin.readlines()

View File

@ -1,5 +1,7 @@
#!/usr/bin/env python3
# script for enhancing Callgrind output with AROS-side symbol names
import re, os, sys
class Module:
@ -13,7 +15,6 @@ class Module:
def loadsymbolinformation():
reg = r'S\|(.*)\|(.*)\|(.*)\|(.*)'
modules = []
symbols = []
lastmodname = ""
module = None
@ -97,7 +98,7 @@ def main():
# Build out actuall symbol information
line = match.group(1) + symbol[0] + os.linesep
break
output.write(line)
output.close()

View File

@ -22,7 +22,7 @@ file = open(sys.argv[1], "r", encoding="iso-8859-15")
for line in file:
outfile.write(' "%s",\n' % line.strip())
count += 1
outfile.write('''};
#define ACKNOWLEDGEMENTS_SIZE (%d)

View File

@ -3,7 +3,7 @@
# Copyright © 2002-2008, The AROS Development Team. All rights reserved.
# $Id$
import os, sys, string
import sys
labels2sids = {
'Coordination' : 'SID_COORDINATION',
@ -97,7 +97,7 @@ for area in credits:
outfile.write(''' SECTION
(
%s''' % labels2sids[area[0]])
for name in area[1]:
outfile.write(',\n NAME("%s")' % name.replace('"', '\\"'))

View File

@ -25,7 +25,7 @@ struct TagItem *SPONSORS = TAGLIST
file = open(sys.argv[1], "r", encoding="iso-8859-15")
for line in file:
outfile.write(',\n NAME("%s")' % line.strip())
outfile.write('''\n ),
TAG_DONE
);