removes unused SerializationValueError exception

This commit is contained in:
Mose Müller 2024-07-29 11:33:37 +02:00
parent de4270daa4
commit 6d786cd0f8
2 changed files with 2 additions and 11 deletions

View File

@ -3,7 +3,6 @@ from typing import TYPE_CHECKING, Any, cast
from pydase.utils.serialization.serializer import ( from pydase.utils.serialization.serializer import (
SerializationPathError, SerializationPathError,
SerializationValueError,
SerializedObject, SerializedObject,
get_nested_dict_by_path, get_nested_dict_by_path,
set_nested_value_by_path, set_nested_value_by_path,
@ -43,7 +42,7 @@ class DataServiceCache:
cast(dict[str, SerializedObject], self._cache["value"]), cast(dict[str, SerializedObject], self._cache["value"]),
full_access_path, full_access_path,
) )
except (SerializationPathError, SerializationValueError, KeyError): except (SerializationPathError, KeyError):
return { return {
"full_access_path": full_access_path, "full_access_path": full_access_path,
"value": None, "value": None,

View File

@ -51,10 +51,6 @@ class SerializationPathError(Exception):
pass pass
class SerializationValueError(Exception):
pass
class Serializer: class Serializer:
@classmethod @classmethod
def serialize_object(cls, obj: Any, access_path: str = "") -> SerializedObject: # noqa: C901 def serialize_object(cls, obj: Any, access_path: str = "") -> SerializedObject: # noqa: C901
@ -358,7 +354,7 @@ def set_nested_value_by_path(
next_level_serialized_object = get_container_item_by_key( next_level_serialized_object = get_container_item_by_key(
current_dict, path_parts[-1], allow_append=True current_dict, path_parts[-1], allow_append=True
) )
except (SerializationPathError, SerializationValueError, KeyError) as e: except (SerializationPathError, KeyError) as e:
logger.error("Error occured trying to change %a: %s", path, e) logger.error("Error occured trying to change %a: %s", path, e)
return return
@ -468,10 +464,6 @@ def get_container_item_by_key(
If the path composed of `attr_name` and any specified index is invalid, or If the path composed of `attr_name` and any specified index is invalid, or
leads to an IndexError or KeyError. This error is also raised if an attempt leads to an IndexError or KeyError. This error is also raised if an attempt
to access a nonexistent key or index occurs without permission to append. to access a nonexistent key or index occurs without permission to append.
SerializationValueError:
If the retrieval results in an object that is expected to be a dictionary
but is not, indicating a mismatch between expected and actual serialized
data structure.
""" """
processed_key = parse_serialized_key(key) processed_key = parse_serialized_key(key)