Skip to content

Commit

Permalink
all main wml tools: use filter(), map() and zip() from Python 3
Browse files Browse the repository at this point in the history
The main difference is that these functions return generators instead of lists. This actually breaks wmlscope's collision detection, which will be fixed in my next commit.
  • Loading branch information
Elvish-Hunter committed Aug 5, 2015
1 parent 6d67fef commit c1a783b
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions data/tools/wesnoth/wmliterator.py
Expand Up @@ -21,6 +21,7 @@
"""

from __future__ import print_function, unicode_literals
from future_builtins import filter, map, zip

from functools import total_ordering
import sys, re, copy, codecs
Expand Down
1 change: 1 addition & 0 deletions data/tools/wesnoth/wmltools.py
Expand Up @@ -4,6 +4,7 @@
"""

from __future__ import print_function, unicode_literals
from future_builtins import filter, map, zip

from functools import total_ordering
import collections, codecs
Expand Down
1 change: 1 addition & 0 deletions data/tools/wmlindent
Expand Up @@ -62,6 +62,7 @@ indent already zero; these two conditions strongly suggest unbalanced WML.
"""

from __future__ import print_function, unicode_literals
from future_builtins import filter, map, zip

import sys, os, getopt, filecmp, re, codecs
from wesnoth import wmltools
Expand Down
1 change: 1 addition & 0 deletions data/tools/wmllint
Expand Up @@ -182,6 +182,7 @@
#

from __future__ import print_function, unicode_literals
from future_builtins import filter, map, zip

import sys, os, re, getopt, string, copy, difflib, time, gzip, codecs
from wesnoth.wmltools import *
Expand Down
3 changes: 2 additions & 1 deletion data/tools/wmlscope
Expand Up @@ -94,6 +94,7 @@
# sets the warning level.

from __future__ import print_function, unicode_literals
from future_builtins import filter, map, zip

import sys, os, time, re, getopt, hashlib, glob, codecs
from wesnoth.wmltools import *
Expand Down Expand Up @@ -448,7 +449,7 @@ Usage: wmlscope [options] dirpath
collisions = []
for (namespace, filename) in xref.filelist.generator():
with open(filename, "rb") as ifp: # this one may be an image or a sound, so don't assume UTF8 encoding
collisions.append(hashlib.md5(ifp.read()).digest())
collisions.append(hashlib.md5(ifp.read()).hexdigest()) # hexdigest can be easily printed, unlike digest
collisions = zip(xref.filelist.flatten(), collisions)
hashcounts = {}
for (n, h) in collisions:
Expand Down

0 comments on commit c1a783b

Please sign in to comment.