_compat.py — anthropic-sdk-python Source File
Architecture documentation for _compat.py, a python file in the anthropic-sdk-python codebase. 9 imports, 4 dependents.
Entity Profile
Dependency Diagram
graph LR c96ee5ad_7068_af50_518d_eabdd7af5c4e["_compat.py"] cde21691_6a41_9f44_bc0e_fb0aa875b99b["_types"] c96ee5ad_7068_af50_518d_eabdd7af5c4e --> cde21691_6a41_9f44_bc0e_fb0aa875b99b c8b41cc2_db36_3062_f709_8c907f559cd4["_datetime_parse.py"] c96ee5ad_7068_af50_518d_eabdd7af5c4e --> c8b41cc2_db36_3062_f709_8c907f559cd4 d22b7d0c_b83e_0078_9b77_bde2723d7864["parse_date"] c96ee5ad_7068_af50_518d_eabdd7af5c4e --> d22b7d0c_b83e_0078_9b77_bde2723d7864 f5a1b8d9_7ad8_89db_b3ec_43eb707e866a["parse_datetime"] c96ee5ad_7068_af50_518d_eabdd7af5c4e --> f5a1b8d9_7ad8_89db_b3ec_43eb707e866a 42faf450_4542_3635_bb7f_62cffcc3e979["sys"] c96ee5ad_7068_af50_518d_eabdd7af5c4e --> 42faf450_4542_3635_bb7f_62cffcc3e979 37c05070_ca59_d596_7250_de9d1939227f["typing_extensions"] c96ee5ad_7068_af50_518d_eabdd7af5c4e --> 37c05070_ca59_d596_7250_de9d1939227f 89ddcdd7_3ae1_4c7b_41bb_9f1e25f16875["typing"] c96ee5ad_7068_af50_518d_eabdd7af5c4e --> 89ddcdd7_3ae1_4c7b_41bb_9f1e25f16875 7e1d14c5_475e_409c_7c4e_1274f9d40aa9["datetime"] c96ee5ad_7068_af50_518d_eabdd7af5c4e --> 7e1d14c5_475e_409c_7c4e_1274f9d40aa9 681ec9d7_e890_23ce_c800_893673580581["types"] c96ee5ad_7068_af50_518d_eabdd7af5c4e --> 681ec9d7_e890_23ce_c800_893673580581 6dadb144_3070_6111_357f_214554108905["__init__.py"] 6dadb144_3070_6111_357f_214554108905 --> c96ee5ad_7068_af50_518d_eabdd7af5c4e add5a69b_d84f_deef_9958_765008080340["_json.py"] add5a69b_d84f_deef_9958_765008080340 --> c96ee5ad_7068_af50_518d_eabdd7af5c4e 17ea9c01_2df6_304d_71e2_31af17ed7395["_transform.py"] 17ea9c01_2df6_304d_71e2_31af17ed7395 --> c96ee5ad_7068_af50_518d_eabdd7af5c4e b104416a_b868_41fc_902c_7e2aaf93e2af["_typing.py"] b104416a_b868_41fc_902c_7e2aaf93e2af --> c96ee5ad_7068_af50_518d_eabdd7af5c4e style c96ee5ad_7068_af50_518d_eabdd7af5c4e fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
from __future__ import annotations
import sys
import typing_extensions
from typing import Any, Type, Union, Literal, Optional
from datetime import date, datetime
from typing_extensions import get_args as _get_args, get_origin as _get_origin
from .._types import StrBytesIntFloat
from ._datetime_parse import parse_date as _parse_date, parse_datetime as _parse_datetime
_LITERAL_TYPES = {Literal, typing_extensions.Literal}
def get_args(tp: type[Any]) -> tuple[Any, ...]:
return _get_args(tp)
def get_origin(tp: type[Any]) -> type[Any] | None:
return _get_origin(tp)
def is_union(tp: Optional[Type[Any]]) -> bool:
if sys.version_info < (3, 10):
return tp is Union # type: ignore[comparison-overlap]
else:
import types
return tp is Union or tp is types.UnionType
def is_typeddict(tp: Type[Any]) -> bool:
return typing_extensions.is_typeddict(tp)
def is_literal_type(tp: Type[Any]) -> bool:
return get_origin(tp) in _LITERAL_TYPES
def parse_date(value: Union[date, StrBytesIntFloat]) -> date:
return _parse_date(value)
def parse_datetime(value: Union[datetime, StrBytesIntFloat]) -> datetime:
return _parse_datetime(value)
Domain
Subdomains
Functions
Dependencies
- _datetime_parse.py
- _types
- datetime
- parse_date
- parse_datetime
- sys
- types
- typing
- typing_extensions
Imported By
Source
Frequently Asked Questions
What does _compat.py do?
_compat.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 _compat.py?
_compat.py defines 7 function(s): get_args, get_origin, is_literal_type, is_typeddict, is_union, parse_date, parse_datetime.
What does _compat.py depend on?
_compat.py imports 9 module(s): _datetime_parse.py, _types, datetime, parse_date, parse_datetime, sys, types, typing, and 1 more.
What files import _compat.py?
_compat.py is imported by 4 file(s): __init__.py, _json.py, _transform.py, _typing.py.
Where is _compat.py in the architecture?
_compat.py is located at src/anthropic/_utils/_compat.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