finesse.script.adapter.ItemAdapter
¶
Overview
- class finesse.script.adapter.ItemAdapter(full_name, short_name=None, other_names=None, getter=None, factory=None, setter=None, documenter=None, singular=False, build_last=False)[source]¶
Bases:
object
Adapter defining how a script instruction maps to/from a Python type.
This encapsulates the required information to take a script instruction and generate a corresponding Python object (e.g. a
Laser
from a laser l1 … instruction), to add it to aModel
(or in the case of commands, set some model attribute), to dump that Python object back to script, and to generate documentation.- Parameters:
- full_name
str
The instruction’s unabbreviated name. This must be alphanumeric and can contain underscores but no spaces.
- short_name
str
, optional The instruction’s short form name, used when generating compact script. If not specified, full_name is used in cases where the short form is desired.
- other_namessequence, optional
Any other supported names for this instruction.
- getter
ItemDumper
, optional Object handling the retrieval of parameters from the Python object corresponding to this instruction.
- factory
ItemFactory
, optional Object handling the creation of the Python object corresponding to this instruction.
- setter
ItemSetter
, optional Object handling the setting of parameters in the Python object corresponding to this instruction’s parameters.
- documenter
Documenter
Object handling the retrieval of docstrings and syntax suggestions for the instruction.
- singular
bool
, optional Flag indicating that this instruction can be defined only once per script. Defaults to False.
- build_last
bool
, optional Whether to build the Python object last, regardless of dependencies. This is useful for elements with implicit dependencies (see e.g. the cavity adapter). Be careful using this flag because statements for other adapters that depend on statements for adapters with this flag will be built first. Defaults to False.
- full_name
Properties
The instruction alias(es). |