@@ -128,7 +128,7 @@ class UserRecord(UserInfo):
128128 """Contains metadata associated with a Firebase user account."""
129129
130130 def __init__ (self , data ):
131- super (UserRecord , self ).__init__ ()
131+ super ().__init__ ()
132132 if not isinstance (data , dict ):
133133 raise ValueError ('Invalid data argument: {0}. Must be a dictionary.' .format (data ))
134134 if not data .get ('localId' ):
@@ -452,7 +452,7 @@ class ProviderUserInfo(UserInfo):
452452 """Contains metadata regarding how a user is known by a particular identity provider."""
453453
454454 def __init__ (self , data ):
455- super (ProviderUserInfo , self ).__init__ ()
455+ super ().__init__ ()
456456 if not isinstance (data , dict ):
457457 raise ValueError ('Invalid data argument: {0}. Must be a dictionary.' .format (data ))
458458 if not data .get ('rawId' ):
@@ -518,8 +518,8 @@ def encode_action_code_settings(settings):
518518 if not parsed .netloc :
519519 raise ValueError ('Malformed dynamic action links url: "{0}".' .format (settings .url ))
520520 parameters ['continueUrl' ] = settings .url
521- except Exception :
522- raise ValueError ('Malformed dynamic action links url: "{0}".' .format (settings .url ))
521+ except Exception as err :
522+ raise ValueError ('Malformed dynamic action links url: "{0}".' .format (settings .url )) from err
523523
524524 # handle_code_in_app
525525 if settings .handle_code_in_app is not None :
@@ -788,13 +788,13 @@ def import_users(self, users, hash_alg=None):
788788 raise ValueError (
789789 'Users must be a non-empty list with no more than {0} elements.' .format (
790790 MAX_IMPORT_USERS_SIZE ))
791- if any ([ not isinstance (u , _user_import .ImportUserRecord ) for u in users ] ):
791+ if any (not isinstance (u , _user_import .ImportUserRecord ) for u in users ):
792792 raise ValueError ('One or more user objects are invalid.' )
793- except TypeError :
794- raise ValueError ('users must be iterable' )
793+ except TypeError as err :
794+ raise ValueError ('users must be iterable' ) from err
795795
796796 payload = {'users' : [u .to_dict () for u in users ]}
797- if any ([ 'passwordHash' in u for u in payload ['users' ] ]):
797+ if any ('passwordHash' in u for u in payload ['users' ]):
798798 if not isinstance (hash_alg , _user_import .UserImportHash ):
799799 raise ValueError ('A UserImportHash is required to import users with passwords.' )
800800 payload .update (hash_alg .to_dict ())
0 commit comments