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

Method nextprefix

suds/servicedefinition.py:158–170  ·  view source on GitHub ↗

Get the next available prefix. This means a prefix starting with 'ns' with a number appended as (ns0, ns1, ..) that is not already defined on the wsdl document.

(self)

Source from the content-addressed store, hash-verified

156 self.types.sort(key=lambda x: x[0].name)
157
158 def nextprefix(self):
159 """
160 Get the next available prefix. This means a prefix starting with 'ns'
161 with a number appended as (ns0, ns1, ..) that is not already defined
162 on the wsdl document.
163 """
164 used = [ns[0] for ns in self.prefixes]
165 used += [ns[0] for ns in self.wsdl.root.nsprefixes.items()]
166 for n in range(0, 1024):
167 p = 'ns%d' % n
168 if p not in used:
169 return p
170 raise Exception('prefixes exhausted')
171
172 def getprefix(self, u):
173 """

Callers 1

getprefixesMethod · 0.95

Calls 1

itemsMethod · 0.45

Tested by

no test coverage detected