def main(): print('do something here') # for loop to 10000 creation of uids in various bases for i in range(10000): generate() generate(2) generate(16) generate(58) generate(64)
def main(): for i in range(1000): u = generate(base=16) for i in range(1000): u = generate(base=32) for i in range(1000): u = generate(base=64)
def evaluate(params, is_logged_in, timestamp): uid = generate() # Select the appropriate download function if params['dhtml']: download_resources = call_dhtmlget else: download_resources = call_wget start_time = datetime.now() download_resources(params, is_logged_in, uid) end_time = datetime.now() if settings.LOGGING: logger.info("Elapsed time for %s download: %s", uid, end_time - start_time) start_time = datetime.now() pgcount = analyze_resources(params, is_logged_in, uid, timestamp) end_time = datetime.now() if settings.LOGGING: logger.info("Elapsed time for %s analysis: %s", uid, end_time - start_time) if not settings.RESOURCES_DEBUG: remove_resources(uid) return (pgcount, uid)
def evaluate_dhtml(params, is_logged_in, timestamp): uid = generate() request = params['request'] save_resources(request, uid) start_time = datetime.now() pgcount = analyze_resources(params, is_logged_in, uid, timestamp) end_time = datetime.now() if settings.LOGGING: logger.info("Elapsed time for %s analysis: %s", uid, end_time - start_time) if not settings.RESOURCES_DEBUG: remove_resources(uid) return (pgcount, uid)
def multi_evaluate(params, is_logged_in, timestamp): uid = generate() # Select the appropriate download function if params['dhtml']: download_resources = call_dhtmlget else: download_resources = call_wget urls = params['urls'].split() start_time = datetime.now() for url in urls: params['url'] = url download_resources(params, is_logged_in, uid) end_time = datetime.now() if settings.LOGGING: logger.info("Elapsed time for %s downloads: %s", uid, end_time - start_time) # Cleanup the params dictionary del params['url'] start_time = datetime.now() pgcount = analyze_resources(params, is_logged_in, uid, timestamp) end_time = datetime.now() if settings.LOGGING: logger.info("Elapsed time for %s analysis: %s", uid, end_time - start_time) if not settings.RESOURCES_DEBUG: remove_resources(uid) return (pgcount, uid)
def store_formid(request): formid = generate() request.session['formid'] = formid return formid
def main(): # f = open("uids.txt","w+") for i in range(10000): generate(2)
def register(user, password): cur.execute('insert into register(user, password userid, time) values("%s", "%s", "%s")' % (user, hashlib(password).hexdigest(), uid.generate(), time.time())) db.commit()
def test_two_uids(self): u1 = generate() sleep(.01) u2 = generate() time1, time2 = unpack(u1)[0], unpack(u2)[0] self.assertLess(time1, time2)
def test_unpack_shard(self): uid = generate() unpacked_shard = unpack(uid)[2] self.assertEqual(unpacked_shard, SHARD_ID)
def test_unpack_length(self): uid = generate() self.assertEqual(len(unpack(uid)), 3)