better performance in optiondescription creation
This commit is contained in:
parent
b10f02a8e9
commit
79c28038a5
|
@ -275,15 +275,10 @@ class Base(object):
|
||||||
self._val_call = (val, val_call)
|
self._val_call = (val, val_call)
|
||||||
|
|
||||||
def impl_is_optiondescription(self):
|
def impl_is_optiondescription(self):
|
||||||
#FIXME deplacer dans OpenDescription ?
|
return False
|
||||||
return self.__class__.__name__ in ['OptionDescription',
|
|
||||||
'DynOptionDescription',
|
|
||||||
'SynDynOptionDescription',
|
|
||||||
'MasterSlaves']
|
|
||||||
|
|
||||||
def impl_is_dynoptiondescription(self):
|
def impl_is_dynoptiondescription(self):
|
||||||
return self.__class__.__name__ in ['DynOptionDescription',
|
return False
|
||||||
'SynDynOptionDescription']
|
|
||||||
|
|
||||||
def impl_getname(self):
|
def impl_getname(self):
|
||||||
return self._name
|
return self._name
|
||||||
|
|
|
@ -393,11 +393,12 @@ class OptionDescription(OptionDescriptionWalk):
|
||||||
if child.impl_is_dynoptiondescription():
|
if child.impl_is_dynoptiondescription():
|
||||||
dynopt_names.append(name)
|
dynopt_names.append(name)
|
||||||
|
|
||||||
|
children_ = (tuple(child_names), tuple(children))
|
||||||
|
|
||||||
# better performance like this
|
# better performance like this
|
||||||
valid_child = copy(child_names)
|
child_names.sort()
|
||||||
valid_child.sort()
|
|
||||||
old = None
|
old = None
|
||||||
for child in valid_child:
|
for child in child_names:
|
||||||
if child == old:
|
if child == old:
|
||||||
raise ConflictError(_('duplicate option name: '
|
raise ConflictError(_('duplicate option name: '
|
||||||
'"{0}"').format(child))
|
'"{0}"').format(child))
|
||||||
|
@ -407,11 +408,21 @@ class OptionDescription(OptionDescriptionWalk):
|
||||||
raise ConflictError(_('the option\'s name "{}" start as '
|
raise ConflictError(_('the option\'s name "{}" start as '
|
||||||
'the dynoptiondescription\'s name "{}"').format(child, dynopt))
|
'the dynoptiondescription\'s name "{}"').format(child, dynopt))
|
||||||
old = child
|
old = child
|
||||||
self._children = (tuple(child_names), tuple(children))
|
self._children = children_
|
||||||
self._cache_consistencies = None
|
self._cache_consistencies = None
|
||||||
# the group_type is useful for filtering OptionDescriptions in a config
|
# the group_type is useful for filtering OptionDescriptions in a config
|
||||||
self._group_type = groups.default
|
self._group_type = groups.default
|
||||||
|
|
||||||
|
def impl_is_optiondescription(self):
|
||||||
|
return self.__class__.__name__ in ['OptionDescription',
|
||||||
|
'DynOptionDescription',
|
||||||
|
'SynDynOptionDescription',
|
||||||
|
'MasterSlaves']
|
||||||
|
|
||||||
|
def impl_is_dynoptiondescription(self):
|
||||||
|
return self.__class__.__name__ in ['DynOptionDescription',
|
||||||
|
'SynDynOptionDescription']
|
||||||
|
|
||||||
def impl_is_master_slaves(self, *args, **kwargs):
|
def impl_is_master_slaves(self, *args, **kwargs):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue