tiramisu/doc/option.txt

115 lines
2.4 KiB
Text

.. default-role:: literal
The `tiramisu.option.Option` options
======================================
Description of Options
----------------------
All the constructors take a ``name`` and a ``doc`` argument as first
arguments to give the option or option group a name and to document it.
Most constructors take a ``default`` argument that specifies the default
value of the option. If this argument is not supplied the default value
is assumed to be ``None``.
.. _optdescr:
The `OptionDescription` class
-------------------------------
.. module:: tiramisu.option
.. autoclass: OptionDescription
.. automethod:: __init__
.. rubric:: Methods
.. autosummary::
~Config.__init__
~Config.set_group_type
.. automethod:: set_group_type
`Options description` objects lives in the :class:`tiramisu.config.Config` attribute.
If you need to access an option object, you can do it with the OptionDescription
object. Not only the value of the option by attribute access, but the option
object itself that lives behind the scene. It can always be accessed internally
with the `_cfgimpl_descr` attribute of the `config` objects. For example, with a
option named `name` in a `gc` group the `name` object can be accessed like
this::
conf._cfgimpl_descr.name
of sub configs with ::
conf.gc._cfgimpl_descr.name
This is a binding. The option objects are in the `_children` config's attribute.
Why accessing an option object ? It is possible for example freeze the
configuration option
::
conf.gc._cfgimpl_descr.dummy.freeze()
or to hide it, or disable it, or... anything.
The `Option` base class
-------------------------
It's the abstract base class for almost all options (except the symblink).
.. _optioninit:
.. autoclass:: Option
:special-members:
:members:
All option types
------------------
.. autoclass:: BoolOption
:private-members:
.. autoclass:: IntOption
:private-members:
.. autoclass:: FloatOption
:private-members:
.. autoclass:: StrOption
:private-members:
.. autoclass:: SymLinkOption
.. automethod:: __init__
``SymLinkOption`` redirects to another configuration option in the
configuration, that is :
- retrieves the value of the target,
- can set the value of the target too
.. autoclass:: IPOption
.. autoclass:: NetmaskOption
.. autoclass:: NetworkOption
.. autoclass:: DomainnameOption
.. autoclass:: ChoiceOption
.. automethod:: __init__