MCPcopy
hub / github.com/openai/openai-python / _merge_mappings

Function _merge_mappings

src/openai/_base_client.py:2205–2214  ·  view source on GitHub ↗

Merge two mappings of the same type, removing any values that are instances of `Omit`. In cases with duplicate keys the second mapping takes precedence.

(
    obj1: Mapping[_T_co, Union[_T, Omit]],
    obj2: Mapping[_T_co, Union[_T, Omit]],
)

Source from the content-addressed store, hash-verified

2203
2204
2205def _merge_mappings(
2206 obj1: Mapping[_T_co, Union[_T, Omit]],
2207 obj2: Mapping[_T_co, Union[_T, Omit]],
2208) -> Dict[_T_co, _T]:
2209 """Merge two mappings of the same type, removing any values that are instances of `Omit`.
2210
2211 In cases with duplicate keys the second mapping takes precedence.
2212 """
2213 merged = {**obj1, **obj2}
2214 return {key: value for key, value in merged.items() if not isinstance(value, Omit)}

Callers 8

_build_headersMethod · 0.85
_build_requestMethod · 0.85
__aenter__Method · 0.85
__enter__Method · 0.85
_connect_wsMethod · 0.85
_connect_wsMethod · 0.85
_connect_wsMethod · 0.85
_connect_wsMethod · 0.85

Calls 1

itemsMethod · 0.45

Tested by

no test coverage detected