<s> """<STR_LIT>""" <EOL> import base64 <EOL> import xml . sax <EOL> from boto import handler <EOL> from boto . resultset import ResultSet <EOL> class BotoClientError ( StandardError ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , reason , * args ) : <EOL> StandardError . __init__ ( self , reason , * args ) <EOL> self . reason = reason <EOL> def __repr__ ( self ) : <EOL> return '<STR_LIT>' % self . reason <EOL> def __str__ ( self ) : <EOL> return '<STR_LIT>' % self . reason <EOL> class SDBPersistenceError ( StandardError ) : <EOL> pass <EOL> class StoragePermissionsError ( BotoClientError ) : <EOL> """<STR_LIT>""" <EOL> pass <EOL> class S3PermissionsError ( StoragePermissionsError ) : <EOL> """<STR_LIT>""" <EOL> pass <EOL> class GSPermissionsError ( StoragePermissionsError ) : <EOL> """<STR_LIT>""" <EOL> pass <EOL> class BotoServerError ( StandardError ) : <EOL> def __init__ ( self , status , reason , body = None , * args ) : <EOL> StandardError . __init__ ( self , status , reason , body , * args ) <EOL> self . status = status <EOL> self . reason = reason <EOL> self . body = body or '<STR_LIT>' <EOL> self . request_id = None <EOL> self . error_code = None <EOL> self . error_message = None <EOL> self . box_usage = None <EOL> if self . body : <EOL> try : <EOL> h = handler . XmlHandler ( self , self ) <EOL> xml . sax . parseString ( self . body , h ) <EOL> except ( TypeError , xml . sax . SAXParseException ) , pe : <EOL> self . error_message = self . body <EOL> self . body = None <EOL> def __getattr__ ( self , name ) : <EOL> if name == '<STR_LIT:message>' : <EOL> return self . error_message <EOL> if name == '<STR_LIT:code>' : <EOL> return self . error_code <EOL> raise AttributeError <EOL> def __repr__ ( self ) : <EOL> return '<STR_LIT>' % ( self . __class__ . __name__ , <EOL> self . status , self . reason , self . body ) <EOL> def __str__ ( self ) : <EOL> return '<STR_LIT>' % ( self . __class__ . __name__ , <EOL> self . status , self . reason , self . body ) <EOL> def startElement ( self , name , attrs , connection ) : <EOL> pass <EOL> def endElement ( self , name , value , connection ) : <EOL> if name in ( '<STR_LIT>' , '<STR_LIT>' ) : <EOL> self . request_id = value <EOL> elif name == '<STR_LIT>' : <EOL> self . error_code = value <EOL> elif name == '<STR_LIT>' : <EOL> self . error_message = value <EOL> elif name == '<STR_LIT>' : <EOL> self . box_usage = value <EOL> return None <EOL> def _cleanupParsedProperties ( self ) : <EOL> self . request_id = None <EOL> self . error_code = None <EOL> self . error_message = None <EOL> self . box_usage = None <EOL> class ConsoleOutput : <EOL> def __init__ ( self , parent = None ) : <EOL> self . parent = parent <EOL> self . instance_id = None <EOL> self . timestamp = None <EOL> self . comment = None <EOL> self . output = None <EOL> def startElement ( self , name , attrs , connection ) : <EOL> return None <EOL> def endElement ( self , name , value , connection ) : <EOL> if name == '<STR_LIT>' : <EOL> self . instance_id = value <EOL> elif name == '<STR_LIT>' : <EOL> self . output = base64 . b64decode ( value ) <EOL> else : <EOL> setattr ( self , name , value ) <EOL> class StorageCreateError ( BotoServerError ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , status , reason , body = None ) : <EOL> self . bucket = None <EOL> BotoServerError . __init__ ( self , status , reason , body ) <EOL> def endElement ( self , name , value , connection ) : <EOL> if name == '<STR_LIT>' : <EOL> self . bucket = value <EOL> else : <EOL> return BotoServerError . endElement ( self , name , value , connection ) <EOL> class S3CreateError ( StorageCreateError ) : <EOL> """<STR_LIT>""" <EOL> pass <EOL> class GSCreateError ( StorageCreateError ) : <EOL> """<STR_LIT>""" <EOL> pass <EOL> class StorageCopyError ( BotoServerError ) : <EOL> """<STR_LIT>""" <EOL> pass <EOL> class S3CopyError ( StorageCopyError ) : <EOL> """<STR_LIT>""" <EOL> pass <EOL> class GSCopyError ( StorageCopyError ) : <EOL> """<STR_LIT>""" <EOL> pass <EOL> class SQSError ( BotoServerError ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , status , reason , body = None ) : <EOL> self . detail = None <EOL> self . type = None <EOL> BotoServerError . __init__ ( self , status , reason , body ) <EOL> def startElement ( self , name , attrs , connection ) : <EOL> return BotoServerError . startElement ( self , name , attrs , connection ) <EOL> def endElement ( self , name , value , connection ) : <EOL> if name == '<STR_LIT>' : <EOL> self . detail = value <EOL> elif name == '<STR_LIT>' : <EOL> self . type = value <EOL> else : <EOL> return BotoServerError . endElement ( self , name , value , connection ) <EOL> def _cleanupParsedProperties ( self ) : <EOL> BotoServerError . _cleanupParsedProperties ( self ) <EOL> for p in ( '<STR_LIT>' , '<STR_LIT:type>' ) : <EOL> setattr ( self , p , None ) <EOL> class SQSDecodeError ( BotoClientError ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , reason , message ) : <EOL> BotoClientError . __init__ ( self , reason , message ) <EOL> self . message = message <EOL> def __repr__ ( self ) : <EOL> return '<STR_LIT>' % self . reason <EOL> def __str__ ( self ) : <EOL> return '<STR_LIT>' % self . reason <EOL> class StorageResponseError ( BotoServerError ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , status , reason , body = None ) : <EOL> self . resource = None <EOL> BotoServerError . __init__ ( self , status , reason , body ) <EOL> def startElement ( self , name , attrs , connection ) : <EOL> return BotoServerError . startElement ( self , name , attrs , connection ) <EOL> def endElement ( self , name , value , connection ) : <EOL> if name == '<STR_LIT>' : <EOL> self . resource = value <EOL> else : <EOL> return BotoServerError . endElement ( self , name , value , connection ) <EOL> def _cleanupParsedProperties ( self ) : <EOL> BotoServerError . _cleanupParsedProperties ( self ) <EOL> for p in ( '<STR_LIT>' ) : <EOL> setattr ( self , p , None ) <EOL> class S3ResponseError ( StorageResponseError ) : <EOL> """<STR_LIT>""" <EOL> pass <EOL> class GSResponseError ( StorageResponseError ) : <EOL> """<STR_LIT>""" <EOL> pass <EOL> class EC2ResponseError ( BotoServerError ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , status , reason , body = None ) : <EOL> self . errors = None <EOL> self . _errorResultSet = [ ] <EOL> BotoServerError . __init__ ( self , status , reason , body ) <EOL> self . errors = [ ( e . error_code , e . error_message ) for e in self . _errorResultSet ] <EOL> if len ( self . errors ) : <EOL> self . error_code , self . error_message = self . errors [ <NUM_LIT:0> ] <EOL> def startElement ( self , name , attrs , connection ) : <EOL> if name == '<STR_LIT>' : <EOL> self . _errorResultSet = ResultSet ( [ ( '<STR_LIT>' , _EC2Error ) ] ) <EOL> return self . _errorResultSet <EOL> else : <EOL> return None <EOL> def endElement ( self , name , value , connection ) : <EOL> if name == '<STR_LIT>' : <EOL> self . request_id = value <EOL> else : <EOL> return None <EOL> def _cleanupParsedProperties ( self ) : <EOL> BotoServerError . _cleanupParsedProperties ( self ) <EOL> self . _errorResultSet = [ ] <EOL> for p in ( '<STR_LIT>' ) : <EOL> setattr ( self , p , None ) <EOL> class DynamoDBResponseError ( BotoServerError ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , status , reason , body = None , * args ) : <EOL> self . status = status <EOL> self . reason = reason <EOL> self . body = body <EOL> if self . body : <EOL> self . error_message = self . body . get ( '<STR_LIT:message>' , None ) <EOL> self . error_code = self . body . get ( '<STR_LIT>' , None ) <EOL> if self . error_code : <EOL> self . error_code = self . error_code . split ( '<STR_LIT:#>' ) [ - <NUM_LIT:1> ] <EOL> class SWFResponseError ( BotoServerError ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , status , reason , body = None , * args ) : <EOL> self . status = status <EOL> self . reason = reason <EOL> self . body = body <EOL> if self . body : <EOL> self . error_message = self . body . get ( '<STR_LIT:message>' , None ) <EOL> self . error_code = self . body . get ( '<STR_LIT>' , None ) <EOL> if self . error_code : <EOL> self . error_code = self . error_code . split ( '<STR_LIT:#>' ) [ - <NUM_LIT:1> ] <EOL> class EmrResponseError ( BotoServerError ) : <EOL> """<STR_LIT>""" <EOL> pass <EOL> class _EC2Error : <EOL> def __init__ ( self , connection = None ) : <EOL> self . connection = connection <EOL> self . error_code = None <EOL> self . error_message = None <EOL> def startElement ( self , name , attrs , connection ) : <EOL> return None <EOL> def endElement ( self , name , value , connection ) : <EOL> if name == '<STR_LIT>' : <EOL> self . error_code = value <EOL> elif name == '<STR_LIT>' : <EOL> self . error_message = value <EOL> else : <EOL> return None <EOL> class SDBResponseError ( BotoServerError ) : <EOL> """<STR_LIT>""" <EOL> pass <EOL> class AWSConnectionError ( BotoClientError ) : <EOL> """<STR_LIT>""" <EOL> pass <EOL> class StorageDataError ( BotoClientError ) : <EOL> """<STR_LIT>""" <EOL> pass <EOL> class S3DataError ( StorageDataError ) : <EOL> """<STR_LIT>""" <EOL> pass <EOL> class GSDataError ( StorageDataError ) : <EOL> """<STR_LIT>""" <EOL> pass <EOL> class InvalidUriError ( Exception ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , message ) : <EOL> Exception . __init__ ( self , message ) <EOL> self . message = message <EOL> class InvalidAclError ( Exception ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , message ) : <EOL> Exception . __init__ ( self , message ) <EOL> self . message = message <EOL> class InvalidCorsError ( Exception ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , message ) : <EOL> Exception . __init__ ( self , message ) <EOL> self . message = message <EOL> class NoAuthHandlerFound ( Exception ) : <EOL> """<STR_LIT>""" <EOL> pass <EOL> class TooManyAuthHandlerReadyToAuthenticate ( Exception ) : <EOL> """<STR_LIT>""" <EOL> pass <EOL> class ResumableTransferDisposition ( object ) : <EOL> START_OVER = '<STR_LIT>' <EOL> WAIT_BEFORE_RETRY = '<STR_LIT>' <EOL> ABORT_CUR_PROCESS = '<STR_LIT>' <EOL> ABORT = '<STR_LIT>' <EOL> class ResumableUploadException ( Exception ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , message , disposition ) : <EOL> Exception . __init__ ( self , message , disposition ) <EOL> self . message = message <EOL> self . disposition = disposition <EOL> def __repr__ ( self ) : <EOL> return '<STR_LIT>' % ( <EOL> self . message , self . disposition ) <EOL> class ResumableDownloadException ( Exception ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , message , disposition ) : <EOL> Exception . __init__ ( self , message , disposition ) <EOL> self . message = message <EOL> self . disposition = disposition <EOL> def __repr__ ( self ) : <EOL> return '<STR_LIT>' % ( <EOL> self . message , self . disposition ) </s>
