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

Method make_sequence

src/werkzeug/wrappers/response.py:341–356  ·  view source on GitHub ↗

Converts the response iterator in a list. By default this happens automatically if required. If `implicit_sequence_conversion` is disabled, this method is not automatically called and some properties might raise exceptions. This also encodes all the items. .. vers

(self)

Source from the content-addressed store, hash-verified

339 self.make_sequence()
340
341 def make_sequence(self) -> None:
342 """Converts the response iterator in a list. By default this happens
343 automatically if required. If `implicit_sequence_conversion` is
344 disabled, this method is not automatically called and some properties
345 might raise exceptions. This also encodes all the items.
346
347 .. versionadded:: 0.6
348 """
349 if not self.is_sequence:
350 # if we consume an iterable we have to ensure that the close
351 # method of the iterable is called if available when we tear
352 # down the response
353 close = getattr(self.response, "close", None)
354 self.response = list(self.iter_encoded())
355 if close is not None:
356 self.call_on_close(close)
357
358 def iter_encoded(self) -> t.Iterator[bytes]:
359 """Iter the response encoded with the encoding of the response.

Callers 3

_ensure_sequenceMethod · 0.95
openMethod · 0.80

Calls 3

iter_encodedMethod · 0.95
call_on_closeMethod · 0.95
listFunction · 0.50

Tested by 2

openMethod · 0.64