Style: fix redundant parentheses and typos

This commit is contained in:
Ziyue Pan 2023-03-23 14:45:34 +08:00 committed by Michael Opdenacker
parent 7c4886cf3c
commit a627571baf
5 changed files with 17 additions and 17 deletions

12
data.py
View file

@ -68,9 +68,9 @@ class DefList:
type = defTypeR [type.decode()]
line = int(line)
family = family.decode()
yield(id, type, line, family)
yield id, type, line, family
if dummy:
yield(maxId, None, None, None)
yield maxId, None, None, None
def append(self, id, type, line, family):
if type not in defTypeD:
@ -108,9 +108,9 @@ class PathList:
id, path = p.split(b' ',maxsplit=1)
id = int(id)
path = path.decode()
yield(id, path)
yield id, path
if dummy:
yield(maxId, None)
yield maxId, None
def append(self, id, path):
p = str(id).encode() + b' ' + path + b'\n'
@ -133,9 +133,9 @@ class RefList:
b = int(b.decode())
c = c.decode()
d = d.decode()
yield(b, c, d)
yield b, c, d
if dummy:
yield(maxId, None, None)
yield maxId, None, None
def append(self, id, lines, family):
p = str(id) + ':' + lines + ':' + family + '\n'

View file

@ -1,6 +1,6 @@
# Elixir Python definitions for DT compatible strings support
if(dts_comp_support):
if dts_comp_support:
exec(open('dtscompC.py').read())
exec(open('dtscompD.py').read())
exec(open('dtscompB.py').read())

View file

@ -339,16 +339,16 @@ elif mode == 'ident':
previous_type = ''
types_count = {}
# Count occurences of each type before printing
# Count occurrences of each type before printing
for symbol_definition in symbol_definitions:
if (symbol_definition.type in types_count):
if symbol_definition.type in types_count:
types_count[symbol_definition.type] += 1
else:
types_count[symbol_definition.type] = 1
for symbol_definition in symbol_definitions:
if (symbol_definition.type != previous_type) :
if (previous_type != ''):
if symbol_definition.type != previous_type:
if previous_type != '':
print('</ul>')
print('<h2>Defined in '+str(types_count[symbol_definition.type])+' files as a '+symbol_definition.type+':</h2>')
print('<ul>')

View file

@ -106,7 +106,7 @@ def query(cmd, *args):
elif cmd == 'exist':
# Returns True if the requested file exists, overwise returns False
# Returns True if the requested file exists, otherwise returns False
version = args[0]
path = args[1]
@ -232,7 +232,7 @@ def query(cmd, *args):
return get_idents_defs(version, ident, family)
else:
return('Unknown subcommand: ' + cmd + '\n')
return 'Unknown subcommand: ' + cmd + '\n'
def get_idents_comps(version, ident):

View file

@ -96,10 +96,10 @@ def get_file(path, version):
#Read arguments
if(len(sys.argv) > 1):
if(sys.argv[1] == '-v'):
if len(sys.argv) > 1:
if sys.argv[1] == '-v':
verbose = True
elif (sys.argv[1] == '-h'):
elif sys.argv[1] == '-h':
print("LXR_PROJ_DIR needs to be set before launching this script\n" +
"Options :\n" +
"-v Verbose mode (Show requests details)")
@ -107,7 +107,7 @@ if(len(sys.argv) > 1):
#Query init
query = init_query(project)
if(query == None):
if query == None:
exit()
#Database test