wmltools and wmlscope: fixed .keys() usages for Python 3
Most usages of the .keys() method were already safe, because they were either iterated only once, or they were wrapped in a call to sorted(), which casts them as lists
This commit is contained in:
parent
c407625ad3
commit
be62976d80
2 changed files with 4 additions and 5 deletions
|
@ -786,7 +786,7 @@ class CrossRef:
|
|||
def refcount(self, name):
|
||||
"Return a reference count for the specified resource."
|
||||
try:
|
||||
return len(self.fileref[name].references.keys())
|
||||
return len(self.fileref[name].references)
|
||||
except KeyError:
|
||||
return 0
|
||||
|
||||
|
@ -857,7 +857,7 @@ class Translation(dict):
|
|||
if self.isocode == "C":
|
||||
return True
|
||||
else:
|
||||
return key in self.gettext.keys()
|
||||
return key in self.gettext
|
||||
|
||||
class Translations:
|
||||
"Wraps around Translation to support multiple languages and domains."
|
||||
|
|
|
@ -165,7 +165,7 @@ class CrossRefLister(CrossRef):
|
|||
if len(self.unresolved) == 0 and len(self.missing) == 0:
|
||||
print("# No unresolved references")
|
||||
else:
|
||||
#print(self.fileref.keys())
|
||||
#print(list(self.fileref.keys()))
|
||||
for (name, reference) in self.unresolved + self.missing:
|
||||
print("%s: Unresolved reference -> %s" % (reference, name))
|
||||
mismatched = []
|
||||
|
@ -269,8 +269,7 @@ class CrossRefLister(CrossRef):
|
|||
def extracthelp(self, pref, fp):
|
||||
"Deliver all macro help comments in HTML form."
|
||||
# Bug: finds only the first definition of each macro in scope.
|
||||
doclist = self.xref.keys()
|
||||
doclist = [x for x in doclist if self.xref[x][0].docstring.count("\n") > 1]
|
||||
doclist = [x for x in self.xref.keys() if self.xref[x][0].docstring.count("\n") > 1]
|
||||
doclist.sort(key=lambda element: self.xref[element][0])
|
||||
outstr = ""
|
||||
filename = None
|
||||
|
|
Loading…
Add table
Reference in a new issue