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

All Samples(16)  |  Call(11)  |  Derive(0)  |  Import(5)

src/d/h/DHTBot-HEAD/dhtbot/protocols/krpc_responder.py   DHTBot(Download)
from dhtbot.datastore import MemoryDataStore
from dhtbot.protocols.krpc_sender import KRPC_Sender, IKRPC_Sender
from dhtbot.kademlia.routing_table import TreeRoutingTable
 
class IKRPC_Responder(IKRPC_Sender):

src/d/h/DHTBot-HEAD/dhtbot/test/kademlia/test_routing_table.py   DHTBot(Download)
from dhtbot.kademlia import routing_table
from dhtbot.kademlia.kbucket import KBucket
from dhtbot.kademlia.routing_table import _TreeNode, TreeRoutingTable, \
                                         SubsecondRoutingTable
from dhtbot.test import testing_data
    def test_offer_node_oneNode(self):
        rt = TreeRoutingTable(node_id=2**16)
        node_accepted = rt.offer_node(generate_node(15))
        self.assertTrue(node_accepted)
 
    def test_offer_node_remove_node_get_node_sixteenNodes(self):
        # Note: It is important to choose
        # a proper clustering of the node IDs for the
        # routing table to accept the nodes
        rt = TreeRoutingTable(node_id=1)
    def test_offer_node_properNumKBuckets(self):
        rt = TreeRoutingTable(node_id=1)
        # range(2, 9) generates 7 numbers
        for node_id in range(2, 9):
            rt.offer_node(generate_node(node_id))
    def test_get_closest_nodes_noRecursion(self):
        rt = TreeRoutingTable(node_id=1)
        target = 2**160 - 5
        for node_id in [2, 4, 8, 2**158, 2**159]:
            rt.offer_node(generate_node(node_id))

src/d/h/DHTBot-HEAD/dhtbot/test/protocols/test_krpc_sender.py   DHTBot(Download)
from twisted.trial import unittest
from twisted.python.monkey import MonkeyPatcher
 
from dhtbot.krpc_types import Query, Response, Error
from dhtbot.kademlia.routing_table import TreeRoutingTable

src/d/h/DHTBot-HEAD/dhtbot/test/protocols/test_krpc_iterator.py   DHTBot(Download)
 
from dhtbot.contact import Node
from dhtbot.kademlia.routing_table import TreeRoutingTable
from dhtbot.protocols.krpc_iterator import KRPC_Iterator, IterationError
# Imported so that the reactor can be patched out
    def __init__(self):
        self.node_id = 999
        self.routing_table = TreeRoutingTable(self.node_id)
        self.find_node_count = 0
        self.get_peers_count = 0

src/d/h/DHTBot-HEAD/dhtbot/test/extensions/test_rate_limiter.py   DHTBot(Download)
        RateLimiter, RateLimiter_Patcher, TokenBucket
from dhtbot.coding import krpc_coder
from dhtbot.kademlia.routing_table import TreeRoutingTable
from dhtbot.krpc_types import Query
from dhtbot.protocols.krpc_sender import KRPC_Sender