|
12 | 12 | import typing
|
13 | 13 | import warnings
|
14 | 14 | from collections import OrderedDict
|
| 15 | +from functools import partial |
15 | 16 |
|
16 | 17 | from lxml import etree
|
17 | 18 |
|
@@ -108,42 +109,43 @@ def __repr__(self):
|
108 | 109 | return "<WSDL(location=%r)>" % self.location
|
109 | 110 |
|
110 | 111 | def dump(self, output=sys.stdout):
|
111 |
| - print("", file=output) |
112 |
| - print("Prefixes:", file=output) |
| 112 | + print = partial(print, file=output) |
| 113 | + print("") |
| 114 | + print("Prefixes:") |
113 | 115 | for prefix, namespace in self.types.prefix_map.items():
|
114 |
| - print(" " * 4, "%s: %s" % (prefix, namespace), file=output) |
| 116 | + print(" " * 4, "%s: %s" % (prefix, namespace)) |
115 | 117 |
|
116 |
| - print("", file=output) |
117 |
| - print("Global elements:", file=output) |
| 118 | + print("") |
| 119 | + print("Global elements:") |
118 | 120 | for elm_obj in sorted(self.types.elements, key=lambda k: k.qname):
|
119 | 121 | value = elm_obj.signature(schema=self.types)
|
120 |
| - print(" " * 4, value, file=output) |
| 122 | + print(" " * 4, value) |
121 | 123 |
|
122 |
| - print("", file=output) |
123 |
| - print("Global types:", file=output) |
| 124 | + print("") |
| 125 | + print("Global types:") |
124 | 126 | for type_obj in sorted(self.types.types, key=lambda k: k.qname or ""):
|
125 | 127 | value = type_obj.signature(schema=self.types)
|
126 |
| - print(" " * 4, value, file=output) |
| 128 | + print(" " * 4, value) |
127 | 129 |
|
128 |
| - print("", file=output) |
129 |
| - print("Bindings:", file=output) |
| 130 | + print("") |
| 131 | + print("Bindings:") |
130 | 132 | for binding_obj in sorted(self.bindings.values(), key=lambda k: str(k)):
|
131 |
| - print(" " * 4, str(binding_obj), file=output) |
| 133 | + print(" " * 4, str(binding_obj)) |
132 | 134 |
|
133 |
| - print("", file=output) |
| 135 | + print("") |
134 | 136 | for service in self.services.values():
|
135 |
| - print(str(service), file=output) |
| 137 | + print(str(service)) |
136 | 138 | for port in service.ports.values():
|
137 |
| - print(" " * 4, str(port), file=output) |
138 |
| - print(" " * 8, "Operations:", file=output) |
| 139 | + print(" " * 4, str(port)) |
| 140 | + print(" " * 8, "Operations:") |
139 | 141 |
|
140 | 142 | operations = sorted(
|
141 | 143 | port.binding._operations.values(), key=operator.attrgetter("name")
|
142 | 144 | )
|
143 | 145 |
|
144 | 146 | for operation in operations:
|
145 |
| - print("%s%s" % (" " * 12, str(operation)), file=output) |
146 |
| - print("", file=output) |
| 147 | + print("%s%s" % (" " * 12, str(operation))) |
| 148 | + print("") |
147 | 149 |
|
148 | 150 | def _get_xml_document(self, location: typing.IO) -> etree._Element:
|
149 | 151 | """Load the XML content from the given location and return an
|
|
0 commit comments