@@ -39,7 +39,7 @@ def __init__(self, *args, **kwargs):
3939 # If the exception is caused by a b2 server response,
4040 # the server MAY have included instructions to pause the thread before issuing any more requests
4141 self .retry_after_seconds = None
42- super (B2Error , self ).__init__ (* args , ** kwargs )
42+ super ().__init__ (* args , ** kwargs )
4343
4444 @property
4545 def prefix (self ):
@@ -82,7 +82,7 @@ class B2SimpleError(B2Error, metaclass=ABCMeta):
8282 """
8383
8484 def __str__ (self ):
85- return '%s: %s' % (self .prefix , super (B2SimpleError , self ).__str__ ())
85+ return '%s: %s' % (self .prefix , super ().__str__ ())
8686
8787
8888class NotAllowedByAppKeyError (B2SimpleError , metaclass = ABCMeta ):
@@ -134,7 +134,7 @@ class CapabilityNotAllowed(NotAllowedByAppKeyError):
134134
135135class ChecksumMismatch (TransientErrorMixin , B2Error ):
136136 def __init__ (self , checksum_type , expected , actual ):
137- super (ChecksumMismatch , self ).__init__ ()
137+ super ().__init__ ()
138138 self .checksum_type = checksum_type
139139 self .expected = expected
140140 self .actual = actual
@@ -168,7 +168,7 @@ def __init__(self, clock_skew_seconds):
168168 """
169169 :param int clock_skew_seconds: The difference: local_clock - server_clock
170170 """
171- super (ClockSkew , self ).__init__ ()
171+ super ().__init__ ()
172172 self .clock_skew_seconds = clock_skew_seconds
173173
174174 def __str__ (self ):
@@ -210,7 +210,7 @@ def should_retry_http(self):
210210
211211class DestFileNewer (B2Error ):
212212 def __init__ (self , dest_path , source_path , dest_prefix , source_prefix ):
213- super (DestFileNewer , self ).__init__ ()
213+ super ().__init__ ()
214214 self .dest_path = dest_path
215215 self .source_path = source_path
216216 self .dest_prefix = dest_prefix
@@ -240,7 +240,7 @@ class ResourceNotFound(B2SimpleError):
240240
241241class FileOrBucketNotFound (ResourceNotFound ):
242242 def __init__ (self , bucket_name = None , file_id_or_name = None ):
243- super (FileOrBucketNotFound , self ).__init__ ()
243+ super ().__init__ ()
244244 self .bucket_name = bucket_name
245245 self .file_id_or_name = file_id_or_name
246246
@@ -291,7 +291,7 @@ class SSECKeyIdMismatchInCopy(InvalidMetadataDirective):
291291
292292class InvalidRange (B2Error ):
293293 def __init__ (self , content_length , range_ ):
294- super (InvalidRange , self ).__init__ ()
294+ super ().__init__ ()
295295 self .content_length = content_length
296296 self .range_ = range_
297297
@@ -310,7 +310,7 @@ class InvalidUploadSource(B2SimpleError):
310310
311311class BadRequest (B2Error ):
312312 def __init__ (self , message , code ):
313- super (BadRequest , self ).__init__ ()
313+ super ().__init__ ()
314314 self .message = message
315315 self .code = code
316316
@@ -326,7 +326,7 @@ def __init__(self, message, code, size: int):
326326
327327class Unauthorized (B2Error ):
328328 def __init__ (self , message , code ):
329- super (Unauthorized , self ).__init__ ()
329+ super ().__init__ ()
330330 self .message = message
331331 self .code = code
332332
@@ -350,22 +350,29 @@ class InvalidAuthToken(Unauthorized):
350350 """
351351
352352 def __init__ (self , message , code ):
353- super (InvalidAuthToken ,
354- self ).__init__ ('Invalid authorization token. Server said: ' + message , code )
353+ super ().__init__ ('Invalid authorization token. Server said: ' + message , code )
355354
356355
357356class RestrictedBucket (B2Error ):
358357 def __init__ (self , bucket_name ):
359- super (RestrictedBucket , self ).__init__ ()
358+ super ().__init__ ()
360359 self .bucket_name = bucket_name
361360
362361 def __str__ (self ):
363362 return 'Application key is restricted to bucket: %s' % self .bucket_name
364363
365364
365+ class RestrictedBucketMissing (RestrictedBucket ):
366+ def __init__ (self ):
367+ super ().__init__ ('' )
368+
369+ def __str__ (self ):
370+ return 'Application key is restricted to a bucket that doesn\' t exist'
371+
372+
366373class MaxFileSizeExceeded (B2Error ):
367374 def __init__ (self , size , max_allowed_size ):
368- super (MaxFileSizeExceeded , self ).__init__ ()
375+ super ().__init__ ()
369376 self .size = size
370377 self .max_allowed_size = max_allowed_size
371378
@@ -378,7 +385,7 @@ def __str__(self):
378385
379386class MaxRetriesExceeded (B2Error ):
380387 def __init__ (self , limit , exception_info_list ):
381- super (MaxRetriesExceeded , self ).__init__ ()
388+ super ().__init__ ()
382389 self .limit = limit
383390 self .exception_info_list = exception_info_list
384391
@@ -405,7 +412,7 @@ class FileSha1Mismatch(B2SimpleError):
405412
406413class PartSha1Mismatch (B2Error ):
407414 def __init__ (self , key ):
408- super (PartSha1Mismatch , self ).__init__ ()
415+ super ().__init__ ()
409416 self .key = key
410417
411418 def __str__ (self ):
@@ -435,7 +442,7 @@ def __str__(self):
435442
436443class TooManyRequests (B2Error ):
437444 def __init__ (self , retry_after_seconds = None ):
438- super (TooManyRequests , self ).__init__ ()
445+ super ().__init__ ()
439446 self .retry_after_seconds = retry_after_seconds
440447
441448 def __str__ (self ):
@@ -447,7 +454,7 @@ def should_retry_http(self):
447454
448455class TruncatedOutput (TransientErrorMixin , B2Error ):
449456 def __init__ (self , bytes_read , file_size ):
450- super (TruncatedOutput , self ).__init__ ()
457+ super ().__init__ ()
451458 self .bytes_read = bytes_read
452459 self .file_size = file_size
453460
@@ -482,7 +489,7 @@ def __str__(self):
482489
483490class UploadTokenUsedConcurrently (B2Error ):
484491 def __init__ (self , token ):
485- super (UploadTokenUsedConcurrently , self ).__init__ ()
492+ super ().__init__ ()
486493 self .token = token
487494
488495 def __str__ (self ):
0 commit comments