From 575d12792527ae98ff6ed22de3594ca39e03bc84 Mon Sep 17 00:00:00 2001 From: Mark Huang Date: Mon, 16 Oct 2006 19:18:31 +0000 Subject: [PATCH] cast instead of rebuilding dict when returning lists of dicts --- PLC/Methods/GetAttributes.py | 2 +- PLC/Methods/GetKeys.py | 2 +- PLC/Methods/GetNodeGroups.py | 2 +- PLC/Methods/GetNodes.py | 2 +- PLC/Methods/GetPCUs.py | 2 +- PLC/Methods/GetPersons.py | 2 +- PLC/Methods/GetRoles.py | 2 +- PLC/Methods/GetSites.py | 2 +- PLC/Methods/GetSliceAttributes.py | 2 +- PLC/Methods/GetSlices.py | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/PLC/Methods/GetAttributes.py b/PLC/Methods/GetAttributes.py index 5b5ea9f..8790e13 100644 --- a/PLC/Methods/GetAttributes.py +++ b/PLC/Methods/GetAttributes.py @@ -25,6 +25,6 @@ class GetAttributes(Method): attributes = Attributes(self.api, attribute_id_or_name_list).values() # Turn each attribute into a real dict. - attributes = [dict(attribute.items()) for attribute in attributes] + attributes = [dict(attribute) for attribute in attributes] return attributes diff --git a/PLC/Methods/GetKeys.py b/PLC/Methods/GetKeys.py index 80c4538..41a3ce2 100644 --- a/PLC/Methods/GetKeys.py +++ b/PLC/Methods/GetKeys.py @@ -34,6 +34,6 @@ class GetKeys(Method): keys = Keys(self.api, key_id_list).values() # Turn each key into a real dict - keys = [dict(key.items()) for key in keys] + keys = [dict(key) for key in keys] return keys diff --git a/PLC/Methods/GetNodeGroups.py b/PLC/Methods/GetNodeGroups.py index 738f0ce..c9c0b62 100644 --- a/PLC/Methods/GetNodeGroups.py +++ b/PLC/Methods/GetNodeGroups.py @@ -26,6 +26,6 @@ class GetNodeGroups(Method): nodegroups = NodeGroups(self.api, nodegroup_id_or_name_list).values() # Turn each nodegroup into a real dict. - nodegroups = [dict(nodegroup.items()) for nodegroup in nodegroups] + nodegroups = [dict(nodegroup) for nodegroup in nodegroups] return nodegroups diff --git a/PLC/Methods/GetNodes.py b/PLC/Methods/GetNodes.py index 2b270d0..dafc53f 100644 --- a/PLC/Methods/GetNodes.py +++ b/PLC/Methods/GetNodes.py @@ -47,6 +47,6 @@ class GetNodes(Method): nodes = Nodes(self.api, node_id_or_hostname_list).values() # turn each node into a real dict. - nodes = [dict(node.items()) for node in nodes] + nodes = [dict(node) for node in nodes] return nodes diff --git a/PLC/Methods/GetPCUs.py b/PLC/Methods/GetPCUs.py index 60aabbb..17b9670 100644 --- a/PLC/Methods/GetPCUs.py +++ b/PLC/Methods/GetPCUs.py @@ -34,6 +34,6 @@ class GetPCUs(Method): pcus = PCUs(self.api, pcu_ids).values() # turn each pcu into a real dict - pcus = [dict(pcu.items()) for pcu in pcus] + pcus = [dict(pcu) for pcu in pcus] return pcus diff --git a/PLC/Methods/GetPersons.py b/PLC/Methods/GetPersons.py index 1e3fa3b..a6fbc10 100644 --- a/PLC/Methods/GetPersons.py +++ b/PLC/Methods/GetPersons.py @@ -62,6 +62,6 @@ class GetPersons(Method): persons = filter(self.caller.can_view, persons.values()) # Turn each person into a real dict. - persons = [dict(person.items()) for person in persons] + persons = [dict(person) for person in persons] return persons diff --git a/PLC/Methods/GetRoles.py b/PLC/Methods/GetRoles.py index 6826476..084350f 100644 --- a/PLC/Methods/GetRoles.py +++ b/PLC/Methods/GetRoles.py @@ -22,6 +22,6 @@ class GetRoles(Method): roles = Roles(self.api).values() #turn each role into a real dict - roles = [dict(role.items()) for role in roles] + roles = [dict(role) for role in roles] return roles diff --git a/PLC/Methods/GetSites.py b/PLC/Methods/GetSites.py index 50d5e84..cb9847a 100644 --- a/PLC/Methods/GetSites.py +++ b/PLC/Methods/GetSites.py @@ -40,6 +40,6 @@ class GetSites(Method): sites = Sites(self.api, site_id_or_login_base_list) # turn each site into a real dict. - sites = [dict(site.items()) for site in sites.values()] + sites = [dict(site) for site in sites.values()] return sites diff --git a/PLC/Methods/GetSliceAttributes.py b/PLC/Methods/GetSliceAttributes.py index 38e887f..9d92c1e 100644 --- a/PLC/Methods/GetSliceAttributes.py +++ b/PLC/Methods/GetSliceAttributes.py @@ -53,7 +53,7 @@ class GetSliceAttributes(Method): slice_attributes = SliceAttributes(self.api, slice_attribute_id_list).values() # turn each slice attribute into a real dict - slice_attributes = [dict(slice_attribute.items()) \ + slice_attributes = [dict(slice_attribute) \ for slice_attribute in slice_attributes] return slice_attributes diff --git a/PLC/Methods/GetSlices.py b/PLC/Methods/GetSlices.py index 292de53..b87ee91 100644 --- a/PLC/Methods/GetSlices.py +++ b/PLC/Methods/GetSlices.py @@ -43,6 +43,6 @@ class GetSlices(Method): slices = filter(can_view, slices) # turn each slice into a real dict - slices = [dict(slice.items()) for slice in slices] + slices = [dict(slice) for slice in slices] return slices -- 2.43.0