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

All Samples(7)  |  Call(6)  |  Derive(0)  |  Import(1)

src/d/h/DHTBot-HEAD/dhtbot/coding/krpc_coder.py   DHTBot(Download)
    """
    q = Query()
    q._from = basic_coder.decode_network_id(rpc_dict['a']['id'])
    q.rpctype = rpctype = rpc_dict['q']
 
    if rpctype == 'ping':
        pass
    elif rpctype == 'find_node':
        q.target_id = basic_coder.decode_network_id(rpc_dict['a']['target'])
        q.target_id = basic_coder.decode_network_id(rpc_dict['a']['target'])
    elif rpctype == 'get_peers':
        q.target_id = basic_coder.decode_network_id(rpc_dict['a']['info_hash'])
    elif rpctype == 'announce_peer':
        q.target_id = basic_coder.decode_network_id(rpc_dict['a']['info_hash'])
    r = Response()
    # All responses have querier IDs
    r._from = basic_coder.decode_network_id(rpc_dict['r']['id'])
    # find_node always returns a list of nodes
    # get_peers sometimes returns a list of nodes

src/d/h/DHTBot-HEAD/dhtbot/contact.py   DHTBot(Download)
 
    """
    node_id = basic_coder.decode_network_id(node_string[:20])
    address = basic_coder.decode_address(node_string[20:])
    return Node(node_id, address)

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,