def __init__(self, code, reason, headers, sock, connection=None):
        #: The reason phrase returned by the server.
        self.reason = reason

        #: The status code returned by the server.
        self.status = code

        #: The response headers. These are determined upon creation, assigned
        #: once, and never assigned again.
        self.headers = headers

        #: The response trailers. These are always intially ``None``.
        self.trailers = None

        # The socket this response is being sent over.
        self._sock = sock

        # Whether we expect the connection to be closed. If we do, we don't
        # bother checking for content-length, we just keep reading until
        # we no longer can.
        self._expect_close = False
        if self.headers.get(b'connection', []) in b'close':
            self._expect_close = True

        # The expected length of the body.
        try:
            self._length = int(self.headers[b'content-length'][0])
        except KeyError:
            self._length = None

        # Whether we expect a chunked response.
        self._chunked = (
            b'chunked' in self.headers.get(b'transfer-encoding', [])
        )

        # One of the following must be true: we must expect that the connection
        # will be closed following the body, or that a content-length was sent,
        # or that we're getting a chunked response.
        # FIXME: Remove naked assert, replace with something better.
        assert self._expect_close or self._length is not None or self._chunked

        # This object is used for decompressing gzipped request bodies. Right
        # now we only support gzip because that's all the RFC mandates of us.
        # Later we'll add support for more encodings.
        # This 16 + MAX_WBITS nonsense is to force gzip. See this
        # Stack Overflow answer for more:
        # http://stackoverflow.com/a/2695466/1401686
        if b'gzip' in self.headers.get(b'content-encoding', []):
            self._decompressobj = zlib.decompressobj(16 + zlib.MAX_WBITS)
        elif b'deflate' in self.headers.get(b'content-encoding', []):
            self._decompressobj = DeflateDecoder()
        else:
            self._decompressobj = None

        # This is a reference that allows for the Response class to tell the
        # parent connection object to throw away its socket object. This is to
        # be used when the connection is genuinely closed, so that the user
        # can keep using the Connection object.
        # Strictly, we take a weakreference to this so that we don't set up a
        # reference cycle.
        if connection is not None:
            self._parent = weakref.ref(connection)
        else:
            self._parent = None

        self._buffered_data = b''
        self._chunker = None
dataset/ETHPy150Open Lukasa/hyper/hyper/http11/response.py/HTTP11Response.__init__/swapped operands of `in`