1.1. eventstreamr2.lib.amp.arguments — Additional argument types

The arguments defined here can be used to create new commands. To find out more see Defining a Command.

Note

This module can be included in place of twisted.protocols.amp

1.1.1. Arguments

Most Argument subclasses accept a optional argument to thier constructor. The arguments will error when an invalid type is provided and in the process prevent the command from being sent. If the type is unknown then use an Object as it does not perform type checks.

Todo

Figure out the difference between BoxSender and Transport.

Todo

Figure out if the two seperate classes(BoxSender and Transport) are strictly required.

class eventstreamr2.lib.amp.arguments.BigString(optional=False)[source]
class eventstreamr2.lib.amp.arguments.BigUnicode(optional=False)[source]

An argument that accepts an arbitary length ASCII/Unicode string.

Note

Use BigUnicode over BigString. This is to prevent BigString from raising an error if the value provided is accidentaly unicode.

class eventstreamr2.lib.amp.arguments.Boolean(optional=False)

An argument that accepts a bool().

class eventstreamr2.lib.amp.arguments.BoxSender[source]

An argument that automatically fills in the sender’s information for the reciever.

This argument is a twisted.protocols.amp.BoxDispatcher; it allows access to callRemote which can allow for a callback to send more calls to the sender.

This is used in manager to update the configuration when a new station connects.

Note

BoxSender is always optional. Any value provided is discarded prior to transmission.

class eventstreamr2.lib.amp.arguments.Float(optional=False)

An argument that accepts a floating point number.

class eventstreamr2.lib.amp.arguments.Integer(optional=False)

An argument that accepts an integer-valued number.

class eventstreamr2.lib.amp.arguments.Object(optional=False)[source]

An argument that accepts any python object.

The implementation will use pickle to convert the object into a string, then send the pickled object. Then at the other end the string is unpickled and the object returned.

class eventstreamr2.lib.amp.arguments.Path(optional=False)

An argument that accepts a twisted.python.filepath.FilePath object.

class eventstreamr2.lib.amp.arguments.String(optional=False)
class eventstreamr2.lib.amp.arguments.Unicode(optional=False)

An argument that accepts a ASCII/Unicode string.

Note

This argument is length limited to the limits imposed by the AMP protocol which is 65,535 bytes. Use BigString or BigUnicode if the length could excede this.

class eventstreamr2.lib.amp.arguments.Transport[source]

An argument that automatically fills in the sender’s transport information for the reciever.

This is used in manager to update the configuration when a new station connects.

Note

Transport is always optional. Any value provided is discarded prior to transmission.

1.1.2. Command

The Command class is defined in the twisted.protocols.amp module; but made avaliable here for simplicity.

class eventstreamr2.lib.amp.arguments.Command

Subclass this to specify a command. See the full documentation on the Twisted’s API documentation

Variables:
  • arguments – A list of 2-tuples of (name, Argument-subclass-instance), specifying the names and values of the parameters which are required for this command.
  • response – A list like L{arguments}, but instead used for the return value.