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

Class GraphResolver

suds/resolver.py:391–469  ·  view source on GitHub ↗

The graph resolver is a I{stateful} L{Object} graph resolver used to resolve each node in a tree. As such, it mirrors the tree structure to ensure that nodes are resolved in context.

Source from the content-addressed store, hash-verified

389
390
391class GraphResolver(TreeResolver):
392 """
393 The graph resolver is a I{stateful} L{Object} graph resolver
394 used to resolve each node in a tree. As such, it mirrors
395 the tree structure to ensure that nodes are resolved in
396 context.
397 """
398
399 def __init__(self, schema):
400 """
401 @param schema: A schema object.
402 @type schema: L{xsd.schema.Schema}
403 """
404 TreeResolver.__init__(self, schema)
405
406 def find(self, name, object, resolved=False, push=True):
407 """
408 @param name: The name of the object to be resolved.
409 @type name: basestring
410 @param object: The name's value.
411 @type object: (any|L{Object})
412 @param resolved: A flag indicating that the fully resolved type
413 should be returned.
414 @type resolved: boolean
415 @param push: Indicates that the resolved type should be
416 pushed onto the stack.
417 @type push: boolean
418 @return: The found schema I{type}
419 @rtype: L{xsd.sxbase.SchemaObject}
420 """
421 known = None
422 parent = self.top().resolved
423 if parent is None:
424 result, ancestry = self.query(name)
425 else:
426 result, ancestry = self.getchild(name, parent)
427 if result is None:
428 return None
429 if isinstance(object, Object):
430 known = self.known(object)
431 if push:
432 frame = Frame(result, resolved=known, ancestry=ancestry)
433 self.push(frame)
434 if resolved:
435 if known is None:
436 result = result.resolve()
437 else:
438 result = known
439 return result
440
441 def query(self, name):
442 """ blindly query the schema by name """
443 log.debug('searching schema for (%s)', name)
444 schema = self.schema
445 wsdl = self.wsdl()
446 if wsdl is None:
447 qref = qualify(name, schema.root, schema.tns)
448 else:

Callers 1

__init__Method · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected