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

extract_files() — anthropic-sdk-python Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  4a5c63c8_b631_4371_7b42_e932e335f345["extract_files()"]
  875202ec_3744_577d_9ec4_ed9fbc6aaf41["_utils.py"]
  4a5c63c8_b631_4371_7b42_e932e335f345 -->|defined in| 875202ec_3744_577d_9ec4_ed9fbc6aaf41
  3cc9768b_7fb8_a4f4_5e9d_bdc7bcb1b1a4["_extract_items()"]
  4a5c63c8_b631_4371_7b42_e932e335f345 -->|calls| 3cc9768b_7fb8_a4f4_5e9d_bdc7bcb1b1a4
  style 4a5c63c8_b631_4371_7b42_e932e335f345 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/anthropic/_utils/_utils.py lines 37–53

def extract_files(
    # TODO: this needs to take Dict but variance issues.....
    # create protocol type ?
    query: Mapping[str, object],
    *,
    paths: Sequence[Sequence[str]],
) -> list[tuple[str, FileTypes]]:
    """Recursively extract files from the given dictionary based on specified paths.

    A path may look like this ['foo', 'files', '<array>', 'data'].

    Note: this mutates the given dictionary.
    """
    files: list[tuple[str, FileTypes]] = []
    for path in paths:
        files.extend(_extract_items(query, path, index=0, flattened_key=None))
    return files

Subdomains

Frequently Asked Questions

What does extract_files() do?
extract_files() is a function in the anthropic-sdk-python codebase, defined in src/anthropic/_utils/_utils.py.
Where is extract_files() defined?
extract_files() is defined in src/anthropic/_utils/_utils.py at line 37.
What does extract_files() call?
extract_files() calls 1 function(s): _extract_items.

Analyze Your Own Codebase

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

Try Supermodel Free