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

Method __init__

src/werkzeug/wsgi.py:247–264  ·  view source on GitHub ↗
(
        self,
        iterable: t.Iterable[bytes],
        callbacks: None
        | (t.Callable[[], None] | t.Iterable[t.Callable[[], None]]) = None,
    )

Source from the content-addressed store, hash-verified

245 """
246
247 def __init__(
248 self,
249 iterable: t.Iterable[bytes],
250 callbacks: None
251 | (t.Callable[[], None] | t.Iterable[t.Callable[[], None]]) = None,
252 ) -> None:
253 iterator = iter(iterable)
254 self._next = t.cast(t.Callable[[], bytes], partial(next, iterator))
255 if callbacks is None:
256 callbacks = []
257 elif callable(callbacks):
258 callbacks = [callbacks]
259 else:
260 callbacks = list(callbacks)
261 iterable_close = getattr(iterable, "close", None)
262 if iterable_close:
263 callbacks.insert(0, iterable_close)
264 self._callbacks = callbacks
265
266 def __iter__(self) -> ClosingIterator:
267 return self

Callers

nothing calls this directly

Calls 2

listFunction · 0.50
insertMethod · 0.45

Tested by

no test coverage detected