From c376121698427c1731a89736d0e9ecf072b6004e Mon Sep 17 00:00:00 2001
From: Piotr Maslanka <piotr.maslanka@henrietta.com.pl>
Date: Sun, 8 Oct 2017 10:43:35 +0200
Subject: [PATCH] shorter

---
 coolamqp/framing/compilation/xml_fields.py | 4 ++--
 coolamqp/framing/compilation/xml_tags.py   | 7 +++++--
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/coolamqp/framing/compilation/xml_fields.py b/coolamqp/framing/compilation/xml_fields.py
index a6a0f82..173b11e 100644
--- a/coolamqp/framing/compilation/xml_fields.py
+++ b/coolamqp/framing/compilation/xml_fields.py
@@ -82,8 +82,8 @@ class _ChildField(_ComputedField):
     List of other properties
     """
     def __init__(self, name, xml_tag, fun, postexec=nop):
-        super(_ChildField, self).__init__(name, lambda elem: postexec(map(fun, _get_tagchild(elem, xml_tag))))
-
+        super(_ChildField, self).__init__(name, lambda elem: \
+            postexec([fun, _get_tagchild(elem, xml_tag)]))
 
 def get_docs(elem, label):
     """Parse an XML element. Return documentation"""
diff --git a/coolamqp/framing/compilation/xml_tags.py b/coolamqp/framing/compilation/xml_tags.py
index 2621aa6..5c98e58 100644
--- a/coolamqp/framing/compilation/xml_tags.py
+++ b/coolamqp/framing/compilation/xml_tags.py
@@ -103,14 +103,17 @@ class Method(BaseObject):
         return not any(field.basic_type in DYNAMIC_BASIC_TYPES for field in self.fields)
 
 
+_cls_method_sortkey = lambda m: (m.name.strip('-')[0], -len(m.response))
+_cls_method_postexec = lambda q: sorted(q, key=_cls_method_sortkey)
+
 class Class(BaseObject):
     NAME = 'class'
     FIELDS = [
         _name,
         _SimpleField('index', int),
         _docs_with_label,
-        _ChildField('methods', 'method', Method, postexec=lambda q: sorted(q,
-            key=lambda m: (m.name.strip('-')[0], -len(m.response)))),
+        _ChildField('methods', 'method', Method, postexec= \
+            _cls_method_postexec),
         _ChildField('properties', 'field', Field)
     ]
 
-- 
GitLab