<s> """<STR_LIT>""" <EOL> import urlparse <EOL> from boto . sqs . message import Message <EOL> from boto . sqs . queue import * <EOL> class AsyncQueue ( Queue ) : <EOL> def __init__ ( self , connection = None , url = None , message_class = Message ) : <EOL> self . connection = connection <EOL> self . url = url <EOL> self . message_class = message_class <EOL> self . visibility_timeout = None <EOL> def get_attributes ( self , attributes = '<STR_LIT>' , callback = None ) : <EOL> """<STR_LIT>""" <EOL> return self . connection . get_queue_attributes ( self , attributes , callback = callback ) <EOL> def set_attribute ( self , attribute , value , callback = None ) : <EOL> """<STR_LIT>""" <EOL> return self . connection . set_queue_attribute ( self , attribute , value , callback = callback ) <EOL> def get_timeout ( self , callback = None ) : <EOL> """<STR_LIT>""" <EOL> def got_timeout ( a ) : <EOL> if callable ( callback ) : <EOL> callback ( int ( a [ '<STR_LIT>' ] ) ) <EOL> self . get_attributes ( '<STR_LIT>' , callback = got_timeout ) <EOL> def set_timeout ( self , visibility_timeout , callback = None ) : <EOL> """<STR_LIT>""" <EOL> def _set_timeout ( retval ) : <EOL> if retval : <EOL> self . visibility_timeout = visibility_timeout <EOL> if callable ( callback ) : <EOL> callback ( retval ) <EOL> retval = self . set_attribute ( '<STR_LIT>' , visibility_timeout , callback = _set_timeout ) <EOL> def add_permission ( self , label , aws_account_id , action_name , callback = None ) : <EOL> """<STR_LIT>""" <EOL> return self . connection . add_permission ( self , label , aws_account_id , action_name , callback = callback ) <EOL> def remove_permission ( self , label , callback = None ) : <EOL> """<STR_LIT>""" <EOL> return self . connection . remove_permission ( self , label , callback = callback ) <EOL> def read ( self , visibility_timeout = None , callback = None ) : <EOL> """<STR_LIT>""" <EOL> def _read ( rs ) : <EOL> if callable ( callback ) : <EOL> callback ( rs [ <NUM_LIT:0> ] if len ( rs ) == <NUM_LIT:1> else None ) <EOL> self . get_messages ( <NUM_LIT:1> , visibility_timeout , callback = callback ) <EOL> def write ( self , message , callback = None ) : <EOL> """<STR_LIT>""" <EOL> def wrote ( new_msg ) : <EOL> message . id = new_msg . id <EOL> message . md5 = new_msg . md5 <EOL> if callable ( callback ) : <EOL> callback ( message ) <EOL> self . connection . send_message ( self , message . get_body_encoded ( ) , callback = wrote ) <EOL> def get_messages ( self , num_messages = <NUM_LIT:1> , visibility_timeout = None , <EOL> attributes = None , callback = None ) : <EOL> """<STR_LIT>""" <EOL> return self . connection . receive_message ( self , number_messages = num_messages , <EOL> visibility_timeout = visibility_timeout , <EOL> attributes = attributes , callback = callback ) <EOL> def delete_message ( self , message , callback = None ) : <EOL> """<STR_LIT>""" <EOL> return self . connection . delete_message ( self , message , callback = callback ) <EOL> def delete ( self , callback = None ) : <EOL> """<STR_LIT>""" <EOL> return self . connection . delete_queue ( self , callback = callback ) <EOL> def clear ( self , page_size = <NUM_LIT:10> , vtimeout = <NUM_LIT:10> , callback = None ) : <EOL> """<STR_LIT>""" <EOL> raise BotoClientError ( '<STR_LIT>' ) <EOL> def count ( self , page_size = <NUM_LIT:10> , vtimeout = <NUM_LIT:10> , callback = None ) : <EOL> """<STR_LIT>""" <EOL> def counted ( a ) : <EOL> if callable ( callback ) : <EOL> callback ( int ( a [ '<STR_LIT>' ] ) ) <EOL> self . get_attributes ( '<STR_LIT>' , callback = counted ) <EOL> def count_slow ( self , page_size = <NUM_LIT:10> , vtimeout = <NUM_LIT:10> , callback = None ) : <EOL> """<STR_LIT>""" <EOL> raise BotoClientError ( '<STR_LIT>' ) <EOL> def dump ( self , file_name , page_size = <NUM_LIT:10> , vtimeout = <NUM_LIT:10> , sep = '<STR_LIT:\n>' , callback = None ) : <EOL> """<STR_LIT>""" <EOL> raise BotoClientError ( '<STR_LIT>' ) <EOL> def save_to_file ( self , fp , sep = '<STR_LIT:\n>' , callback = None ) : <EOL> """<STR_LIT>""" <EOL> raise BotoClientError ( '<STR_LIT>' ) <EOL> def save_to_filename ( self , file_name , sep = '<STR_LIT:\n>' , callback = None ) : <EOL> """<STR_LIT>""" <EOL> raise BotoClientError ( '<STR_LIT>' ) <EOL> save = save_to_filename <EOL> def save_to_s3 ( self , bucket ) : <EOL> """<STR_LIT>""" <EOL> raise BotoClientError ( '<STR_LIT>' ) <EOL> def load_from_s3 ( self , bucket , prefix = None ) : <EOL> """<STR_LIT>""" <EOL> raise BotoClientError ( '<STR_LIT>' ) <EOL> def load_from_file ( self , fp , sep = '<STR_LIT:\n>' ) : <EOL> """<STR_LIT>""" <EOL> raise BotoClientError ( '<STR_LIT>' ) <EOL> def load_from_filename ( self , file_name , sep = '<STR_LIT:\n>' ) : <EOL> """<STR_LIT>""" <EOL> raise BotoClientError ( '<STR_LIT>' ) <EOL> load = load_from_filename </s>
