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

Method construct

src/anthropic/_models.py:981–994  ·  view source on GitHub ↗
(  # type: ignore
        cls,
        _fields_set: set[str] | None = None,
        **values: Unpack[FinalRequestOptionsInput],
    )

Source from the content-addressed store, hash-verified

979 # type ignore required because we're adding explicit types to `**values`
980 @classmethod
981 def construct( # type: ignore
982 cls,
983 _fields_set: set[str] | None = None,
984 **values: Unpack[FinalRequestOptionsInput],
985 ) -> FinalRequestOptions:
986 kwargs: dict[str, Any] = {
987 # we unconditionally call `strip_not_given` on any value
988 # as it will just ignore any non-mapping types
989 key: strip_not_given(value)
990 for key, value in values.items()
991 }
992 if PYDANTIC_V1:
993 return cast(FinalRequestOptions, super().construct(_fields_set, **kwargs)) # pyright: ignore[reportDeprecated]
994 return super().model_construct(_fields_set, **kwargs)
995
996 if not TYPE_CHECKING:
997 # type checkers incorrectly complain about this assignment

Callers

nothing calls this directly

Calls 2

strip_not_givenFunction · 0.85
constructMethod · 0.45

Tested by

no test coverage detected