Skip to content

Commit

Permalink
Added deepcopy method to SensorDict (#130)
Browse files Browse the repository at this point in the history
* Added deepcopy method to SensorDict

* Added typing to __deepcopy__
  • Loading branch information
danielandresarcones authored Aug 21, 2023
1 parent e7e0110 commit ae72785
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/fenicsxconcrete/finite_element_problem/base_material.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
from __future__ import annotations

import importlib
import json
from abc import ABC, abstractmethod
from copy import deepcopy
from dataclasses import dataclass
from pathlib import Path, PosixPath

Expand Down Expand Up @@ -239,3 +242,6 @@ def __setitem__(self, initial_key: str, value: BaseSensor) -> None:
value.name = key

super().__setitem__(key, value)

def __deepcopy__(self, memo: dict) -> SensorDict:
return self.__class__({k: deepcopy(v, memo) for k, v in self.items()})

0 comments on commit ae72785

Please sign in to comment.