Bases: object

This is the base for all attributes.

Methods Summary



Clients will use this method to register their values for subclasses of Attr.

Methods Documentation

classmethod update_values(adict)[source]#

Clients will use this method to register their values for subclasses of Attr.

The input has to be a dictionary, with each key being an instance of a client. The value for each client has to be a dictionary with each key being a subclass of Attr. The value for each Attr key should be a list of tuples with each tuple of the form (Name, Description). If you do not want to add a description, you can put None or an empty string. We sanitize the name you provide by removing all special characters and making it all lower case. If it still invalid we will append to the start of the name to make it a valid attribute name. This is an ugly workaround, so please try to pick a valid attribute name.

It is recommended that clients register values for all attrs used by their `_can_handle_query` method.


adict (dict) – The keys for this dictionary have to be an instance of a downloader client. The values for each client are a dictionary that has keys of Attr. Each key should have a list of tuples as it value. Each tuple should be a pair of strings. First string is the attribute name you want to register Second string is the description of the attribute.


# The first import is to make this example work, it should not be used otherwise >>> from import GenericClient >>> from import attr, attrs >>> attr.Attr.update_values({GenericClient : { … attrs.Instrument: [(‘AIA’, ‘AIA is in Space.’), … (‘HMI’, ‘HMI is next to AIA.’)]}}) # doctest: +SKIP >>> attr.Attr._attr_registry[attrs.Instrument] # doctest: +SKIP attr(name=[‘aia’, ‘hmi’], client=[‘Generic’, ‘Generic’], name_long=[‘AIA’, ‘HMI’], desc=[‘AIA is in Space.’, ‘HMI is next to AIA.’]) >>> attr.Attr._attr_registry[attrs.Instrument].name # doctest: +SKIP [‘aia’, ‘hmi’] >>> attr.Attr._attr_registry[attrs.Instrument].name_long # doctest: +SKIP [‘AIA’, ‘HMI’] >>> attr.Attr._attr_registry[attrs.Instrument].desc # doctest: +SKIP [‘AIA is in Space.’, ‘HMI is next to AIA.’] >>> attrs.Instrument.aia, attrs.Instrument.hmi # doctest: +SKIP (< AIA is in Space.) object at 0x…>, < HMI is next to AIA.) object at 0x…>)