Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
tools: make mkssldef.py Python 3 compatible
This patch replaces the usage of `map` in such a way that it will be
compatible with Python 3.
  • Loading branch information
thefourtheye committed Jan 19, 2019
commit 725fc96ef4a8c9667b705cb0cef8729210f731f2
4 changes: 2 additions & 2 deletions tools/mkssldef.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@
elif option.startswith('-X'): excludes += option[2:].split(',')
elif option.startswith('-B'): bases += option[2:].split(',')

excludes = map(re.compile, excludes)
excludes = [re.compile(exclude) for exclude in excludes]
exported = []

for filename in filenames:
for line in open(filename).readlines():
name, _, _, meta, _ = re.split('\s+', line)
if any(map(lambda p: p.match(name), excludes)): continue
if any([p.match(name) for p in excludes]): continue
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need the square brackets here, any() accepts a generator.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed it to a generator now.

meta = meta.split(':')
assert meta[0] in ('EXIST', 'NOEXIST')
assert meta[2] in ('FUNCTION', 'VARIABLE')
Expand Down