diff --git a/coolamqp/framing/compilation/xml_fields.py b/coolamqp/framing/compilation/xml_fields.py index a6a0f82db91275f07087ed483deb35fe531c67d3..173b11ec82801fd21e94e72879dc42e62cd29234 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 2621aa65692b0050873d1169290d921b980d990f..5c98e58d1922f8f45ff49bbe87f96f98d1725857 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) ]