@@ -87,7 +87,7 @@ class CodeMessageException(RuntimeError):
8787 """
8888
8989 def __init__ (self , code : Union [int , HTTPStatus ], msg : str ):
90- super (CodeMessageException , self ).__init__ ("%d: %s" % (code , msg ))
90+ super ().__init__ ("%d: %s" % (code , msg ))
9191
9292 # Some calls to this method pass instances of http.HTTPStatus for `code`.
9393 # While HTTPStatus is a subclass of int, it has magic __str__ methods
@@ -138,7 +138,7 @@ def __init__(self, code: int, msg: str, errcode: str = Codes.UNKNOWN):
138138 msg: The human-readable error message.
139139 errcode: The matrix error code e.g 'M_FORBIDDEN'
140140 """
141- super (SynapseError , self ).__init__ (code , msg )
141+ super ().__init__ (code , msg )
142142 self .errcode = errcode
143143
144144 def error_dict (self ):
@@ -159,7 +159,7 @@ def __init__(
159159 errcode : str = Codes .UNKNOWN ,
160160 additional_fields : Optional [Dict ] = None ,
161161 ):
162- super (ProxiedRequestError , self ).__init__ (code , msg , errcode )
162+ super ().__init__ (code , msg , errcode )
163163 if additional_fields is None :
164164 self ._additional_fields = {} # type: Dict
165165 else :
@@ -181,7 +181,7 @@ def __init__(self, msg: str, consent_uri: str):
181181 msg: The human-readable error message
182182 consent_url: The URL where the user can give their consent
183183 """
184- super (ConsentNotGivenError , self ).__init__ (
184+ super ().__init__ (
185185 code = HTTPStatus .FORBIDDEN , msg = msg , errcode = Codes .CONSENT_NOT_GIVEN
186186 )
187187 self ._consent_uri = consent_uri
@@ -201,7 +201,7 @@ def __init__(self, msg: str):
201201 Args:
202202 msg: The human-readable error message
203203 """
204- super (UserDeactivatedError , self ).__init__ (
204+ super ().__init__ (
205205 code = HTTPStatus .FORBIDDEN , msg = msg , errcode = Codes .USER_DEACTIVATED
206206 )
207207
@@ -225,7 +225,7 @@ def __init__(self, destination: Optional[str]):
225225
226226 self .destination = destination
227227
228- super (FederationDeniedError , self ).__init__ (
228+ super ().__init__ (
229229 code = 403 ,
230230 msg = "Federation denied with %s." % (self .destination ,),
231231 errcode = Codes .FORBIDDEN ,
@@ -244,9 +244,7 @@ class InteractiveAuthIncompleteError(Exception):
244244 """
245245
246246 def __init__ (self , session_id : str , result : "JsonDict" ):
247- super (InteractiveAuthIncompleteError , self ).__init__ (
248- "Interactive auth not yet complete"
249- )
247+ super ().__init__ ("Interactive auth not yet complete" )
250248 self .session_id = session_id
251249 self .result = result
252250
@@ -261,14 +259,14 @@ def __init__(self, *args, **kwargs):
261259 message = "Unrecognized request"
262260 else :
263261 message = args [0 ]
264- super (UnrecognizedRequestError , self ).__init__ (400 , message , ** kwargs )
262+ super ().__init__ (400 , message , ** kwargs )
265263
266264
267265class NotFoundError (SynapseError ):
268266 """An error indicating we can't find the thing you asked for"""
269267
270268 def __init__ (self , msg : str = "Not found" , errcode : str = Codes .NOT_FOUND ):
271- super (NotFoundError , self ).__init__ (404 , msg , errcode = errcode )
269+ super ().__init__ (404 , msg , errcode = errcode )
272270
273271
274272class AuthError (SynapseError ):
@@ -279,7 +277,7 @@ class AuthError(SynapseError):
279277 def __init__ (self , * args , ** kwargs ):
280278 if "errcode" not in kwargs :
281279 kwargs ["errcode" ] = Codes .FORBIDDEN
282- super (AuthError , self ).__init__ (* args , ** kwargs )
280+ super ().__init__ (* args , ** kwargs )
283281
284282
285283class InvalidClientCredentialsError (SynapseError ):
@@ -335,7 +333,7 @@ def __init__(
335333 ):
336334 self .admin_contact = admin_contact
337335 self .limit_type = limit_type
338- super (ResourceLimitError , self ).__init__ (code , msg , errcode = errcode )
336+ super ().__init__ (code , msg , errcode = errcode )
339337
340338 def error_dict (self ):
341339 return cs_error (
@@ -352,7 +350,7 @@ class EventSizeError(SynapseError):
352350 def __init__ (self , * args , ** kwargs ):
353351 if "errcode" not in kwargs :
354352 kwargs ["errcode" ] = Codes .TOO_LARGE
355- super (EventSizeError , self ).__init__ (413 , * args , ** kwargs )
353+ super ().__init__ (413 , * args , ** kwargs )
356354
357355
358356class EventStreamError (SynapseError ):
@@ -361,7 +359,7 @@ class EventStreamError(SynapseError):
361359 def __init__ (self , * args , ** kwargs ):
362360 if "errcode" not in kwargs :
363361 kwargs ["errcode" ] = Codes .BAD_PAGINATION
364- super (EventStreamError , self ).__init__ (* args , ** kwargs )
362+ super ().__init__ (* args , ** kwargs )
365363
366364
367365class LoginError (SynapseError ):
@@ -384,7 +382,7 @@ def __init__(
384382 error_url : Optional [str ] = None ,
385383 errcode : str = Codes .CAPTCHA_INVALID ,
386384 ):
387- super (InvalidCaptchaError , self ).__init__ (code , msg , errcode )
385+ super ().__init__ (code , msg , errcode )
388386 self .error_url = error_url
389387
390388 def error_dict (self ):
@@ -402,7 +400,7 @@ def __init__(
402400 retry_after_ms : Optional [int ] = None ,
403401 errcode : str = Codes .LIMIT_EXCEEDED ,
404402 ):
405- super (LimitExceededError , self ).__init__ (code , msg , errcode )
403+ super ().__init__ (code , msg , errcode )
406404 self .retry_after_ms = retry_after_ms
407405
408406 def error_dict (self ):
@@ -418,9 +416,7 @@ def __init__(self, current_version: str):
418416 Args:
419417 current_version: the current version of the store they should have used
420418 """
421- super (RoomKeysVersionError , self ).__init__ (
422- 403 , "Wrong room_keys version" , Codes .WRONG_ROOM_KEYS_VERSION
423- )
419+ super ().__init__ (403 , "Wrong room_keys version" , Codes .WRONG_ROOM_KEYS_VERSION )
424420 self .current_version = current_version
425421
426422
@@ -429,7 +425,7 @@ class UnsupportedRoomVersionError(SynapseError):
429425 not support."""
430426
431427 def __init__ (self , msg : str = "Homeserver does not support this room version" ):
432- super (UnsupportedRoomVersionError , self ).__init__ (
428+ super ().__init__ (
433429 code = 400 , msg = msg , errcode = Codes .UNSUPPORTED_ROOM_VERSION ,
434430 )
435431
@@ -440,7 +436,7 @@ class ThreepidValidationError(SynapseError):
440436 def __init__ (self , * args , ** kwargs ):
441437 if "errcode" not in kwargs :
442438 kwargs ["errcode" ] = Codes .FORBIDDEN
443- super (ThreepidValidationError , self ).__init__ (* args , ** kwargs )
439+ super ().__init__ (* args , ** kwargs )
444440
445441
446442class IncompatibleRoomVersionError (SynapseError ):
@@ -451,7 +447,7 @@ class IncompatibleRoomVersionError(SynapseError):
451447 """
452448
453449 def __init__ (self , room_version : str ):
454- super (IncompatibleRoomVersionError , self ).__init__ (
450+ super ().__init__ (
455451 code = 400 ,
456452 msg = "Your homeserver does not support the features required to "
457453 "join this room" ,
@@ -473,7 +469,7 @@ def __init__(
473469 msg : str = "This password doesn't comply with the server's policy" ,
474470 errcode : str = Codes .WEAK_PASSWORD ,
475471 ):
476- super (PasswordRefusedError , self ).__init__ (
472+ super ().__init__ (
477473 code = 400 , msg = msg , errcode = errcode ,
478474 )
479475
@@ -488,7 +484,7 @@ class RequestSendFailed(RuntimeError):
488484 """
489485
490486 def __init__ (self , inner_exception , can_retry ):
491- super (RequestSendFailed , self ).__init__ (
487+ super ().__init__ (
492488 "Failed to send request: %s: %s"
493489 % (type (inner_exception ).__name__ , inner_exception )
494490 )
@@ -542,7 +538,7 @@ def __init__(
542538 self .source = source
543539
544540 msg = "%s %s: %s" % (level , code , reason )
545- super (FederationError , self ).__init__ (msg )
541+ super ().__init__ (msg )
546542
547543 def get_dict (self ):
548544 return {
@@ -570,7 +566,7 @@ def __init__(self, code: int, msg: str, response: bytes):
570566 msg: reason phrase from HTTP response status line
571567 response: body of response
572568 """
573- super (HttpResponseException , self ).__init__ (code , msg )
569+ super ().__init__ (code , msg )
574570 self .response = response
575571
576572 def to_synapse_error (self ):
0 commit comments