Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(5)  |  Call(4)  |  Derive(0)  |  Import(1)

src/d/h/DHTBot-HEAD/dhtbot/coding/krpc_coder.py   DHTBot(Download)
    # Encode and attach the transaction id
    intermediate_msg['t'] = (
            basic_coder.ltob(message._transaction_id))
 
    # Determine the type of this KRPC
                basic_coder.encode_network_id(query.target_id))
    elif query.rpctype == 'announce_peer':
        query_dict['a']['token'] = basic_coder.ltob(query.token)
        # Try encoding the port, to see if it is within range
        basic_coder.encode_port(query.port)
        resp_dict['r']['values'] = "".join(encoded_peers)
    if response.token is not None:
        resp_dict['r']['token'] = basic_coder.ltob(response.token)
    return resp_dict
 

src/d/h/DHTBot-HEAD/dhtbot/test/coding/test_basic_coder.py   DHTBot(Download)
from twisted.trial import unittest
 
# Functions being tested
from dhtbot.coding.basic_coder import (ltob, btol, encode_address,
        decode_address, encode_port, decode_port, encode_network_id, 
        decode_network_id, InvalidDataError)
 
class LongNumberCodingTestCase(unittest.TestCase):
    def test_ltob_and_btol(self):
        bijection = lambda num: btol(ltob(num))