Commit dca1764e authored by Iustin Pop's avatar Iustin Pop
Browse files

Simplify rapi.baserlib.MapFields()

We can use zip for simplifying this function. Actually, at this point
I'm not sure if it needs to be a separate function at all.

Reviewed-by: imsnah
parent 3be9a705
...@@ -37,7 +37,7 @@ def BuildUriList(ids, uri_format, uri_fields=("name", "uri")): ...@@ -37,7 +37,7 @@ def BuildUriList(ids, uri_format, uri_fields=("name", "uri")):
""" """
(field_id, field_uri) = uri_fields (field_id, field_uri) = uri_fields
def _MapId(m_id): def _MapId(m_id):
return { field_id: m_id, field_uri: uri_format % m_id, } return { field_id: m_id, field_uri: uri_format % m_id, }
...@@ -73,7 +73,7 @@ def MapFields(names, data): ...@@ -73,7 +73,7 @@ def MapFields(names, data):
""" """
if len(names) != len(data): if len(names) != len(data):
raise AttributeError("Names and data must have the same length") raise AttributeError("Names and data must have the same length")
return dict([(names[i], data[i]) for i in range(len(names))]) return dict(zip(names, data))
def _Tags_GET(kind, name=None): def _Tags_GET(kind, name=None):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment