MCPcopy Index your code
hub / github.com/ronreiter/interactive-tutorials / str

Method str

suds/xsd/sxbase.py:427–461  ·  view source on GitHub ↗

Get a string representation of this object. @param indent: The indent. @type indent: int @return: A string. @rtype: str

(self, indent=0, history=None)

Source from the content-addressed store, hash-verified

425 return collection
426
427 def str(self, indent=0, history=None):
428 """
429 Get a string representation of this object.
430 @param indent: The indent.
431 @type indent: int
432 @return: A string.
433 @rtype: str
434 """
435 if history is None:
436 history = []
437 if self in history:
438 return '%s ...' % Repr(self)
439 history.append(self)
440 tab = '%*s' % (indent * 3, '')
441 result = []
442 result.append('%s<%s' % (tab, self.id))
443 for n in self.description():
444 if not hasattr(self, n):
445 continue
446 v = getattr(self, n)
447 if v is None:
448 continue
449 result.append(' %s="%s"' % (n, v))
450 if len(self):
451 result.append('>')
452 for c in self.rawchildren:
453 result.append('\n')
454 result.append(c.str(indent+1, history[:]))
455 if c.isattr():
456 result.append('@')
457 result.append('\n%s' % tab)
458 result.append('</%s>' % self.__class__.__name__)
459 else:
460 result.append(' />')
461 return ''.join(result)
462
463 def description(self):
464 """

Callers

nothing calls this directly

Calls 4

descriptionMethod · 0.95
ReprClass · 0.90
appendMethod · 0.45
isattrMethod · 0.45

Tested by

no test coverage detected