Skip to content

Commit

Permalink
Replace usage of map unsupported on Python 3
Browse files Browse the repository at this point in the history
In Python 3, map returns a map object not a list. Replaced the
occurrences I could find with list comprehensions.
  • Loading branch information
amercader committed Nov 8, 2019
1 parent 59006ac commit c7cfef5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions ckanext/example_idatastorebackend/example_sqlite.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ def resource_id_from_alias(self, alias):
return False, alias

def get_all_ids(self):
return map(lambda t: t.name, self._get_engine().execute(
return [t.name for t in self._get_engine().execute(
u'''
select name from sqlite_master
where type = "table"'''
).fetchall())
).fetchall()]
4 changes: 3 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
#

def parse_version(s):
return map(int, s.split('.'))
return [int(part) for part in s.split('.')]



HERE = os.path.dirname(__file__)
with open(os.path.join(HERE, 'requirement-setuptools.txt')) as f:
Expand Down

0 comments on commit c7cfef5

Please sign in to comment.