From f22d6b6253370e261910a7aee4d28a4b511aad3b Mon Sep 17 00:00:00 2001 From: AAriam <80158628+AAriam@users.noreply.github.com> Date: Mon, 18 Nov 2024 19:23:23 +0100 Subject: [PATCH] Release version 0.0.0.dev42 --- pyproject.toml | 6 +++--- requirements.txt | 4 ++-- src/pyserials/property_dict.py | 17 +++++++++++++++-- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 08b080a..87a3ae8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -17,7 +17,7 @@ namespaces = true # ----------------------------------------- Project Metadata ------------------------------------- # [project] -version = "0.0.0.dev41" +version = "0.0.0.dev42" name = "PySerials" dependencies = [ "jsonschema >= 4.21.0, < 5", @@ -26,8 +26,8 @@ dependencies = [ "ruamel.yaml >= 0.17.32, < 0.18", # https://yaml.readthedocs.io/en/stable/ "ruamel.yaml.string >= 0.1.1, < 1", "tomlkit >= 0.11.8, < 0.12", # https://tomlkit.readthedocs.io/en/stable/, - "MDit == 0.0.0.dev38", - "ExceptionMan == 0.0.0.dev38", + "MDit == 0.0.0.dev39", + "ExceptionMan == 0.0.0.dev39", "ProtocolMan == 0.0.0.dev2", ] requires-python = ">=3.10" diff --git a/requirements.txt b/requirements.txt index 52fb317..b4c5fad 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,6 +4,6 @@ jsonpath-ng >= 1.6.1, < 2 ruamel.yaml >= 0.17.32, < 0.18 ruamel.yaml.string >= 0.1.1, < 1 tomlkit >= 0.11.8, < 0.12 -MDit == 0.0.0.dev38 -ExceptionMan == 0.0.0.dev38 +MDit == 0.0.0.dev39 +ExceptionMan == 0.0.0.dev39 ProtocolMan == 0.0.0.dev2 \ No newline at end of file diff --git a/src/pyserials/property_dict.py b/src/pyserials/property_dict.py index d6fa22d..ea343b7 100644 --- a/src/pyserials/property_dict.py +++ b/src/pyserials/property_dict.py @@ -55,6 +55,19 @@ def __ne__(self, other): return self._data != other._data def __deepcopy__(self, memo): - # Use `deepcopy` on the internal dictionary to copy its contents + # Dynamically handle subclass instantiation with additional arguments + cls = type(self) + # Deepcopy the data dictionary copied_data = _copy.deepcopy(self._data, memo) - return PropertyDict(copied_data) + # Capture extra attributes (everything except `_data`) + extra_attrs = { + key: _copy.deepcopy(value, memo) + for key, value in self.__dict__.items() + if key != "_data" + } + # Create a new instance + obj = cls.__new__(cls) # Avoid calling __init__ directly + obj._data = copied_data # Set _data directly + # Restore extra attributes + obj.__dict__.update(extra_attrs) + return obj