MCPcopy Create free account
hub / github.com/ronreiter/interactive-tutorials / print_dictionary

Method print_dictionary

suds/sudsobject.py:330–354  ·  view source on GitHub ↗

print complex using the specified indent (n) and newline (nl).

(self, d, h, n, nl=False)

Source from the content-addressed store, hash-verified

328 return ''.join(s)
329
330 def print_dictionary(self, d, h, n, nl=False):
331 """ print complex using the specified indent (n) and newline (nl). """
332 if d in h:
333 return '{}...'
334 h.append(d)
335 s = []
336 if nl:
337 s.append('\n')
338 s.append(self.indent(n))
339 s.append('{')
340 for item in d.items():
341 s.append('\n')
342 s.append(self.indent(n+1))
343 if isinstance(item[1], (list, tuple)):
344 s.append(tostr(item[0]))
345 s.append('[]')
346 else:
347 s.append(tostr(item[0]))
348 s.append(' = ')
349 s.append(self.process(item[1], h, n, True))
350 s.append('\n')
351 s.append(self.indent(n))
352 s.append('}')
353 h.pop()
354 return ''.join(s)
355
356 def print_collection(self, c, h, n):
357 """print collection using the specified indent (n) and newline (nl)."""

Callers 1

processMethod · 0.95

Calls 6

indentMethod · 0.95
processMethod · 0.95
tostrFunction · 0.85
appendMethod · 0.45
itemsMethod · 0.45
popMethod · 0.45

Tested by

no test coverage detected