Did I find the right examples for you? yes no

All Samples(25)  |  Call(19)  |  Derive(0)  |  Import(6)
The binascii.hexlify function returns a bytestring in
Python3, but sometimes we want to use its output to
show a log message. This function returns an unicode
str, which is suitable for it.

        def hexlify(data):
    """The binascii.hexlify function returns a bytestring in
       Python3, but sometimes we want to use its output to
       show a log message. This function returns an unicode
       str, which is suitable for it."""
    return binascii.hexlify(data).decode('ascii')

src/m/i/mikroe-uhb-0.2/mikroeuhb/devkit.py   mikroe-uhb(Download)
import struct, logging
from util import hexlify, maketrans, bord
from device import Device, Command, HID_buf_size
logger = logging.getLogger(__name__)
        first_block = self.blocks[0]
        stackp, resetaddr = struct.unpack('<LL', first_block[:8])
        logger.debug('first block before fix: ' + hexlify(first_block[:8]))
        if resetaddr & 1 != 1:
            logger.warn('reset address 0x%x does not have a Thumb mark -- enforcing it' % resetaddr)
            resetaddr |= 1
        # Change the reset address to point to the bootloader code.
        if not disable_bootloader:
            first_block[4:8] = struct.pack('<L', self.BootStart|1)
        logger.debug('first block after fix: ' + hexlify(first_block[:8]))
        assert(len(program) == 20)  # length expected by bootloader
        logger.debug('reset program: ' + hexlify(program))
        self._write_phy(self.BootStart - len(program), program)
    def fix_bootloader(self, disable_bootloader=False):
        first_block = self.blocks[0]
        jump_to_main_prog = first_block[:4]
        logger.debug('first block before fix: ' + hexlify(jump_to_main_prog))
        if not disable_bootloader:

src/m/i/mikroe-uhb-0.2/mikroeuhb/device.py   mikroe-uhb(Download)
import re, struct, logging
from util import hexlify
from bootinfo import BootInfo
logger = logging.getLogger(__name__)
            struct.unpack(self._fmt, buf[:8])
        if self.stx != STX:
            logger.error('missing stx: ' + hexlify(buf))
        return self
    def send_data(self, data):
        """Send data (mainly for writing the flash)"""
        logger.debug('send data: ' + hexlify(data))
        self.f.write(b'\x00' + data.ljust(HID_buf_size, b'\xff'))
    def recv(self):
    def recv_data(self):
        """Receive data (mainly for getting the BootInfo struct)"""
        data = self.f.read(HID_buf_size)
        logger.debug('recv data: ' + hexlify(data))
        return data

src/k/t/ktorrent-HEAD/ktorrent/frontend.py   ktorrent(Download)
from proxytorrent import ProxyTorrent
from tracker import Tracker
from util import hexlify
class BaseHandler(tornado.web.RequestHandler):
            torrents = []
            for h,t in client.torrents.iteritems():
                hash = hexlify(h)
                r = [None for _ in range(len(TorrentDef.coldefs))]
                r[TorrentDef.coldefnames['hash']] = hash
            attrs.update( dict( 
                    clients = [ (c, dict( (hexlify(h), t) for h,t in c.torrents.iteritems() )) for c in Client.instances ],
                    trackers = Tracker.instances,
                    ws_prot = WebSocketProtocolHandler.instances,
                    connections = Connection.instances,
                    torrents = dict( (binascii.hexlify(h), {'torrent':t, 'conns':t.connections,'attrs':t._attributes}) for h,t in Torrent.instances.iteritems() ),
                    peers = [dict( (str(k),v) for k,v in Peer.instances_compact.items() ), dict( (hexlify(k),v) for k,v in Peer.instances_peerid.items() )]

src/k/t/ktorrent-HEAD/ktorrent/handlers.py   ktorrent(Download)
from peer import Peer
import math
from util import parse_bitmask, hexlify, decode_peer
class BTMessageHandler(object):
    def _request_summary(self):
        if self.request.connection.torrent and self.request.connection.torrent.hash:
            hashstr = '(' + hexlify(self.request.connection.torrent.hash)[:6] + '..)'
            hashstr = '--'

src/k/t/ktorrent-HEAD/ktorrent/torrent.py   ktorrent(Download)
from piece import Piece
from util import hexlify
class Torrent(object):
    def __repr__(self):
        return '<Torrent %s (meta:%s, %s)>' % (hexlify(self.hash), True if self.meta else False, self.get_summary())
    def throttled(self):
        if self.max_dl_rate() > 0:
                 'recheck': "[nf]()",
        if self.meta:
                return self.meta['info']['name']
                return hexlify(self.hash)
        elif key == 'size':
            return self.get_size() if self.meta else None

src/k/t/ktorrent-HEAD/ktorrent/session.py   ktorrent(Download)
from util import hexlify    
class Session(object):
            for hash, torrent in self.client.torrents.iteritems():
                outhash = hexlify(hash)
                if outhash not in self.state['btapp']['torrent']['all']:
            self.state['btapp']['torrent'] = {'all':{}}
            for hash,torrent in self.client.torrents.iteritems():
                outhash = hexlify(hash)
                self.state['btapp']['torrent']['all'][outhash] = torrent.dump_state()
        return self.state