option

Contents

option#

pulserver.design.option()[source]#

Declare a plugin option at user entry user and return the value the plugin is loaded with.

A plugin assigns it to a module constant at module level, before its SequencePlugin subclass, whose class body reads it, so the option shapes the sequence function and the protocol the plugin declares. The subclass lists the option as user<user>_value, the index of its value among choices (0 or 1 for a flag), named label and the code of each choice in user<user>_name. A design call loads the plugin at the options its request holds in those entries; outside load_plugin() the value is default.

Parameters:
  • name (str) – The option’s name, which a design’s manifest records it by.

  • default (bool, int, float or str) – Its value where the request does not state it.

  • choices (tuple, default=()) – Its values, default among them, at most five; a flag, whose default is a bool, takes none and chooses between False and True.

  • user (int) – The user entry it is listed at.

  • label (str) – The option’s name on the console.

Raises:

OptionError – If a flag is given choices, any other option is not, default is not among them, there are more than five or user is not a user entry; or, while a plugin loads, if name or user is declared twice or the value it is loaded with is not among the choices.