_transform_file() — anthropic-sdk-python Function Reference
Architecture documentation for the _transform_file() function in _files.py from the anthropic-sdk-python codebase.
Entity Profile
Dependency Diagram
graph TD b8087977_732a_4a4d_c940_30a2bc3ff47f["_transform_file()"] e20f2c32_b105_01cb_557f_c10174db767d["_files.py"] b8087977_732a_4a4d_c940_30a2bc3ff47f -->|defined in| e20f2c32_b105_01cb_557f_c10174db767d fe1e967b_1ba5_59ce_0b67_87ce63fe58e9["to_httpx_files()"] fe1e967b_1ba5_59ce_0b67_87ce63fe58e9 -->|calls| b8087977_732a_4a4d_c940_30a2bc3ff47f 9a63633c_8e74_26f9_c6a1_f20798823de1["is_file_content()"] b8087977_732a_4a4d_c940_30a2bc3ff47f -->|calls| 9a63633c_8e74_26f9_c6a1_f20798823de1 5b752d55_a978_6fad_1fd7_3d1a5ad6e905["read_file_content()"] b8087977_732a_4a4d_c940_30a2bc3ff47f -->|calls| 5b752d55_a978_6fad_1fd7_3d1a5ad6e905 style b8087977_732a_4a4d_c940_30a2bc3ff47f fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
src/anthropic/_files.py lines 63–74
def _transform_file(file: FileTypes) -> HttpxFileTypes:
if is_file_content(file):
if isinstance(file, os.PathLike):
path = pathlib.Path(file)
return (path.name, path.read_bytes())
return file
if is_tuple_t(file):
return (file[0], read_file_content(file[1]), *file[2:])
raise TypeError(f"Expected file types input to be a FileContent type or to be a tuple")
Domain
Subdomains
Defined In
Called By
Source
Frequently Asked Questions
What does _transform_file() do?
_transform_file() is a function in the anthropic-sdk-python codebase, defined in src/anthropic/_files.py.
Where is _transform_file() defined?
_transform_file() is defined in src/anthropic/_files.py at line 63.
What does _transform_file() call?
_transform_file() calls 2 function(s): is_file_content, read_file_content.
What calls _transform_file()?
_transform_file() is called by 1 function(s): to_httpx_files.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free