AttrWalker#

class sunpy.net.attr.AttrWalker[source]#

Bases: object

Traverse the Attr tree and convert it to a different representation.

The AttrWalker can walk a complex tree of attrs and represent that tree in a way that is useful to the client using the attrs. For the VSO client it generates a VSOQueryResponseTable.

The walker has three core operations that can be applied to the tree, all of these are functions which are applied to one or more Attr types, using conditional dispatch based on type.

  • creators: Creators when given an Attr return a new object.

  • appliers: Appliers process an Attr type and modify any arguments passed.

  • converters: Converters convert types unknown to any other creator or appliers to types known by them. They take in an Attr type and return a different one.

Methods Summary

add_applier(*types)

Register all specified types with this function for the .apply method.

add_converter(*types)

Register a function to convert the specified type into a known type for create and apply.

add_creator(*types)

Register all specified types with this function for the .create method.

apply(*args, **kwargs)

Call the apply function(s) matching the arguments to this method.

create(*args, **kwargs)

Call the create function(s) matching the arguments to this method.

Methods Documentation

add_applier(*types)[source]#

Register all specified types with this function for the .apply method.

add_converter(*types)[source]#

Register a function to convert the specified type into a known type for create and apply.

After a converter is run, create or apply will be called again with the new types.

add_creator(*types)[source]#

Register all specified types with this function for the .create method.

apply(*args, **kwargs)[source]#

Call the apply function(s) matching the arguments to this method.

create(*args, **kwargs)[source]#

Call the create function(s) matching the arguments to this method.