_transform.py — anthropic-sdk-python Source File
Architecture documentation for _transform.py, a python file in the anthropic-sdk-python codebase. 28 imports, 1 dependents.
Entity Profile
Dependency Diagram
graph LR 17ea9c01_2df6_304d_71e2_31af17ed7395["_transform.py"] 875202ec_3744_577d_9ec4_ed9fbc6aaf41["_utils.py"] 17ea9c01_2df6_304d_71e2_31af17ed7395 --> 875202ec_3744_577d_9ec4_ed9fbc6aaf41 106ba2ee_6caf_3f30_1f8a_f3ebc5755de0["is_list"] 17ea9c01_2df6_304d_71e2_31af17ed7395 --> 106ba2ee_6caf_3f30_1f8a_f3ebc5755de0 134c332e_654b_985e_839c_e13698f1b9e7["is_given"] 17ea9c01_2df6_304d_71e2_31af17ed7395 --> 134c332e_654b_985e_839c_e13698f1b9e7 8294e4b9_a2f1_2622_baf4_5103603d0b96["lru_cache"] 17ea9c01_2df6_304d_71e2_31af17ed7395 --> 8294e4b9_a2f1_2622_baf4_5103603d0b96 b41b21ba_47c5_2c24_a6d6_d106399b3c57["is_mapping"] 17ea9c01_2df6_304d_71e2_31af17ed7395 --> b41b21ba_47c5_2c24_a6d6_d106399b3c57 6136e8f7_248c_4449_ec8e_4711c4295b45["is_iterable"] 17ea9c01_2df6_304d_71e2_31af17ed7395 --> 6136e8f7_248c_4449_ec8e_4711c4295b45 a5a30c49_c3ef_f9ce_d619_c3e25bb6a42f["is_sequence"] 17ea9c01_2df6_304d_71e2_31af17ed7395 --> a5a30c49_c3ef_f9ce_d619_c3e25bb6a42f 8b7ab286_2165_44a3_b9a8_f20a2042bd76["_files"] 17ea9c01_2df6_304d_71e2_31af17ed7395 --> 8b7ab286_2165_44a3_b9a8_f20a2042bd76 c96ee5ad_7068_af50_518d_eabdd7af5c4e["_compat.py"] 17ea9c01_2df6_304d_71e2_31af17ed7395 --> c96ee5ad_7068_af50_518d_eabdd7af5c4e 17854057_420d_9158_b387_597d6c79873e["get_origin"] 17ea9c01_2df6_304d_71e2_31af17ed7395 --> 17854057_420d_9158_b387_597d6c79873e 0f0a7322_bca0_54aa_b4a9_622c0c790efb["is_typeddict"] 17ea9c01_2df6_304d_71e2_31af17ed7395 --> 0f0a7322_bca0_54aa_b4a9_622c0c790efb b104416a_b868_41fc_902c_7e2aaf93e2af["_typing.py"] 17ea9c01_2df6_304d_71e2_31af17ed7395 --> b104416a_b868_41fc_902c_7e2aaf93e2af 02d7607e_c938_0626_4987_d7b4228394e8["is_list_type"] 17ea9c01_2df6_304d_71e2_31af17ed7395 --> 02d7607e_c938_0626_4987_d7b4228394e8 447ec259_02e0_02ff_f348_bceda3f526e2["is_union_type"] 17ea9c01_2df6_304d_71e2_31af17ed7395 --> 447ec259_02e0_02ff_f348_bceda3f526e2 style 17ea9c01_2df6_304d_71e2_31af17ed7395 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
from __future__ import annotations
import io
import base64
import pathlib
from typing import Any, Mapping, TypeVar, cast
from datetime import date, datetime
from typing_extensions import Literal, get_args, override, get_type_hints as _get_type_hints
import anyio
import pydantic
from ._utils import (
is_list,
is_given,
lru_cache,
is_mapping,
is_iterable,
is_sequence,
)
from .._files import is_base64_file_input
from ._compat import get_origin, is_typeddict
from ._typing import (
is_list_type,
is_union_type,
extract_type_arg,
is_iterable_type,
is_required_type,
is_sequence_type,
is_annotated_type,
strip_annotated_type,
)
_T = TypeVar("_T")
# TODO: support for drilling globals() and locals()
# TODO: ensure works correctly with forward references in all cases
PropertyFormat = Literal["iso8601", "base64", "custom"]
class PropertyInfo:
"""Metadata class to be used in Annotated types to provide information about a given type.
For example:
class MyParams(TypedDict):
account_holder_name: Annotated[str, PropertyInfo(alias='accountHolderName')]
This means that {'account_holder_name': 'Robert'} will be transformed to {'accountHolderName': 'Robert'} before being sent to the API.
"""
alias: str | None
format: PropertyFormat | None
format_template: str | None
discriminator: str | None
def __init__(
// ... (398 more lines)
Domain
Subdomains
Functions
Classes
Dependencies
- _compat.py
- _files
- _typing.py
- _utils.py
- anyio
- base64
- datetime
- extract_type_arg
- get_origin
- io
- is_annotated_type
- is_given
- is_iterable
- is_iterable_type
- is_list
- is_list_type
- is_mapping
- is_required_type
- is_sequence
- is_sequence_type
- is_typeddict
- is_union_type
- lru_cache
- pathlib
- pydantic
- strip_annotated_type
- typing
- typing_extensions
Imported By
Source
Frequently Asked Questions
What does _transform.py do?
_transform.py is a source file in the anthropic-sdk-python codebase, written in python. It belongs to the AnthropicClient domain, SyncAPI subdomain.
What functions are defined in _transform.py?
_transform.py defines 14 function(s): _async_format_data, _async_transform_recursive, _async_transform_typeddict, _format_data, _get_annotated_type, _maybe_transform_key, _no_transform_needed, _transform_recursive, _transform_typeddict, async_maybe_transform, and 4 more.
What does _transform.py depend on?
_transform.py imports 28 module(s): _compat.py, _files, _typing.py, _utils.py, anyio, base64, datetime, extract_type_arg, and 20 more.
What files import _transform.py?
_transform.py is imported by 1 file(s): __init__.py.
Where is _transform.py in the architecture?
_transform.py is located at src/anthropic/_utils/_transform.py (domain: AnthropicClient, subdomain: SyncAPI, directory: src/anthropic/_utils).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free