<s> import urllib2 <EOL> import argparse <EOL> import numpy as np <EOL> import cStringIO <EOL> import sys <EOL> import tempfile <EOL> import h5py <EOL> def main ( ) : <EOL> parser = argparse . ArgumentParser ( description = '<STR_LIT>' ) <EOL> parser . add_argument ( '<STR_LIT>' , action = "<STR_LIT:store>" ) <EOL> parser . add_argument ( '<STR_LIT>' , action = "<STR_LIT:store>" ) <EOL> parser . add_argument ( '<STR_LIT>' , action = "<STR_LIT:store>" , type = int ) <EOL> parser . add_argument ( '<STR_LIT>' , action = "<STR_LIT:store>" , type = int ) <EOL> result = parser . parse_args ( ) <EOL> for annid in range ( result . low , result . high ) : <EOL> tmpfile = tempfile . NamedTemporaryFile ( ) <EOL> h5fh = h5py . File ( tmpfile . name ) <EOL> idgrp = h5fh . create_group ( str ( annid ) ) <EOL> ann_type = <NUM_LIT:1> <EOL> idgrp . create_dataset ( "<STR_LIT>" , ( <NUM_LIT:1> , ) , np . uint32 , data = ann_type ) <EOL> mdgrp = idgrp . create_group ( "<STR_LIT>" ) <EOL> ann_status = <NUM_LIT:0> <EOL> ann_author = '<STR_LIT>' <EOL> mdgrp . create_dataset ( "<STR_LIT>" , ( <NUM_LIT:1> , ) , np . uint32 , data = ann_status ) <EOL> mdgrp . create_dataset ( "<STR_LIT>" , ( <NUM_LIT:1> , ) , dtype = h5py . special_dtype ( vlen = str ) , data = ann_author ) <EOL> url = "<STR_LIT>" % ( result . baseurl , result . token ) <EOL> print url <EOL> h5fh . flush ( ) <EOL> tmpfile . seek ( <NUM_LIT:0> ) <EOL> try : <EOL> req = urllib2 . Request ( url , tmpfile . read ( ) ) <EOL> response = urllib2 . urlopen ( req ) <EOL> except urllib2 . URLError , e : <EOL> print "<STR_LIT>" , url <EOL> print "<STR_LIT>" % ( e ) <EOL> sys . exit ( <NUM_LIT:0> ) <EOL> the_page = response . read ( ) <EOL> print "<STR_LIT>" % the_page <EOL> tmpfile . close ( ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> main ( ) </s>
