diff --git a/unstructured/documents/elements.py b/unstructured/documents/elements.py index dbf4c4d3ef..76b2a79df1 100644 --- a/unstructured/documents/elements.py +++ b/unstructured/documents/elements.py @@ -15,12 +15,11 @@ from typing_extensions import ParamSpec, TypeAlias, TypedDict -from unstructured.documents.coordinates import ( - TYPE_TO_COORDINATE_SYSTEM_MAP, - CoordinateSystem, - RelativeCoordinateSystem, -) -from unstructured.partition.utils.constants import UNSTRUCTURED_INCLUDE_DEBUG_METADATA +from unstructured.documents.coordinates import (TYPE_TO_COORDINATE_SYSTEM_MAP, + CoordinateSystem, + RelativeCoordinateSystem) +from unstructured.partition.utils.constants import \ + UNSTRUCTURED_INCLUDE_DEBUG_METADATA from unstructured.utils import get_call_args_applying_defaults, lazyproperty Point: TypeAlias = "tuple[float, float]" @@ -391,7 +390,7 @@ def to_dict(self) -> dict[str, Any]: """ from unstructured.staging.base import elements_to_base64_gzipped_json - meta_dict = copy.deepcopy(dict(self.fields)) + meta_dict = dict(self.fields) # -- remove fields that should not be serialized -- for field_name in self.DEBUG_FIELD_NAMES: @@ -1036,6 +1035,8 @@ def _kvform_rehydrate_internal_elements(kv_pairs: list[dict[str, Any]]) -> list[ """ from unstructured.staging.base import elements_from_dicts + Points: TypeAlias = "tuple[Point, ...]" + # safe to overwrite - deepcopy already happened for kv_pair in kv_pairs: if kv_pair["key"]["custom_element"] is not None: