def FromEncoded(cls, encoded):
        """Create a DataStreamSelector from an encoded 16-bit value.

        The binary value must be equivalent to what is produced by
        a call to self.encode() and will turn that value back into
        a a DataStreamSelector.

        Note that the following operation is a no-op:

        DataStreamSelector.FromEncode(value).encode()

        Args:
            encoded (int): The encoded binary representation of a
                DataStreamSelector.

        Returns:
            DataStreamSelector: The decoded selector.
        """

        match_spec = encoded & ((1 << 11) | (1 << 15))
        match_type = (encoded & (0b111 << 12)) >> 12
        match_id = encoded & ((1 << 11) - 1)

        if match_spec not in cls.SpecifierEncodingMap:
            raise ArgumentError("Unknown encoded match specifier", match_spec=match_spec, known_specifiers=cls.SpecifierEncodingMap.keys())

        spec_name = cls.SpecifierEncodingMap[match_spec]

        # Handle wildcard matches
        if match_id == cls.MatchAllCode:
            match_id = None

        return DataStreamSelector(match_type, match_id, spec_name)
def FromEncoded ( cls , encoded ) : match_spec = encoded & ( ( 1 << 11 ) | ( 1 << 15 ) ) match_type = ( encoded & ( 0b111 << 12 ) ) >> 12 match_id = encoded & ( ( 1 << 11 ) - 1 ) if match_spec not in cls . SpecifierEncodingMap : raise ArgumentError ( "Unknown encoded match specifier" , match_spec = match_spec , known_specifiers = cls . SpecifierEncodingMap . keys ( ) ) spec_name = cls . SpecifierEncodingMap [ match_spec ] if match_id == cls . MatchAllCode : match_id = None return DataStreamSelector ( match_type , match_id , spec_name )
Create a DataStreamSelector from an encoded 16-bit value.

        The binary value must be equivalent to what is produced by
        a call to self.encode() and will turn that value back into
        a a DataStreamSelector.

        Note that the following operation is a no-op:

        DataStreamSelector.FromEncode(value).encode()

        Args:
            encoded (int): The encoded binary representation of a
                DataStreamSelector.

        Returns:
            DataStreamSelector: The decoded selector.