t.p.a.IArgumentType(Interface) : interface documentation

Part of twisted.protocols.amp View Source View In Hierarchy

Known implementations: twisted.protocols.amp.Argument

An IArgumentType can serialize a Python object into an AMP box and deserialize information from an AMP box back into a Python object.
Present Since9.0
Method fromBox Given an argument name and an AMP box containing serialized values, extract one or more Python objects and add them to the objects dictionary.
Method toBox Given an argument name and a dictionary containing structured Python objects, serialize values into one or more strings and add them to the strings dictionary.
def fromBox(name, strings, objects, proto): (source)
Given an argument name and an AMP box containing serialized values, extract one or more Python objects and add them to the objects dictionary.
ParametersnameThe name associated with this argument. Most commonly, this is the key which can be used to find a serialized value in strings and which should be used as the key in objects to associate with a structured Python object. (type: str)
stringsThe AMP box from which to extract one or more values. (type: dict)
objectsThe output dictionary to populate with the value for this argument. (type: dict)
protoThe protocol instance which received the AMP box being interpreted. Most likely this is an instance of AMP, but this is not guaranteed.
ReturnsNone
def toBox(name, strings, objects, proto): (source)
Given an argument name and a dictionary containing structured Python objects, serialize values into one or more strings and add them to the strings dictionary.
ParametersnameThe name associated with this argument. Most commonly, this is the key which can be used to find an object in objects and which should be used as the key in strings to associate with a str giving the serialized form of that object. (type: str)
stringsThe AMP box into which to insert one or more strings. (type: dict)
objectsThe input dictionary from which to extract Python objects to serialize. (type: dict)
protoThe protocol instance which will send the AMP box once it is fully populated. Most likely this is an instance of AMP, but this is not guaranteed.
ReturnsNone
API Documentation for Twisted, generated by pydoctor at 2012-06-04 17:20:01.