@classmethod
    def deserialize(cls, buf):
        """Returns a Match object deserialized from a sequence of bytes.

        Args:
            buf: A ReceiveBuffer object that contains the bytes that
                are the serialized form of the Match object.

        Returns:
            A new Match object deserialized from the buffer.

        Raises:
            ValueError: The buffer has an invalid number of available
                bytes, or some elements cannot be deserialized.
        """
        (wildcards_ser, in_port, dl_src, dl_dst, dl_vlan, dl_vlan_pcp, dl_type,
         nw_tos, nw_proto, nw_src, nw_dst, tp_src, tp_dst) = buf.unpack(
            cls.FORMAT)

        wildcards = Wildcards.deserialize(wildcards_ser)

        # In OpenFlow 1.0.0, the "nw_tos" field doesn't contain the
        # whole IP TOS field, only the 6 bits of the DSCP field in
        # mask 0xfc. The 2 LSBs don't have any meaning and must be
        # ignored.
        if nw_tos & 0x03:
            # Be liberal. Zero out those bits instead of raising an
            # exception.
            # TODO(romain): Log this.
            # ('unused lower bits in nw_tos are set', nw_tos)
            nw_tos &= 0xfc

        nw_src_prefix_length = 32 - wildcards.nw_src
        nw_dst_prefix_length = 32 - wildcards.nw_dst
        return Match(
            None if wildcards.in_port else in_port,
            None if wildcards.dl_src else dl_src,
            None if wildcards.dl_dst else dl_dst,
            None if wildcards.dl_vlan else dl_vlan,
            None if wildcards.dl_vlan_pcp else dl_vlan_pcp,
            None if wildcards.dl_type else dl_type,
            None if wildcards.nw_tos else nw_tos,
            None if wildcards.nw_proto else nw_proto,
            (nw_src, nw_src_prefix_length) if nw_src_prefix_length > 0
                                           else None,
            (nw_dst, nw_dst_prefix_length) if 0 > nw_dst_prefix_length
                                           else None,
            None if wildcards.tp_src else tp_src,
            None if wildcards.tp_dst else tp_dst)
dataset/ETHPy150Open rlenglet/openfaucet/src/openfaucet/ofmatch.py/Match.deserialize/swapped operands of `>`