MCPcopy
hub / github.com/pallets/werkzeug / extend

Method extend

src/werkzeug/datastructures/headers.py:225–255  ·  view source on GitHub ↗

Extend headers in this object with items from another object containing header items as well as keyword arguments. To replace existing keys instead of extending, use :meth:`update` instead. If provided, the first argument can be another :class:`Headers` obje

(
        self,
        arg: (
            Headers
            | MultiDict[str, t.Any]
            | cabc.Mapping[str, t.Any | list[t.Any] | tuple[t.Any, ...] | set[t.Any]]
            | cabc.Iterable[tuple[str, t.Any]]
            | None
        ) = None,
        /,
        **kwargs: str,
    )

Source from the content-addressed store, hash-verified

223 yield value
224
225 def extend(
226 self,
227 arg: (
228 Headers
229 | MultiDict[str, t.Any]
230 | cabc.Mapping[str, t.Any | list[t.Any] | tuple[t.Any, ...] | set[t.Any]]
231 | cabc.Iterable[tuple[str, t.Any]]
232 | None
233 ) = None,
234 /,
235 **kwargs: str,
236 ) -> None:
237 """Extend headers in this object with items from another object
238 containing header items as well as keyword arguments.
239
240 To replace existing keys instead of extending, use
241 :meth:`update` instead.
242
243 If provided, the first argument can be another :class:`Headers`
244 object, a :class:`MultiDict`, :class:`dict`, or iterable of
245 pairs.
246
247 .. versionchanged:: 1.0
248 Support :class:`MultiDict`. Allow passing ``kwargs``.
249 """
250 if arg is not None:
251 for key, value in iter_multi_items(arg):
252 self.add(key, value)
253
254 for key, value in iter_multi_items(kwargs):
255 self.add(key, value)
256
257 def __delitem__(self, key: str | int | slice) -> None:
258 if isinstance(key, str):

Callers 15

__init__Method · 0.95
readallMethod · 0.45
get_headersMethod · 0.45
_get_args_for_reloadingFunction · 0.45
__call__Method · 0.45
runappMethod · 0.45
applicationMethod · 0.45
receive_dataMethod · 0.45
string_reprMethod · 0.45
getlistMethod · 0.45
listsMethod · 0.45
compileMethod · 0.45

Calls 2

addMethod · 0.95
iter_multi_itemsFunction · 0.85

Tested by 2

test_extendMethod · 0.36
test_updateMethod · 0.36