MCPcopy
hub / github.com/anthropics/anthropic-sdk-python / maybe_transform

Function maybe_transform

src/anthropic/_utils/_transform.py:78–88  ·  view source on GitHub ↗

Wrapper over `transform()` that allows `None` to be passed. See `transform()` for more details.

(
    data: object,
    expected_type: object,
)

Source from the content-addressed store, hash-verified

76
77
78def maybe_transform(
79 data: object,
80 expected_type: object,
81) -> Any | None:
82 """Wrapper over `transform()` that allows `None` to be passed.
83
84 See `transform()` for more details.
85 """
86 if data is None:
87 return None
88 return transform(data, expected_type)
89
90
91# Wrapper over _transform_recursive providing fake types

Callers 15

createMethod · 0.85
listMethod · 0.85
listMethod · 0.85
listMethod · 0.85
listMethod · 0.85
listMethod · 0.85
uploadMethod · 0.85
listMethod · 0.85
listMethod · 0.85
listMethod · 0.85
createMethod · 0.85
updateMethod · 0.85

Calls 1

transformFunction · 0.70

Tested by

no test coverage detected