some optimisations
[tiramisu.git] / tiramisu / storage / dictionary / option.py
index 16949ac..7cfff5b 100644 (file)
@@ -242,16 +242,17 @@ class StorageBase(object):
     def _set_readonly(self):
         if not self.impl_is_readonly():
             dico = self._informations
+            _setattr = object.__setattr__
             if not (dico is None or isinstance(dico, str) or isinstance(dico, unicode)):
                 keys = tuple(dico.keys())
                 if keys == ('doc',):
                     dico = dico['doc']
                 else:
                     dico = tuple([tuple(dico.keys()), tuple(dico.values())])
-                self._informations = dico
+                _setattr(self, '_informations', dico)
             try:
                 extra = self._extra
-                self._extra = tuple([tuple(extra.keys()), tuple(extra.values())])
+                _setattr(self, '_extra', tuple([tuple(extra.keys()), tuple(extra.values())]))
             except AttributeError:
                 pass
 
@@ -370,7 +371,8 @@ class StorageOptionDescription(StorageBase):
         self._cache_paths = None
 
     def _add_children(self, child_names, children):
-        self._children = (tuple(child_names), tuple(children))
+        _setattr = object.__setattr__
+        _setattr(self, '_children', (tuple(child_names), tuple(children)))
 
     def impl_already_build_caches(self):
         return self._is_build_cache
@@ -394,10 +396,11 @@ class StorageOptionDescription(StorageBase):
 
     def impl_build_cache_option(self, _currpath=None, cache_path=None,
                                 cache_option=None):
+        _setattr = object.__setattr__
         try:
             self._cache_paths
         except AttributeError:
-            self._cache_paths = None
+            _setattr(self, '_cache_paths', None)
         if _currpath is None and self._cache_paths is not None:  # pragma: optional cover
             # cache already set
             return
@@ -420,8 +423,8 @@ class StorageOptionDescription(StorageBase):
                                                cache_option)
                 _currpath.pop()
         if save:
-            self._cache_paths = (tuple(cache_option), tuple(cache_path))
-            self._is_build_cache = True
+            _setattr(self, '_cache_paths', (tuple(cache_option), tuple(cache_path)))
+            _setattr(self, '_is_build_cache', True)
 
     def impl_get_options_paths(self, bytype, byname, _subpath, only_first, context):
         find_results = []