parameters: (cls, width, data)
return_statement: return self
docstring: Creates a BinData instance from given raw data.  Raw data must
          be a bytes-like object containing packed elements, with each
          element represented as ceil(width/8) octets in little-endian
          format.
docstring_summary: Creates a BinData instance from given raw data.  Raw data must
          be a bytes-like object containing packed elements, with each
          element represented as ceil(width/8) octets in little-endian
          format.
docstring_tokens: Creates a BinData instance from given raw data . Raw data must be a bytes - like object containing packed elements with each element represented as ceil ( width / 8 ) octets in little - endian format .
function: def from_raw_data(cls, width, data):
          """
          Creates a BinData instance from given raw data.  Raw data must
          be a bytes-like object containing packed elements, with each
          element represented as ceil(width/8) octets in little-endian
          format.
          """
          self = cls(width)
          self._raw_data = bytearray(data)
          if len(self._raw_data) % self.octets_per_element() != 0:
              raise ValueError('raw data length not a multiple of element size')
          ope = self.octets_per_element()
          if self._width % 8 != 0:
              to_check = self._raw_data[ope-1::ope]
              correct = range(1 << (self._width % 8))
              if not all(x in correct for x in to_check):
                  raise ValueError('raw data with non-zero unused bits')
          return self
function_tokens: def from_raw_data ( cls , width , data ) : self = cls ( width ) self . _raw_data = bytearray ( data ) if len ( self . _raw_data ) % self . octets_per_element ( ) != 0 : raise ValueError ( 'raw data length not a multiple of element size' ) ope = self . octets_per_element ( ) if self . _width % 8 != 0 : to_check = self . _raw_data [ ope - 1 : : ope ] correct = range ( 1 << ( self . _width % 8 ) ) if not all ( x in correct for x in to_check ) : raise ValueError ( 'raw data with non-zero unused bits' ) return self