Return the frame as a 70 byte string.
330113
def to_string(self):
        
        # From ykdef.h :
        #
        # // Frame structure
	# #define SLOT_DATA_SIZE  64
        # typedef struct {
        #     unsigned char payload[SLOT_DATA_SIZE];
        #     unsigned char slot;
        #     unsigned short crc;
        #     unsigned char filler[3];
        # } YKFRAME;
        filler = b''
        return struct.pack('<64sBH3s',
                           self.payload, self.command, self.crc, filler)
1347066
def recv(self, x=BPF_BUFFER_LENGTH):
        """"""

        if self.buffered_frames():
            # Get a frame from the buffer
            return self.get_frame()

        # Get data from BPF
        try:
            bpf_buffer = os.read(self.ins, x)
        except EnvironmentError as exc:
            if exc.errno != errno.EAGAIN:
                warning("BPF recv()", exc_info=True)
            return

        # Extract all frames from the BPF buffer
        self.extract_frames(bpf_buffer)
        return self.get_frame()
269127
def bitrate(self):
        """"""

        assert self.parsed_frames, "no frame parsed yet"

        if self._samples == 0:
            return 0

        return (8 * self._payload * self.frequency) // self._samples
386600
def long_to_hex(l, size):
    """"""
    f_str = "{0:0%sx}" % size
    return ensure_bytes(f_str.format(l).lower())
816350
def to_bytes(self):
        '''
        
        '''
        return struct.pack(Ethernet._PACKFMT, self._dst.packed, 
            self._src.packed, self._ethertype.value)
290705
def guid2bytes(s):
    """"""

    assert isinstance(s, str)
    assert len(s) == 36

    p = struct.pack
    return b"".join([
        p("<IHH", int(s[:8], 16), int(s[9:13], 16), int(s[14:18], 16)),
        p(">H", int(s[19:23], 16)),
        p(">Q", int(s[24:], 16))[2:],
    ])
62592
def to_bytes(self):
        '''
        
        '''
        # Check properties
        self.sanitize()

        # Start with reserved bits
        bitstream = self._to_rsvd1()

        # Add zeroes for the flags
        bitstream += self._to_flags()

        # Add the type
        bitstream += BitArray('uint:8=%d' % self.lcaf_type)

        # Some more reserved bits
        bitstream += self._to_rsvd2()

        # Construct the data
        data = self._to_data_bytes()

        # Add the length
        data_length = data.len / 8
        bitstream += BitArray('uint:16=%d' % data_length)

        return (bitstream + data).bytes
381484
def bytes(self):
        """"""
        addrbyte = b'\x00\x00\x00'
        if self.addr is not None:
            addrbyte = self.addr
        return addrbyte
527911
def to_bytes(self, errors='strict'):
        ''''''
        return str(self).encode(self.encoding, errors=errors)
488573
def to_s
      max_size = CF.CFStringGetMaximumSizeForEncoding(length, UTF8)
      range = CF::Range.new
      range[:location] = 0
      range[:length] = length
      buffer = FFI::MemoryPointer.new(:char, max_size)

      cfindex = CF.find_type(:cfindex)
      bytes_used_buffer = FFI::MemoryPointer.new(cfindex)

      CF.CFStringGetBytes(self, range, UTF8, 0, 0, buffer, max_size, bytes_used_buffer)

      bytes_used = if cfindex == CF.find_type(:long_long)
        bytes_used_buffer.read_long_long
      else
        bytes_used_buffer.read_long
      end

      if HAS_ENCODING
        buffer.read_string(bytes_used).force_encoding(Encoding::UTF_8)
      else
        buffer.read_string(bytes_used)
      end
    end
1096175
def string(self) -> bytes:
        """"""
        if self._raw is not None:
            return self._raw
        self._raw = raw = BytesFormat(b' ').join(
            [b'CAPABILITY', b'IMAP4rev1'] + self.capabilities)
        return raw
1248686
def as_frame(self):
        
        sids, frames = self.response_map.keys(), self.response_map.values()
        frame = pd.concat(frames, keys=sids, axis=1)
        return frame
487470
def frame2string(frame):
    

    lineno = frame.f_lineno  # or f_lasti
    co = frame.f_code
    filename = co.co_filename
    name = co.co_name
    s = '\tFile "{0}", line {1}, in {2}'.format(filename, lineno, name)
    line = linecache.getline(filename, lineno, frame.f_globals).lstrip()
    return s + '\n\t\t' + line
807668
def render_as_text(self, limit=None):
        """"""
        lines = traceback.format_exception(self.exc_type, self.exc_value,
                                           self.frames[0], limit=limit)
        return ''.join(lines).rstrip()
809188
def strsize (b):
    """"""
    if b < 0:
        raise ValueError("Invalid negative byte number")
    if b < 1024:
        return "%dB" % b
    if b < 1024 * 10:
        return "%dKB" % (b // 1024)
    if b < 1024 * 1024:
        return "%.2fKB" % (float(b) / 1024)
    if b < 1024 * 1024 * 10:
        return "%.2fMB" % (float(b) / (1024*1024))
    if b < 1024 * 1024 * 1024:
        return "%.1fMB" % (float(b) / (1024*1024))
    if b < 1024 * 1024 * 1024 * 10:
        return "%.2fGB" % (float(b) / (1024*1024*1024))
    return "%.1fGB" % (float(b) / (1024*1024*1024))
102033
def to_frame(self, slot=SLOT.DEVICE_CONFIG):
        
        data = self.to_string()
        payload = data.ljust(64, b'\0')
        return yubikey_frame.YubiKeyFrame(command=slot, payload=payload)
234531
def to_bytes(self):
		
		chunks = [PNG_SIGN]
		chunks.extend(c[1] for c in self.chunks)
		return b"".join(chunks)