Skip to content

Commit

Permalink
"map" improved, courtesy @cclauss
Browse files Browse the repository at this point in the history
  • Loading branch information
David Read committed Nov 8, 2019
1 parent 5552739 commit 203ea77
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion ckan/controllers/api.py
Expand Up @@ -288,7 +288,7 @@ def convert_to_dict(user):
return out

query = query.limit(limit)
out = list(map(convert_to_dict, query.all()))
out = [convert_to_dict(q) for q in query.all()]
return out

@jsonp.jsonpify
Expand Down
2 changes: 1 addition & 1 deletion ckan/lib/dictization/model_save.py
Expand Up @@ -420,7 +420,7 @@ def group_dict_save(group_dict, context, prevent_packages_update=False):
package_ids.extend( pkgs_edited['added'] )
if package_ids:
session.commit()
list(map(rebuild, package_ids))
[rebuild(package_id) for package_id in package_ids]

return group

Expand Down
2 changes: 1 addition & 1 deletion ckan/lib/helpers.py
Expand Up @@ -1512,7 +1512,7 @@ def date_str_to_datetime(date_str):
microseconds = int(m.groupdict(0).get('microseconds'))
time_tuple = time_tuple[:5] + [seconds, microseconds]

return datetime.datetime(*list(map(int, time_tuple)))
return datetime.datetime(*list(int(item) for item in time_tuple))


@core_helper
Expand Down
2 changes: 1 addition & 1 deletion ckan/model/license.py
Expand Up @@ -35,7 +35,7 @@ def __init__(self, data):
if key == 'date_created':
# Parse ISO formatted datetime.
value = datetime.datetime(
*list(map(int, re.split('[^\d]', value))))
*list(int(item) for item in re.split('[^\d]', value)))
self._data[key] = value
elif isinstance(value, str):
# Convert str to unicode (keeps Pylons and SQLAlchemy happy).
Expand Down

0 comments on commit 203ea77

Please sign in to comment.