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

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

src/d/a/Dandelion-Message-Service-HEAD/dandelionpy/dandelion/network.py   Dandelion-Message-Service(Download)
                tc, ids = self._db.get_identities(time_cookie=tc)
                random.shuffle(ids) # To avoid last piece problem
                response_str = dandelion.protocol.create_identity_id_list(tc, ids)
                self._write(response_str.encode())
            elif dandelion.protocol.is_identity_list_request(data):

src/d/a/Dandelion-Message-Service-HEAD/dandelionpy/dandelion/test/protocol_test.py   Dandelion-Message-Service(Download)
        tc_str_ok = encode_b64_bytes(tc).decode()
 
        str_ = dandelion.protocol.create_identity_id_list(tc, [id1, id2, id3])[:-1]
        tc_str, id1_str, id2_str, id3_str = str_.split(';')
        self.assertEqual(tc_str, tc_str_ok)
        self.assertEqual(id1.fingerprint, decode_b64_bytes(id1_str.encode()))
        self.assertEqual(id2.fingerprint, decode_b64_bytes(id2_str.encode()))
        self.assertEqual(id3.fingerprint, decode_b64_bytes(id3_str.encode()))
 
        str_ = dandelion.protocol.create_identity_id_list(tc, None)[:-1]
        self.assertEqual(str_, tc_str)
 
        str_ = dandelion.protocol.create_identity_id_list(tc, [])[:-1]
        self.assertEqual(str_, tc_str)
 
        id3 = dandelion.identity.generate()
 
        tc, identityids = dandelion.protocol.parse_identity_id_list(dandelion.protocol.create_identity_id_list(b'24', [id1, id2, id3]))
        self.assertEqual(tc, b'24')
        self.assertEqual(len(identityids), 3)