Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
super(BadBonusAmountError, self).__init__(**kwargs)
self.message = 'Bonus must be a number greater than 0. You gave: {}'.format(
amount)
class BonusReasonMissingError(DoBonusError):
pass
class NoAutoBonusAmountSetError(DoBonusError):
pass
class AssignmentIdNotFoundInLocalDBError(AmtServicesWrapperError):
def __init__(self, assignment_id='', **kwargs):
super(AssignmentIdNotFoundInLocalDBError, self).__init__(**kwargs)
self.assignment_id = assignment_id
class WorkerIdNotFoundInLocalDBError(AmtServicesWrapperError):
pass
class MissingArgumentsError(AmtServicesWrapperError):
pass
class InvalidPsiturkCredentialsError(AmtServicesWrapperError):
def __init__(self, *args, **kwargs):
super(InvalidPsiturkCredentialsError, self).__init__(*args, **kwargs)
self.message = '\n'.join(['*****************************',
' Sorry, your psiTurk Credentials are invalid.\n ',
' You cannot create ads and hits until you enter valid credentials in ',
' the \'psiTurk Access\' section of ~/.psiturkconfig. You can obtain your',
' credentials or sign up at https://www.psiturk.org/login.\n'])
class InvalidAWSCredentialsError(AmtServicesWrapperError):
def __init__(self, *args, **kwargs):
class NoAutoBonusAmountSetError(DoBonusError):
pass
class AssignmentIdNotFoundInLocalDBError(AmtServicesWrapperError):
def __init__(self, assignment_id='', **kwargs):
super(AssignmentIdNotFoundInLocalDBError, self).__init__(**kwargs)
self.assignment_id = assignment_id
class WorkerIdNotFoundInLocalDBError(AmtServicesWrapperError):
pass
class MissingArgumentsError(AmtServicesWrapperError):
pass
class InvalidPsiturkCredentialsError(AmtServicesWrapperError):
def __init__(self, *args, **kwargs):
super(InvalidPsiturkCredentialsError, self).__init__(*args, **kwargs)
self.message = '\n'.join(['*****************************',
' Sorry, your psiTurk Credentials are invalid.\n ',
' You cannot create ads and hits until you enter valid credentials in ',
' the \'psiTurk Access\' section of ~/.psiturkconfig. You can obtain your',
' credentials or sign up at https://www.psiturk.org/login.\n'])
class InvalidAWSCredentialsError(AmtServicesWrapperError):
def __init__(self, *args, **kwargs):
super(InvalidAWSCredentialsError, self).__init__(*args, **kwargs)
self.message = '\n'.join(['*****************************',
' Sorry, your AWS Credentials are invalid.\n ',
' You cannot create ads and hits until you enter valid credentials in ',
' the \'AWS Access\' section of ~/.psiturkconfig. You can obtain your ',
' credentials via the Amazon AMT requester website.\n'])
class WorkerIdNotFoundInLocalDBError(AmtServicesWrapperError):
pass
class MissingArgumentsError(AmtServicesWrapperError):
pass
class InvalidPsiturkCredentialsError(AmtServicesWrapperError):
def __init__(self, *args, **kwargs):
super(InvalidPsiturkCredentialsError, self).__init__(*args, **kwargs)
self.message = '\n'.join(['*****************************',
' Sorry, your psiTurk Credentials are invalid.\n ',
' You cannot create ads and hits until you enter valid credentials in ',
' the \'psiTurk Access\' section of ~/.psiturkconfig. You can obtain your',
' credentials or sign up at https://www.psiturk.org/login.\n'])
class InvalidAWSCredentialsError(AmtServicesWrapperError):
def __init__(self, *args, **kwargs):
super(InvalidAWSCredentialsError, self).__init__(*args, **kwargs)
self.message = '\n'.join(['*****************************',
' Sorry, your AWS Credentials are invalid.\n ',
' You cannot create ads and hits until you enter valid credentials in ',
' the \'AWS Access\' section of ~/.psiturkconfig. You can obtain your ',
' credentials via the Amazon AMT requester website.\n'])
class AdPsiturkOrgError(AmtServicesWrapperError):
pass
class AdHtmlNotFoundError(AmtServicesWrapperError):
def __init__(self, *args, **kwargs):
super(AdHtmlNotFoundError, self).__init__(*args, **kwargs)
self.message = '\n'.join(['*****************************',
' Sorry, there was an error registering ad.',
pass
class BadBonusAmountError(DoBonusError):
def __init__(self, amount, **kwargs):
super(BadBonusAmountError, self).__init__(**kwargs)
self.message = 'Bonus must be a number greater than 0. You gave: {}'.format(
amount)
class BonusReasonMissingError(DoBonusError):
pass
class NoAutoBonusAmountSetError(DoBonusError):
pass
class AssignmentIdNotFoundInLocalDBError(AmtServicesWrapperError):
def __init__(self, assignment_id='', **kwargs):
super(AssignmentIdNotFoundInLocalDBError, self).__init__(**kwargs)
self.assignment_id = assignment_id
class WorkerIdNotFoundInLocalDBError(AmtServicesWrapperError):
pass
class MissingArgumentsError(AmtServicesWrapperError):
pass
class InvalidPsiturkCredentialsError(AmtServicesWrapperError):
def __init__(self, *args, **kwargs):
super(InvalidPsiturkCredentialsError, self).__init__(*args, **kwargs)
self.message = '\n'.join(['*****************************',
' Sorry, your psiTurk Credentials are invalid.\n ',
' You cannot create ads and hits until you enter valid credentials in ',
message = 'AWS access keys not set in ~/.psiturkconfig; please enter valid credentials.'
super(AWSAccessKeysNotSetError, self).__init__(message=message, **kwargs)
class NoMturkConnectionError(AmtServicesException):
def __init__(self, **kwargs):
message = 'Sorry, unable to connect to Amazon Mechanical Turk. AWS credentials invalid.'
super(NoMturkConnectionError, self).__init__(message=message, **kwargs)
####################################################
# AMT Service Wrapper Exceptions
####################################################
class AmtServicesWrapperError(PsiturkException):
pass
class DoBonusError(AmtServicesWrapperError):
def __init__(self, assignment_id='', **kwargs):
super(DoBonusError, self).__init__(**kwargs)
self.assignment_id = assignment_id
class AssignmentAlreadyBonusedError(DoBonusError):
pass
class BadBonusAmountError(DoBonusError):
def __init__(self, amount, **kwargs):
super(BadBonusAmountError, self).__init__(**kwargs)
self.message = 'Bonus must be a number greater than 0. You gave: {}'.format(
amount)
class BonusReasonMissingError(DoBonusError):
' You cannot create ads and hits until you enter valid credentials in ',
' the \'AWS Access\' section of ~/.psiturkconfig. You can obtain your ',
' credentials via the Amazon AMT requester website.\n'])
class AdPsiturkOrgError(AmtServicesWrapperError):
pass
class AdHtmlNotFoundError(AmtServicesWrapperError):
def __init__(self, *args, **kwargs):
super(AdHtmlNotFoundError, self).__init__(*args, **kwargs)
self.message = '\n'.join(['*****************************',
' Sorry, there was an error registering ad.',
' The file ad.html is required to be in the templates folder',
' of your project so that the ad can be served.'])
class AdHtmlTooLarge(AmtServicesWrapperError):
def __init__(self, size_of_ad, *args, **kwargs):
super(AdHtmlTooLarge, self).__init__(*args, **kwargs)
self.message = '\n'.join(['*****************************',
' Sorry, there was an error registering the ad.',
' Your local ad.html is {} bytes, but the maximum'.format(size_of_ad),
' template size uploadable to the ad server is',
' 1048576 bytes.' ])
#################
# API Exceptions
#################
class APIException(PsiturkException):
pass
' the \'psiTurk Access\' section of ~/.psiturkconfig. You can obtain your',
' credentials or sign up at https://www.psiturk.org/login.\n'])
class InvalidAWSCredentialsError(AmtServicesWrapperError):
def __init__(self, *args, **kwargs):
super(InvalidAWSCredentialsError, self).__init__(*args, **kwargs)
self.message = '\n'.join(['*****************************',
' Sorry, your AWS Credentials are invalid.\n ',
' You cannot create ads and hits until you enter valid credentials in ',
' the \'AWS Access\' section of ~/.psiturkconfig. You can obtain your ',
' credentials via the Amazon AMT requester website.\n'])
class AdPsiturkOrgError(AmtServicesWrapperError):
pass
class AdHtmlNotFoundError(AmtServicesWrapperError):
def __init__(self, *args, **kwargs):
super(AdHtmlNotFoundError, self).__init__(*args, **kwargs)
self.message = '\n'.join(['*****************************',
' Sorry, there was an error registering ad.',
' The file ad.html is required to be in the templates folder',
' of your project so that the ad can be served.'])
class AdHtmlTooLarge(AmtServicesWrapperError):
def __init__(self, size_of_ad, *args, **kwargs):
super(AdHtmlTooLarge, self).__init__(*args, **kwargs)
self.message = '\n'.join(['*****************************',
' Sorry, there was an error registering the ad.',
' Your local ad.html is {} bytes, but the maximum'.format(size_of_ad),
' template size uploadable to the ad server is',
' 1048576 bytes.' ])
class BonusReasonMissingError(DoBonusError):
pass
class NoAutoBonusAmountSetError(DoBonusError):
pass
class AssignmentIdNotFoundInLocalDBError(AmtServicesWrapperError):
def __init__(self, assignment_id='', **kwargs):
super(AssignmentIdNotFoundInLocalDBError, self).__init__(**kwargs)
self.assignment_id = assignment_id
class WorkerIdNotFoundInLocalDBError(AmtServicesWrapperError):
pass
class MissingArgumentsError(AmtServicesWrapperError):
pass
class InvalidPsiturkCredentialsError(AmtServicesWrapperError):
def __init__(self, *args, **kwargs):
super(InvalidPsiturkCredentialsError, self).__init__(*args, **kwargs)
self.message = '\n'.join(['*****************************',
' Sorry, your psiTurk Credentials are invalid.\n ',
' You cannot create ads and hits until you enter valid credentials in ',
' the \'psiTurk Access\' section of ~/.psiturkconfig. You can obtain your',
' credentials or sign up at https://www.psiturk.org/login.\n'])
class InvalidAWSCredentialsError(AmtServicesWrapperError):
def __init__(self, *args, **kwargs):
super(InvalidAWSCredentialsError, self).__init__(*args, **kwargs)
self.message = '\n'.join(['*****************************',
' Sorry, your AWS Credentials are invalid.\n ',
self.message = '\n'.join(['*****************************',
' Sorry, your psiTurk Credentials are invalid.\n ',
' You cannot create ads and hits until you enter valid credentials in ',
' the \'psiTurk Access\' section of ~/.psiturkconfig. You can obtain your',
' credentials or sign up at https://www.psiturk.org/login.\n'])
class InvalidAWSCredentialsError(AmtServicesWrapperError):
def __init__(self, *args, **kwargs):
super(InvalidAWSCredentialsError, self).__init__(*args, **kwargs)
self.message = '\n'.join(['*****************************',
' Sorry, your AWS Credentials are invalid.\n ',
' You cannot create ads and hits until you enter valid credentials in ',
' the \'AWS Access\' section of ~/.psiturkconfig. You can obtain your ',
' credentials via the Amazon AMT requester website.\n'])
class AdPsiturkOrgError(AmtServicesWrapperError):
pass
class AdHtmlNotFoundError(AmtServicesWrapperError):
def __init__(self, *args, **kwargs):
super(AdHtmlNotFoundError, self).__init__(*args, **kwargs)
self.message = '\n'.join(['*****************************',
' Sorry, there was an error registering ad.',
' The file ad.html is required to be in the templates folder',
' of your project so that the ad can be served.'])
class AdHtmlTooLarge(AmtServicesWrapperError):
def __init__(self, size_of_ad, *args, **kwargs):
super(AdHtmlTooLarge, self).__init__(*args, **kwargs)
self.message = '\n'.join(['*****************************',
' Sorry, there was an error registering the ad.',
' Your local ad.html is {} bytes, but the maximum'.format(size_of_ad),