<s> import urllib2 <EOL> import argparse <EOL> import time <EOL> import sys <EOL> import pdb <EOL> def cache_test ( token , hostname , slicenumber , resolution ) : <EOL> """<STR_LIT>""" <EOL> totalsize = <NUM_LIT:0.0> <EOL> for X in range ( <NUM_LIT:0> , <NUM_LIT:20> ) : <EOL> for Y in range ( <NUM_LIT:0> , <NUM_LIT:20> ) : <EOL> try : <EOL> url = '<STR_LIT>' . format ( hostname , token , slicenumber , X , Y , resolution ) <EOL> req = urllib2 . Request ( url ) <EOL> response = urllib2 . urlopen ( req ) <EOL> totalsize += sys . getsizeof ( response ) <EOL> except urllib2 . URLError , e : <EOL> print "<STR_LIT>" . format ( url ) <EOL> print "<STR_LIT>" . format ( e ) <EOL> print "<STR_LIT>" . format ( totalsize / <NUM_LIT> ) <EOL> def main ( ) : <EOL> parser = argparse . ArgumentParser ( description = "<STR_LIT>" ) <EOL> parser . add_argument ( '<STR_LIT>' , action = "<STR_LIT:store>" , help = "<STR_LIT>" ) <EOL> parser . add_argument ( '<STR_LIT>' , action = "<STR_LIT:store>" , help = "<STR_LIT>" ) <EOL> parser . add_argument ( '<STR_LIT>' , action = "<STR_LIT:store>" , type = int , help = "<STR_LIT>" ) <EOL> parser . add_argument ( '<STR_LIT>' , action = "<STR_LIT:store>" , type = int , help = "<STR_LIT>" ) <EOL> global result <EOL> result = parser . parse_args ( ) <EOL> start = time . time ( ) <EOL> cache_test ( result . token , result . hostname , result . slicenumber , result . resolution ) <EOL> end = time . time ( ) <EOL> print end - start <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> main ( ) </s>
