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

Function footprint

suds/sudsobject.py:71–94  ·  view source on GitHub ↗

Get the I{virtual footprint} of the object. This is really a count of the attributes in the branch with a significant value. @param sobject: A suds object. @type sobject: L{Object} @return: The branch footprint. @rtype: int

(sobject)

Source from the content-addressed store, hash-verified

69
70
71def footprint(sobject):
72 """
73 Get the I{virtual footprint} of the object.
74 This is really a count of the attributes in the branch with a significant
75 value.
76 @param sobject: A suds object.
77 @type sobject: L{Object}
78 @return: The branch footprint.
79 @rtype: int
80 """
81 n = 0
82 for a in sobject.__keylist__:
83 v = getattr(sobject, a)
84 if v is None:
85 continue
86 if isinstance(v, Object):
87 n += footprint(v)
88 continue
89 if hasattr(v, '__len__'):
90 if len(v):
91 n += 1
92 continue
93 n += 1
94 return n
95
96
97class Factory:

Callers 1

appendMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected