From 11b2edd07de2c90e692106a529656987f5958af2 Mon Sep 17 00:00:00 2001 From: gwen Date: Mon, 13 Aug 2012 16:06:02 +0200 Subject: [PATCH] Option.force_default() -> opt value returns the default value --- doc/build/pydoc/api-objects.txt | 138 +++++++++++++++----------------- doc/code2html | 4 +- doc/glossary.txt | 10 ++- doc/rst2html.py | 2 +- doc/status.txt | 19 +++-- test/test_option_default.py | 14 ++++ tiramisu/config.py | 6 +- tiramisu/option.py | 16 +++- 8 files changed, 123 insertions(+), 86 deletions(-) diff --git a/doc/build/pydoc/api-objects.txt b/doc/build/pydoc/api-objects.txt index 206bbf5..e293627 100644 --- a/doc/build/pydoc/api-objects.txt +++ b/doc/build/pydoc/api-objects.txt @@ -7,9 +7,9 @@ tiramisu.autolib.__package__ tiramisu.autolib-module.html#__package__ tiramisu.autolib.calc_factory tiramisu.autolib-module.html#calc_factory tiramisu.autolib.special_owner_factory tiramisu.autolib-module.html#special_owner_factory tiramisu.basetype tiramisu.basetype-module.html -tiramisu.basetype.modes tiramisu.basetype-module.html#modes tiramisu.basetype.__package__ tiramisu.basetype-module.html#__package__ tiramisu.config tiramisu.config-module.html +tiramisu.config.mandatory_warnings tiramisu.config-module.html#mandatory_warnings tiramisu.config.special_owner_factory tiramisu.autolib-module.html#special_owner_factory tiramisu.config.__package__ tiramisu.config-module.html#__package__ tiramisu.config.default_owner tiramisu.config-module.html#default_owner @@ -27,20 +27,18 @@ tiramisu.tool tiramisu.tool-module.html tiramisu.tool.apply_requires tiramisu.option-module.html#apply_requires tiramisu.tool.__package__ tiramisu.tool-module.html#__package__ tiramisu.tool.reverse_from_paths tiramisu.tool-module.html#reverse_from_paths +tiramisu.basetype.BaseType tiramisu.basetype.BaseType-class.html +tiramisu.basetype.BaseType.has_properties tiramisu.basetype.BaseType-class.html#has_properties tiramisu.basetype.DisabledBaseType tiramisu.basetype.DisabledBaseType-class.html tiramisu.basetype.DisabledBaseType.enable tiramisu.basetype.DisabledBaseType-class.html#enable tiramisu.basetype.DisabledBaseType.disable tiramisu.basetype.DisabledBaseType-class.html#disable -tiramisu.basetype.DisabledBaseType.disabled tiramisu.basetype.DisabledBaseType-class.html#disabled tiramisu.basetype.DisabledBaseType._is_disabled tiramisu.basetype.DisabledBaseType-class.html#_is_disabled +tiramisu.basetype.BaseType.has_properties tiramisu.basetype.BaseType-class.html#has_properties tiramisu.basetype.HiddenBaseType tiramisu.basetype.HiddenBaseType-class.html tiramisu.basetype.HiddenBaseType.hide tiramisu.basetype.HiddenBaseType-class.html#hide tiramisu.basetype.HiddenBaseType.show tiramisu.basetype.HiddenBaseType-class.html#show tiramisu.basetype.HiddenBaseType._is_hidden tiramisu.basetype.HiddenBaseType-class.html#_is_hidden -tiramisu.basetype.HiddenBaseType.hidden tiramisu.basetype.HiddenBaseType-class.html#hidden -tiramisu.basetype.ModeBaseType tiramisu.basetype.ModeBaseType-class.html -tiramisu.basetype.ModeBaseType.set_mode tiramisu.basetype.ModeBaseType-class.html#set_mode -tiramisu.basetype.ModeBaseType.mode tiramisu.basetype.ModeBaseType-class.html#mode -tiramisu.basetype.ModeBaseType.get_mode tiramisu.basetype.ModeBaseType-class.html#get_mode +tiramisu.basetype.BaseType.has_properties tiramisu.basetype.BaseType-class.html#has_properties tiramisu.config.Config tiramisu.config.Config-class.html tiramisu.config.Config.get_previous_value tiramisu.config.Config-class.html#get_previous_value tiramisu.config.Config.set tiramisu.config.Config-class.html#set @@ -52,11 +50,11 @@ tiramisu.config.Config.cfgimpl_set_owner tiramisu.config.Config-class.html#cfgim tiramisu.config.Config.getkey tiramisu.config.Config-class.html#getkey tiramisu.config.Config._cfgimpl_mandatory tiramisu.config.Config-class.html#_cfgimpl_mandatory tiramisu.config.Config.unwrap_from_path tiramisu.config.Config-class.html#unwrap_from_path +tiramisu.config.Config._cfgimpl_properties tiramisu.config.Config-class.html#_cfgimpl_properties tiramisu.config.Config.__init__ tiramisu.config.Config-class.html#__init__ tiramisu.config.Config._validate_duplicates tiramisu.config.Config-class.html#_validate_duplicates tiramisu.config.Config._cfgimpl_owner tiramisu.config.Config-class.html#_cfgimpl_owner tiramisu.config.Config.__getattr__ tiramisu.config.Config-class.html#__getattr__ -tiramisu.config.Config._cfgimpl_hidden tiramisu.config.Config-class.html#_cfgimpl_hidden tiramisu.config.Config.iter_groups tiramisu.config.Config-class.html#iter_groups tiramisu.config.Config.get_warnings tiramisu.config.Config-class.html#get_warnings tiramisu.config.Config.cfgimpl_update tiramisu.config.Config-class.html#cfgimpl_update @@ -73,47 +71,46 @@ tiramisu.config.Config.is_frozen tiramisu.config.Config-class.html#is_frozen tiramisu.config.Config.__iter__ tiramisu.config.Config-class.html#__iter__ tiramisu.config.Config._cfgimpl_toplevel tiramisu.config.Config-class.html#_cfgimpl_toplevel tiramisu.config.Config._cfgimpl_get_home_by_path tiramisu.config.Config-class.html#_cfgimpl_get_home_by_path -tiramisu.config.Config._cfgimpl_mode tiramisu.config.Config-class.html#_cfgimpl_mode -tiramisu.config.Config.cfgimpl_read_write tiramisu.config.Config-class.html#cfgimpl_read_write tiramisu.config.Config.__eq__ tiramisu.config.Config-class.html#__eq__ tiramisu.config.Config.__dir__ tiramisu.config.Config-class.html#__dir__ tiramisu.config.Config.getpaths tiramisu.config.Config-class.html#getpaths -tiramisu.config.Config.cfgimpl_set_mode tiramisu.config.Config-class.html#cfgimpl_set_mode +tiramisu.config.Config._cfgimpl_get_path tiramisu.config.Config-class.html#_cfgimpl_get_path tiramisu.config.Config.cfgimpl_hide tiramisu.config.Config-class.html#cfgimpl_hide tiramisu.config.Config.cfgimpl_show tiramisu.config.Config-class.html#cfgimpl_show tiramisu.config.Config._cfgimpl_frozen tiramisu.config.Config-class.html#_cfgimpl_frozen -tiramisu.config.Config._cfgimpl_disabled tiramisu.config.Config-class.html#_cfgimpl_disabled +tiramisu.config.Config.cfgimpl_read_write tiramisu.config.Config-class.html#cfgimpl_read_write tiramisu.config.Config.__delattr__ tiramisu.config.Config-class.html#__delattr__ tiramisu.config.Config.add_warning tiramisu.config.Config-class.html#add_warning tiramisu.config.Config.cfgimpl_previous_value tiramisu.config.Config-class.html#cfgimpl_previous_value +tiramisu.config.Config._cfgimpl_has_properties tiramisu.config.Config-class.html#_cfgimpl_has_properties tiramisu.config.Config.cfgimpl_enable tiramisu.config.Config-class.html#cfgimpl_enable tiramisu.config.Config.cfgimpl_freeze tiramisu.config.Config-class.html#cfgimpl_freeze tiramisu.config.Config.cfgimpl_read_only tiramisu.config.Config-class.html#cfgimpl_read_only tiramisu.error.AmbigousOptionError tiramisu.error.AmbigousOptionError-class.html tiramisu.error.ConfigError tiramisu.error.ConfigError-class.html tiramisu.error.ConflictConfigError tiramisu.error.ConflictConfigError-class.html -tiramisu.error.DisabledOptionError tiramisu.error.DisabledOptionError-class.html -tiramisu.error.HiddenOptionError tiramisu.error.HiddenOptionError-class.html tiramisu.error.MandatoryError tiramisu.error.MandatoryError-class.html tiramisu.error.MethodCallError tiramisu.error.MethodCallError-class.html -tiramisu.error.ModeOptionError tiramisu.error.ModeOptionError-class.html tiramisu.error.NoMatchingOptionFound tiramisu.error.NoMatchingOptionFound-class.html tiramisu.error.NotFoundError tiramisu.error.NotFoundError-class.html +tiramisu.error.PropertiesOptionError tiramisu.error.PropertiesOptionError-class.html +tiramisu.error.RequirementRecursionError tiramisu.error.RequirementRecursionError-class.html tiramisu.error.RequiresError tiramisu.error.RequiresError-class.html tiramisu.error.SpecialOwnersError tiramisu.error.SpecialOwnersError-class.html tiramisu.option.ArbitraryOption tiramisu.option.ArbitraryOption-class.html tiramisu.basetype.HiddenBaseType.show tiramisu.basetype.HiddenBaseType-class.html#show tiramisu.option.ArbitraryOption._validate tiramisu.option.ArbitraryOption-class.html#_validate tiramisu.option.Option.getkey tiramisu.option.Option-class.html#getkey -tiramisu.basetype.DisabledBaseType.disabled tiramisu.basetype.DisabledBaseType-class.html#disabled tiramisu.option.Option.getowner tiramisu.option.Option-class.html#getowner tiramisu.option.Option.setowner tiramisu.option.Option-class.html#setowner tiramisu.basetype.DisabledBaseType._is_disabled tiramisu.basetype.DisabledBaseType-class.html#_is_disabled +tiramisu.basetype.BaseType.has_properties tiramisu.basetype.BaseType-class.html#has_properties tiramisu.option.ArbitraryOption.__init__ tiramisu.option.ArbitraryOption-class.html#__init__ tiramisu.option.Option.is_mandatory tiramisu.option.Option-class.html#is_mandatory -tiramisu.basetype.ModeBaseType.set_mode tiramisu.basetype.ModeBaseType-class.html#set_mode tiramisu.basetype.HiddenBaseType._is_hidden tiramisu.basetype.HiddenBaseType-class.html#_is_hidden -tiramisu.basetype.HiddenBaseType.hidden tiramisu.basetype.HiddenBaseType-class.html#hidden +tiramisu.option.Option.is_forced_on_freeze tiramisu.option.Option-class.html#is_forced_on_freeze +tiramisu.option.Option._force_default_on_freeze tiramisu.option.Option-class.html#_force_default_on_freeze +tiramisu.option.Option.force_default tiramisu.option.Option-class.html#force_default tiramisu.basetype.DisabledBaseType.enable tiramisu.basetype.DisabledBaseType-class.html#enable tiramisu.option.Option.setoption tiramisu.option.Option-class.html#setoption tiramisu.basetype.DisabledBaseType.disable tiramisu.basetype.DisabledBaseType-class.html#disable @@ -121,28 +118,28 @@ tiramisu.option.Option.getcallback tiramisu.option.Option-class.html#getcallback tiramisu.basetype.HiddenBaseType.hide tiramisu.basetype.HiddenBaseType-class.html#hide tiramisu.option.Option.validate tiramisu.option.Option-class.html#validate tiramisu.option.Option.freeze tiramisu.option.Option-class.html#freeze -tiramisu.basetype.ModeBaseType.get_mode tiramisu.basetype.ModeBaseType-class.html#get_mode -tiramisu.option.Option._frozen tiramisu.option.Option-class.html#_frozen +tiramisu.option.Option.has_callback tiramisu.option.Option-class.html#has_callback tiramisu.option.Option.getdoc tiramisu.option.Option-class.html#getdoc tiramisu.option.Option.is_multi tiramisu.option.Option-class.html#is_multi +tiramisu.option.Option._frozen tiramisu.option.Option-class.html#_frozen tiramisu.option.ArbitraryOption.getdefault tiramisu.option.ArbitraryOption-class.html#getdefault tiramisu.option.Option.unfreeze tiramisu.option.Option-class.html#unfreeze -tiramisu.basetype.ModeBaseType.mode tiramisu.basetype.ModeBaseType-class.html#mode tiramisu.option.Option.getcallback_params tiramisu.option.Option-class.html#getcallback_params tiramisu.option.BoolOption tiramisu.option.BoolOption-class.html tiramisu.basetype.HiddenBaseType.show tiramisu.basetype.HiddenBaseType-class.html#show tiramisu.option.BoolOption._validate tiramisu.option.BoolOption-class.html#_validate tiramisu.option.BoolOption.opt_type tiramisu.option.BoolOption-class.html#opt_type tiramisu.option.Option.getkey tiramisu.option.Option-class.html#getkey -tiramisu.basetype.DisabledBaseType.disabled tiramisu.basetype.DisabledBaseType-class.html#disabled tiramisu.option.Option.getowner tiramisu.option.Option-class.html#getowner tiramisu.option.Option.setowner tiramisu.option.Option-class.html#setowner tiramisu.basetype.DisabledBaseType._is_disabled tiramisu.basetype.DisabledBaseType-class.html#_is_disabled +tiramisu.basetype.BaseType.has_properties tiramisu.basetype.BaseType-class.html#has_properties tiramisu.option.Option.__init__ tiramisu.option.Option-class.html#__init__ tiramisu.option.Option.is_mandatory tiramisu.option.Option-class.html#is_mandatory -tiramisu.basetype.ModeBaseType.set_mode tiramisu.basetype.ModeBaseType-class.html#set_mode tiramisu.basetype.HiddenBaseType._is_hidden tiramisu.basetype.HiddenBaseType-class.html#_is_hidden -tiramisu.basetype.HiddenBaseType.hidden tiramisu.basetype.HiddenBaseType-class.html#hidden +tiramisu.option.Option.is_forced_on_freeze tiramisu.option.Option-class.html#is_forced_on_freeze +tiramisu.option.Option._force_default_on_freeze tiramisu.option.Option-class.html#_force_default_on_freeze +tiramisu.option.Option.force_default tiramisu.option.Option-class.html#force_default tiramisu.basetype.DisabledBaseType.enable tiramisu.basetype.DisabledBaseType-class.html#enable tiramisu.option.Option.setoption tiramisu.option.Option-class.html#setoption tiramisu.basetype.DisabledBaseType.disable tiramisu.basetype.DisabledBaseType-class.html#disable @@ -150,28 +147,28 @@ tiramisu.option.Option.getcallback tiramisu.option.Option-class.html#getcallback tiramisu.basetype.HiddenBaseType.hide tiramisu.basetype.HiddenBaseType-class.html#hide tiramisu.option.Option.validate tiramisu.option.Option-class.html#validate tiramisu.option.Option.freeze tiramisu.option.Option-class.html#freeze -tiramisu.basetype.ModeBaseType.get_mode tiramisu.basetype.ModeBaseType-class.html#get_mode -tiramisu.option.Option._frozen tiramisu.option.Option-class.html#_frozen +tiramisu.option.Option.has_callback tiramisu.option.Option-class.html#has_callback tiramisu.option.Option.getdoc tiramisu.option.Option-class.html#getdoc tiramisu.option.Option.is_multi tiramisu.option.Option-class.html#is_multi +tiramisu.option.Option._frozen tiramisu.option.Option-class.html#_frozen tiramisu.option.Option.getdefault tiramisu.option.Option-class.html#getdefault tiramisu.option.Option.unfreeze tiramisu.option.Option-class.html#unfreeze -tiramisu.basetype.ModeBaseType.mode tiramisu.basetype.ModeBaseType-class.html#mode tiramisu.option.Option.getcallback_params tiramisu.option.Option-class.html#getcallback_params tiramisu.option.ChoiceOption tiramisu.option.ChoiceOption-class.html tiramisu.basetype.HiddenBaseType.show tiramisu.basetype.HiddenBaseType-class.html#show tiramisu.option.ChoiceOption._validate tiramisu.option.ChoiceOption-class.html#_validate tiramisu.option.ChoiceOption.opt_type tiramisu.option.ChoiceOption-class.html#opt_type tiramisu.option.Option.getkey tiramisu.option.Option-class.html#getkey -tiramisu.basetype.DisabledBaseType.disabled tiramisu.basetype.DisabledBaseType-class.html#disabled tiramisu.option.Option.getowner tiramisu.option.Option-class.html#getowner tiramisu.option.Option.setowner tiramisu.option.Option-class.html#setowner tiramisu.basetype.DisabledBaseType._is_disabled tiramisu.basetype.DisabledBaseType-class.html#_is_disabled +tiramisu.basetype.BaseType.has_properties tiramisu.basetype.BaseType-class.html#has_properties tiramisu.option.ChoiceOption.__init__ tiramisu.option.ChoiceOption-class.html#__init__ tiramisu.option.Option.is_mandatory tiramisu.option.Option-class.html#is_mandatory -tiramisu.basetype.ModeBaseType.set_mode tiramisu.basetype.ModeBaseType-class.html#set_mode tiramisu.basetype.HiddenBaseType._is_hidden tiramisu.basetype.HiddenBaseType-class.html#_is_hidden -tiramisu.basetype.HiddenBaseType.hidden tiramisu.basetype.HiddenBaseType-class.html#hidden +tiramisu.option.Option.is_forced_on_freeze tiramisu.option.Option-class.html#is_forced_on_freeze +tiramisu.option.Option._force_default_on_freeze tiramisu.option.Option-class.html#_force_default_on_freeze +tiramisu.option.Option.force_default tiramisu.option.Option-class.html#force_default tiramisu.basetype.DisabledBaseType.enable tiramisu.basetype.DisabledBaseType-class.html#enable tiramisu.option.ChoiceOption.setoption tiramisu.option.ChoiceOption-class.html#setoption tiramisu.basetype.DisabledBaseType.disable tiramisu.basetype.DisabledBaseType-class.html#disable @@ -179,28 +176,28 @@ tiramisu.option.Option.getcallback tiramisu.option.Option-class.html#getcallback tiramisu.basetype.HiddenBaseType.hide tiramisu.basetype.HiddenBaseType-class.html#hide tiramisu.option.Option.validate tiramisu.option.Option-class.html#validate tiramisu.option.Option.freeze tiramisu.option.Option-class.html#freeze -tiramisu.basetype.ModeBaseType.get_mode tiramisu.basetype.ModeBaseType-class.html#get_mode -tiramisu.option.Option._frozen tiramisu.option.Option-class.html#_frozen +tiramisu.option.Option.has_callback tiramisu.option.Option-class.html#has_callback tiramisu.option.Option.getdoc tiramisu.option.Option-class.html#getdoc tiramisu.option.Option.is_multi tiramisu.option.Option-class.html#is_multi +tiramisu.option.Option._frozen tiramisu.option.Option-class.html#_frozen tiramisu.option.Option.getdefault tiramisu.option.Option-class.html#getdefault tiramisu.option.Option.unfreeze tiramisu.option.Option-class.html#unfreeze -tiramisu.basetype.ModeBaseType.mode tiramisu.basetype.ModeBaseType-class.html#mode tiramisu.option.Option.getcallback_params tiramisu.option.Option-class.html#getcallback_params tiramisu.option.FloatOption tiramisu.option.FloatOption-class.html tiramisu.basetype.HiddenBaseType.show tiramisu.basetype.HiddenBaseType-class.html#show tiramisu.option.FloatOption._validate tiramisu.option.FloatOption-class.html#_validate tiramisu.option.FloatOption.opt_type tiramisu.option.FloatOption-class.html#opt_type tiramisu.option.Option.getkey tiramisu.option.Option-class.html#getkey -tiramisu.basetype.DisabledBaseType.disabled tiramisu.basetype.DisabledBaseType-class.html#disabled tiramisu.option.Option.getowner tiramisu.option.Option-class.html#getowner tiramisu.option.Option.setowner tiramisu.option.Option-class.html#setowner tiramisu.basetype.DisabledBaseType._is_disabled tiramisu.basetype.DisabledBaseType-class.html#_is_disabled +tiramisu.basetype.BaseType.has_properties tiramisu.basetype.BaseType-class.html#has_properties tiramisu.option.Option.__init__ tiramisu.option.Option-class.html#__init__ tiramisu.option.Option.is_mandatory tiramisu.option.Option-class.html#is_mandatory -tiramisu.basetype.ModeBaseType.set_mode tiramisu.basetype.ModeBaseType-class.html#set_mode tiramisu.basetype.HiddenBaseType._is_hidden tiramisu.basetype.HiddenBaseType-class.html#_is_hidden -tiramisu.basetype.HiddenBaseType.hidden tiramisu.basetype.HiddenBaseType-class.html#hidden +tiramisu.option.Option.is_forced_on_freeze tiramisu.option.Option-class.html#is_forced_on_freeze +tiramisu.option.Option._force_default_on_freeze tiramisu.option.Option-class.html#_force_default_on_freeze +tiramisu.option.Option.force_default tiramisu.option.Option-class.html#force_default tiramisu.basetype.DisabledBaseType.enable tiramisu.basetype.DisabledBaseType-class.html#enable tiramisu.option.FloatOption.setoption tiramisu.option.FloatOption-class.html#setoption tiramisu.basetype.DisabledBaseType.disable tiramisu.basetype.DisabledBaseType-class.html#disable @@ -208,28 +205,28 @@ tiramisu.option.Option.getcallback tiramisu.option.Option-class.html#getcallback tiramisu.basetype.HiddenBaseType.hide tiramisu.basetype.HiddenBaseType-class.html#hide tiramisu.option.Option.validate tiramisu.option.Option-class.html#validate tiramisu.option.Option.freeze tiramisu.option.Option-class.html#freeze -tiramisu.basetype.ModeBaseType.get_mode tiramisu.basetype.ModeBaseType-class.html#get_mode -tiramisu.option.Option._frozen tiramisu.option.Option-class.html#_frozen +tiramisu.option.Option.has_callback tiramisu.option.Option-class.html#has_callback tiramisu.option.Option.getdoc tiramisu.option.Option-class.html#getdoc tiramisu.option.Option.is_multi tiramisu.option.Option-class.html#is_multi +tiramisu.option.Option._frozen tiramisu.option.Option-class.html#_frozen tiramisu.option.Option.getdefault tiramisu.option.Option-class.html#getdefault tiramisu.option.Option.unfreeze tiramisu.option.Option-class.html#unfreeze -tiramisu.basetype.ModeBaseType.mode tiramisu.basetype.ModeBaseType-class.html#mode tiramisu.option.Option.getcallback_params tiramisu.option.Option-class.html#getcallback_params tiramisu.option.IPOption tiramisu.option.IPOption-class.html tiramisu.basetype.HiddenBaseType.show tiramisu.basetype.HiddenBaseType-class.html#show tiramisu.option.IPOption._validate tiramisu.option.IPOption-class.html#_validate tiramisu.option.IPOption.opt_type tiramisu.option.IPOption-class.html#opt_type tiramisu.option.Option.getkey tiramisu.option.Option-class.html#getkey -tiramisu.basetype.DisabledBaseType.disabled tiramisu.basetype.DisabledBaseType-class.html#disabled tiramisu.option.Option.getowner tiramisu.option.Option-class.html#getowner tiramisu.option.Option.setowner tiramisu.option.Option-class.html#setowner tiramisu.basetype.DisabledBaseType._is_disabled tiramisu.basetype.DisabledBaseType-class.html#_is_disabled +tiramisu.basetype.BaseType.has_properties tiramisu.basetype.BaseType-class.html#has_properties tiramisu.option.Option.__init__ tiramisu.option.Option-class.html#__init__ tiramisu.option.Option.is_mandatory tiramisu.option.Option-class.html#is_mandatory -tiramisu.basetype.ModeBaseType.set_mode tiramisu.basetype.ModeBaseType-class.html#set_mode tiramisu.basetype.HiddenBaseType._is_hidden tiramisu.basetype.HiddenBaseType-class.html#_is_hidden -tiramisu.basetype.HiddenBaseType.hidden tiramisu.basetype.HiddenBaseType-class.html#hidden +tiramisu.option.Option.is_forced_on_freeze tiramisu.option.Option-class.html#is_forced_on_freeze +tiramisu.option.Option._force_default_on_freeze tiramisu.option.Option-class.html#_force_default_on_freeze +tiramisu.option.Option.force_default tiramisu.option.Option-class.html#force_default tiramisu.basetype.DisabledBaseType.enable tiramisu.basetype.DisabledBaseType-class.html#enable tiramisu.option.IPOption.setoption tiramisu.option.IPOption-class.html#setoption tiramisu.basetype.DisabledBaseType.disable tiramisu.basetype.DisabledBaseType-class.html#disable @@ -237,28 +234,28 @@ tiramisu.option.Option.getcallback tiramisu.option.Option-class.html#getcallback tiramisu.basetype.HiddenBaseType.hide tiramisu.basetype.HiddenBaseType-class.html#hide tiramisu.option.Option.validate tiramisu.option.Option-class.html#validate tiramisu.option.Option.freeze tiramisu.option.Option-class.html#freeze -tiramisu.basetype.ModeBaseType.get_mode tiramisu.basetype.ModeBaseType-class.html#get_mode -tiramisu.option.Option._frozen tiramisu.option.Option-class.html#_frozen +tiramisu.option.Option.has_callback tiramisu.option.Option-class.html#has_callback tiramisu.option.Option.getdoc tiramisu.option.Option-class.html#getdoc tiramisu.option.Option.is_multi tiramisu.option.Option-class.html#is_multi +tiramisu.option.Option._frozen tiramisu.option.Option-class.html#_frozen tiramisu.option.Option.getdefault tiramisu.option.Option-class.html#getdefault tiramisu.option.Option.unfreeze tiramisu.option.Option-class.html#unfreeze -tiramisu.basetype.ModeBaseType.mode tiramisu.basetype.ModeBaseType-class.html#mode tiramisu.option.Option.getcallback_params tiramisu.option.Option-class.html#getcallback_params tiramisu.option.IntOption tiramisu.option.IntOption-class.html tiramisu.basetype.HiddenBaseType.show tiramisu.basetype.HiddenBaseType-class.html#show tiramisu.option.IntOption._validate tiramisu.option.IntOption-class.html#_validate tiramisu.option.IntOption.opt_type tiramisu.option.IntOption-class.html#opt_type tiramisu.option.Option.getkey tiramisu.option.Option-class.html#getkey -tiramisu.basetype.DisabledBaseType.disabled tiramisu.basetype.DisabledBaseType-class.html#disabled tiramisu.option.Option.getowner tiramisu.option.Option-class.html#getowner tiramisu.option.Option.setowner tiramisu.option.Option-class.html#setowner tiramisu.basetype.DisabledBaseType._is_disabled tiramisu.basetype.DisabledBaseType-class.html#_is_disabled +tiramisu.basetype.BaseType.has_properties tiramisu.basetype.BaseType-class.html#has_properties tiramisu.option.Option.__init__ tiramisu.option.Option-class.html#__init__ tiramisu.option.Option.is_mandatory tiramisu.option.Option-class.html#is_mandatory -tiramisu.basetype.ModeBaseType.set_mode tiramisu.basetype.ModeBaseType-class.html#set_mode tiramisu.basetype.HiddenBaseType._is_hidden tiramisu.basetype.HiddenBaseType-class.html#_is_hidden -tiramisu.basetype.HiddenBaseType.hidden tiramisu.basetype.HiddenBaseType-class.html#hidden +tiramisu.option.Option.is_forced_on_freeze tiramisu.option.Option-class.html#is_forced_on_freeze +tiramisu.option.Option._force_default_on_freeze tiramisu.option.Option-class.html#_force_default_on_freeze +tiramisu.option.Option.force_default tiramisu.option.Option-class.html#force_default tiramisu.basetype.DisabledBaseType.enable tiramisu.basetype.DisabledBaseType-class.html#enable tiramisu.option.IntOption.setoption tiramisu.option.IntOption-class.html#setoption tiramisu.basetype.DisabledBaseType.disable tiramisu.basetype.DisabledBaseType-class.html#disable @@ -266,13 +263,12 @@ tiramisu.option.Option.getcallback tiramisu.option.Option-class.html#getcallback tiramisu.basetype.HiddenBaseType.hide tiramisu.basetype.HiddenBaseType-class.html#hide tiramisu.option.Option.validate tiramisu.option.Option-class.html#validate tiramisu.option.Option.freeze tiramisu.option.Option-class.html#freeze -tiramisu.basetype.ModeBaseType.get_mode tiramisu.basetype.ModeBaseType-class.html#get_mode -tiramisu.option.Option._frozen tiramisu.option.Option-class.html#_frozen +tiramisu.option.Option.has_callback tiramisu.option.Option-class.html#has_callback tiramisu.option.Option.getdoc tiramisu.option.Option-class.html#getdoc tiramisu.option.Option.is_multi tiramisu.option.Option-class.html#is_multi +tiramisu.option.Option._frozen tiramisu.option.Option-class.html#_frozen tiramisu.option.Option.getdefault tiramisu.option.Option-class.html#getdefault tiramisu.option.Option.unfreeze tiramisu.option.Option-class.html#unfreeze -tiramisu.basetype.ModeBaseType.mode tiramisu.basetype.ModeBaseType-class.html#mode tiramisu.option.Option.getcallback_params tiramisu.option.Option-class.html#getcallback_params tiramisu.option.Multi tiramisu.option.Multi-class.html tiramisu.option.Multi.pop tiramisu.option.Multi-class.html#pop @@ -285,15 +281,16 @@ tiramisu.basetype.HiddenBaseType.show tiramisu.basetype.HiddenBaseType-class.htm tiramisu.option.NetmaskOption._validate tiramisu.option.NetmaskOption-class.html#_validate tiramisu.option.NetmaskOption.opt_type tiramisu.option.NetmaskOption-class.html#opt_type tiramisu.option.Option.getkey tiramisu.option.Option-class.html#getkey -tiramisu.basetype.DisabledBaseType.disabled tiramisu.basetype.DisabledBaseType-class.html#disabled tiramisu.option.Option.getowner tiramisu.option.Option-class.html#getowner tiramisu.option.Option.setowner tiramisu.option.Option-class.html#setowner tiramisu.basetype.DisabledBaseType._is_disabled tiramisu.basetype.DisabledBaseType-class.html#_is_disabled +tiramisu.basetype.BaseType.has_properties tiramisu.basetype.BaseType-class.html#has_properties tiramisu.option.Option.__init__ tiramisu.option.Option-class.html#__init__ tiramisu.option.Option.is_mandatory tiramisu.option.Option-class.html#is_mandatory -tiramisu.basetype.ModeBaseType.set_mode tiramisu.basetype.ModeBaseType-class.html#set_mode tiramisu.basetype.HiddenBaseType._is_hidden tiramisu.basetype.HiddenBaseType-class.html#_is_hidden -tiramisu.basetype.HiddenBaseType.hidden tiramisu.basetype.HiddenBaseType-class.html#hidden +tiramisu.option.Option.is_forced_on_freeze tiramisu.option.Option-class.html#is_forced_on_freeze +tiramisu.option.Option._force_default_on_freeze tiramisu.option.Option-class.html#_force_default_on_freeze +tiramisu.option.Option.force_default tiramisu.option.Option-class.html#force_default tiramisu.basetype.DisabledBaseType.enable tiramisu.basetype.DisabledBaseType-class.html#enable tiramisu.option.NetmaskOption.setoption tiramisu.option.NetmaskOption-class.html#setoption tiramisu.basetype.DisabledBaseType.disable tiramisu.basetype.DisabledBaseType-class.html#disable @@ -301,26 +298,27 @@ tiramisu.option.Option.getcallback tiramisu.option.Option-class.html#getcallback tiramisu.basetype.HiddenBaseType.hide tiramisu.basetype.HiddenBaseType-class.html#hide tiramisu.option.Option.validate tiramisu.option.Option-class.html#validate tiramisu.option.Option.freeze tiramisu.option.Option-class.html#freeze -tiramisu.basetype.ModeBaseType.get_mode tiramisu.basetype.ModeBaseType-class.html#get_mode -tiramisu.option.Option._frozen tiramisu.option.Option-class.html#_frozen +tiramisu.option.Option.has_callback tiramisu.option.Option-class.html#has_callback tiramisu.option.Option.getdoc tiramisu.option.Option-class.html#getdoc tiramisu.option.Option.is_multi tiramisu.option.Option-class.html#is_multi +tiramisu.option.Option._frozen tiramisu.option.Option-class.html#_frozen tiramisu.option.Option.getdefault tiramisu.option.Option-class.html#getdefault tiramisu.option.Option.unfreeze tiramisu.option.Option-class.html#unfreeze -tiramisu.basetype.ModeBaseType.mode tiramisu.basetype.ModeBaseType-class.html#mode tiramisu.option.Option.getcallback_params tiramisu.option.Option-class.html#getcallback_params tiramisu.option.Option tiramisu.option.Option-class.html tiramisu.basetype.HiddenBaseType.show tiramisu.basetype.HiddenBaseType-class.html#show tiramisu.option.Option.getkey tiramisu.option.Option-class.html#getkey -tiramisu.basetype.DisabledBaseType.disabled tiramisu.basetype.DisabledBaseType-class.html#disabled tiramisu.option.Option.getowner tiramisu.option.Option-class.html#getowner tiramisu.option.Option.setowner tiramisu.option.Option-class.html#setowner tiramisu.basetype.DisabledBaseType._is_disabled tiramisu.basetype.DisabledBaseType-class.html#_is_disabled +tiramisu.basetype.BaseType.has_properties tiramisu.basetype.BaseType-class.html#has_properties tiramisu.option.Option.__init__ tiramisu.option.Option-class.html#__init__ tiramisu.option.Option.is_mandatory tiramisu.option.Option-class.html#is_mandatory -tiramisu.basetype.ModeBaseType.set_mode tiramisu.basetype.ModeBaseType-class.html#set_mode tiramisu.basetype.HiddenBaseType._is_hidden tiramisu.basetype.HiddenBaseType-class.html#_is_hidden -tiramisu.basetype.HiddenBaseType.hidden tiramisu.basetype.HiddenBaseType-class.html#hidden +tiramisu.option.Option.has_callback tiramisu.option.Option-class.html#has_callback +tiramisu.option.Option._force_default_on_freeze tiramisu.option.Option-class.html#_force_default_on_freeze +tiramisu.option.Option.force_default tiramisu.option.Option-class.html#force_default +tiramisu.option.Option.is_forced_on_freeze tiramisu.option.Option-class.html#is_forced_on_freeze tiramisu.basetype.DisabledBaseType.enable tiramisu.basetype.DisabledBaseType-class.html#enable tiramisu.option.Option.setoption tiramisu.option.Option-class.html#setoption tiramisu.basetype.DisabledBaseType.disable tiramisu.basetype.DisabledBaseType-class.html#disable @@ -328,50 +326,46 @@ tiramisu.option.Option.getcallback tiramisu.option.Option-class.html#getcallback tiramisu.basetype.HiddenBaseType.hide tiramisu.basetype.HiddenBaseType-class.html#hide tiramisu.option.Option.validate tiramisu.option.Option-class.html#validate tiramisu.option.Option.freeze tiramisu.option.Option-class.html#freeze -tiramisu.basetype.ModeBaseType.get_mode tiramisu.basetype.ModeBaseType-class.html#get_mode tiramisu.option.Option._frozen tiramisu.option.Option-class.html#_frozen tiramisu.option.Option.getdoc tiramisu.option.Option-class.html#getdoc tiramisu.option.Option.is_multi tiramisu.option.Option-class.html#is_multi tiramisu.option.Option.getdefault tiramisu.option.Option-class.html#getdefault tiramisu.option.Option.unfreeze tiramisu.option.Option-class.html#unfreeze -tiramisu.basetype.ModeBaseType.mode tiramisu.basetype.ModeBaseType-class.html#mode tiramisu.option.Option.getcallback_params tiramisu.option.Option-class.html#getcallback_params tiramisu.option.OptionDescription tiramisu.option.OptionDescription-class.html tiramisu.option.OptionDescription.show tiramisu.option.OptionDescription-class.html#show tiramisu.option.OptionDescription.add_child tiramisu.option.OptionDescription-class.html#add_child -tiramisu.basetype.DisabledBaseType.disabled tiramisu.basetype.DisabledBaseType-class.html#disabled tiramisu.basetype.DisabledBaseType._is_disabled tiramisu.basetype.DisabledBaseType-class.html#_is_disabled +tiramisu.basetype.BaseType.has_properties tiramisu.basetype.BaseType-class.html#has_properties tiramisu.option.OptionDescription.__init__ tiramisu.option.OptionDescription-class.html#__init__ tiramisu.option.OptionDescription.hide tiramisu.option.OptionDescription-class.html#hide -tiramisu.basetype.ModeBaseType.set_mode tiramisu.basetype.ModeBaseType-class.html#set_mode tiramisu.option.OptionDescription.get_group_type tiramisu.option.OptionDescription-class.html#get_group_type tiramisu.option.OptionDescription.update_child tiramisu.option.OptionDescription-class.html#update_child tiramisu.option.OptionDescription.set_group_type tiramisu.option.OptionDescription-class.html#set_group_type tiramisu.basetype.HiddenBaseType._is_hidden tiramisu.basetype.HiddenBaseType-class.html#_is_hidden -tiramisu.basetype.HiddenBaseType.hidden tiramisu.basetype.HiddenBaseType-class.html#hidden tiramisu.option.OptionDescription.group_type tiramisu.option.OptionDescription-class.html#group_type tiramisu.option.OptionDescription.getpaths tiramisu.option.OptionDescription-class.html#getpaths tiramisu.option.OptionDescription.enable tiramisu.option.OptionDescription-class.html#enable tiramisu.option.OptionDescription.disable tiramisu.option.OptionDescription-class.html#disable tiramisu.option.OptionDescription.getkey tiramisu.option.OptionDescription-class.html#getkey -tiramisu.basetype.ModeBaseType.get_mode tiramisu.basetype.ModeBaseType-class.html#get_mode tiramisu.option.OptionDescription._build tiramisu.option.OptionDescription-class.html#_build tiramisu.option.OptionDescription.getdoc tiramisu.option.OptionDescription-class.html#getdoc -tiramisu.basetype.ModeBaseType.mode tiramisu.basetype.ModeBaseType-class.html#mode tiramisu.option.StrOption tiramisu.option.StrOption-class.html tiramisu.basetype.HiddenBaseType.show tiramisu.basetype.HiddenBaseType-class.html#show tiramisu.option.StrOption._validate tiramisu.option.StrOption-class.html#_validate tiramisu.option.StrOption.opt_type tiramisu.option.StrOption-class.html#opt_type tiramisu.option.Option.getkey tiramisu.option.Option-class.html#getkey -tiramisu.basetype.DisabledBaseType.disabled tiramisu.basetype.DisabledBaseType-class.html#disabled tiramisu.option.Option.getowner tiramisu.option.Option-class.html#getowner tiramisu.option.Option.setowner tiramisu.option.Option-class.html#setowner tiramisu.basetype.DisabledBaseType._is_disabled tiramisu.basetype.DisabledBaseType-class.html#_is_disabled +tiramisu.basetype.BaseType.has_properties tiramisu.basetype.BaseType-class.html#has_properties tiramisu.option.Option.__init__ tiramisu.option.Option-class.html#__init__ tiramisu.option.Option.is_mandatory tiramisu.option.Option-class.html#is_mandatory -tiramisu.basetype.ModeBaseType.set_mode tiramisu.basetype.ModeBaseType-class.html#set_mode tiramisu.basetype.HiddenBaseType._is_hidden tiramisu.basetype.HiddenBaseType-class.html#_is_hidden -tiramisu.basetype.HiddenBaseType.hidden tiramisu.basetype.HiddenBaseType-class.html#hidden +tiramisu.option.Option._frozen tiramisu.option.Option-class.html#_frozen +tiramisu.option.Option._force_default_on_freeze tiramisu.option.Option-class.html#_force_default_on_freeze +tiramisu.option.Option.force_default tiramisu.option.Option-class.html#force_default +tiramisu.option.Option.is_forced_on_freeze tiramisu.option.Option-class.html#is_forced_on_freeze tiramisu.basetype.DisabledBaseType.enable tiramisu.basetype.DisabledBaseType-class.html#enable tiramisu.option.StrOption.setoption tiramisu.option.StrOption-class.html#setoption tiramisu.basetype.DisabledBaseType.disable tiramisu.basetype.DisabledBaseType-class.html#disable @@ -379,13 +373,11 @@ tiramisu.option.Option.getcallback tiramisu.option.Option-class.html#getcallback tiramisu.basetype.HiddenBaseType.hide tiramisu.basetype.HiddenBaseType-class.html#hide tiramisu.option.Option.validate tiramisu.option.Option-class.html#validate tiramisu.option.Option.freeze tiramisu.option.Option-class.html#freeze -tiramisu.basetype.ModeBaseType.get_mode tiramisu.basetype.ModeBaseType-class.html#get_mode -tiramisu.option.Option._frozen tiramisu.option.Option-class.html#_frozen +tiramisu.option.Option.has_callback tiramisu.option.Option-class.html#has_callback tiramisu.option.Option.getdoc tiramisu.option.Option-class.html#getdoc tiramisu.option.Option.is_multi tiramisu.option.Option-class.html#is_multi tiramisu.option.Option.getdefault tiramisu.option.Option-class.html#getdefault tiramisu.option.Option.unfreeze tiramisu.option.Option-class.html#unfreeze -tiramisu.basetype.ModeBaseType.mode tiramisu.basetype.ModeBaseType-class.html#mode tiramisu.option.Option.getcallback_params tiramisu.option.Option-class.html#getcallback_params tiramisu.option.SymLinkOption tiramisu.option.SymLinkOption-class.html tiramisu.option.SymLinkOption.setoption tiramisu.option.SymLinkOption-class.html#setoption diff --git a/doc/code2html b/doc/code2html index 14ddc02..9fd5f16 100755 --- a/doc/code2html +++ b/doc/code2html @@ -71,10 +71,10 @@ def process_modules(): if not '__init__' in modname: parse_module(modname) - pyfiles = glob(normpath(join(directory, '..', 'tiramisu', 'test', '*.py'))) + pyfiles = glob(normpath(join(directory, '..', 'test', '*.py'))) for pyf in pyfiles: pyf = splitext(basename(pyf))[0] - modname = 'tiramisu.test.' + pyf + modname = 'test.' + pyf if not '__init__' in modname: parse_module(modname) diff --git a/doc/glossary.txt b/doc/glossary.txt index 6adf36a..eaafa29 100644 --- a/doc/glossary.txt +++ b/doc/glossary.txt @@ -50,7 +50,15 @@ glossary **freeze** A whole configuration can be frozen (used in read only access). See - :doc:`status` for details. + :ref:`status#frozenconfig` for details. + + A single option can be frozen too. + +**forced on freeze** + + A single option is frozen and we want the option to return something + else than his value, for example his default value, see + :ref:`status#frozen` .. _`valueowner`: diff --git a/doc/rst2html.py b/doc/rst2html.py index 3e356f3..61df338 100755 --- a/doc/rst2html.py +++ b/doc/rst2html.py @@ -42,7 +42,7 @@ def api_reference_role(role, rawtext, text, lineno, inliner, if ".py" in text: basename = splitext(text)[0] if "test_" in text: - refuri = "api/" + "tiramisu.test." + basename + '.html' + refuri = "api/" + "test." + basename + '.html' else: refuri = "api/" + "tiramisu." + basename + '.html' roles.set_classes(options) diff --git a/doc/status.txt b/doc/status.txt index 7c5e7d7..390d540 100644 --- a/doc/status.txt +++ b/doc/status.txt @@ -39,19 +39,28 @@ These configuration statuses corresponds to specific global attributes : "read only status", `False`, `True`, `True` "read-write status", `True`, `False`, `False` +.. _`frozenconfig`: + Freezing a configuration --------------------------- +At the configuration level, :api:`config.Config.cfgimpl_freeze()` freezes +the whole configuration options. + +- :api:`test_option_type.test_frozen_value()` +- :api:`test_option_type.test_freeze()` + +.. _`frozen`: + It is possible to *freeze* a single `Option` object with :api:`option.Option.freeze()`. If you try to modify a frozen option, it raises a `TypeError: trying to change a frozen option object`. -At the configuration level, :api:`config.Config.cfgimpl_freeze()` freeze -the whole configuration options. - - :api:`test_option_type.test_freeze_one_option()` -- :api:`test_option_type.test_frozen_value()` -- :api:`test_option_type.test_freeze()` + +Moreover, frozen option can return his default value if +:api:`option.Option.force_default()` has been called on this option, +see :api:`test_option_default.test_force_default_on_freeze()` Restricted access to an `Option()` diff --git a/test/test_option_default.py b/test/test_option_default.py index 64504ef..d01b1e2 100644 --- a/test/test_option_default.py +++ b/test/test_option_default.py @@ -65,6 +65,20 @@ def test_mandatory(): config.dummy2 = False assert config.dummy2 == False +def test_force_default_on_freeze(): + "a frozen option wich is forced returns his default" + dummy1 = BoolOption('dummy1', 'doc dummy', default=False) + dummy2 = BoolOption('dummy2', 'doc dummy', default=True) + group = OptionDescription('group', '', [dummy1, dummy2]) + config = Config(group) + config.dummy1 = True + config.dummy2 = False + dummy1.freeze() + dummy1.force_default() + dummy2.freeze() + assert config.dummy1 == False + assert config.dummy2 == False + def test_override_are_defaults(): descr = make_description() config = Config(descr, bool=False) diff --git a/tiramisu/config.py b/tiramisu/config.py index 8b63fbb..c4f9024 100644 --- a/tiramisu/config.py +++ b/tiramisu/config.py @@ -245,8 +245,8 @@ class Config(object): else: _result = result return _result - # mandatory options if not isinstance(opt_or_descr, OptionDescription): + # mandatory options homeconfig = self._cfgimpl_get_toplevel() mandatory = homeconfig._cfgimpl_mandatory if opt_or_descr.is_mandatory() and mandatory: @@ -254,6 +254,10 @@ class Config(object): and opt_or_descr.getdefault() == None: raise MandatoryError("option: {0} is mandatory " "and shall have a value".format(name)) + # frozen and force default + if opt_or_descr.is_forced_on_freeze(): + return opt_or_descr.getdefault() + return self._cfgimpl_values[name] def __dir__(self): diff --git a/tiramisu/option.py b/tiramisu/option.py index 8a84b5f..4cd8700 100644 --- a/tiramisu/option.py +++ b/tiramisu/option.py @@ -83,6 +83,7 @@ class Multi(list): class Option(HiddenBaseType, DisabledBaseType): #reminder: an Option object is **not** a container for the value _frozen = False + _force_default_on_freeze = False def __init__(self, name, doc, default=None, default_multi=None, requires=None, mandatory=False, multi=False, callback=None, callback_params=None): @@ -141,6 +142,15 @@ class Option(HiddenBaseType, DisabledBaseType): def getdefault(self): return self.default + def force_default(self): + self._force_default_on_freeze = True + + def is_forced_on_freeze(self): + if self._frozen and self._force_default_on_freeze: + return True + else: + return False + def getdoc(self): return self.doc @@ -372,7 +382,8 @@ class ArbitraryOption(Option): return self.default class OptionDescription(HiddenBaseType, DisabledBaseType): - + group_type = 'default' + def __init__(self, name, doc, children, requires=None): self._name = name self.doc = doc @@ -380,8 +391,7 @@ class OptionDescription(HiddenBaseType, DisabledBaseType): self._requires = requires self._build() self.properties = [] # 'hidden', 'disabled'... - self.group_type = 'default' - + def getdoc(self): return self.doc