Skip to content

Commit 6c55a86

Browse files
committed
Implement suggestion of @frost-nzcr4 on PR mvantellingen#1213 comments.
1 parent e20aa1f commit 6c55a86

File tree

1 file changed

+20
-18
lines changed

1 file changed

+20
-18
lines changed

src/zeep/wsdl/wsdl.py

+20-18
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import typing
1313
import warnings
1414
from collections import OrderedDict
15+
from functools import partial
1516

1617
from lxml import etree
1718

@@ -108,42 +109,43 @@ def __repr__(self):
108109
return "<WSDL(location=%r)>" % self.location
109110

110111
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:")
113115
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))
115117

116-
print("", file=output)
117-
print("Global elements:", file=output)
118+
print("")
119+
print("Global elements:")
118120
for elm_obj in sorted(self.types.elements, key=lambda k: k.qname):
119121
value = elm_obj.signature(schema=self.types)
120-
print(" " * 4, value, file=output)
122+
print(" " * 4, value)
121123

122-
print("", file=output)
123-
print("Global types:", file=output)
124+
print("")
125+
print("Global types:")
124126
for type_obj in sorted(self.types.types, key=lambda k: k.qname or ""):
125127
value = type_obj.signature(schema=self.types)
126-
print(" " * 4, value, file=output)
128+
print(" " * 4, value)
127129

128-
print("", file=output)
129-
print("Bindings:", file=output)
130+
print("")
131+
print("Bindings:")
130132
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))
132134

133-
print("", file=output)
135+
print("")
134136
for service in self.services.values():
135-
print(str(service), file=output)
137+
print(str(service))
136138
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:")
139141

140142
operations = sorted(
141143
port.binding._operations.values(), key=operator.attrgetter("name")
142144
)
143145

144146
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("")
147149

148150
def _get_xml_document(self, location: typing.IO) -> etree._Element:
149151
"""Load the XML content from the given location and return an

0 commit comments

Comments
 (0)