From a51d6fd6c3291cd192605c88b8558f18e7336490 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Zahradn=C3=ADk?= Date: Thu, 23 Nov 2023 02:39:25 +0100 Subject: [PATCH] Make template copyable --- neuralogic/core/template.py | 11 +++++++++++ pyproject.toml | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/neuralogic/core/template.py b/neuralogic/core/template.py index a19a3055..d37ff46c 100644 --- a/neuralogic/core/template.py +++ b/neuralogic/core/template.py @@ -183,3 +183,14 @@ def __setitem__(self, key, value): if isinstance(value, (Iterable, Module)): raise NotImplementedError self.template[key] = value + + def __copy__(self) -> "Template": + temp = Template() + + temp.template_file = self.template_file + temp.template = self.template + + return temp + + def clone(self) -> "Template": + return self.__copy__() diff --git a/pyproject.toml b/pyproject.toml index c4b58a05..ca63f61a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.black] line-length = 120 -target-version = ['py38'] +target-version = ['py39'] [tool.mypy] ignore_missing_imports = true