From f35521a943b14ae0d38e2b2bb005b7ace2fc25cd Mon Sep 17 00:00:00 2001 From: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> Date: Mon, 20 Oct 2025 18:00:00 +0200 Subject: [PATCH] rename 'DefaultValueDict' to 'DefaultKeysDict' --- client/ayon_core/lib/__init__.py | 2 ++ client/ayon_core/lib/path_templates.py | 14 +++++++------- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/client/ayon_core/lib/__init__.py b/client/ayon_core/lib/__init__.py index 5ccc8d03e5..2a25e949a5 100644 --- a/client/ayon_core/lib/__init__.py +++ b/client/ayon_core/lib/__init__.py @@ -73,6 +73,7 @@ from .log import ( ) from .path_templates import ( + DefaultKeysDict, TemplateUnsolved, StringTemplate, FormatObject, @@ -228,6 +229,7 @@ __all__ = [ "get_version_from_path", "get_last_version_from_path", + "DefaultKeysDict", "TemplateUnsolved", "StringTemplate", "FormatObject", diff --git a/client/ayon_core/lib/path_templates.py b/client/ayon_core/lib/path_templates.py index 131a2efaa4..c01de6f1a6 100644 --- a/client/ayon_core/lib/path_templates.py +++ b/client/ayon_core/lib/path_templates.py @@ -42,12 +42,12 @@ class TemplateUnsolved(Exception): ) -class DefaultValueDict(dict): +class DefaultKeysDict(dict): """Dictionary that supports the default key to use for str conversion. Is helpful for changes of a key in a template from string to dictionary for example '{folder}' -> '{folder[name]}'. - >>> data = DefaultValueDict( + >>> data = DefaultKeysDict( >>> "name", >>> {"folder": {"name": "FolderName"}} >>> ) @@ -80,17 +80,17 @@ class DefaultValueDict(dict): def __str__(self) -> str: return str(self.get_default_value()) - def __copy__(self) -> "DefaultValueDict": - return DefaultValueDict( + def __copy__(self) -> "DefaultKeysDict": + return DefaultKeysDict( self.get_default_keys(), dict(self.items()) ) - def __deepcopy__(self) -> "DefaultValueDict": + def __deepcopy__(self) -> "DefaultKeysDict": data_copy = { key: copy.deepcopy(value) for key, value in self.items() } - return DefaultValueDict(self.get_default_keys(), data_copy) + return DefaultKeysDict(self.get_default_keys(), data_copy) def get_default_keys(self) -> list[str]: return list(self._default_keys) @@ -696,7 +696,7 @@ class FormattingPart: result.add_output(self.template) return result - if isinstance(value, DefaultValueDict): + if isinstance(value, DefaultKeysDict): try: value = value.get_default_value() except KeyError: