Home / Function/ deepcopy_minimal() — anthropic-sdk-python Function Reference

deepcopy_minimal() — anthropic-sdk-python Function Reference

Architecture documentation for the deepcopy_minimal() function in _utils.py from the anthropic-sdk-python codebase.

Entity Profile

Dependency Diagram

graph TD
  92b81a9e_00a9_05ec_9ca3_abf08359d711["deepcopy_minimal()"]
  c93149f4_1fef_7df2_3583_785d1eb6e828["_utils.py"]
  92b81a9e_00a9_05ec_9ca3_abf08359d711 -->|defined in| c93149f4_1fef_7df2_3583_785d1eb6e828
  891fc59a_5adc_6948_557f_aac354f77180["is_mapping()"]
  92b81a9e_00a9_05ec_9ca3_abf08359d711 -->|calls| 891fc59a_5adc_6948_557f_aac354f77180
  3879919a_6fb4_efd2_250a_51deef105320["is_list()"]
  92b81a9e_00a9_05ec_9ca3_abf08359d711 -->|calls| 3879919a_6fb4_efd2_250a_51deef105320
  style 92b81a9e_00a9_05ec_9ca3_abf08359d711 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/anthropic/_utils/_utils.py lines 179–191

def deepcopy_minimal(item: _T) -> _T:
    """Minimal reimplementation of copy.deepcopy() that will only copy certain object types:

    - mappings, e.g. `dict`
    - list

    This is done for performance reasons.
    """
    if is_mapping(item):
        return cast(_T, {k: deepcopy_minimal(v) for k, v in item.items()})
    if is_list(item):
        return cast(_T, [deepcopy_minimal(entry) for entry in item])
    return item

Subdomains

Frequently Asked Questions

What does deepcopy_minimal() do?
deepcopy_minimal() is a function in the anthropic-sdk-python codebase, defined in src/anthropic/_utils/_utils.py.
Where is deepcopy_minimal() defined?
deepcopy_minimal() is defined in src/anthropic/_utils/_utils.py at line 179.
What does deepcopy_minimal() call?
deepcopy_minimal() calls 2 function(s): is_list, is_mapping.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free