From 10aaf2219f4592a258e014fa4e6197ff3ad95bc8 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Wed, 12 Sep 2018 17:26:12 +0200 Subject: [PATCH] copy/deepcopy could be persistent --- tiramisu/api.py | 4 ++++ tiramisu/config.py | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/tiramisu/api.py b/tiramisu/api.py index 7caba99..44d4731 100644 --- a/tiramisu/api.py +++ b/tiramisu/api.py @@ -979,14 +979,18 @@ class TiramisuContextConfig(TiramisuContext): def _c_copy(self, session_id=None, + persistent=False, storage=None): return Config(self.config_bag.context.duplicate(session_id, + persistent=persistent, storage=storage)) def _c_deepcopy(self, session_id=None, + persistent=False, storage=None): return Config(self.config_bag.context.duplicate(session_id, + persistent=persistent, storage=storage, deep=True)) diff --git a/tiramisu/config.py b/tiramisu/config.py index 2ca919f..9b83096 100644 --- a/tiramisu/config.py +++ b/tiramisu/config.py @@ -681,6 +681,7 @@ class _CommonConfig(SubConfig): force_values=None, force_settings=None, storage=None, + persistent=False, deep=False): if isinstance(self, KernelConfig): config = KernelConfig(self._impl_descr, @@ -688,6 +689,7 @@ class _CommonConfig(SubConfig): session_id=session_id, force_values=force_values, force_settings=force_settings, + persistent=persistent, storage=storage) elif isinstance(self, KernelMetaConfig): config = KernelMetaConfig([], @@ -696,6 +698,7 @@ class _CommonConfig(SubConfig): session_id=session_id, force_values=force_values, force_settings=force_settings, + persistent=persistent, storage=storage) else: raise Exception('hu?') @@ -706,7 +709,7 @@ class _CommonConfig(SubConfig): )._pp_.exportation()) if self._impl_meta: if deep: - meta = self._impl_meta().duplicate(deep=deep, storage=storage) + meta = self._impl_meta().duplicate(deep=deep, storage=storage, persistent=persistent) meta._impl_children.append(config) config._impl_meta = weakref.ref(meta) config = meta